@wavemaker/app-runtime-wm-build 11.7.3-next.26375 → 11.7.3-next.26381

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -844,7 +844,7 @@ var FullCalendar=function(e){"use strict";var t=function(e,n){return(t=Object.se
844
844
  *
845
845
  * Copyright (c) 2016 Jorik Tangelder;
846
846
  * Licensed under the MIT license */
847
- !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(b,c,d){var e="DEPRECATED METHOD: "+c+"\n"+d+" AT \n";return function(){var c=new Error("get-stack-trace"),d=c&&c.stack?c.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),(function(b){a.addEventListener(b,c,!1)}))}function n(a,b,c){g(q(b),(function(b){a.removeEventListener(b,c,!1)}))}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function s(a){return Array.prototype.slice.call(a,0)}function t(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];r(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort((function(a,c){return a[b]>c[b]})):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ma.length;){if(c=ma[g],e=c?c+f:b,e in a)return e;g++}return d}function v(){return ua++}function w(b){var c=b.ownerDocument||b;return c.defaultView||c.parentWindow||a}function x(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){k(a.options.enable,[a])&&c.handler(b)},this.init()}function y(a){var b,c=a.options.inputClass;return new(b=c?c:xa?M:ya?P:wa?R:L)(a,z)}function z(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&Ea&&d-e===0,g=b&(Ga|Ha)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,A(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function A(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=D(b)),e>1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:pa(a.pointers[c].clientX),clientY:pa(a.pointers[c].clientY)},c++;return{timeStamp:ra(),pointers:b,center:E(b),deltaX:a.deltaX,deltaY:a.deltaY}}function E(a){var b=a.length;if(1===b)return{x:pa(a[0].clientX),y:pa(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Ea|Fa)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter((function(a){return o(a.target,i)})),b===Ea)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Ga|Ha)&&delete d[g[e].identifier],e++;return h.length?[t(f.concat(h),"identifier",!0),h]:void 0}function R(){x.apply(this,arguments);var a=j(this.handler,this);this.touch=new P(this.manager,a),this.mouse=new L(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}function S(a,b){a&Ea?(this.primaryTouch=b.changedPointers[0].identifier,T.call(this,b)):a&(Ga|Ha)&&T.call(this,b)}function T(a){var b=a.changedPointers[0];if(b.identifier===this.primaryTouch){var c={x:b.clientX,y:b.clientY};this.lastTouches.push(c);var d=this.lastTouches,e=function(){var a=d.indexOf(c);a>-1&&d.splice(a,1)};setTimeout(e,cb)}}function U(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d<this.lastTouches.length;d++){var e=this.lastTouches[d],f=Math.abs(b-e.x),g=Math.abs(c-e.y);if(db>=f&&db>=g)return!0}return!1}function V(a,b){this.manager=a,this.set(b)}function W(a){if(p(a,jb))return jb;var b=p(a,kb),c=p(a,lb);return b&&c?jb:b||c?b?kb:lb:p(a,ib)?ib:hb}function X(){if(!fb)return!1;var b={},c=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(d){b[d]=c?a.CSS.supports("touch-action",d):!0})),b}function Y(a){this.options=la({},this.defaults,a||{}),this.id=v(),this.manager=null,this.options.enable=l(this.options.enable,!0),this.state=nb,this.simultaneous={},this.requireFail=[]}function Z(a){return a&sb?"cancel":a&qb?"end":a&pb?"move":a&ob?"start":""}function $(a){return a==Ma?"down":a==La?"up":a==Ja?"left":a==Ka?"right":""}function _(a,b){var c=b.manager;return c?c.get(a):a}function aa(){Y.apply(this,arguments)}function ba(){aa.apply(this,arguments),this.pX=null,this.pY=null}function ca(){aa.apply(this,arguments)}function da(){Y.apply(this,arguments),this._timer=null,this._input=null}function ea(){aa.apply(this,arguments)}function fa(){aa.apply(this,arguments)}function ga(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ha(a,b){return b=b||{},b.recognizers=l(b.recognizers,ha.defaults.preset),new ia(a,b)}function ia(a,b){this.options=la({},ha.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=y(this),this.touchAction=new V(this,this.options.touchAction),ja(this,!0),g(this.options.recognizers,(function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])}),this)}function ja(a,b){var c=a.element;if(c.style){var d;g(a.options.cssProps,(function(e,f){d=u(c.style,f),b?(a.oldCssProps[d]=c.style[d],c.style[d]=e):c.style[d]=a.oldCssProps[d]||""})),b||(a.oldCssProps={})}}function ka(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var la,ma=["","webkit","Moz","MS","ms","o"],na=b.createElement("div"),oa="function",pa=Math.round,qa=Math.abs,ra=Date.now;la="function"!=typeof Object.assign?function(a){if(a===d||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var e=arguments[c];if(e!==d&&null!==e)for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b}:Object.assign;var sa=h((function(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a}),"extend","Use `assign`."),ta=h((function(a,b){return sa(a,b,!0)}),"merge","Use `assign`."),ua=1,va=/mobile|tablet|ip(ad|hone|od)|android/i,wa="ontouchstart"in a,xa=u(a,"PointerEvent")!==d,ya=wa&&va.test(navigator.userAgent),za="touch",Aa="pen",Ba="mouse",Ca="kinect",Da=25,Ea=1,Fa=2,Ga=4,Ha=8,Ia=1,Ja=2,Ka=4,La=8,Ma=16,Na=Ja|Ka,Oa=La|Ma,Pa=Na|Oa,Qa=["x","y"],Ra=["clientX","clientY"];x.prototype={handler:function(){},init:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(w(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(w(this.element),this.evWin,this.domHandler)}};var Sa={mousedown:Ea,mousemove:Fa,mouseup:Ga},Ta="mousedown",Ua="mousemove mouseup";i(L,x,{handler:function(a){var b=Sa[a.type];b&Ea&&0===a.button&&(this.pressed=!0),b&Fa&&1!==a.which&&(b=Ga),this.pressed&&(b&Ga&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:Ba,srcEvent:a}))}});var Va={pointerdown:Ea,pointermove:Fa,pointerup:Ga,pointercancel:Ha,pointerout:Ha},Wa={2:za,3:Aa,4:Ba,5:Ca},Xa="pointerdown",Ya="pointermove pointerup pointercancel";a.MSPointerEvent&&!a.PointerEvent&&(Xa="MSPointerDown",Ya="MSPointerMove MSPointerUp MSPointerCancel"),i(M,x,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Va[d],f=Wa[a.pointerType]||a.pointerType,g=f==za,h=r(b,a.pointerId,"pointerId");e&Ea&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Ga|Ha)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Za={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},$a="touchstart",_a="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Za[a.type];if(b===Ea&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ga|Ha)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}}});var ab={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},bb="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=ab[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}});var cb=2500,db=25;i(R,x,{handler:function(a,b,c){var d=c.pointerType==za,e=c.pointerType==Ba;if(!(e&&c.sourceCapabilities&&c.sourceCapabilities.firesTouchEvents)){if(d)S.call(this,b,c);else if(e&&U.call(this,c))return;this.callback(a,b,c)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var eb=u(na.style,"touchAction"),fb=eb!==d,gb="compute",hb="auto",ib="manipulation",jb="none",kb="pan-x",lb="pan-y",mb=X();V.prototype={set:function(a){a==gb&&(a=this.compute()),fb&&this.manager.element.style&&mb[a]&&(this.manager.element.style[eb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,(function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))})),W(a.join(" "))},preventDefaults:function(a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,jb)&&!mb[jb],f=p(d,lb)&&!mb[lb],g=p(d,kb)&&!mb[kb];if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}return g&&f?void 0:e||f&&c&Na||g&&c&Oa?this.preventSrc(b):void 0},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var nb=1,ob=2,pb=4,qb=8,rb=qb,sb=16,tb=32;Y.prototype={defaults:{},set:function(a){return la(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=_(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=_(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=_(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;qb>d&&b(c.options.event+Z(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=qb&&b(c.options.event+Z(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=tb)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(tb|nb)))return!1;a++}return!0},recognize:function(a){var b=la({},a);return k(this.options.enable,[this,b])?(this.state&(rb|sb|tb)&&(this.state=nb),this.state=this.process(b),void(this.state&(ob|pb|qb|sb)&&this.tryEmit(b))):(this.reset(),void(this.state=tb))},process:function(a){},getTouchAction:function(){},reset:function(){}},i(aa,Y,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(ob|pb),e=this.attrTest(a);return d&&(c&Ha||!e)?b|sb:d||e?c&Ga?b|qb:b&ob?b|pb:ob:tb}}),i(ba,aa,{defaults:{event:"pan",threshold:10,pointers:1,direction:Pa},getTouchAction:function(){var a=this.options.direction,b=[];return a&Na&&b.push(lb),a&Oa&&b.push(kb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Na?(e=0===f?Ia:0>f?Ja:Ka,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ia:0>g?La:Ma,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return aa.prototype.attrTest.call(this,a)&&(this.state&ob||!(this.state&ob)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i(ca,aa,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ob)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(da,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[hb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Ga|Ha)&&!f)this.reset();else if(a.eventType&Ea)this.reset(),this._timer=e((function(){this.state=rb,this.tryEmit()}),b.time,this);else if(a.eventType&Ga)return rb;return tb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===rb&&(a&&a.eventType&Ga?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=ra(),this.manager.emit(this.options.event,this._input)))}}),i(ea,aa,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ob)}}),i(fa,aa,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Na|Oa,pointers:1},getTouchAction:function(){return ba.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Na|Oa)?b=a.overallVelocity:c&Na?b=a.overallVelocityX:c&Oa&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&qa(b)>this.options.velocity&&a.eventType&Ga},emit:function(a){var b=$(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ga,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ib]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&Ea&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=Ga)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||H(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e((function(){this.state=rb,this.tryEmit()}),b.interval,this),ob):rb}return tb},failTimeout:function(){return this._timer=e((function(){this.state=tb}),this.options.interval,this),tb},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==rb&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ha.VERSION="2.0.7",ha.defaults={domEvents:!1,touchAction:gb,enable:!0,inputTarget:null,inputClass:null,preset:[[ea,{enable:!1}],[ca,{enable:!1},["rotate"]],[fa,{direction:Na}],[ba,{direction:Na},["swipe"]],[ga],[ga,{event:"doubletap",taps:2},["tap"]],[da]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ub=1,vb=2;ia.prototype={set:function(a){return la(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?vb:ub},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&rb)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===vb||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(ob|pb|qb)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof Y)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;if(a=this.get(a)){var b=this.recognizers,c=r(b,a);-1!==c&&(b.splice(c,1),this.touchAction.update())}return this},on:function(a,b){if(a!==d&&b!==d){var c=this.handlers;return g(q(a),(function(a){c[a]=c[a]||[],c[a].push(b)})),this}},off:function(a,b){if(a!==d){var c=this.handlers;return g(q(a),(function(a){b?c[a]&&c[a].splice(r(c[a],b),1):delete c[a]})),this}},emit:function(a,b){this.options.domEvents&&ka(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&ja(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},la(ha,{INPUT_START:Ea,INPUT_MOVE:Fa,INPUT_END:Ga,INPUT_CANCEL:Ha,STATE_POSSIBLE:nb,STATE_BEGAN:ob,STATE_CHANGED:pb,STATE_ENDED:qb,STATE_RECOGNIZED:rb,STATE_CANCELLED:sb,STATE_FAILED:tb,DIRECTION_NONE:Ia,DIRECTION_LEFT:Ja,DIRECTION_RIGHT:Ka,DIRECTION_UP:La,DIRECTION_DOWN:Ma,DIRECTION_HORIZONTAL:Na,DIRECTION_VERTICAL:Oa,DIRECTION_ALL:Pa,Manager:ia,Input:x,TouchAction:V,TouchInput:P,MouseInput:L,PointerEventInput:M,TouchMouseInput:R,SingleTouchInput:N,Recognizer:Y,AttrRecognizer:aa,Tap:ga,Pan:ba,Swipe:fa,Pinch:ca,Rotate:ea,Press:da,on:m,off:n,each:g,merge:ta,extend:sa,assign:la,inherit:i,bindFn:j,prefixed:u});var wb="undefined"!=typeof a?a:"undefined"!=typeof self?self:{};wb.Hammer=ha,"function"==typeof define&&define.amd?define((function(){return ha})):"undefined"!=typeof module&&module.exports?module.exports=ha:a[c]=ha}(window,document,"Hammer");"use strict";$.widget("wm.datatable",{options:{data:[],statusMsg:"",colDefs:[],rowActions:[],headerConfig:[],sortInfo:{field:"",direction:""},isMobile:false,enableSort:true,filtermode:"",filteronkeypress:false,activeRow:undefined,height:"100%",showHeader:true,selectFirstRow:false,showNewRow:true,showRowIndex:false,enableRowSelection:true,enableColumnSelection:false,multiselect:false,filterNullRecords:true,navigation:"",isdynamictable:"",cssClassNames:{tableRow:"app-datagrid-row",headerCell:"app-datagrid-header-cell",groupHeaderCell:"app-datagrid-group-header-cell",tableCell:"app-datagrid-cell",grid:"",gridDefault:"table",gridBody:"app-datagrid-body",gridFooter:"app-datagrid-footer",deleteRow:"danger",ascIcon:"wi wi-long-arrow-up",descIcon:"wi wi-long-arrow-down",selectedColumn:"selected-column",rowExpandIcon:"wi wi-minus-square",rowCollapseIcon:"wi wi-plus-square",gridRowExpansionClass:"table-row-expansion",expandedRowClass:"expanded"},dataStates:{loading:"Loading...",ready:"",error:"An error occurred in loading the data.",nodata:"No data found."},messages:{selectField:"Select Field"},loadingicon:"",startRowIndex:1,editmode:"",actionsEnabled:{edit:true,new:true},rowExpansionEnabled:false,rowDef:{position:"0",closeothers:false,columnwidth:"30px"},summaryRow:false,summaryRowDefs:[],summaryRowDefsObject:[],searchHandler:function(){},sortHandler:function(){}},customColumnDefs:{checkbox:{field:"checkbox",type:"custom",displayName:"",sortable:false,searchable:false,resizable:false,selectable:false,readonly:true,style:"width: 50px; text-align: center;",textAlignment:"center",isMultiSelectCol:true,show:true},radio:{field:"radio",type:"custom",displayName:"",sortable:false,searchable:false,resizable:false,selectable:false,readonly:true,style:"width: 50px; text-align: center;",textAlignment:"center",show:true},__expand:{field:"__expand",type:"custom",displayName:"",sortable:false,searchable:false,resizable:false,selectable:false,readonly:true,style:"text-align: center;",textAlignment:"center",show:true,width:"30px"},rowIndex:{field:"rowIndex",type:"custom",displayName:"S. No.",sortable:false,searchable:false,selectable:false,readonly:true,style:"text-align: left;",textAlignment:"left",show:true}},CONSTANTS:{QUICK_EDIT:"quickedit",INLINE:"inline",FORM:"form",DIALOG:"dialog",SEARCH:"search",MULTI_COLUMN:"multicolumn"},Utils:{random:function(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)},isDefined:function(value){return value!==undefined},isObject:function(value){return value!==null&&typeof value==="object"},getObjectIndex:function(data,obj){var matchIndex=-1;if(!Array.isArray(data)){return-1}data.some((function(data,index){if(_.isEqual(data,obj)){matchIndex=index;return true}}));return matchIndex},generateGuid:function(){var random=this.random;return random()+random()+"-"+random()+"-"+random()+"-"+random()+"-"+random()+random()+random()},isValidHtml:function(htm){var validHtmlRegex=/<[a-z][\s\S]*>/i;return validHtmlRegex.test(htm)},isMac:function(){return navigator.platform.toUpperCase().indexOf("MAC")>=0},isDeleteKey:function(event){return this.isMac()&&event.which===8||event.which===46}},_setStyles:function($el,styleString){if(!styleString){return}var styles=styleString.split(";");styles.forEach((function(styleBit){var parts=styleBit.split(":");var property,value;if(parts.length===2){property=parts[0].trim();value=parts[1].trim();$el.css(property,value)}}));return styleString},_getColumnSortDirection:function(field){var sortInfo=this.options.sortInfo;return field===sortInfo.field?sortInfo.direction:""},_toggleSpacingClasses:function(value){switch(value){case"normal":this.tableContainer.removeClass("table-condensed");if(this.gridSearch){this.gridSearch.find(".form-group").removeClass("form-group-sm");this.gridSearch.find("select").removeClass("input-sm");this.gridSearch.find(".input-group").removeClass("input-group-sm")}break;case"condensed":this.tableContainer.addClass("table-condensed");if(this.gridSearch){this.gridSearch.find(".form-group").addClass("form-group-sm");this.gridSearch.find("select").addClass("input-sm");this.gridSearch.find(".input-group").addClass("input-group-sm")}break}},_getColSpan:function(cols){var colSpan=0,self=this;_.forEach(cols,(function(col){var colDef;if(col.isGroup){colSpan+=self._getColSpan(col.columns)}else{colDef=_.find(self.preparedHeaderData,{field:col.field});colSpan=!_.isUndefined(colDef.show)&&!colDef.show?colSpan:colSpan+1}}));return colSpan},_setColSpan:function(config){var self=this;_.forEach(config,(function(col){if(col.isGroup){col.colspan=self._getColSpan(col.columns);self.gridHeaderElement.find('th[data-col-group="'+col.field+'"]').attr("colspan",col.colspan);self._setColSpan(col.columns)}}))},_getHeaderTemplate:function(){var $colgroup=$("<colgroup></colgroup>"),$htm=this.gridHeaderElement.empty(),isDefined=this.Utils.isDefined,sortInfo=this.options.sortInfo,sortField=sortInfo.field,self=this,rowTemplates=[],headerConfig=this.options.headerConfig,headerGroupClass=self.options.cssClassNames.groupHeaderCell,$row;function generateHeaderCell(value,index){var id=index,field=value.field,headerLabel=self.Utils.isDefined(value.displayName)?value.displayName:field||"",titleLabel=headerLabel,sortEnabled=self.options.enableSort&&(_.isUndefined(value.show)||value.show)&&(_.isUndefined(value.sortable)||value.sortable),headerClasses=self.options.cssClassNames.headerCell,sortClass,tl="",$th,$col,$sortSpan,$sortIcon;headerLabel=!self.Utils.isDefined(headerLabel)||headerLabel===""?"&nbsp;":headerLabel;$col=$("<col/>");if(value.style){self._setStyles($col,value.style)}$colgroup.append($col);if(isDefined(value.class)){headerClasses+=" "+value.class}if(value.selected){headerClasses+=" "+self.options.cssClassNames.selectedColumn+" "}if(field==="checkbox"||field==="radio"){headerClasses+=" grid-col-small"}tl+="<th";if((_.isUndefined(value.resizable)||value.resizable)&&(_.isUndefined(value.show)||value.show)){tl+=" data-col-resizable"}if(self.options.enableColumnSelection&&(_.isUndefined(value.selectable)||value.selectable)){tl+=" data-col-selectable"}if(sortEnabled){tl+=" data-col-sortable"}tl+="></th>";$th=$(tl);$th.attr({"data-col-id":id,"data-col-field":field,title:titleLabel});self._setStyles($th,"text-align: "+value.textAlignment);$th.addClass(headerClasses);if(field==="checkbox"){$th.append('<input type="checkbox" />')}$th.append('<span class="header-data">'+headerLabel+"</span>");if(sortEnabled){$sortSpan=$('<span class="sort-buttons-container"></span>');$sortIcon=$('<i class="sort-icon"></i>');if(sortField&&sortField===value.field&&sortInfo.direction){sortClass=sortInfo.direction==="asc"?self.options.cssClassNames.ascIcon:self.options.cssClassNames.descIcon;$sortSpan.addClass("active");$sortIcon.addClass(sortClass+" "+sortInfo.direction)}$th.append($sortSpan.append($sortIcon))}return $th}function generateRow(cols,i){var $thList=[];_.forEach(cols,(function(col){var index,value,classes,styles,$groupTl;if(col.columns&&col.columns.length){$groupTl=$("<th></th>");classes=headerGroupClass+" "+(col.class||"");styles="text-align: "+col.textAlignment+";background-color: "+(col.backgroundColor||"")+";";$groupTl.attr({"data-col-group":col.field,class:classes,title:col.displayName});self._setStyles($groupTl,styles);$groupTl.append('<span class="header-data">'+col.displayName+"</span>");$thList.push($groupTl);generateRow(col.columns,i+1)}else{index=_.findIndex(self.preparedHeaderData,{field:col.field});value=self.preparedHeaderData[index];if(value){$thList.push(generateHeaderCell(value,index))}}}));rowTemplates[i]=rowTemplates[i]||[];rowTemplates[i]=rowTemplates[i].concat($thList)}if(_.isEmpty(headerConfig)){$row=$("<tr></tr>");self.preparedHeaderData.forEach((function(value,index){$row.append(generateHeaderCell(value,index))}));$htm.append($row)}else{generateRow(headerConfig,0);rowTemplates.forEach((function($thList,index){$row=$('<tr role="row" tabindex="0"></tr>');var rowSpan=rowTemplates.length-index;$thList.forEach((function($th){if(rowSpan>1&&$th.hasClass("app-datagrid-header-cell")){$th.attr("rowspan",rowSpan)}$row.append($th)}));$htm.append($row)}))}return{colgroup:$colgroup,header:$htm}},_getSearchEl:function(){var htm,sel='<select name="wm-datatable" data-element="dgFilterValue" '+'class="form-control app-select">'+'<option value="" selected class="placeholder">'+this.options.messages.selectField+"</option>",searchLabel=this.Utils.isDefined(this.options.searchLabel)&&this.options.searchLabel.length?this.options.searchLabel:"";this.options.colDefs.forEach((function(colDef,index){if(colDef.field!=="none"&&colDef.field!=="rowOperations"&&colDef.searchable&&_.toString(colDef.showinfilter)!=="false"){sel+='<option value="'+colDef.field+'" data-coldef-index="'+index+'">'+(colDef.displayName||colDef.field)+"</option>"}}));sel+="</select>";htm='<form class="form-search form-inline" onsubmit="return false;"><div class="form-group">'+'<input type="text" data-element="dgSearchText" class="form-control app-textbox" value="" placeholder="'+searchLabel+'"/>'+'</div><div class="input-append input-group">'+sel+'<span class="input-group-addon"><button type="button" data-element="dgSearchButton" class="app-search-button" title="'+searchLabel+'">'+'<i class="wi wi-search"></i>'+"</button></span>"+"</div>"+"</div></form>";var $htm=$(htm);this._setStyles($htm.find('[data-element="dgSearchText"]'),"display: inline-block;");return $htm},_appendRowExpansionButtons:function($htm){var self=this;$htm.find("[data-identifier='rowExpansionButtons']").each((function(index){var _rowData,$row,rowId,rowIndex=index;$row=$(this).closest("tr.app-datagrid-row");rowId=parseInt($row.attr("data-row-id"),10);_rowData=_.clone(self.options.data[rowId]);_rowData.$index=rowIndex+1;self.options.generateRowExpansionCell(_rowData,rowIndex);$(this).empty().append(self.options.getRowExpansionAction(rowIndex))}))},setSummaryRowDef:function(key,data,rowIndex,refreshIndicator){this.options.summaryRow=true;if(this.options.summaryRowDefs[rowIndex]==undefined){this.options.summaryRowDefs[rowIndex]={};this.options.summaryRowDefsObject[rowIndex]={}}this.options.summaryRowDefsObject[rowIndex][key]=data;this.options.summaryRowDefs[rowIndex][key]=data&&data.value?data.value:data;if(refreshIndicator)this.refreshGridData()},_getSummaryRowTemplate:function(){var self=this,$tfoot=$('<tfoot class="'+this.options.cssClassNames.gridFooter+'"></tfoot>');this._setStyles($tfoot,"border-top: 3px solid #eee;");_.forEach(this.options.summaryRowDefs,(function(row,index){row.$$pk=index;$tfoot.append(self._getRowTemplate(row,index,true))}));return $tfoot},getPageStartIndex:function(){var currentPage=this.options.getCurrentPage(),pagesize=this.options.getPageSize();var isPrevPageUpdated=this.options.actionRowPage<currentPage;var pageIndex=isPrevPageUpdated?this.options.actionRowPage:currentPage;return(pageIndex-1)*pagesize},_getPreparedDataForInfiniteScroll:function($tbody,preparedData){preparedData=preparedData.filter((function(row,index){var isExists=$tbody.find("tr.app-datagrid-row[data-row-id="+row.$$pk+"]");if(!isExists.length){return row}}));return preparedData},_updateTrData:function($tbody){var editedRow,updatedRowData,self=this;editedRow=$tbody.find("tr.app-datagrid-row[data-row-id="+self.options.actionRowIndex+"]");updatedRowData=self.preparedData[self.options.actionRowIndex];self.options.generateCustomExpressions(updatedRowData,self.options.actionRowIndex);var rowTemplate=self._getRowTemplate(updatedRowData,self.options.actionRowIndex);editedRow.replaceWith(rowTemplate[0])},_handleCRUDForInfiniteScroll:function($tbody){var self=this;if((self.options.lastActionPerformed===self.options.ACTIONS.SEARCH_OR_SORT||self.options.lastActionPerformed===self.options.ACTIONS.FILTER_CRITERIA||self.options.lastActionPerformed===self.options.ACTIONS.DATASET_UPDATE)&&(self.options.isSearchTrigerred||self.options.isDatasetUpdated||self.options.isDataUpdatedByUser)){$tbody.html("");if(this.options.navigation==="On-Demand"&&!this.options.isLastPage)this.element.find(".on-demand-datagrid").show();self.options.clearCustomExpression();self.options.clearRowDetailExpression();self.options.setIsSearchTrigerred(false);self.options.setIsDatasetUpdated(false)}else if(self.options.lastActionPerformed===self.options.ACTIONS.EDIT&&self.options.actionRowIndex!==undefined&&self.options.editmode!==this.CONSTANTS.QUICK_EDIT){self._updateTrData($tbody)}},_getGridTemplate:function(){var self=this,preparedData,$tbody,pageStartIndex=self.getPageStartIndex(),startRowIndex=self.options.startRowIndex,isScrollorOnDemand=self.options.isNavTypeScrollOrOndemand();if(isScrollorOnDemand){$tbody=this.gridElement;if(this.renderTableOnViewLess){$tbody=this.gridElement.empty();this.hideLoadingIndicator();this.renderTableOnViewLess=false}}else{$tbody=this.gridElement.empty()}if(isScrollorOnDemand){this._handleCRUDForInfiniteScroll($tbody);if(self.options.lastActionPerformed===self.options.ACTIONS.DELETE){startRowIndex=self.options.actionRowIndex+1}preparedData=this._getPreparedDataForInfiniteScroll($tbody,this.preparedData.slice(pageStartIndex))}else{this.options.clearCustomExpression();this.options.clearRowDetailExpression();preparedData=this.preparedData}_.forEach(preparedData,(function(row,index){var _row=_.clone(row),rowIndex=isScrollorOnDemand?startRowIndex+index-1:index,rowTemplate;_row.$index=rowIndex+1;self.options.generateCustomExpressions(_row,rowIndex);self.options.registerRowNgClassWatcher(_row,rowIndex);rowTemplate=self._getRowTemplate(row,rowIndex);$tbody.append(rowTemplate);if(self.options.rowExpansionEnabled){var rowHeight=self.options.rowDef.height;var rowPosition=self.options.rowDef.position;var colSpanLength=_.filter(self.preparedHeaderData,(function(c){return c.show})).length-1;var $tr=$('<tr class="app-datagrid-detail-row" tabindex="0" role="row" data-row-id="'+row.$$pk+'"><td></td><td colspan="'+colSpanLength+'" class="app-datagrid-row-details-cell">'+'<div class="row-overlay"><div class="row-status"><i class="'+self.options.loadingicon+'"></i></div></div><div class="details-section"></div>'+"</td></tr>");if(rowPosition==="-1"){$tr=$('<tr class="app-datagrid-detail-row" tabindex="0" role="row" data-row-id="'+row.$$pk+'"><td colspan="'+colSpanLength+'" class="app-datagrid-row-details-cell">'+'<div class="row-overlay"><div class="row-status"><i class="'+self.options.loadingicon+'"></i></div></div><div class="details-section"></div>'+"</td><td></td></tr>")}if(rowHeight){$tr.find("div.row-overlay").css("min-height",rowHeight)}$tr.css("display","none");$tr.find(".details-section").css("display","none");$tbody.append($tr)}}));if(!this.options.isdynamictable){this.options.setLastActionPerformed(this.options.ACTIONS.DEFAULT);this.options.setIsDataUpdatedByUser(false);this.options.clearActionRowIndex()}return $tbody},_getRowTemplate:function(row,rowIndex,summaryRow){var $htm,self=this,gridOptions=self.options;$htm=$('<tr role="row" tabindex="0" class="'+gridOptions.cssClassNames.tableRow+" "+(gridOptions.rowClass||"")+'" data-row-id="'+row.$$pk+'"></tr>');this.preparedHeaderData.forEach((function(current,colIndex){$htm.append(self._getColumnTemplate(row,colIndex,current,rowIndex,summaryRow))}));return $htm},_getRowActionsColumnDefIndex:function(){var i,len=this.preparedHeaderData.length;for(i=0;i<len;i+=1){if(this.preparedHeaderData[i].field==="rowOperations"){return i}}return-1},_getRowActionsColumnDef:function(){var index=this._getRowActionsColumnDefIndex();if(index!==-1){return this.preparedHeaderData[index]}return null},_getCheckboxTemplate:function(row,isMultiSelectCol){var checked=row._checked===true?" checked":"",disabled=row.disabed?" disabled":"",chkBoxName=isMultiSelectCol?"gridMultiSelect":"";return'<input name="'+chkBoxName+'" type="checkbox"'+checked+disabled+"/>"},_getRadioTemplate:function(row){var checked=row._checked===true?" checked":"",disabled=row.disabed?" disabled":"";return'<input type="radio" rowSelectInput name="" value=""'+checked+disabled+"/>"},_getColumnTemplate:function(row,colId,colDef,rowIndex,summaryRow){var $htm,columnValue,columnValueObject,cellPreloader='<div class="overlay"><span aria-hidden="true" class="form-field-spinner fa fa-circle-o-notch fa-spin form-control-feedback"></span></div>',customExpressionHtml,innerTmpl,classes=this.options.cssClassNames.tableCell+" "+(colDef.class||""),colExpression=colDef.customExpression,styles="text-align: "+colDef.textAlignment+";position: relative;";$htm=$('<td class="'+classes+'" data-col-id="'+colId+'" role="cell"></td>');this._setStyles($htm,styles);columnValue=_.get(row,colDef.field);if(summaryRow){columnValueObject=this.options.summaryRowDefsObject[rowIndex][colDef.field];if(columnValueObject instanceof Object){if(columnValueObject.class){$htm.addClass(columnValueObject.class)}}if(columnValue instanceof Promise){customExpressionHtml=cellPreloader;$htm.html(customExpressionHtml)}else{innerTmpl=_.isUndefined(columnValue)||columnValue===null?"":columnValue;$htm.html(innerTmpl)}}else if(colExpression){$htm.html(this.options.getCustomExpression(colDef.field,rowIndex))}else{if(colDef.type!=="custom"){columnValue=_.get(row,colDef.field);if(this.options.filterNullRecords&&columnValue===null||_.isUndefined(columnValue)){columnValue=""}$htm.attr("title",columnValue);$htm.text(""+columnValue)}else{switch(colDef.field){case"checkbox":innerTmpl=this._getCheckboxTemplate(row,colDef.isMultiSelectCol);break;case"__expand":innerTmpl='<span class="row-expansion-column" data-identifier="rowExpansionButtons"></span>';break;case"radio":innerTmpl=this._getRadioTemplate(row);break;case"rowOperations":innerTmpl='<span class="actions-column" data-identifier="actionButtons"></span>';break;case"rowIndex":innerTmpl=row.$$index;break;case"none":innerTmpl="";break;default:innerTmpl=_.isUndefined(columnValue)||columnValue===null?"":columnValue}$htm.html(innerTmpl)}}row.$index=rowIndex+1;this.options.registerColNgClassWatcher(row,colDef,rowIndex,colId);return $htm},_getEventTemplate:function(colDef){var events=_.filter(_.keys(colDef),(function(key){return _.startsWith(key,"on")})),changeEvt,template="";changeEvt=colDef.editWidgetType==="autocomplete"?"onSubmit":"onChange";events=_.union(events,[changeEvt]);_.forEach(events,(function(eventName){template+=" "+_.kebabCase(eventName)+'="';if(eventName==="onSubmit"||eventName==="onChange"){template+="_"+eventName+"Field($event, $scope, newVal, oldVal);"}template+=(colDef[eventName]||"")+'" '}));return template},_insertFieldInHeaderConfig:function(headerConfig,fieldName,position){var index=_.findIndex(headerConfig,{field:position}),self=this;if(index===-1){_.forEach(headerConfig,(function(config){if(config.isGroup){self._insertFieldInHeaderConfig(config.columns,fieldName,position)}}))}else{headerConfig.splice(index+1,0,{field:fieldName,isPredefined:true})}},setHeaderConfigForDefaultFields:function(name,position){if(_.isEmpty(this.options.headerConfig)){return}var fieldName=this.customColumnDefs[name].field;_.remove(this.options.headerConfig,{field:fieldName});if(position==="0"){this.options.headerConfig.unshift({field:fieldName,isPredefined:true})}else if(position==="-1"){this.options.headerConfig.push({field:fieldName,isPredefined:true})}else{this._insertFieldInHeaderConfig(this.options.headerConfig,fieldName,position)}},setDefaultColsData:function(header){if(_.isEmpty(this.preparedHeaderData)){return}var rowExpandPosition,rowExpandCol;if(this.options.rowExpansionEnabled){rowExpandPosition=this.options.rowDef.position;rowExpandCol=_.clone(this.customColumnDefs.__expand);rowExpandCol.width=this.options.rowDef.columnwidth;if(header){if(rowExpandPosition==="-1"){this.preparedHeaderData.push(rowExpandCol)}else if(rowExpandPosition==="0"){this.preparedHeaderData.unshift(rowExpandCol)}else{var index=_.findIndex(this.preparedHeaderData,{field:rowExpandPosition});this.preparedHeaderData.splice(index+1,0,rowExpandCol)}}this.setHeaderConfigForDefaultFields("__expand",rowExpandPosition)}if(this.options.showRowIndex){if(header){this.preparedHeaderData.unshift(this.customColumnDefs.rowIndex)}this.setHeaderConfigForDefaultFields("rowIndex","0")}if(this.options.multiselect){if(header){this.preparedHeaderData.unshift(this.customColumnDefs.checkbox)}this.setHeaderConfigForDefaultFields("checkbox","0")}if(!this.options.multiselect&&this.options.showRadioColumn){if(header){this.preparedHeaderData.unshift(this.customColumnDefs.radio)}this.setHeaderConfigForDefaultFields("radio","0")}},_prepareHeaderData:function(){this.preparedHeaderData=[];$.extend(this.preparedHeaderData,this.options.colDefs);this.setDefaultColsData(true)},_generateCustomColDefs:function(){var colDefs=[],generatedColDefs={};function generateColumnDef(key){if(!generatedColDefs[key]){var colDef={type:"string",field:key};colDefs.push(colDef);generatedColDefs[key]=true}}this.options.data.forEach((function(item){_.keys(item).forEach(generateColumnDef)}));this.options.colDefs=colDefs;this._prepareHeaderData()},_prepareData:function(){var data=[],colDefs=this.options.colDefs,self=this,gridData=[],pageStartIndex=self.getPageStartIndex(),isObject=this.Utils.isObject,isDefined=this.Utils.isDefined;if(!this.options.colDefs.length&&this.options.data.length){this._generateCustomColDefs()}gridData=this.options.isNavTypeScrollOrOndemand()?this.options.data.slice(pageStartIndex):this.options.data;gridData.forEach((function(item,i){var rowData=$.extend(true,{},item);colDefs.forEach((function(colDef){if(!colDef.field){return}var fields=colDef.field.split("."),text=item,j,len=fields.length,key,isArray;for(j=0;j<len;j++){key=fields[j];isArray=undefined;if(key.indexOf("[0]")!==-1){key=key.replace("[0]","");isArray=true}if(isObject(text)&&!isArray){text=_.get(text,key)}else if(isArray){text=_.get(text,key+"[0]")}else{text=undefined;break}}if(isDefined(text)){rowData[colDef.field]=text}else if(fields.length>1&&_.has(item,colDef.field)){rowData[colDef.field]=item[colDef.field]}}));rowData.$$index=pageStartIndex+i+1;rowData.$$pk=self.options.isNavTypeScrollOrOndemand()?pageStartIndex+i:i;data.push(rowData)}));if(self.options.isNavTypeScrollOrOndemand()){if(self.options.isSearchTrigerred&&!self.emptySearch||self.options.isDatasetUpdated){self.preparedData=data}else if(self.preparedData.length){data.forEach((function(rowData,index){var rowId=pageStartIndex+index;if(self.preparedData[rowId]&&rowData.$$index===self.preparedData[rowId].$$index){self.preparedData[rowId]=rowData}else{self.preparedData.push(rowData)}}))}else{self.preparedData.push(...data)}}else{self.preparedData=data}},_reselectColumns:function(){var selectedColumns=[],self=this;if(this.gridHeaderElement&&this.options.enableColumnSelection){selectedColumns=this.gridHeaderElement.find("th."+this.options.cssClassNames.selectedColumn);if(selectedColumns.length){selectedColumns.each((function(){self.columnSelectionHandler(undefined,$(this))}))}}if(this.options.multiselect){this.updateSelectAllCheckboxState()}},_create:function(){$.extend(this,{dataStatus:{message:"",state:"ready"},preparedData:[],preparedHeaderData:[],dataStatusContainer:null,gridContainer:null,gridElement:null,gridHeader:null,gridBody:null,columnClickInfo:{},gridFooter:null,gridSearch:null,tableId:null,searchObj:{field:"",value:"",event:null},compiledCellTemplates:{}});this._setStatus=_.debounce((function(isCreated){this.__setStatus(isCreated)}),100);this._debounceOnEnter=_.debounce((function($target,$row,quickEdit,event){this._onEnter($target,$row,quickEdit,event)}),150);this.options.summaryRow=false;this.options.summaryRowDefs=[];this._prepareHeaderData();this._prepareData();this._render(true)},_setGridEditMode:function(val){if(_.isFunction(this.options.setGridEditMode)){this.options.setGridEditMode(val)}},_refreshGrid:function(){this._prepareHeaderData();this._prepareData();this._render();this.addOrRemoveScroll();this._setGridEditMode(false)},refreshGrid:function(){window.clearTimeout(this.refreshGridTimeout);this.refreshGridTimeout=window.setTimeout(this._refreshGrid.bind(this),50)},callRenderGridForInfiniteScroll:function(){this.gridFooter.remove();var $alwaysNewRow=this.gridElement.find("> tr.app-datagrid-row.always-new-row");if($alwaysNewRow.length){$alwaysNewRow.remove()}this._renderGrid(undefined)},refreshGridData:function(){this._prepareData();if(!this.options.isNavTypeScrollOrOndemand()){this.gridFooter.remove();this._renderGrid()}else{this.callRenderGridForInfiniteScroll()}this._reselectColumns();this.addOrRemoveScroll();this._setGridEditMode(false);this.toggleNewRowActions(false)},setDefaultRowData:function(rowData){_.forEach(this.preparedHeaderData,(function(colDef){rowData[colDef.field]=colDef.defaultvalue}))},addNewRow:function(skipFocus,alwaysNewRow){var rowId=this.gridElement.find("> tr.app-datagrid-row:visible").length||99999,self=this,rowData={},$row,$gridBody,$alwaysNewRow;if(!alwaysNewRow&&_.isFunction(this.options.beforeRowInsert)){this.options.beforeRowInsert()}$gridBody=this.gridElement;$alwaysNewRow=$gridBody.find("> tr.app-datagrid-row.always-new-row");if($alwaysNewRow.length){this.setFocusOnElement(undefined,$alwaysNewRow);if(this.options.editmode===this.CONSTANTS.QUICK_EDIT){var $qTarget=$alwaysNewRow.find("input").length>0?$($alwaysNewRow.find("input")[0]):null;if($qTarget!==null){var event=$.Event("keydown");event.which=13;$qTarget.trigger(event)}}return}rowData.$index=rowId;rowData.$$pk=rowId;if(this.options.editmode!==this.CONSTANTS.FORM&&this.options.editmode!==this.CONSTANTS.DIALOG){$row=$(this._getRowTemplate(rowData,rowData.$index));if(!this.preparedData.length){this.setStatus("ready",this.dataStatus.ready)}if(this.options.formPosition==="top"){$gridBody.prepend($row)}else{$gridBody.append($row)}this._appendRowActions($row,true,rowData);this.attachEventHandlers($row);if(alwaysNewRow||this.options.editmode!==this.CONSTANTS.QUICK_EDIT){$row.find(".delete-row-button").hide();if(alwaysNewRow){$row.find(".edit-row-button").hide()}}this._findAndReplaceCompiledTemplates();if(alwaysNewRow){this.setDefaultRowData(rowData);$row.addClass("always-new-row").addClass("row-editing");this.options.runInNgZone((function(){self.makeRowEditable($row,rowData,true)}))}else{$row.trigger("click",[undefined,{action:"edit",operation:"new",skipFocus:skipFocus}])}this.updateSelectAllCheckboxState();this.addOrRemoveScroll();this.options.timeoutCall((function(){self.setColGroupWidths()}),100)}},addLoadMoreBtn:function(onDemandMsg,loadingdatamsg,cb,infScroll){var $btnEl;if(!this.options.isLastPage||infScroll){var self=this;var $parenEl=$('<div class="on-demand-datagrid"><a class="app-button btn btn-block on-demand-load-btn"></a></div>');$btnEl=$parenEl.find("a");$btnEl.append(onDemandMsg);this.element.find(".app-grid-header-inner").append($parenEl);if(infScroll){if(this.element.find(".on-demand-load-btn").length){this.element.find(".on-demand-load-btn").text(this.options.viewlessmessage)}}$btnEl.on("click",(function(e){var lastPage=self.options.getCurrentPage()==self.options.getPageCount();if(!lastPage){self.showLoadingIndicator(loadingdatamsg,false)}if(!self.options.showviewlessbutton){$btnEl.hide()}if(infScroll){if(lastPage){self.element.find(".on-demand-datagrid").remove()}}if(lastPage&&self.options.showviewlessbutton){$btnEl.hide();self.renderTableOnViewLess=true;self.renderPaginationOnViewLess=true;self.options.enableNavigation();self._renderGrid()}if(cb&&typeof cb==="function"){cb(e)}}))}},showLoadingIndicator:function(loadingdatamsg,infScroll){var hasLoadingEl=this.element.find(".loading-data-msg");var $dataGrid=this.element.find(".on-demand-datagrid");if(hasLoadingEl.length&&!infScroll){hasLoadingEl.show()}else if(infScroll&&$dataGrid.length){$dataGrid.show()}else{var $loadingEl=$('<div class="loading-data-msg spin-icon-in-center"><span><i class="app-icon panel-icon fa-spin '+this.options.loadingicon+'"></i>'+'<span class="sr-only">Loading</span><span class="loading-text"></span></span></div>');$loadingEl.find(".loading-text").html(loadingdatamsg);if($dataGrid.length){$dataGrid.append($loadingEl)}else{var gridEl=$('<div class="on-demand-datagrid">'+$loadingEl[0].outerHTML+"</div>");this.element.find(".app-grid-header-inner").append(gridEl)}}},hideLoadingIndicator:function(showLoadBtn,infScroll){if(!showLoadBtn&&!infScroll){this.element.find(".loading-data-msg").hide();this.element.find(".on-demand-load-btn").text(this.options.ondemandmessage);this.element.find(".on-demand-load-btn").show()}else if(this.options.getCurrentPage()==this.options.getPageCount()&&this.options.showviewlessbutton){this.element.find(".on-demand-load-btn").show().text(this.options.viewlessmessage);this.element.find(".loading-data-msg").hide();if(infScroll){if(!this.element.find(".on-demand-load-btn").length){this.options.addLoadMoreBtn()}this.element.find(".loading-data-msg").hide()}}else{this.element.find(".on-demand-datagrid").hide()}},getSelectedRows:function(){this.getSelectedColumns();var selectedRowsData=[],self=this;this.preparedData.forEach((function(data,i){if(data._selected){selectedRowsData.push(self.options.data[i])}}));return selectedRowsData},selectRows:function(rows){var self=this;self.gridElement.find("tr.app-datagrid-row").each((function(index){if(self.preparedData[index]&&self.preparedData[index]._selected===true){$(this).trigger("click",[$(this),{skipSingleCheck:true}])}}));if(_.isArray(rows)){_.forEach(rows,(function(row){self.selectRow(row,true)}))}else{self.selectRow(rows,true)}},toggleRowFilter:function(show){if(this.options.filtermode===this.CONSTANTS.MULTI_COLUMN&&this.gridSearch){if(show){this.gridSearch.show()}else{this.gridSearch.hide()}}},setColGroupWidths:function(){var self=this,headerCols=this.options.isMobile?this.tableContainer.find("col"):this.tableContainer.find("col"),bodyCols=this.tableContainer.find("col"),headerCells=this.options.showHeader?this.gridContainer.find("th.app-datagrid-header-cell"):this.gridElement.find("tr.app-datagrid-row").first().find("td"),colLength=this.preparedHeaderData.length,scrollLeft=this.gridElement.parent().prop("scrollLeft");if(!headerCols.length&&!headerCells.length){return}this._setColSpan(this.options.headerConfig);this.toggleRowFilter();var definedColWidth=0;var colsLen=headerCols.length;headerCols.each((function(){var eachColWidth=$(this).width();if(eachColWidth){definedColWidth=definedColWidth+eachColWidth;colsLen=colsLen-1}}));headerCells.each((function(){var id=Number($(this).attr("data-col-id")),colDef=self.preparedHeaderData[id],$headerCell=self.gridContainer.find('th[data-col-id="'+id+'"]'),$tdCell=self.gridElement.find('td.app-datagrid-cell[data-col-id="'+id+'"]'),$footCell=self.tableContainer.find('tfoot tr.app-datagrid-row td.app-datagrid-cell[data-col-id="'+id+'"]'),$headerCol=$(headerCols[id]),$bodyCol=$(bodyCols[id]),definedWidth,width;if(!colDef){return}definedWidth=colDef.width;if(!_.isUndefined(colDef.show)&&!colDef.show){$headerCell.hide();$tdCell.hide();$headerCol.hide();$bodyCol.hide();$footCell.hide()}else{$headerCell.show();$tdCell.show();$headerCol.show();$bodyCol.show();$footCell.show()}if($headerCol.length&&$headerCol[0].style.width==="90px"){width=_.isUndefined(definedWidth)?"":definedWidth;$headerCol.css("width",width);$bodyCol.css("width",width)}}));headerCells.each((function(){var $header=$(this),id=Number($header.attr("data-col-id")),colDef=self.preparedHeaderData[id],definedWidth,width,tempWidth,$headerCol;if(!colDef){return}definedWidth=colDef.width;if(!_.isUndefined(colDef.show)&&!colDef.show){width=0}else{if($header.hasClass("grid-col-small")){width=50}else{if(_.isUndefined(definedWidth)||definedWidth===""||_.includes(definedWidth,"%")){$headerCol=$(headerCols[id]);if($headerCol.length){tempWidth=$headerCol[0].style.width;if(tempWidth===""||tempWidth==="0px"||tempWidth==="90px"||_.includes(tempWidth,"%")){width=$header.width();if(width<=0){var currentNode=$header;var elemWidth=width;var padding=0;while(elemWidth<=0){currentNode=currentNode.parent();elemWidth=currentNode.width();if(currentNode.find("table").length){padding=padding+parseFloat(currentNode.css("padding-left"))+parseFloat(currentNode.css("padding-right"))}}if(elemWidth>0){if(padding){elemWidth=elemWidth-padding}if(_.includes(tempWidth,"%")){var widthPercent=parseInt(tempWidth);var pixelWidth=elemWidth*(widthPercent/100);width=pixelWidth}else{var parentWidth=definedColWidth&&definedColWidth>0?elemWidth-definedColWidth:elemWidth;var totalCols=colsLen?colsLen:headerCols.length;width=parentWidth/totalCols;width=width>90?colLength===id+1?width-17:width:90}}else{width=width>90?colLength===id+1?width-17:width:90}}else{width=width>90?colLength===id+1?width-17:width:90}}else{width=tempWidth}}}else{width=definedWidth}}}$(headerCols[id]).css("width",width);$(bodyCols[id]).css("width",width)}));this.toggleRowFilter(true);this.gridElement.parent().prop("scrollLeft",scrollLeft);this.gridHeaderElement.parent().prop("scrollLeft",scrollLeft)},getSelectedColumns:function(){var selectedColsData={},headerData=[],self=this,multiSelectColIndex,radioColIndex,colIndex;$.extend(headerData,this.preparedHeaderData);if(this.options.multiselect){headerData.some((function(item,i){if(item.field==="checkbox"){multiSelectColIndex=i;return true}}));headerData.splice(multiSelectColIndex,1)}else if(this.options.showRadioColumn){headerData.some((function(item,i){if(item.field==="radio"){radioColIndex=i;return true}}));headerData.splice(radioColIndex,1)}if(this.options.showRowIndex){headerData.some((function(item,i){if(item.field==="rowIndex"){colIndex=i;return true}}));headerData.splice(colIndex,1)}headerData.forEach((function(colDef){var field=colDef.field;if(colDef.selected){selectedColsData[field]={colDef:colDef,colData:self.options.data.map((function(data){return data[field]}))}}}));return selectedColsData},_setOption:function(key,value){this._super(key,value);switch(key){case"showHeader":this._toggleHeader();this._toggleSearch();this.setColGroupWidths();this.addOrRemoveScroll();break;case"filtermode":this._toggleSearch();break;case"searchLabel":if(this.gridSearch){this.gridSearch.find('[data-element="dgSearchText"]').attr("placeholder",value);this.gridSearch.find('[data-element="dgSearchButton"]').attr("title",value)}break;case"selectFirstRow":this.selectFirstRow(value);break;case"data":if(!this.isResetSortIconsDone){this.setSortIconDefault()}this.refreshGridData();break;case"dataStates":if(this.dataStatus.state==="nodata"){this.setStatus("nodata",this.dataStatus.nodata)}else if(this.dataStatus.state==="loading"){this.setStatus("loading")}break;case"loadingicon":this.dataStatusContainer.find("i").removeClass().addClass(this.options.loadingicon);break;case"colDefs":if(this.options.isNavTypeScrollOrOndemand()&&this.options.isNextPageData){this.tableContainer.find("colgroup").remove();this._prepareHeaderData();this.setColGroupWidths();this._renderHeader();this._renderSearch();this.attachEventHandlers(this.gridElement);this._reselectColumns();this.addOrRemoveScroll();break}case"multiselect":case"showRadioColumn":case"rowActions":case"filterNullRecords":case"showRowIndex":this.refreshGrid();break;case"cssClassNames":var gridClass=this.options.cssClassNames.gridDefault+" "+this.options.cssClassNames.grid;if(this.options.rowExpansionEnabled){gridClass=gridClass+" "+this.options.cssClassNames.gridRowExpansionClass}this.tableContainer.attr("class",gridClass);if(this.options.spacing==="condensed"){this._toggleSpacingClasses("condensed")}break;case"spacing":this._toggleSpacingClasses(value);break;case"messages":this.gridSearch&&this.gridSearch.find("option.placeholder").text(value&&value.selectField);break}},getOptions:function(){return this.options},_toggleHeader:function(){if(this.gridHeaderElement){this.gridHeaderElement.empty()}if(this.tableContainer){this.tableContainer.find("colgroup").remove();this.tableContainer.find("thead").remove()}this.setDefaultColsData();if(this.options.showHeader){this._renderHeader()}},_toggleSearch:function(){if(this.gridSearch){this.gridSearch.remove()}if(this.options.filtermode===this.CONSTANTS.SEARCH){this._renderSearch()}else if(this.options.filtermode===this.CONSTANTS.MULTI_COLUMN){this._renderRowFilter();this.setColGroupWidths()}},selectFirstRow:function(value,visible){var $row,id;if(visible&&this.gridElement.find("tr").is(":visible")){this.__setStatus();$row=this.gridElement.find("tr.app-datagrid-row:visible:not(.always-new-row)").first()}else{$row=this.gridElement.find("tr.app-datagrid-row:not(.always-new-row)").first()}id=$row.attr("data-row-id");if($row.length&&this.preparedData.length){this.preparedData[id]._selected=!value;$row[0].click()}},selectRow:function(row,value){var rowIndex=_.isNumber(row)?row:this.Utils.getObjectIndex(this.options.data,row),selector,$row;if(rowIndex!==-1){selector="tr.app-datagrid-row[data-row-id="+rowIndex+"]";$row=this.gridElement.find(selector);if($row.length){this.preparedData[rowIndex]._selected=!value}if(value){$row.trigger("click")}else{this.toggleRowSelection($row,value);this.options.callOnRowDeselectEvent(this.preparedData[rowIndex])}}},deselectRow:function(row){this.selectRow(row,false)},toggleRowSelection:function($row,selected,e,isSelectAll){if(!$row.length){return}var rowId=$row.attr("data-row-id"),$checkbox,$radio;if(!this.preparedData[rowId]){return}this.preparedData[rowId]._selected=selected;if(selected){$row.addClass("active")}else{$row.removeClass("active")}if(this.options.showRadioColumn){$radio=$row.find("td input[rowSelectInput]:radio:not(:disabled)");$radio.prop("checked",selected);this.preparedData[rowId]._checked=selected}if(this.options.multiselect){$checkbox=$row.find('td input[name="gridMultiSelect"]:checkbox:not(:disabled)');$checkbox.prop("checked",selected);this.preparedData[rowId]._checked=selected;if(!isSelectAll){this.updateSelectAllCheckboxState()}}else{this._deselectPreviousSelection($row,e)}},updateSelectAllCheckboxState:function(){if(!this.options.showHeader||!this.options.multiselect){return}this.__setStatus();var $headerCheckbox=this.gridHeaderElement.find("th.app-datagrid-header-cell input:checkbox"),$tbody=this.gridElement,checkedItemsLength=$tbody.find('tr.app-datagrid-row:visible input[name="gridMultiSelect"]:checkbox:checked').length,visibleRowsLength=$tbody.find("tr.app-datagrid-row:visible").length;if(!visibleRowsLength){$headerCheckbox.prop("checked",false);return}if(checkedItemsLength===visibleRowsLength){$headerCheckbox.prop("checked",true)}else{$headerCheckbox.prop("checked",false)}},rowClickHandlerOnCapture:function(e,$row,options){if(this.getColInfo(e)&&e.target.type!="checkbox"){return}$row=$row||$(e.target).closest("tr.app-datagrid-row");var gridRow=this.gridElement.find($row);if(gridRow.length&&gridRow.closest("tbody").attr("id")===this.gridElement.attr("id")){var rowId=$row.attr("data-row-id");var rowData=this.preparedData[rowId];var data=this.options.data[rowId];this.options.assignSelectedItems(data,e,{rowId:rowId,_selected:rowData?._selected})}},rowSelectionHandler:function(e,$row,options){if(this.getColInfo(e)&&e.target.type!="checkbox"){return}options=options||{};var rowId,rowData,data,selected,self=this,action=options.action,$target=$(e.target),isQuickEdit=this.options.editmode===this.CONSTANTS.QUICK_EDIT;function callRowSelectionEvents(){if(selected&&_.isFunction(self.options.onRowSelect)){self.options.onRowSelect(data,e)}if(!selected&&_.isFunction(self.options.onRowDeselect)){self.options.onRowDeselect(data,e)}}$row=$row||$target.closest("tr.app-datagrid-row");if(action||isQuickEdit&&($target.hasClass("app-datagrid-cell")||$target.closest("td.app-datagrid-cell").length)&&!$row.hasClass("always-new-row")){options.action=options.action||"edit";if(options.operation==="new"||self.options.actionsEnabled.edit){self.toggleEditRow(e,options)}if(options.skipSelect){return}}rowId=$row.attr("data-row-id");rowData=this.preparedData[rowId];data=this.options.data[rowId];selected=rowData&&rowData._selected||false;if(!options.skipSingleCheck&&($row.hasClass("active")&&!this.options.multiselect||!rowData)){if(!isQuickEdit&&options.operation!=="new"){callRowSelectionEvents()}return}this.options.callOnRowClickEvent(data,e);selected=!selected;this.toggleRowSelection($row,selected,e);callRowSelectionEvents()},rowDblClickHandler:function(e,$row){e.stopPropagation();$row=$row||$(e.target).closest("tr.app-datagrid-row");var rowData,rowId=$row.attr("data-row-id");rowData=this.preparedData[rowId];if(!rowData){return}if(_.isFunction(this.options.onRowDblClick)){this.options.onRowDblClick(rowData,e)}},closePopover:function(){this.options.closePopover(this.element)},headerClickHandler:function(e){var $th=$(e.target).closest("th.app-datagrid-header-cell"),id=$th.attr("data-col-id");this.closePopover();this.options.onHeaderClick(this.preparedHeaderData[id],e)},columnSelectionHandler:function(e,$headerCell){if(e){e.stopImmediatePropagation()}var $th=e?$(e.target).closest("th.app-datagrid-header-cell"):$headerCell,id=$th.attr("data-col-id"),colDef=this.preparedHeaderData[id],field=colDef.field,selector='td[data-col-id="'+id+'"]',$column=this.gridElement.find(selector),selected=$column.data("selected")||false,colInfo={colDef:colDef,data:this.options.data.map((function(data){return data[field]})),sortDirection:this._getColumnSortDirection(colDef.field)},selectedClass=this.options.cssClassNames.selectedColumn;selected=!selected;colDef.selected=selected;$column.data("selected",selected);if(selected){$column.addClass(selectedClass);$th.addClass(selectedClass);if(_.isFunction(this.options.onColumnSelect)&&e){this.options.onColumnSelect(colInfo,e)}}else{$column.removeClass(selectedClass);$th.removeClass(selectedClass);if(_.isFunction(this.options.onColumnDeselect)&&e){this.options.onColumnDeselect(colInfo,e)}}},getTextValue:function(fieldName,alwaysNewRow){return this.options.getFieldValue(alwaysNewRow?fieldName+"_new":fieldName)},getUploadedFiles:function($el,fieldName){return _.get(document.forms,[$el.find("form").attr("name"),fieldName,"files",0])},isDataModified:function($editableElements,rowData,alwaysNewRow){var isDataChanged=false,self=this;function getEpoch(val){return val?moment(val).valueOf():val}$editableElements.each((function(){var $el=$(this),colId=$el.attr("data-col-id"),colDef=self.preparedHeaderData[colId],text=self.getTextValue(colDef.field,alwaysNewRow),originalData=_.get(rowData,colDef.field);if(colDef.editWidgetType==="upload"){isDataChanged=self.getUploadedFiles($el,colDef.field)instanceof File}else{if(!self.Utils.isDefined(text)&&(originalData===null||originalData===undefined)){isDataChanged=false}else{if(colDef.editWidgetType==="datetime"){isDataChanged=!(getEpoch(originalData)===getEpoch(text))}else{isDataChanged=!(originalData==text)}}}if(isDataChanged){return!isDataChanged}}));return isDataChanged},focusActiveRow:function(){this.gridElement.find("tr.app-datagrid-row.active").focus()},focusNewRow:function(){var newRow=this.gridElement.find("tr.always-new-row");var newRowInputs=newRow&&newRow.find("input")||[];newRowInputs.length&&newRowInputs[0].focus()},disableActions:function(val){var $deleteBtns=this.gridElement.find(".delete-row-button"),$editBtns=this.gridElement.find(".edit-row-button");if(val){$editBtns.addClass("disabled-action");$deleteBtns.addClass("disabled-action")}else{$editBtns.removeClass("disabled-action");$deleteBtns.removeClass("disabled-action")}},setFocusOnElement:function(e,$el,skipDelay){var $firstEl,$target=e&&$(e.target),$focusEl;if($target&&$target.hasClass("app-datagrid-cell")){$firstEl=$target.find("input")}else{if(!$el){$el=$target.closest("tr.app-datagrid-row").find("td.cell-editing")}else if($el.hasClass("app-datagrid-row")){$el=$el.find("td.cell-editing")}$firstEl=$($el).first().find("input");if(!$firstEl.length){$firstEl=$($el).first().find("textarea")}if(!$firstEl.length){$firstEl=$($el).first().find("select")}}if($firstEl.length){$focusEl=$firstEl.first();if(skipDelay){$focusEl.focus();$focusEl.select()}else{this.options.timeoutCall((function(){$focusEl.focus();$focusEl.select()}))}}},removeNewRow:function($row){this.disableActions(false);this._setGridEditMode(false);if($row.hasClass("always-new-row")){return}$row.attr("data-removed",true);$row.remove();if(!this.preparedData.length){this.setStatus("nodata",this.dataStatus.nodata)}this.addOrRemoveScroll();this.toggleNewRowActions(false)},saveRow:function(callBack){this.gridElement.find("tr.app-datagrid-row.row-editing:not(.always-new-row)").each((function(){$(this).trigger("click",[undefined,{action:"save",skipSelect:true,noMsg:true,success:callBack}])}))},makeRowEditable:function($row,rowData,alwaysNewRow){var self=this,$originalElements=$row.find("td.app-datagrid-cell"),rowId=parseInt($row.attr("data-row-id"),10),$editableElements,_rowData=_.clone(rowData);_rowData.$index=rowId+1;this.options.removeValidations(alwaysNewRow);this.options.generateInlineEditRow(_rowData,alwaysNewRow);$originalElements.each((function(){var $el=$(this),cellText=$el.text(),id=$el.attr("data-col-id"),colDef=self.preparedHeaderData[id],value,editableTemplate;if(!colDef.readonly){value=_.get(rowData,colDef.field);editableTemplate=self.options.getInlineEditWidget(colDef.field,value,alwaysNewRow);if(!(colDef.customExpression||colDef.formatpattern&&colDef.formatpattern!=="None")){$el.addClass("cell-editing").html(editableTemplate).data("originalText",cellText)}else{$el.addClass("cell-editing editable-expression").data("originalValue",{rowIndex:rowId,fieldName:colDef.field});$el.addClass("cell-editing editable-expression").html(editableTemplate).data("originalText",cellText)}$el.addClass("form-group");if(colDef.binding!=="rowOperations"){self.options.timeoutCall((function(){self.options.applyValidations(colDef,alwaysNewRow);if(colDef.required){$el.addClass("required-field")}}))}else if(colDef.required){$el.addClass("required-field")}}}));$editableElements=$row.find("td.cell-editing");$editableElements.on("click",(function(e){e.stopPropagation()}));$editableElements.on("keydown",(function(e){if((e.which===38||e.which===40)&&(e.currentTarget&&!e.currentTarget.closest(".always-new-row"))){e.stopPropagation()}}))},toggleNewRowActions:function(saveInd){var self=this,$gridActions=$(this.element).siblings("div.panel-footer, div.panel-heading").find("div.app-datagrid-actions"),$newRow=this.gridElement.find("tr.app-datagrid-row.row-editing"),$newRowButton=$gridActions.find("i.wi-plus").closest(".app-button");if(this.options.editmode===this.CONSTANTS.INLINE&&(this.options.rowActions.length===0||!_.some(this.options.rowActions,{action:"editRow($event)"}))){if(saveInd){$gridActions.append('<button type="button" wmbutton="" class="btn app-button btn-default cancelNewRow" tabindex="0" accesskey="" title="Cancel">'+'<i aria-hidden="true" class="app-icon wi wi-cancel"></i>'+'<span class="sr-only">Cancel Icon</span><span class="btn-caption">Cancel</span>'+"</button>"+'<button type="button" wmbutton="" class="btn app-button btn-primary saveNewRow" tabindex="0" accesskey="" title="Save">'+'<i aria-hidden="true" class="app-icon wi wi-done"></i>'+'<span class="sr-only">Save Icon</span><span class="btn-caption">Save</span>'+"</button>");$gridActions.find(".cancelNewRow").on("click",(function(event){self.toggleEditRow(event,{action:"cancel",$row:$newRow})}));$gridActions.find(".saveNewRow").on("click",(function(event){self.toggleEditRow(event,{action:"save",$row:$newRow})}));$newRowButton.hide()}else{$("typeahead-container").removeClass("open");$gridActions.find(".cancelNewRow").remove();$gridActions.find(".saveNewRow").remove();$newRowButton.show()}}},_isNewRow:function($row){var rowId=parseInt($row.attr("data-row-id"),10);return rowId>=this.preparedData.length||$row.hasClass("always-new-row")},toggleEditRow:function(e,options){options=options||{};if(e){e.stopPropagation()}this.closePopover();var $row=options.$row||$(e.target).closest("tr.app-datagrid-row"),$editButton=$row.find(".edit-row-button"),$cancelButton=$row.find(".cancel-edit-row-button"),$saveButton=$row.find(".save-edit-row-button"),$deleteButton=$row.find(".delete-row-button"),rowData=_.cloneDeep(this.options.data[$row.attr("data-row-id")])||{},self=this,action,isNewRow,$editableElements,isDataChanged=false,isValid,$requiredEls,alwaysNewRow=$row.hasClass("always-new-row"),advancedEdit=self.options.editmode===self.CONSTANTS.QUICK_EDIT,editOptions={};this.options.setActionRowIndex($row.attr("data-row-id"));this.options.setLastActionPerformed(this.options.ACTIONS.EDIT);function onSaveSuccess(skipFocus,error){if(_.isFunction(options.success)){options.success(skipFocus,error)}if(!advancedEdit||self.options.actionsEnabled.edit){self.focusActiveRow()}}if($row.attr("data-removed")==="true"){return}if(options.selectRow){this.selectRow(rowData,true)}e=e||{};e.data=e.data||{};action=e.data.action||options.action;if(action==="edit"){if(this.options.editmode===this.CONSTANTS.INLINE){this.options.callLoadInlineWidgetData()}if(advancedEdit&&self.gridElement.find("tr.app-datagrid-row.row-editing:not(.always-new-row)").length){self.saveRow((function(skipFocus,error){self.editSuccessHandler(skipFocus,error,e,$row,true)}));return}$row.addClass("row-editing");if(_.isFunction(this.options.beforeRowUpdate)){this.options.beforeRowUpdate(rowData,e)}if(self.options.editmode===self.CONSTANTS.FORM||self.options.editmode===self.CONSTANTS.DIALOG){return}if(options.operation==="new"){self.setDefaultRowData(rowData);self.toggleNewRowActions(true)}if(_.isFunction(this.options.onBeforeFormRender)){isValid=this.options.onBeforeFormRender(rowData,e,options.operation||action);if(isValid===false){return}}this._setGridEditMode(true);this.disableActions(true);$deleteButton.removeClass("disabled-action");this.options.runInNgZone((function(){self.makeRowEditable($row,rowData)}));$editButton.addClass("hidden");$cancelButton.removeClass("hidden");$saveButton.removeClass("hidden");$editableElements=$row.find("td.cell-editing");if(!options.skipFocus&&$editableElements){this.options.timeoutCall((function(){self.setFocusOnElement(e,$editableElements)}))}if(_.isFunction(this.options.onFormRender)){this.options.onFormRender($row,e,options.operation||action,$row.hasClass("always-new-row"))}}else{$editableElements=$row.find("td.cell-editing");isNewRow=self._isNewRow($row);if(action==="save"){if(isNewRow){isDataChanged=true}else{isDataChanged=this.isDataModified($editableElements,rowData,alwaysNewRow)}if(isDataChanged){$editableElements.each((function(){var $el=$(this),colId=$el.attr("data-col-id"),colDef=self.preparedHeaderData[colId],fields=_.split(colDef.field,"."),text;text=self.getTextValue(colDef.field,alwaysNewRow);if(fields.length===1&&colDef.editWidgetType==="upload"){_.set(rowData,colDef.field,self.getUploadedFiles($el,colDef.field))}else{text=(fields.length===1||isNewRow)&&text===""?undefined:text;if(self.Utils.isDefined(text)){text=text==="null"?null:text;if(text===null){if(fields.length>1){_.set(rowData,fields[0],text)}else{if(!isNewRow){_.set(rowData,colDef.field,"")}}}else{_.set(rowData,colDef.field,text)}}else{if(fields.length===1&&!isNewRow){_.set(rowData,colDef.field,text)}}}}));if($editableElements.find(".ng-pending").length>0){setTimeout(this.toggleEditRow.bind(this,e,options),200);return}$requiredEls=$editableElements.find(".ng-invalid");if($requiredEls.length>0){$requiredEls.each((function(index){var $invalidTd=$(this).closest("td.app-datagrid-cell");if(index===0){$invalidTd.find("[focus-target]").focus()}self.options.setTouched($invalidTd.find("[formcontrolname]").attr("formcontrolname"))}));if(_.isFunction(options.success)){options.success(false,true)}return}if(isNewRow&&advancedEdit&&_.isEmpty(rowData)){self.removeNewRow($row);if(_.isFunction(options.success)){options.success(false,undefined,true)}return}if(isNewRow){if(_.isFunction(this.options.onBeforeRowInsert)){isValid=this.options.onBeforeRowInsert(rowData,e,editOptions);if(isValid===false){return}}this.options.onRowInsert(rowData,e,onSaveSuccess,editOptions);self.toggleNewRowActions(false);if(!$row.hasClass("always-new-row")&&self.options.isNavTypeScrollOrOndemand()){self.removeNewRow($row)}}else{if(_.isFunction(this.options.onBeforeRowUpdate)){isValid=this.options.onBeforeRowUpdate(rowData,e,editOptions);if(isValid===false){return}}this.options.afterRowUpdate(rowData,e,onSaveSuccess,editOptions)}}else{this.cancelEdit($row);if(!options.noMsg){this.options.noChangesDetected()}if(_.isFunction(options.success)){options.success(false)}}}else{if(isNewRow){self.removeNewRow($row);return}this.cancelEdit($row)}}this.addOrRemoveScroll()},cancelEdit:function($row){var self=this,$editableElements=$row.find("td.cell-editing"),$cancelButton=$row.find(".cancel-edit-row-button"),$saveButton=$row.find(".save-edit-row-button"),$editButton=$row.find(".edit-row-button");this.options.clearActionRowIndex();this.disableActions(false);$row.removeClass("row-editing");$editableElements.off("click");$editableElements.each((function(){var $el=$(this),value=$el.data("originalValue");$el.removeClass("datetime-wrapper cell-editing required-field form-group");if(!value){$el.text($el.data("originalText")||"")}else{$el.html(self.options.getCustomExpression(value.fieldName,value.rowIndex))}}));$("typeahead-container").removeClass("open");$editButton.removeClass("hidden");$cancelButton.addClass("hidden");$saveButton.addClass("hidden");this._setGridEditMode(false)},closeEditedRow:function(){var $row=this.gridElement.find("tr.app-datagrid-row.row-editing");if($row.length){if(this._isNewRow($row)){this.removeNewRow($row)}else{this.cancelEdit($row)}}},hideRowEditMode:function($row){if($row.hasClass("always-new-row")&&this.options.isNavTypeScrollOrOndemand()){this.resetNewRow($row);return}var $editableElements=$row.find("td.cell-editing"),$editButton=$row.find(".edit-row-button"),$cancelButton=$row.find(".cancel-edit-row-button"),$saveButton=$row.find(".save-edit-row-button"),self=this;$row.removeClass("row-editing");$editableElements.off("click");this.disableActions(false);this._setGridEditMode(false);$editableElements.each((function(){var $el=$(this),value=$el.data("originalValue"),text,colDef;$el.removeClass("datetime-wrapper cell-editing required-field form-group");if(!value){colDef=self.preparedHeaderData[$el.attr("data-col-id")];text=self.getTextValue(colDef.field);$el.text(self.Utils.isDefined(text)?text:"")}else{$el.html(self.options.getCustomExpression(value.fieldName,value.rowIndex))}}));$editButton.removeClass("hidden");$cancelButton.addClass("hidden");$saveButton.addClass("hidden");this.addOrRemoveScroll()},deleteRow:function(e){e.stopPropagation();var $row=$(e.target).closest("tr.app-datagrid-row"),rowId=$row.attr("data-row-id"),rowData=this.options.data[rowId],isNewRow=this._isNewRow($row),className,isActiveRow,isValid,options={},self=this;this.options.setActionRowIndex(rowId);this.options.setLastActionPerformed(this.options.ACTIONS.DELETE);if(_.isFunction(this.options.beforeRowDelete)){this.options.beforeRowDelete(rowData,e)}if(isNewRow){this.disableActions(false);this._setGridEditMode(false);$row.attr("data-removed",true);$row.remove();if(!this.preparedData.length){this.setStatus("nodata",this.dataStatus.nodata)}this.addOrRemoveScroll();return}if(_.isFunction(this.options.onBeforeRowDelete)){isValid=this.options.onBeforeRowDelete(rowData,e,options);if(isValid===false){return}}if(_.isFunction(this.options.onRowDelete)){className=this.options.cssClassNames.deleteRow;isActiveRow=$row.attr("class").indexOf("active")!==-1;if(isActiveRow){$row.removeClass("active")}$row.addClass(className);this.options.onRowDelete(rowData,(function(){if(isActiveRow){$row.addClass("active")}$row.removeClass(className);self.addOrRemoveScroll()}),e,(function(skipFocus,error){if(self.options.isNavTypeScrollOrOndemand()){var rowId=+$(e.target).closest("tr.app-datagrid-row").attr("data-row-id");var $row=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowId+'"]');self.options.setDeletedRowIndex(rowId);self.preparedData.splice(rowId,1);self.options.data.splice(rowId,1);self.gridElement.find("tr.app-datagrid-row:gt("+rowId+")").each((function(index,row){if(!$row.is(":last-child")&&!$(row).hasClass("always-new-row")){$(row).attr("data-row-id",rowId);self.preparedData[rowId].$$pk--;self.preparedData[rowId].$$index--;self.preparedData[rowId].$index--;rowId++}}));$row.remove()}if(self.options.editmode!==self.CONSTANTS.QUICK_EDIT||!($(e.target).hasClass("delete-row-button")||self.Utils.isDeleteKey(e))){return}self.__setStatus();var rowID,$nextRow;if(error){return}rowID=+$(e.target).closest("tr.app-datagrid-row").attr("data-row-id");$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowID+'"]');if(!$nextRow.length){$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+(rowID-1)+'"]')}$nextRow.trigger("click",[undefined,{action:"edit",skipFocus:skipFocus}])}),options)}},deleteRowAndUpdateSelectAll:function(e){this.deleteRow(e);this.updateSelectAllCheckboxState()},_deselectPreviousSelection:function($row,e){var selectedRows=this.gridElement.find("tr.app-datagrid-row.active"),rowId=$row.attr("data-row-id"),self=this;selectedRows.each((function(){var id=$(this).attr("data-row-id"),preparedData=self.preparedData[id];if(id!==rowId&&preparedData){$(this).find("input[rowSelectInput]:radio").prop("checked",false);preparedData._selected=preparedData._checked=false;$(this).removeClass("active");self.options.callOnRowDeselectEvent(preparedData,e)}}))},resetSortIcons:function($el){this.isResetSortIconsDone=true;var $sortContainer;if(!$el&&this.gridHeaderElement){$sortContainer=this.gridHeaderElement.find(".sort-buttons-container.active");$el=$sortContainer.find("i.sort-icon");$sortContainer.removeClass("active")}$el.removeClass("desc asc").removeClass(this.options.cssClassNames.descIcon).removeClass(this.options.cssClassNames.ascIcon)},setSortIconDefault:function(){const sortInfo=this.options.sortInfo,$e=this.tableContainer,$th=$e.find("[data-col-field='"+sortInfo.field+"']"),$sortContainer=$th.find(".sort-buttons-container"),$sortIcon=$sortContainer.find("i.sort-icon"),direction=sortInfo.direction;if(direction==="asc"){$sortIcon.addClass(direction+" "+this.options.cssClassNames.ascIcon);$sortContainer.addClass("active")}else if(direction==="desc"){$sortIcon.addClass(direction+" "+this.options.cssClassNames.descIcon);$sortContainer.addClass("active")}},sortHandler:function(e){e.stopImmediatePropagation();if($(e.target).hasClass("header-data")&&this.options.enableColumnSelection){this.headerClickHandler(e)}var $e=$(e.target),$th=$e.closest("th.app-datagrid-header-cell"),id=$th.attr("data-col-id"),$sortContainer=$th.find(".sort-buttons-container"),$sortIcon=$sortContainer.find("i.sort-icon"),direction=$sortIcon.hasClass("asc")?"desc":"asc",sortInfo=this.options.sortInfo,$previousSortMarker=this.gridHeaderElement.find(".sort-buttons-container.active"),field=$th.attr("data-col-field"),$previousSortedColumn,$previousSortIcon,colId,colDef;this.resetSortIcons($sortIcon);$sortIcon.addClass(direction);if(direction==="asc"){$sortIcon.addClass(this.options.cssClassNames.ascIcon);$sortContainer.addClass("active")}else if(direction==="desc"){$sortIcon.addClass(this.options.cssClassNames.descIcon);$sortContainer.addClass("active")}if($previousSortMarker.length){$previousSortedColumn=$previousSortMarker.closest("th.app-datagrid-header-cell");colId=$previousSortedColumn.attr("data-col-id");colDef=this.preparedHeaderData[colId];$previousSortIcon=$previousSortMarker.find("i.sort-icon");if(colDef.field!==field){$previousSortMarker.removeClass("active");this.resetSortIcons($previousSortIcon)}colDef.sortInfo={sorted:false,direction:""}}sortInfo.direction=direction;sortInfo.field=field;if(direction!==""){this.preparedHeaderData[id].sortInfo={sorted:true,direction:direction}}this._setGridEditMode(false);this.closeEditedRow();this.options.sortHandler.call(this,this.options.sortInfo,e,"sort")},processUpDownKeys:function(event,$row,direction){var self=this;var rowData=$row.find("input").val();if($row.hasClass("row-editing")&&self.options.editmode===self.CONSTANTS.QUICK_EDIT&&rowData){self.toggleEditRow(event,{action:"save",noMsg:true,success:function(skipFocus,error){self.editSuccessHandler(skipFocus,error,event,$row,true,direction)}})}else{$row=direction==="down"?$row.next():$row.prev();if(this.options.rowExpansionEnabled&&!$row.is(":visible")){$row=direction==="down"?$row.next():$row.prev()}$row.focus()}},resetNewRow:function($row){var rowData={},self=this;this.options.clearForm(true);self.setDefaultRowData(rowData);$row.find("[data-field-name]").each((function(){var $input=$(this),fieldName=$input.attr("data-field-name")+"_new";self.options.setFieldValue(fieldName,rowData[$input.attr("data-field-name")]||"")}));self.options.safeApply();self.setFocusOnElement(undefined,$row,true)},_onEnter:function($target,$row,quickEdit,event){var self=this;if($target.is("button")){return}if(quickEdit&&$target.hasClass("app-datagrid-row")&&!$target.hasClass("row-editing")){$row.trigger("click",[undefined,{action:"edit"}])}else{if($row.hasClass("row-editing")&&$target.closest("[data-field-name]").length){$target.blur();self.toggleEditRow(event,{action:"save",success:function(skipFocus,error){if(error){$target.focus()}else{self.focusActiveRow();self.focusNewRow()}}})}else{$row.trigger("click");if(quickEdit&&$target.hasClass("always-new-row")&&$target.hasClass("row-editing")){self.focusNewRow()}}}if(!$target.is("button")){event.stopPropagation()}},onKeyDown:function(event){var $target=$(event.target),$row=$target.closest("tr.app-datagrid-row"),self=this,quickEdit=this.options.editmode===this.CONSTANTS.QUICK_EDIT,isNewRow;if(this.options.rowExpansionEnabled&&!$row.length){$row=$target.closest("tr.app-datagrid-detail-row")}if(this.Utils.isDeleteKey(event)){if(!this.options.actionsEnabled.delete||$target.is("input")||$target.hasClass("form-control")){return}this.deleteRow(event);return}if(event.which===27){isNewRow=this._isNewRow($row);if(isNewRow&&$row.hasClass("always-new-row")){$target.blur();self.resetNewRow($row)}else{$row.trigger("click",[undefined,{action:"cancel"}])}if(!isNewRow){$row.focus()}return}if(event.which===13){event.stopPropagation();this._debounceOnEnter($target,$row,quickEdit,event);return}if(event.which===38){this.processUpDownKeys(event,$row,"up");return}if(event.which===40){this.processUpDownKeys(event,$row,"down")}},editSuccessHandler:function(skipFocus,error,e,$row,isSameRow,direction){var self=this,rowID,$nextRow;self.__setStatus();if(error){self.setFocusOnElement(e);return}rowID=+$row.attr("data-row-id");if(direction){rowID=direction==="down"?++rowID:--rowID;$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowID+'"]');if($nextRow.length){$nextRow.focus()}else{$row.focus()}return}if(!isSameRow&&!_.isUndefined(isSameRow)){rowID++}$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowID+'"]');if($nextRow.hasClass("always-new-row")){if(self.options.formPosition!=="top"||$row.hasClass("always-new-row")){self.addNewRow(skipFocus)}}else if($nextRow.length){$nextRow.trigger("click",[undefined,{action:"edit",skipFocus:skipFocus,skipSelect:self.options.multiselect}])}else if(self.options.actionsEnabled.new){self.addNewRow(skipFocus)}},isLastColumn:function($target){var $cell=$target.closest("td.app-datagrid-cell"),$editCells;if($cell.is(":last-child")){return true}if($cell.hasClass("cell-editing")){$editCells=$cell.closest("tr.app-datagrid-row").find(".cell-editing").has('> :not([disabled="disabled"])');return $cell.attr("data-col-id")===$editCells.last().attr("data-col-id")}return false},getColInfo:function(event){var row=$(event.target).closest("tr.app-datagrid-row");var rowId=row.attr("data-row-id");var column=$(event.target).closest("td.app-datagrid-cell");var colId=column.attr("data-col-id");if(this.columnClickInfo&&this.columnClickInfo[rowId]&&this.columnClickInfo[rowId][colId]){return this.columnClickInfo[rowId][colId]}return false},attachEventHandlers:function($htm){var $header=this.gridHeaderElement,self=this;if(this.options.enableRowSelection){$htm[0].removeEventListener("click",this.rowClickHandlerOnCapture.bind(this));$htm.off();$htm[0].addEventListener("click",this.rowClickHandlerOnCapture.bind(this));$htm.on("click",this.rowSelectionHandler.bind(this));$htm.on("click","td *",(function(event){if(event.target.type!="checkbox"){var row=$(event.target).closest("tr.app-datagrid-row");var rowId=row.attr("data-row-id");var column=$(event.target).closest("td.app-datagrid-cell");var colId=column.attr("data-col-id");var id=Number(colId);var colDefination=self.preparedHeaderData[id];if(colDefination.readonly){self.columnClickInfo[rowId]={};self.columnClickInfo[rowId][colId]=true}}}));$htm.on("dblclick",this.rowDblClickHandler.bind(this));$htm.on("keydown",this.onKeyDown.bind(this))}if($header){if(this.options.enableColumnSelection){$header.find("th[data-col-selectable]").off("click",this.columnSelectionHandler.bind(this));$header.find("th[data-col-selectable]").on("click",this.columnSelectionHandler.bind(this))}else{$header.find("th[data-col-selectable]").off("click")}if(this.options.enableSort){if(this.options.enableColumnSelection){$header.find("th[data-col-sortable] .header-data").off("click",this.sortHandler.bind(this));$header.find("th[data-col-sortable] .header-data").on("click",this.sortHandler.bind(this))}else{$header.find("th[data-col-sortable]").off("click",this.sortHandler.bind(this));$header.find("th[data-col-sortable]").on("click",this.sortHandler.bind(this))}}else{if(this.options.enableColumnSelection){$header.find("th[data-col-sortable] .header-data").off("click")}else{$header.find("th[data-col-sortable]").off("click")}}}if(this.options.rowActions.length){$htm.find(".cancel-edit-row-button").off("click");$htm.find(".save-edit-row-button").off("click");$htm.find(".cancel-edit-row-button").on("click",{action:"cancel"},this.toggleEditRow.bind(this));$htm.find(".save-edit-row-button").on("click",{action:"save"},this.toggleEditRow.bind(this))}if(self.options.editmode===self.CONSTANTS.QUICK_EDIT){$htm.on("focusout","tr.app-datagrid-row",(function(e){var $target=$(e.target),$row=$target.closest("tr.app-datagrid-row"),$relatedTarget=$(e.relatedTarget),isLastColumn=self.isLastColumn($target,$relatedTarget),isTargetRowAction=$target.closest("span.actions-column").length>0,isRelatedTargetRowAction=$relatedTarget.closest("span.actions-column").length>0,isTargetGridAction=$relatedTarget.closest("div.app-datagrid-actions").length>0,isRelatedTargetGridAction=$relatedTarget.closest("div.app-datagrid-actions").length>0,invalidTargets='.row-editing:not(".always-new-row"), .row-action-button, .app-datagrid-cell, .caption, button.btn-time, button.btn-date';function isInvalidTarget(){if(!$relatedTarget.closest(".app-grid").length){return true}return $relatedTarget.is(invalidTargets)}if($relatedTarget.is("tr.app-datagrid-row")){if($relatedTarget.attr("data-row-id")===$row.attr("data-row-id")){return}}if(isRelatedTargetRowAction||$row.hasClass("danger")||isRelatedTargetGridAction||isTargetRowAction&&isRelatedTargetRowAction||isTargetRowAction&&e.relatedTarget===null||isInvalidTarget()||$relatedTarget.attr("focus-target")===""){return}if(!isTargetGridAction&&!isTargetRowAction){if(!isLastColumn||isLastColumn&&e.relatedTarget===null||$target.hasClass("file-upload")){return}}self.options.timeoutCall((function(){self.toggleEditRow(e,{action:"save",noMsg:true,success:function(skipFocus,error,isNewRow){if(!isNewRow){self.editSuccessHandler(skipFocus,error,e,$row)}}})}))}))}$htm.find('[data-identifier="rowExpansionButtons"]').off("click");$htm.find('[data-identifier="rowExpansionButtons"]').on("click",(function(e){var $row=$(e.target).closest("tr.app-datagrid-row");if($(this).find(".app-button").attr("disabled")){return}self.toggleExpandRow(+$row.attr("data-row-id"),undefined,e)}))},expandRow:function(rowId){this.toggleExpandRow(rowId,true)},collapseRow:function(rowId){this.toggleExpandRow(rowId,false)},_collapseRow:function(e,rowData,rowId,$nextDetailRow,$icon){var self=this,$tbody=self.gridElement,$row=$($tbody.find('> tr.app-datagrid-row[data-row-id="'+rowId+'"]'));$row.removeClass(self.options.cssClassNames.expandedRowClass);$row.find("button, a").attr("aria-expanded","false").attr("aria-live","polite");if(this.options.onBeforeRowCollapse(e,rowData,rowId)===false){return}if($icon.length&&$icon.hasClass(this.options.cssClassNames.rowExpandIcon)){$icon.removeClass(this.options.cssClassNames.rowExpandIcon).addClass(this.options.cssClassNames.rowCollapseIcon)}$nextDetailRow.hide();this.options.onRowCollapse(e,rowData)},toggleExpandRow:function(rowId,isExpand,e){var self=this,$tbody=self.gridElement,$row=$($tbody.find('> tr.app-datagrid-row[data-row-id="'+rowId+'"]')),rowData=_.clone(self.options.data[rowId]),$nextDetailRow=$row.next("tr.app-datagrid-detail-row"),isClosed=!$nextDetailRow.is(":visible"),$icon=$row.find('[data-identifier="rowExpansionButtons"] i.app-icon');rowData.$index=rowId+1;if(isExpand&&!isClosed){return}if(isExpand===false&&isClosed){return}if(isClosed){$row.addClass(self.options.cssClassNames.expandedRowClass);$row.find("button, a").attr("aria-expanded","true");if(e&&self.preparedData[rowId]._selected){e.stopPropagation()}if(self.options.rowDef.closeothers){$tbody.find("> tr.app-datagrid-detail-row:visible").each((function(){var $otherDetailRow=$(this),$otherIcon=$otherDetailRow.prev("tr.app-datagrid-row").find('[data-identifier="rowExpansionButtons"] i.app-icon'),otherRowId=+$otherDetailRow.attr("data-row-id"),otherRowData=self.options.data[otherRowId];$otherDetailRow.hide();self._collapseRow(e,otherRowData,otherRowId,$otherDetailRow,$otherIcon)}))}self.options.generateRowDetailView(e,rowData,rowId,$nextDetailRow.find("td.app-datagrid-row-details-cell .details-section"),$nextDetailRow.find("td.app-datagrid-row-details-cell .row-overlay"),(function(){if($icon.length&&$icon.hasClass(self.options.cssClassNames.rowCollapseIcon)){$icon.removeClass(self.options.cssClassNames.rowCollapseIcon).addClass(self.options.cssClassNames.rowExpandIcon)}$nextDetailRow.show()}))}else{self._collapseRow(e,rowData,rowId,$nextDetailRow,$icon)}},_findAndReplaceCompiledTemplates:function(){if(!this.gridElement){return}var $compiledCells=this.gridElement.find("td[data-compiled-template]"),self=this;$compiledCells.each((function(){var $cell=$(this),id=$cell.attr("data-compiled-template");$cell.replaceWith(self.compiledCellTemplates[id])}))},_renderSearch:function(){var $htm=$(this._getSearchEl()),self=this,$searchBox;function search(e){e.stopPropagation();var searchText=$htm.find('[data-element="dgSearchText"]')[0].value,$filterField=$htm.find('[data-element="dgFilterValue"]'),field=$filterField[0].value,colDefIndex=$htm.find("option:selected").attr("data-coldef-index"),colDef=self.options.colDefs[colDefIndex],type=colDef&&colDef.type?colDef.type:"";self.searchObj={field:field,value:searchText,type:type,event:e};self.options.searchHandler.call(self,self.searchObj,e,"search")}this.element.find(".form-search").remove();$htm.insertBefore(this.gridContainer);this.gridSearch=this.element.find(".form-search");$searchBox=this.gridSearch.find('[data-element="dgSearchText"]');this.gridSearch.find(".app-search-button").on("click",search);this.gridSearch.find('[data-element="dgFilterValue"]').on("change",(function(e){if(self.dataStatusContainer.find(".status").text()===self.options.dataStates.nodata){search(e)}}));$searchBox.on("keyup",(function(e){e.stopPropagation();if(!$(this).val()){self.emptySearch=true;if(self.searchObj.value){self.searchObj.value="";search(e)}}else{self.emptySearch=false}if(e.which===13||self.options.filteronkeypress){search(e)}}))},_renderRowFilter:function(){var $row=$('<tr class="filter-row"></tr>'),self=this,$headerElement=this.options.isMobile&&!this.options.showHeader?this.gridElement:this.gridHeaderElement;$headerElement.find(".filter-row").remove();this.options.generateFilterRow();this.preparedHeaderData.forEach((function(field,index){var fieldName=field.field,$th=$('<th data-col-id="'+index+'"></th>');if(!field.searchable){$row.append($th);return}$th.append(self.options.getFilterWidget(fieldName));$row.append($th)}),this);if(this.options.showHeader){this.gridHeaderElement.append($row)}else{if(this.options.isMobile){$headerElement.empty().append($row)}else{$headerElement.empty().append($row)}}this.gridSearch=$headerElement.find(".filter-row")},_renderHeader:function(){var headerTemplate=this._getHeaderTemplate(),$colgroup=headerTemplate.colgroup,self=this,$header;this.gridElement.parent().scroll((function(){self.gridHeaderElement.parent().prop("scrollLeft",this.scrollLeft)}));if(!this.options.showHeader){this.tableContainer.append($colgroup);this.gridHeaderElement.hide();return}else{this.gridHeaderElement.show()}$header=headerTemplate.header;function toggleSelectAll(e){var $checkboxes=$('tr.app-datagrid-row:not(.always-new-row):visible td input[name="gridMultiSelect"]:checkbox',self.gridElement),checked=this.checked;$checkboxes.prop("checked",checked);$checkboxes.each((function(){var $row=$(this).closest("tr.app-datagrid-row"),rowId=$row.attr("data-row-id"),rowData=self.options.data[rowId];self.options.assignSelectedItems(rowData,e,{rowId:rowId,_selected:self.preparedData[rowId]?._selected});self.toggleRowSelection($row,checked,e,true);if(checked&&_.isFunction(self.options.onRowSelect)){self.options.onRowSelect(rowData,e)}if(!checked&&_.isFunction(self.options.onRowDeselect)){self.options.onRowDeselect(rowData,e)}}))}var headerCells=$header.find("th.app-datagrid-header-cell");var headerCols=$colgroup.find("col");headerCells.each((function(){var id=Number($(this).attr("data-col-id")),colDef=self.preparedHeaderData[id],$headerCol=$(headerCols[id]);if(!colDef){return}if(!_.isUndefined(colDef.show)&&!colDef.show){$(this).hide();$headerCol.hide()}}));if(this.options.isMobile){this.tableContainer.append($colgroup)}else{this.tableContainer.append($colgroup)}$header.on("click",".app-datagrid-header-cell input:checkbox",toggleSelectAll);if(_.isFunction(this.options.onHeaderClick)){this.gridHeaderElement.find("th.app-datagrid-header-cell").on("click",this.headerClickHandler.bind(this))}if(!this.options.isMobile&&this.gridHeaderElement.length){this.gridHeaderElement.find("th[data-col-resizable]").resizable({handles:"e",minWidth:50,resize:function(evt,ui){var $colElement,$colHeaderElement,$cellElements,colIndex=+ui.helper.attr("data-col-id")+1,originalWidth=ui.helper.width(),newWidth=ui.size.width,originalTableWidth,newTableWidth;$colHeaderElement=self.tableContainer.find("colgroup > col:nth-child("+colIndex+")");$colElement=self.tableContainer.find("colgroup > col:nth-child("+colIndex+")");$cellElements=self.gridElement.find("tr.app-datagrid-row > td:nth-child("+colIndex+") > div");$colElement.width(newWidth);$colHeaderElement.width(newWidth);$cellElements.width(newWidth);$(this).css("height","auto");if(newWidth>ui.originalSize.width){originalTableWidth=self.gridHeaderElement.width();newTableWidth=originalTableWidth+newWidth-originalWidth;self.gridHeaderElement.width(newTableWidth);self.gridElement.width(newTableWidth)}self.addOrRemoveScroll();self.options.redrawWidgets()}})}if(!this.isResetSortIconsDone){this.setSortIconDefault()}},addOrRemoveScroll:function(){var gridContent=this.gridContainer.find("tbody"),gridHeader=this.gridContainer.find(".table-header");if(gridContent.scrollHeight>gridContent.clientHeight&&!this.Utils.isMac()){gridHeader.addClass("scroll-visible")}else{gridHeader.removeClass("scroll-visible")}},_handleCustomEvents:function(e,options){this.options.handleCustomEvents(e,options)},_setActionsEnabled:function(){var self=this;_.forEach(this.options.rowActions,(function(def){if(_.includes(def.action,"editRow(")){self.options.actionsEnabled.edit=true}else if(_.includes(def.action,"deleteRow(")){self.options.actionsEnabled.delete=true}}))},_appendRowActions:function($htm,isNewRow,rowData){var self,rowOperationsCol=this._getRowActionsColumnDef();if(this.options.rowActions.length||rowOperationsCol){this._setActionsEnabled();self=this;$htm.find("[data-identifier='actionButtons']").each((function(index){var _rowData,$row,rowId,rowIndex=index;if(isNewRow){_rowData=rowData}else{$row=$(this).closest("tr.app-datagrid-row");rowId=parseInt($row.attr("data-row-id"),10);_rowData=_.clone(self.options.data[rowId]);_rowData.$index=rowIndex+1}self.options.generateRowActions(_rowData,rowIndex);$(this).empty().append(self.options.getRowAction(rowIndex))}))}},_renderGrid:function(isCreated){var $htm,isScrollorOnDemand=this.options.isNavTypeScrollOrOndemand(),pageStartIndex=this.getPageStartIndex();$("table.table-bordered").parents(".app-grid-header-inner").addClass("table_border");if(isScrollorOnDemand){var $tbody=this.gridElement;var template=this._getGridTemplate();$htm=$(template);if(template&&!$tbody.length){this.gridElement.append($htm)}}else{var templates=this._getGridTemplate();$htm=$(templates);if(templates){this.gridElement.append($htm)}}if(this.options.summaryRow){var $summaryRowHtm=$(this._getSummaryRowTemplate());this.tableContainer.find("tfoot").remove();if(this.options.data.length){this.tableContainer.append($summaryRowHtm)}}if(!this.options.data.length&&this.dataStatus.state==="nodata"){this.setStatus("nodata")}else{this.dataStatus.state=this.dataStatus.state||"loading";this.dataStatus.message=this.dataStatus.message||this.options.dataStates.loading;this.setStatus(this.dataStatus.state,this.dataStatus.message,isCreated)}this.gridBody=this.gridElement.find("tbody");this.gridFooter=this.tableContainer.find("tfoot");this._findAndReplaceCompiledTemplates();this.options.clearRowActions();this._appendRowExpansionButtons($htm);this._appendRowActions($htm);this.attachEventHandlers($htm);this.__setStatus(isCreated);if(this.options.editmode===this.CONSTANTS.QUICK_EDIT&&this.options.showNewRow){this.addNewRow(false,true)}if(isCreated){this._setColSpan(this.options.headerConfig)}if(_.isFunction(this.options.onDataRender)){this.options.onDataRender()}if(!isCreated&&this.options.selectFirstRow){if(this.options.multiselect){this.options.selectFirstRow=false}if(this.gridElement.find("tr.app-datagrid-row.active").length<=0){this.selectFirstRow(true,true)}}},_render:function(isCreated){if(!this.tableId){this.tableId=this.Utils.generateGuid()}var overflow=this.options.isNavTypeScrollOrOndemand()&&(this.options.height==="100%"||this.options.height==="auto")?"hidden":"auto";var statusContainer='<div class="overlay">'+'<div class="status"><i class="'+this.options.loadingicon+'"></i><span class="message"></span></div>'+"</div>",table='<div class="table-container table-responsive">'+'<div class="app-grid-header">'+'<div class="app-grid-header-inner">'+'<table tabindex="0" class="'+this.options.cssClassNames.gridDefault+" "+this.options.cssClassNames.grid+'">'+'<thead tabindex="0" class="table-header thead-sticky" id="table_header_'+this.tableId+'">'+'</thead><tbody class="app-grid-content app-datagrid-body" id="table_'+this.tableId+'">'+"</tbody></table>"+"</div></div></div>",$statusContainer=$(statusContainer),$tableContainer=this.element.find(".table-container");this.gridContainer=$(table);this.gridHeaderElement=this.gridContainer.find(".table-header");this._setStyles($statusContainer.find("div.overlay"),"display:none");this._setStyles(this.gridContainer.find("div.app-grid-header-inner"),"height:"+this.options.height+"; overflow: auto;");this.tableContainer=this.gridContainer.find("table");this.gridElement=this.gridContainer.find(".app-grid-content");if(this.options.isNavTypeScrollOrOndemand()&&(!$tableContainer.length||!this.options.isNextPageData)||!this.options.isNavTypeScrollOrOndemand()){this.element.find(".table-container").remove();this.element.append(this.gridContainer)}this.options.setIsNextPageData(false);if(!this.gridContainer.find(".overlay").length){this.dataStatusContainer=$(statusContainer);this.gridContainer.append(this.dataStatusContainer)}if(this.gridHeaderElement){this.gridHeaderElement.empty();this.gridElement.find("colgroup").remove()}this._renderHeader();if(this.options.filtermode===this.CONSTANTS.SEARCH&&(_.isEmpty(this.searchObj)||this.searchObj&&!this.searchObj.field&&!this.searchObj.value)){this._renderSearch()}else if(this.options.filtermode===this.CONSTANTS.MULTI_COLUMN){this._renderRowFilter()}if(this.options.spacing==="condensed"){this._toggleSpacingClasses("condensed")}this._renderGrid(isCreated);this.addNavigationControls()},addNavigationControls:function(){if(this.options.isdynamictable){this.element.find(".on-demand-datagrid").remove();if(this.options.navigation==="On-Demand"&&!this.element.find(".on-demand-datagrid").length){this.options.addLoadMoreBtn()}else if(this.options.navigation==="Scroll"){this.options.bindScrollEvt()}}},__setStatus:function(isCreated){var loadingIndicator=this.dataStatusContainer.find("i"),state=this.dataStatus.state,isScrollOrOndemand=this.options.isNavTypeScrollOrOndemand();this.dataStatusContainer.find(".message").text(this.dataStatus.message);if(state==="loading"){loadingIndicator.removeClass("hidden")}else{loadingIndicator.addClass("hidden")}if(state==="ready"){this.dataStatusContainer.hide()}else{if(this.options.isNavTypeScrollOrOndemand()&&(state==="nodata"||this.options.getCurrentPage()==this.options.getPageCount()&&!this.options.showviewlessbutton)){this.element.find(".on-demand-datagrid a").hide()}this.dataStatusContainer.show()}if(state==="nodata"||state==="loading"||state==="error"){if(this.options.height==="100%"||this.options.height==="auto"){if(state==="nodata"){this.dataStatusContainer.css("height","auto");this.dataStatus.contentHeight=0}else if(this.options.isNavTypeScrollOrOndemand()&&this.options.getCurrentPage()>1){this.dataStatusContainer.hide()}else{this.dataStatus.height=this.dataStatus.height||this.dataStatusContainer.outerHeight();this.dataStatus.contentHeight=this.gridElement.outerHeight()||this.dataStatus.contentHeight;this.dataStatusContainer.css("height",this.dataStatus.height>this.dataStatus.contentHeight?"auto":this.dataStatus.contentHeight)}}if(!isScrollOrOndemand||isScrollOrOndemand&&this.options.getCurrentPage()===1){this.gridContainer.addClass("show-msg")}}else{this.gridContainer.removeClass("show-msg");if(this.options.editmode===this.CONSTANTS.QUICK_EDIT){if(this.options.activeRow){this.attachHandlersToActiveRow(this.options.activeRow)}this.options.activeRow=undefined}}if(!isCreated){this.setColGroupWidths()}this.addOrRemoveScroll()},attachHandlersToActiveRow(rowObj){var rowIndex=this.Utils.getObjectIndex(this.options.data,rowObj);var row=this.gridElement.find("tr.app-datagrid-row[data-row-id="+rowIndex+"]");if(!row.length){return}else if(!row.hasClass("active")){row.addClass("active")}this.focusActiveRow();this.attachEventHandlers(row)},setActiveRow(row){this.options.activeRow=row},setStatus:function(state,message,isCreated){var $newRow;if(state==="nodata"){$newRow=this.gridElement&&this.gridElement.find("tr.app-datagrid-row.always-new-row");state=$newRow&&$newRow.length?"ready":state}this.dataStatus.state=state;this.options.setGridState(state);this.dataStatus.message=message||this.options.dataStates[state];if(this._setStatusCalled){this._setStatus(isCreated)}else{this.__setStatus(isCreated);this._setStatusCalled=true}},setGridDimensions:function(key,value){if(value.indexOf("px")===-1&&value.indexOf("%")===-1&&value.indexOf("em")===-1&&value!="auto"){value=value+"px"}this.options[key]=value;if(key==="height"){var elements=this.gridHeaderElement.find("th");this.gridContainer.find(".app-grid-header-inner").css(key,value);if(this.options.isNavTypeScrollOrOndemand()&&(this.options.height!="100%"&&this.options.height!="auto")){this.gridContainer.find(".app-grid-header-inner").css("overflow","auto")}this.dataStatusContainer.css(key,value)}this.addOrRemoveScroll()},setColumnProp:function(fieldName,property,val,isGroup){var $col;if(property==="displayName"){if(isGroup){$col=this.gridHeaderElement.find('th[data-col-group="'+fieldName+'"]')}else{$col=this.gridHeaderElement.find('th[data-col-field="'+fieldName+'"]')}$col.attr("title",val);$col.find(".header-data").html(val);if(this.options.filtermode===this.CONSTANTS.SEARCH&&this.gridSearch){this.gridSearch.find('select option[value="'+fieldName+'"]').text(val)}}},applyRowNgClass:function(val,index){var $row=this.gridElement.find('tr.app-datagrid-row[data-row-id="'+index+'"]');$row.removeClass(val.toRemove);$row.addClass(val.toAdd)},applyColNgClass:function(val,rowIndex,colIndex){var $cell=this.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowIndex+'"] td.app-datagrid-cell[data-col-id="'+colIndex+'"]');$cell.removeClass(val.toRemove);$cell.addClass(val.toAdd)},_destroy:function(){this.element.text("");window.clearTimeout(this.refreshGridTimeout)}});(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("rxjs")):typeof define==="function"&&define.amd?define(["exports","rxjs"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory((global.awesomeCordova=global.awesomeCordova||{},global.awesomeCordova.core={}),global.rxjs))})(this,(function(exports,rxjs){"use strict";function checkReady(){if(typeof process==="undefined"){var win_1=typeof window!=="undefined"?window:{};var DEVICE_READY_TIMEOUT_1=5e3;var before_1=Date.now();var didFireReady_1=false;win_1.document.addEventListener("deviceready",(function(){console.log("Ionic Native: deviceready event fired after "+(Date.now()-before_1)+" ms");didFireReady_1=true}));setTimeout((function(){if(!didFireReady_1&&win_1.cordova){console.warn("Ionic Native: deviceready did not fire within "+DEVICE_READY_TIMEOUT_1+"ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.")}}),DEVICE_READY_TIMEOUT_1)}}var ERR_CORDOVA_NOT_AVAILABLE={error:"cordova_not_available"};var ERR_PLUGIN_NOT_INSTALLED={error:"plugin_not_installed"};function getPromise(callback){var tryNativePromise=function(){if(Promise){return new Promise((function(resolve,reject){callback(resolve,reject)}))}else{console.error("No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.")}};if(typeof window!=="undefined"&&window.angular){var doc=window.document;var injector=window.angular.element(doc.querySelector("[ng-app]")||doc.body).injector();if(injector){var $q=injector.get("$q");return $q((function(resolve,reject){callback(resolve,reject)}))}console.warn("Angular 1 was detected but $q couldn't be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won't trigger an automatic digest when promises resolve.")}return tryNativePromise()}function wrapPromise(pluginObj,methodName,args,opts){if(opts===void 0){opts={}}var pluginResult,rej;var p=getPromise((function(resolve,reject){if(opts.destruct){pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return resolve(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return reject(args)}))}else{pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,resolve,reject)}rej=reject}));if(pluginResult&&pluginResult.error){p.catch((function(){}));typeof rej==="function"&&rej(pluginResult.error)}return p}function wrapOtherPromise(pluginObj,methodName,args,opts){if(opts===void 0){opts={}}return getPromise((function(resolve,reject){var pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts);if(pluginResult){if(pluginResult.error){reject(pluginResult.error)}else if(pluginResult.then){pluginResult.then(resolve).catch(reject)}}else{reject({error:"unexpected_error"})}}))}function wrapObservable(pluginObj,methodName,args,opts){if(opts===void 0){opts={}}return new rxjs.Observable((function(observer){var pluginResult;if(opts.destruct){pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.next(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.error(args)}))}else{pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,observer.next.bind(observer),observer.error.bind(observer))}if(pluginResult&&pluginResult.error){observer.error(pluginResult.error);observer.complete()}return function(){try{if(opts.clearFunction){if(opts.clearWithArgs){return callCordovaPlugin(pluginObj,opts.clearFunction,args,opts,observer.next.bind(observer),observer.error.bind(observer))}return callCordovaPlugin(pluginObj,opts.clearFunction,[])}}catch(e){console.warn("Unable to clear the previous observable watch for",pluginObj.constructor.getPluginName(),methodName);console.warn(e)}}}))}function wrapEventObservable(event,element){element=typeof window!=="undefined"&&element?get$1(window,element):element||(typeof window!=="undefined"?window:{});return rxjs.fromEvent(element,event)}function checkAvailability(plugin,methodName,pluginName){var pluginRef,pluginPackage;if(typeof plugin==="string"){pluginRef=plugin}else{pluginRef=plugin.constructor.getPluginRef();pluginName=plugin.constructor.getPluginName();pluginPackage=plugin.constructor.getPluginInstallName()}var pluginInstance=getPlugin(pluginRef);if(!pluginInstance||!!methodName&&typeof pluginInstance[methodName]==="undefined"){if(typeof window==="undefined"||!window.cordova){cordovaWarn(pluginName,methodName);return ERR_CORDOVA_NOT_AVAILABLE}pluginWarn(pluginName,pluginPackage,methodName);return ERR_PLUGIN_NOT_INSTALLED}return true}function instanceAvailability(pluginObj,methodName){return pluginObj._objectInstance&&(!methodName||typeof pluginObj._objectInstance[methodName]!=="undefined")}function setIndex(args,opts,resolve,reject){if(opts===void 0){opts={}}if(opts.sync){return args}if(opts.callbackOrder==="reverse"){args.unshift(reject);args.unshift(resolve)}else if(opts.callbackStyle==="node"){args.push((function(err,result){if(err){reject(err)}else{resolve(result)}}))}else if(opts.callbackStyle==="object"&&opts.successName&&opts.errorName){var obj={};obj[opts.successName]=resolve;obj[opts.errorName]=reject;args.push(obj)}else if(typeof opts.successIndex!=="undefined"||typeof opts.errorIndex!=="undefined"){var setSuccessIndex=function(){if(opts.successIndex>args.length){args[opts.successIndex]=resolve}else{args.splice(opts.successIndex,0,resolve)}};var setErrorIndex=function(){if(opts.errorIndex>args.length){args[opts.errorIndex]=reject}else{args.splice(opts.errorIndex,0,reject)}};if(opts.successIndex>opts.errorIndex){setErrorIndex();setSuccessIndex()}else{setSuccessIndex();setErrorIndex()}}else{args.push(resolve);args.push(reject)}return args}function callCordovaPlugin(pluginObj,methodName,args,opts,resolve,reject){if(opts===void 0){opts={}}args=setIndex(args,opts,resolve,reject);var availabilityCheck=checkAvailability(pluginObj,methodName);if(availabilityCheck===true){var pluginInstance=getPlugin(pluginObj.constructor.getPluginRef());return pluginInstance[methodName].apply(pluginInstance,args)}else{return availabilityCheck}}function callInstance(pluginObj,methodName,args,opts,resolve,reject){if(opts===void 0){opts={}}args=setIndex(args,opts,resolve,reject);if(instanceAvailability(pluginObj,methodName)){return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance,args)}}function getPlugin(pluginRef){if(typeof window!=="undefined"){return get$1(window,pluginRef)}return null}function get$1(element,path){var paths=path.split(".");var obj=element;for(var i=0;i<paths.length;i++){if(!obj){return null}obj=obj[paths[i]]}return obj}function pluginWarn(pluginName,plugin,method){if(method){console.warn("Native: tried calling "+pluginName+"."+method+", but the "+pluginName+" plugin is not installed.")}else{console.warn("Native: tried accessing the "+pluginName+" plugin but it's not installed.")}if(plugin){console.warn("Install the "+pluginName+" plugin: 'ionic cordova plugin add "+plugin+"'")}}function cordovaWarn(pluginName,method){if(typeof process==="undefined"){if(method){console.warn("Native: tried calling "+pluginName+"."+method+", but Cordova is not available. Make sure to include cordova.js or run in a device/simulator")}else{console.warn("Native: tried accessing the "+pluginName+" plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator")}}}var wrap=function(pluginObj,methodName,opts){if(opts===void 0){opts={}}return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}if(opts.sync){return callCordovaPlugin(pluginObj,methodName,args,opts)}else if(opts.observable){return wrapObservable(pluginObj,methodName,args,opts)}else if(opts.eventObservable&&opts.event){return wrapEventObservable(opts.event,opts.element)}else if(opts.otherPromise){return wrapOtherPromise(pluginObj,methodName,args,opts)}else{return wrapPromise(pluginObj,methodName,args,opts)}}};function wrapInstance(pluginObj,methodName,opts){if(opts===void 0){opts={}}return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}if(opts.sync){return callInstance(pluginObj,methodName,args,opts)}else if(opts.observable){return new rxjs.Observable((function(observer){var pluginResult;if(opts.destruct){pluginResult=callInstance(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.next(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.error(args)}))}else{pluginResult=callInstance(pluginObj,methodName,args,opts,observer.next.bind(observer),observer.error.bind(observer))}if(pluginResult&&pluginResult.error){observer.error(pluginResult.error)}return function(){try{if(opts.clearWithArgs){return callInstance(pluginObj,opts.clearFunction,args,opts,observer.next.bind(observer),observer.error.bind(observer))}return callInstance(pluginObj,opts.clearFunction,[])}catch(e){console.warn("Unable to clear the previous observable watch for",pluginObj.constructor.getPluginName(),methodName);console.warn(e)}}}))}else if(opts.otherPromise){return getPromise((function(resolve,reject){var result;if(opts.destruct){result=callInstance(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return resolve(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return reject(args)}))}else{result=callInstance(pluginObj,methodName,args,opts,resolve,reject)}if(result&&result.then){result.then(resolve,reject)}else{reject()}}))}else{var pluginResult_1,rej_1;var p=getPromise((function(resolve,reject){if(opts.destruct){pluginResult_1=callInstance(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return resolve(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return reject(args)}))}else{pluginResult_1=callInstance(pluginObj,methodName,args,opts,resolve,reject)}rej_1=reject}));if(pluginResult_1&&pluginResult_1.error){p.catch((function(){}));typeof rej_1==="function"&&rej_1(pluginResult_1.error)}return p}}}function get(element,path){var paths=path.split(".");var obj=element;for(var i=0;i<paths.length;i++){if(!obj){return null}obj=obj[paths[i]]}return obj}var AwesomeCordovaNativePlugin=function(){function AwesomeCordovaNativePlugin(){}AwesomeCordovaNativePlugin.installed=function(){var isAvailable=checkAvailability(this.pluginRef)===true;return isAvailable};AwesomeCordovaNativePlugin.getPlugin=function(){if(typeof window!=="undefined"){return get(window,this.pluginRef)}return null};AwesomeCordovaNativePlugin.getPluginName=function(){var pluginName=this.pluginName;return pluginName};AwesomeCordovaNativePlugin.getPluginRef=function(){var pluginRef=this.pluginRef;return pluginRef};AwesomeCordovaNativePlugin.getPluginInstallName=function(){var plugin=this.plugin;return plugin};AwesomeCordovaNativePlugin.getSupportedPlatforms=function(){var platform=this.platforms;return platform};AwesomeCordovaNativePlugin.pluginName="";AwesomeCordovaNativePlugin.pluginRef="";AwesomeCordovaNativePlugin.plugin="";AwesomeCordovaNativePlugin.repo="";AwesomeCordovaNativePlugin.platforms=[];AwesomeCordovaNativePlugin.install="";return AwesomeCordovaNativePlugin}();function cordova(pluginObj,methodName,config,args){return wrap(pluginObj,methodName,config).apply(this,args)}function overrideFunction(pluginObj,methodName){return new rxjs.Observable((function(observer){var availabilityCheck=checkAvailability(pluginObj,methodName);if(availabilityCheck===true){var pluginInstance_1=getPlugin(pluginObj.constructor.getPluginRef());pluginInstance_1[methodName]=observer.next.bind(observer);return function(){return pluginInstance_1[methodName]=function(){}}}else{observer.error(availabilityCheck);observer.complete()}}))}function cordovaFunctionOverride(pluginObj,methodName,args){return overrideFunction(pluginObj,methodName)}function cordovaInstance(pluginObj,methodName,config,args){args=Array.from(args);return wrapInstance(pluginObj,methodName,config).apply(this,args)}function cordovaPropertyGet(pluginObj,key){if(checkAvailability(pluginObj,key)===true){return getPlugin(pluginObj.constructor.getPluginRef())[key]}return null}function cordovaPropertySet(pluginObj,key,value){if(checkAvailability(pluginObj,key)===true){getPlugin(pluginObj.constructor.getPluginRef())[key]=value}}function instancePropertyGet(pluginObj,key){if(pluginObj._objectInstance&&pluginObj._objectInstance[key]){return pluginObj._objectInstance[key]}return null}function instancePropertySet(pluginObj,key,value){if(pluginObj._objectInstance){pluginObj._objectInstance[key]=value}}checkReady();window.rxjs._throw=window.rxjs.throwError;exports.AwesomeCordovaNativePlugin=AwesomeCordovaNativePlugin;exports.checkAvailability=checkAvailability;exports.cordova=cordova;exports.cordovaFunctionOverride=cordovaFunctionOverride;exports.cordovaInstance=cordovaInstance;exports.cordovaPropertyGet=cordovaPropertyGet;exports.cordovaPropertySet=cordovaPropertySet;exports.getPromise=getPromise;exports.instanceAvailability=instanceAvailability;exports.instancePropertyGet=instancePropertyGet;exports.instancePropertySet=instancePropertySet;exports.wrap=wrap}));(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory(require("tslib"),require("@angular/core"),require("@awesome-cordova-plugins/core"),require("rxjs"),require("rxjs/operators")):typeof define==="function"&&define.amd?define(["tslib","@angular/core","@awesome-cordova-plugins/core","rxjs","rxjs/operators"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.awesomeCordova=global.awesomeCordova||{},global.awesomeCordova.plugins=factory(global.tslib,global.ng.core,global.awesomeCordova.core,global.rxjs,global.rxjs.operators))})(this,(function(tslib,core$1,core,rxjs,operators){"use strict";var AppVersion=function(_super){tslib.__extends(AppVersion,_super);function AppVersion(){return _super!==null&&_super.apply(this,arguments)||this}AppVersion.prototype.getAppName=function(){return core.cordova(this,"getAppName",{},arguments)};AppVersion.prototype.getPackageName=function(){return core.cordova(this,"getPackageName",{},arguments)};AppVersion.prototype.getVersionCode=function(){return core.cordova(this,"getVersionCode",{},arguments)};AppVersion.prototype.getVersionNumber=function(){return core.cordova(this,"getVersionNumber",{},arguments)};AppVersion.pluginName="AppVersion";AppVersion.plugin="cordova-plugin-app-version";AppVersion.pluginRef="cordova.getAppVersion";AppVersion.repo="https://github.com/whiteoctober/cordova-plugin-app-version";AppVersion.platforms=["Android","iOS","Windows"];AppVersion.decorators=[{type:core$1.Injectable}];return AppVersion}(core.AwesomeCordovaNativePlugin);var AppVersion$1=Object.freeze({__proto__:null,AppVersion:AppVersion});var BarcodeScanner=function(_super){tslib.__extends(BarcodeScanner,_super);function BarcodeScanner(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.Encode={TEXT_TYPE:"TEXT_TYPE",EMAIL_TYPE:"EMAIL_TYPE",PHONE_TYPE:"PHONE_TYPE",SMS_TYPE:"SMS_TYPE"};return _this}BarcodeScanner.prototype.scan=function(options){return core.cordova(this,"scan",{callbackOrder:"reverse"},arguments)};BarcodeScanner.prototype.encode=function(type,data){return core.cordova(this,"encode",{},arguments)};BarcodeScanner.pluginName="BarcodeScanner";BarcodeScanner.plugin="phonegap-plugin-barcodescanner";BarcodeScanner.pluginRef="cordova.plugins.barcodeScanner";BarcodeScanner.repo="https://github.com/phonegap/phonegap-plugin-barcodescanner";BarcodeScanner.platforms=["Android","BlackBerry 10","Browser","iOS","Windows"];BarcodeScanner.decorators=[{type:core$1.Injectable}];return BarcodeScanner}(core.AwesomeCordovaNativePlugin);var BarcodeScanner$1=Object.freeze({__proto__:null,BarcodeScanner:BarcodeScanner});var Calendar=function(_super){tslib.__extends(Calendar,_super);function Calendar(){return _super!==null&&_super.apply(this,arguments)||this}Calendar.prototype.hasReadWritePermission=function(){return core.cordova(this,"hasReadWritePermission",{},arguments)};Calendar.prototype.hasReadPermission=function(){return core.cordova(this,"hasReadPermission",{},arguments)};Calendar.prototype.hasWritePermission=function(){return core.cordova(this,"hasWritePermission",{},arguments)};Calendar.prototype.requestWritePermission=function(){return core.cordova(this,"requestWritePermission",{},arguments)};Calendar.prototype.requestReadPermission=function(){return core.cordova(this,"requestReadPermission",{},arguments)};Calendar.prototype.requestReadWritePermission=function(){return core.cordova(this,"requestReadWritePermission",{},arguments)};Calendar.prototype.createCalendar=function(nameOrOptions){return core.cordova(this,"createCalendar",{},arguments)};Calendar.prototype.deleteCalendar=function(name){return core.cordova(this,"deleteCalendar",{},arguments)};Calendar.prototype.getCalendarOptions=function(){return core.cordova(this,"getCalendarOptions",{sync:true},arguments)};Calendar.prototype.getCreateCalendarOptions=function(){return core.cordova(this,"getCreateCalendarOptions",{sync:true},arguments)};Calendar.prototype.createEvent=function(title,location,notes,startDate,endDate){return core.cordova(this,"createEvent",{},arguments)};Calendar.prototype.createEventWithOptions=function(title,location,notes,startDate,endDate,options){return core.cordova(this,"createEventWithOptions",{},arguments)};Calendar.prototype.createEventInteractively=function(title,location,notes,startDate,endDate){return core.cordova(this,"createEventInteractively",{},arguments)};Calendar.prototype.createEventInteractivelyWithOptions=function(title,location,notes,startDate,endDate,options){return core.cordova(this,"createEventInteractivelyWithOptions",{},arguments)};Calendar.prototype.findEvent=function(title,location,notes,startDate,endDate){return core.cordova(this,"findEvent",{},arguments)};Calendar.prototype.findEventWithOptions=function(title,location,notes,startDate,endDate,options){return core.cordova(this,"findEventWithOptions",{},arguments)};Calendar.prototype.listEventsInRange=function(startDate,endDate){return core.cordova(this,"listEventsInRange",{platforms:["Android"]},arguments)};Calendar.prototype.listCalendars=function(){return core.cordova(this,"listCalendars",{},arguments)};Calendar.prototype.findAllEventsInNamedCalendar=function(calendarName){return core.cordova(this,"findAllEventsInNamedCalendar",{platforms:["iOS"]},arguments)};Calendar.prototype.modifyEvent=function(title,location,notes,startDate,endDate,newTitle,newLocation,newNotes,newStartDate,newEndDate){return core.cordova(this,"modifyEvent",{platforms:["iOS"]},arguments)};Calendar.prototype.modifyEventWithOptions=function(title,location,notes,startDate,endDate,newTitle,newLocation,newNotes,newStartDate,newEndDate,filterOptions,newOptions){return core.cordova(this,"modifyEventWithOptions",{platforms:["iOS"]},arguments)};Calendar.prototype.deleteEvent=function(title,location,notes,startDate,endDate){return core.cordova(this,"deleteEvent",{},arguments)};Calendar.prototype.deleteEventFromNamedCalendar=function(title,location,notes,startDate,endDate,calendarName){return core.cordova(this,"deleteEventFromNamedCalendar",{platforms:["iOS"]},arguments)};Calendar.prototype.deleteEventById=function(id,fromDate){return core.cordova(this,"deleteEventById",{},arguments)};Calendar.prototype.openCalendar=function(date){return core.cordova(this,"openCalendar",{},arguments)};Calendar.pluginName="Calendar";Calendar.plugin="cordova-plugin-calendar";Calendar.pluginRef="plugins.calendar";Calendar.repo="https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin";Calendar.platforms=["Android","iOS"];Calendar.decorators=[{type:core$1.Injectable}];return Calendar}(core.AwesomeCordovaNativePlugin);var Calendar$1=Object.freeze({__proto__:null,Calendar:Calendar});var DestinationType;(function(DestinationType){DestinationType[DestinationType["DATA_URL"]=0]="DATA_URL";DestinationType[DestinationType["FILE_URL"]=1]="FILE_URL";DestinationType[DestinationType["NATIVE_URI"]=2]="NATIVE_URI"})(DestinationType||(DestinationType={}));var EncodingType;(function(EncodingType){EncodingType[EncodingType["JPEG"]=0]="JPEG";EncodingType[EncodingType["PNG"]=1]="PNG"})(EncodingType||(EncodingType={}));var MediaType;(function(MediaType){MediaType[MediaType["PICTURE"]=0]="PICTURE";MediaType[MediaType["VIDEO"]=1]="VIDEO";MediaType[MediaType["ALLMEDIA"]=2]="ALLMEDIA"})(MediaType||(MediaType={}));var PictureSourceType;(function(PictureSourceType){PictureSourceType[PictureSourceType["PHOTOLIBRARY"]=0]="PHOTOLIBRARY";PictureSourceType[PictureSourceType["CAMERA"]=1]="CAMERA";PictureSourceType[PictureSourceType["SAVEDPHOTOALBUM"]=2]="SAVEDPHOTOALBUM"})(PictureSourceType||(PictureSourceType={}));var PopoverArrowDirection;(function(PopoverArrowDirection){PopoverArrowDirection[PopoverArrowDirection["ARROW_UP"]=1]="ARROW_UP";PopoverArrowDirection[PopoverArrowDirection["ARROW_DOWN"]=2]="ARROW_DOWN";PopoverArrowDirection[PopoverArrowDirection["ARROW_LEFT"]=3]="ARROW_LEFT";PopoverArrowDirection[PopoverArrowDirection["ARROW_RIGHT"]=4]="ARROW_RIGHT";PopoverArrowDirection[PopoverArrowDirection["ARROW_ANY"]=5]="ARROW_ANY"})(PopoverArrowDirection||(PopoverArrowDirection={}));var Direction;(function(Direction){Direction[Direction["BACK"]=0]="BACK";Direction[Direction["FRONT"]=1]="FRONT"})(Direction||(Direction={}));var Camera=function(_super){tslib.__extends(Camera,_super);function Camera(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.DestinationType={DATA_URL:0,FILE_URI:1,NATIVE_URI:2};_this.EncodingType={JPEG:0,PNG:1};_this.MediaType={PICTURE:0,VIDEO:1,ALLMEDIA:2};_this.PictureSourceType={PHOTOLIBRARY:0,CAMERA:1,SAVEDPHOTOALBUM:2};_this.PopoverArrowDirection={ARROW_UP:1,ARROW_DOWN:2,ARROW_LEFT:4,ARROW_RIGHT:8,ARROW_ANY:15};_this.Direction={BACK:0,FRONT:1};return _this}Camera.prototype.getPicture=function(options){return core.cordova(this,"getPicture",{callbackOrder:"reverse"},arguments)};Camera.prototype.cleanup=function(){return core.cordova(this,"cleanup",{platforms:["iOS"]},arguments)};Camera.pluginName="Camera";Camera.plugin="cordova-plugin-camera";Camera.pluginRef="navigator.camera";Camera.repo="https://github.com/apache/cordova-plugin-camera";Camera.platforms=["Android","Browser","iOS","Windows"];Camera.decorators=[{type:core$1.Injectable}];return Camera}(core.AwesomeCordovaNativePlugin);var Camera$1=Object.freeze({__proto__:null,Camera:Camera,get DestinationType(){return DestinationType},get Direction(){return Direction},get EncodingType(){return EncodingType},get MediaType(){return MediaType},get PictureSourceType(){return PictureSourceType},get PopoverArrowDirection(){return PopoverArrowDirection}});var Device=function(_super){tslib.__extends(Device,_super);function Device(){return _super!==null&&_super.apply(this,arguments)||this}Object.defineProperty(Device.prototype,"cordova",{get:function(){return core.cordovaPropertyGet(this,"cordova")},set:function(value){core.cordovaPropertySet(this,"cordova",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"model",{get:function(){return core.cordovaPropertyGet(this,"model")},set:function(value){core.cordovaPropertySet(this,"model",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"platform",{get:function(){return core.cordovaPropertyGet(this,"platform")},set:function(value){core.cordovaPropertySet(this,"platform",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"uuid",{get:function(){return core.cordovaPropertyGet(this,"uuid")},set:function(value){core.cordovaPropertySet(this,"uuid",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"version",{get:function(){return core.cordovaPropertyGet(this,"version")},set:function(value){core.cordovaPropertySet(this,"version",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"manufacturer",{get:function(){return core.cordovaPropertyGet(this,"manufacturer")},set:function(value){core.cordovaPropertySet(this,"manufacturer",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"isVirtual",{get:function(){return core.cordovaPropertyGet(this,"isVirtual")},set:function(value){core.cordovaPropertySet(this,"isVirtual",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"serial",{get:function(){return core.cordovaPropertyGet(this,"serial")},set:function(value){core.cordovaPropertySet(this,"serial",value)},enumerable:false,configurable:true});Device.pluginName="Device";Device.plugin="cordova-plugin-device";Device.pluginRef="device";Device.repo="https://github.com/apache/cordova-plugin-device";Device.platforms=["Android","Browser","iOS","macOS","Windows"];Device.decorators=[{type:core$1.Injectable}];return Device}(core.AwesomeCordovaNativePlugin);var Device$1=Object.freeze({__proto__:null,Device:Device});var File=function(_super){tslib.__extends(File,_super);function File(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.cordovaFileError={1:"NOT_FOUND_ERR",2:"SECURITY_ERR",3:"ABORT_ERR",4:"NOT_READABLE_ERR",5:"ENCODING_ERR",6:"NO_MODIFICATION_ALLOWED_ERR",7:"INVALID_STATE_ERR",8:"SYNTAX_ERR",9:"INVALID_MODIFICATION_ERR",10:"QUOTA_EXCEEDED_ERR",11:"TYPE_MISMATCH_ERR",12:"PATH_EXISTS_ERR",13:"WRONG_ENTRY_TYPE",14:"DIR_READ_ERR"};return _this}File.prototype.getFreeDiskSpace=function(){var _this=this;return function(){if(core.checkAvailability(_this)===true){return core.getPromise((function(resolve,reject){cordova.exec(resolve,reject,"File","getFreeDiskSpace",[])}))}}()};File.prototype.checkDir=function(path,dir){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dir)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}var fullPath=path+dir;return _this.resolveDirectoryUrl(fullPath).then((function(){return true}))}}()};File.prototype.createDir=function(path,dirName,replace){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}var options={create:true};if(!replace){options.exclusive=true}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,options)}))}}()};File.prototype.removeDir=function(path,dirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(de){return _this.remove(de)}))}}()};File.prototype.moveDir=function(path,dirName,newPath,newDirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){newDirName=newDirName||dirName;if(/^\//.test(newDirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(srcde){return _this.resolveDirectoryUrl(newPath).then((function(destenation){return _this.move(srcde,destenation,newDirName)}))}))}}()};File.prototype.copyDir=function(path,dirName,newPath,newDirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(newDirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(srcde){return _this.resolveDirectoryUrl(newPath).then((function(deste){return _this.copy(srcde,deste,newDirName)}))}))}}()};File.prototype.listDir=function(path,dirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false,exclusive:false})})).then((function(de){var reader=de.createReader();return _this.readEntries(reader)}))}}()};File.prototype.removeRecursively=function(path,dirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(de){return _this.rimraf(de)}))}}()};File.prototype.checkFile=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(file)){var err=new FileError(5);err.message="file cannot start with /";return Promise.reject(err)}return _this.resolveLocalFilesystemUrl(path+file).then((function(fse){if(fse.isFile){return true}else{var err=new FileError(13);err.message="input is not a file";return Promise.reject(err)}}))}}()};File.prototype.createFile=function(path,fileName,replace){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(fileName)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}var options={create:true};if(!replace){options.exclusive=true}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,options)}))}}()};File.prototype.removeFile=function(path,fileName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(fileName)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,{create:false})})).then((function(fe){return _this.remove(fe)}))}}()};File.prototype.writeFile=function(path,fileName,text,options){var _this=this;if(options===void 0){options={}}return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(fileName)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}var getFileOpts={create:!options.append,exclusive:!options.replace};return _this.resolveDirectoryUrl(path).then((function(directoryEntry){return _this.getFile(directoryEntry,fileName,getFileOpts)})).then((function(fileEntry){return _this.writeFileEntry(fileEntry,text,options)}))}}()};File.prototype.writeFileEntry=function(fe,text,options){var _this=this;return this.createWriter(fe).then((function(writer){if(options.append){writer.seek(writer.length)}if(options.truncate){writer.truncate(options.truncate)}return _this.write(writer,text)})).then((function(){return fe}))};File.prototype.writeExistingFile=function(path,fileName,text){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.writeFile(path,fileName,text,{replace:true})}}()};File.prototype.readAsText=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"Text")}}()};File.prototype.readAsDataURL=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"DataURL")}}()};File.prototype.readAsBinaryString=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"BinaryString")}}()};File.prototype.readAsArrayBuffer=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"ArrayBuffer")}}()};File.prototype.moveFile=function(path,fileName,newPath,newFileName){var _this=this;return function(){if(core.checkAvailability(_this)===true){newFileName=newFileName||fileName;if(/^\//.test(newFileName)){var err=new FileError(5);err.message="file name cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,{create:false})})).then((function(srcfe){return _this.resolveDirectoryUrl(newPath).then((function(deste){return _this.move(srcfe,deste,newFileName)}))}))}}()};File.prototype.copyFile=function(path,fileName,newPath,newFileName){var _this=this;return function(){if(core.checkAvailability(_this)===true){newFileName=newFileName||fileName;if(/^\//.test(newFileName)){var err=new FileError(5);err.message="file name cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,{create:false})})).then((function(srcfe){return _this.resolveDirectoryUrl(newPath).then((function(deste){return _this.copy(srcfe,deste,newFileName)}))}))}}()};File.prototype.fillErrorMessage=function(err){try{err.message=this.cordovaFileError[err.code]}catch(e){}};File.prototype.resolveLocalFilesystemUrl=function(fileUrl){var _this=this;return function(){if(core.checkAvailability(_this)===true){return core.getPromise((function(resolve,reject){try{window.resolveLocalFileSystemURL(fileUrl,(function(entry){resolve(entry)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}catch(xc){_this.fillErrorMessage(xc);reject(xc)}}))}}()};File.prototype.resolveDirectoryUrl=function(directoryUrl){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.resolveLocalFilesystemUrl(directoryUrl).then((function(de){if(de.isDirectory){return de}else{var err=new FileError(13);err.message="input is not a directory";return Promise.reject(err)}}))}}()};File.prototype.getDirectory=function(directoryEntry,directoryName,flags){var _this=this;return function(){if(core.checkAvailability(_this)===true){return new Promise((function(resolve,reject){try{directoryEntry.getDirectory(directoryName,flags,(function(de){resolve(de)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}catch(xc){_this.fillErrorMessage(xc);reject(xc)}}))}}()};File.prototype.getFile=function(directoryEntry,fileName,flags){var _this=this;return function(){if(core.checkAvailability(_this)===true){return new Promise((function(resolve,reject){try{directoryEntry.getFile(fileName,flags,resolve,(function(err){_this.fillErrorMessage(err);reject(err)}))}catch(xc){_this.fillErrorMessage(xc);reject(xc)}}))}}()};File.prototype.readFile=function(path,file,readAs){var _this=this;if(/^\//.test(file)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}return this.resolveDirectoryUrl(path).then((function(directoryEntry){return _this.getFile(directoryEntry,file,{create:false})})).then((function(fileEntry){var reader=new FileReader;return core.getPromise((function(resolve,reject){reader.onloadend=function(){if(reader.result!==undefined||reader.result!==null){resolve(reader.result)}else if(reader.error!==undefined||reader.error!==null){reject(reader.error)}else{reject({code:null,message:"READER_ONLOADEND_ERR"})}};fileEntry.file((function(file){reader["readAs"+readAs].call(reader,file)}),(function(error){reject(error)}))}))}))};File.prototype.remove=function(fe){var _this=this;return new Promise((function(resolve,reject){fe.remove((function(){resolve({success:true,fileRemoved:fe})}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.move=function(srce,destdir,newName){var _this=this;return new Promise((function(resolve,reject){srce.moveTo(destdir,newName,(function(deste){resolve(deste)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.copy=function(srce,destdir,newName){var _this=this;return new Promise((function(resolve,reject){srce.copyTo(destdir,newName,(function(deste){resolve(deste)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.readEntries=function(dr){var _this=this;return new Promise((function(resolve,reject){dr.readEntries((function(entries){resolve(entries)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.rimraf=function(de){var _this=this;return new Promise((function(resolve,reject){de.removeRecursively((function(){resolve({success:true,fileRemoved:de})}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.createWriter=function(fe){var _this=this;return new Promise((function(resolve,reject){fe.createWriter((function(writer){resolve(writer)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.write=function(writer,gu){if(gu instanceof Blob){return this.writeFileInChunks(writer,gu)}return new Promise((function(resolve,reject){writer.onwriteend=function(evt){if(writer.error){reject(writer.error)}else{resolve(evt)}};writer.write(gu)}))};File.prototype.writeFileInChunks=function(writer,file){var BLOCK_SIZE=1024*1024;var writtenSize=0;function writeNextChunk(){var size=Math.min(BLOCK_SIZE,file.size-writtenSize);var chunk=file.slice(writtenSize,writtenSize+size);writtenSize+=size;writer.write(chunk)}return core.getPromise((function(resolve,reject){writer.onerror=reject;writer.onwrite=function(){if(writtenSize<file.size){writeNextChunk()}else{resolve()}};writeNextChunk()}))};Object.defineProperty(File.prototype,"applicationDirectory",{get:function(){return core.cordovaPropertyGet(this,"applicationDirectory")},set:function(value){core.cordovaPropertySet(this,"applicationDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"applicationStorageDirectory",{get:function(){return core.cordovaPropertyGet(this,"applicationStorageDirectory")},set:function(value){core.cordovaPropertySet(this,"applicationStorageDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"dataDirectory",{get:function(){return core.cordovaPropertyGet(this,"dataDirectory")},set:function(value){core.cordovaPropertySet(this,"dataDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"cacheDirectory",{get:function(){return core.cordovaPropertyGet(this,"cacheDirectory")},set:function(value){core.cordovaPropertySet(this,"cacheDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalApplicationStorageDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalApplicationStorageDirectory")},set:function(value){core.cordovaPropertySet(this,"externalApplicationStorageDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalDataDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalDataDirectory")},set:function(value){core.cordovaPropertySet(this,"externalDataDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalCacheDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalCacheDirectory")},set:function(value){core.cordovaPropertySet(this,"externalCacheDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalRootDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalRootDirectory")},set:function(value){core.cordovaPropertySet(this,"externalRootDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"tempDirectory",{get:function(){return core.cordovaPropertyGet(this,"tempDirectory")},set:function(value){core.cordovaPropertySet(this,"tempDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"syncedDataDirectory",{get:function(){return core.cordovaPropertyGet(this,"syncedDataDirectory")},set:function(value){core.cordovaPropertySet(this,"syncedDataDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"documentsDirectory",{get:function(){return core.cordovaPropertyGet(this,"documentsDirectory")},set:function(value){core.cordovaPropertySet(this,"documentsDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"sharedDirectory",{get:function(){return core.cordovaPropertyGet(this,"sharedDirectory")},set:function(value){core.cordovaPropertySet(this,"sharedDirectory",value)},enumerable:false,configurable:true});File.pluginName="File";File.plugin="cordova-plugin-file";File.pluginRef="cordova.file";File.repo="https://github.com/apache/cordova-plugin-file";File.platforms=["Android","Browser","iOS","macOS","Windows"];File.decorators=[{type:core$1.Injectable}];return File}(core.AwesomeCordovaNativePlugin);var File$1=Object.freeze({__proto__:null,File:File});var FileOpener=function(_super){tslib.__extends(FileOpener,_super);function FileOpener(){return _super!==null&&_super.apply(this,arguments)||this}FileOpener.prototype.open=function(filePath,fileMIMEType){return core.cordova(this,"open",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.prototype.uninstall=function(packageId){return core.cordova(this,"uninstall",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.prototype.appIsInstalled=function(packageId){return core.cordova(this,"appIsInstalled",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.prototype.showOpenWithDialog=function(filePath,fileMIMEType){return core.cordova(this,"showOpenWithDialog",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.pluginName="FileOpener";FileOpener.plugin="cordova-plugin-file-opener2";FileOpener.pluginRef="cordova.plugins.fileOpener2";FileOpener.repo="https://github.com/pwlin/cordova-plugin-file-opener2";FileOpener.platforms=["Android","iOS","Windows","Windows Phone 8"];FileOpener.decorators=[{type:core$1.Injectable}];return FileOpener}(core.AwesomeCordovaNativePlugin);var FileOpener$1=Object.freeze({__proto__:null,FileOpener:FileOpener});var Geolocation=function(_super){tslib.__extends(Geolocation,_super);function Geolocation(){return _super!==null&&_super.apply(this,arguments)||this}Geolocation.prototype.getCurrentPosition=function(options){return core.cordova(this,"getCurrentPosition",{callbackOrder:"reverse"},arguments)};Geolocation.prototype.watchPosition=function(options){return new rxjs.Observable((function(observer){var watchId=navigator.geolocation.watchPosition(observer.next.bind(observer),observer.next.bind(observer),options);return function(){return navigator.geolocation.clearWatch(watchId)}}))};Geolocation.pluginName="Geolocation";Geolocation.plugin="cordova-plugin-geolocation";Geolocation.pluginRef="navigator.geolocation";Geolocation.repo="https://github.com/apache/cordova-plugin-geolocation";Geolocation.install='ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="To locate you"';Geolocation.installVariables=["GEOLOCATION_USAGE_DESCRIPTION"];Geolocation.platforms=["Amazon Fire OS","Android","Browser","iOS","Windows"];Geolocation.decorators=[{type:core$1.Injectable}];return Geolocation}(core.AwesomeCordovaNativePlugin);var GeoLocation=Object.freeze({__proto__:null,Geolocation:Geolocation});var MediaCapture=function(_super){tslib.__extends(MediaCapture,_super);function MediaCapture(){return _super!==null&&_super.apply(this,arguments)||this}MediaCapture.prototype.captureAudio=function(options){return core.cordova(this,"captureAudio",{callbackOrder:"reverse"},arguments)};MediaCapture.prototype.captureImage=function(options){return core.cordova(this,"captureImage",{callbackOrder:"reverse"},arguments)};MediaCapture.prototype.captureVideo=function(options){return core.cordova(this,"captureVideo",{callbackOrder:"reverse"},arguments)};MediaCapture.prototype.onPendingCaptureResult=function(){return core.cordova(this,"onPendingCaptureResult",{eventObservable:true,event:"pendingcaptureresult"},arguments)};MediaCapture.prototype.onPendingCaptureError=function(){return core.cordova(this,"onPendingCaptureError",{eventObservable:true,event:"pendingcaptureerror"},arguments)};Object.defineProperty(MediaCapture.prototype,"supportedImageModes",{get:function(){return core.cordovaPropertyGet(this,"supportedImageModes")},set:function(value){core.cordovaPropertySet(this,"supportedImageModes",value)},enumerable:false,configurable:true});Object.defineProperty(MediaCapture.prototype,"supportedAudioModes",{get:function(){return core.cordovaPropertyGet(this,"supportedAudioModes")},set:function(value){core.cordovaPropertySet(this,"supportedAudioModes",value)},enumerable:false,configurable:true});Object.defineProperty(MediaCapture.prototype,"supportedVideoModes",{get:function(){return core.cordovaPropertyGet(this,"supportedVideoModes")},set:function(value){core.cordovaPropertySet(this,"supportedVideoModes",value)},enumerable:false,configurable:true});MediaCapture.pluginName="MediaCapture";MediaCapture.plugin="cordova-plugin-media-capture";MediaCapture.pluginRef="navigator.device.capture";MediaCapture.repo="https://github.com/apache/cordova-plugin-media-capture";MediaCapture.platforms=["Android","Browser","iOS","Windows"];MediaCapture.decorators=[{type:core$1.Injectable}];return MediaCapture}(core.AwesomeCordovaNativePlugin);var MediaCapture$1=Object.freeze({__proto__:null,MediaCapture:MediaCapture});var Connection;(function(Connection){Connection["UNKNOWN"]="unknown";Connection["ETHERNET"]="ethernet";Connection["WIFI"]="wifi";Connection["CELL_2G"]="2g";Connection["CELL_3G"]="3g";Connection["CELL_4G"]="4g";Connection["CELL"]="cellular";Connection["NONE"]="none"})(Connection||(Connection={}));var Network=function(_super){tslib.__extends(Network,_super);function Network(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.Connection={UNKNOWN:"unknown",ETHERNET:"ethernet",WIFI:"wifi",CELL_2G:"2g",CELL_3G:"3g",CELL_4G:"4g",CELL:"cellular",NONE:"none"};return _this}Network.prototype.onChange=function(){var _this=this;return function(){if(core.checkAvailability(_this)===true){return rxjs.merge(_this.onConnect().pipe(operators.mapTo("connected")),_this.onDisconnect().pipe(operators.mapTo("disconnected")))}}()};Network.prototype.onDisconnect=function(){return core.cordova(this,"onDisconnect",{eventObservable:true,event:"offline",element:"document"},arguments)};Network.prototype.onConnect=function(){return core.cordova(this,"onConnect",{eventObservable:true,event:"online",element:"document"},arguments)};Object.defineProperty(Network.prototype,"type",{get:function(){return core.cordovaPropertyGet(this,"type")},set:function(value){core.cordovaPropertySet(this,"type",value)},enumerable:false,configurable:true});Object.defineProperty(Network.prototype,"downlinkMax",{get:function(){return core.cordovaPropertyGet(this,"downlinkMax")},set:function(value){core.cordovaPropertySet(this,"downlinkMax",value)},enumerable:false,configurable:true});Network.pluginName="Network";Network.plugin="cordova-plugin-network-information";Network.pluginRef="navigator.connection";Network.repo="https://github.com/apache/cordova-plugin-network-information";Network.platforms=["Amazon Fire OS","Android","Browser","iOS","Windows"];Network.decorators=[{type:core$1.Injectable}];return Network}(core.AwesomeCordovaNativePlugin);var Network$1=Object.freeze({__proto__:null,get Connection(){return Connection},Network:Network});var SQLiteObject=function(){function SQLiteObject(_objectInstance){this._objectInstance=_objectInstance}SQLiteObject.prototype.addTransaction=function(transaction){return core.cordovaInstance(this,"addTransaction",{sync:true},arguments)};SQLiteObject.prototype.transaction=function(fn){return core.cordovaInstance(this,"transaction",{successIndex:2,errorIndex:1},arguments)};SQLiteObject.prototype.readTransaction=function(fn){return core.cordovaInstance(this,"readTransaction",{},arguments)};SQLiteObject.prototype.startNextTransaction=function(){return core.cordovaInstance(this,"startNextTransaction",{sync:true},arguments)};SQLiteObject.prototype.open=function(){return core.cordovaInstance(this,"open",{},arguments)};SQLiteObject.prototype.close=function(){return core.cordovaInstance(this,"close",{},arguments)};SQLiteObject.prototype.executeSql=function(statement,params){return core.cordovaInstance(this,"executeSql",{},arguments)};SQLiteObject.prototype.sqlBatch=function(sqlStatements){return core.cordovaInstance(this,"sqlBatch",{},arguments)};SQLiteObject.prototype.abortallPendingTransactions=function(){return core.cordovaInstance(this,"abortallPendingTransactions",{sync:true},arguments)};Object.defineProperty(SQLiteObject.prototype,"databaseFeatures",{get:function(){return core.instancePropertyGet(this,"databaseFeatures")},set:function(value){core.instancePropertySet(this,"databaseFeatures",value)},enumerable:false,configurable:true});Object.defineProperty(SQLiteObject.prototype,"openDBs",{get:function(){return core.instancePropertyGet(this,"openDBs")},set:function(value){core.instancePropertySet(this,"openDBs",value)},enumerable:false,configurable:true});return SQLiteObject}();var SQLite=function(_super){tslib.__extends(SQLite,_super);function SQLite(){return _super!==null&&_super.apply(this,arguments)||this}SQLite.prototype.create=function(config){var _this=this;return function(){if(core.checkAvailability(_this)===true){return new Promise((function(resolve,reject){sqlitePlugin.openDatabase(config,(function(db){return resolve(new SQLiteObject(db))}),reject)}))}}()};SQLite.prototype.echoTest=function(){return core.cordova(this,"echoTest",{},arguments)};SQLite.prototype.selfTest=function(){return core.cordova(this,"selfTest",{},arguments)};SQLite.prototype.deleteDatabase=function(config){return core.cordova(this,"deleteDatabase",{},arguments)};SQLite.pluginName="SQLite";SQLite.pluginRef="sqlitePlugin";SQLite.plugin="cordova-sqlite-storage";SQLite.repo="https://github.com/litehelpers/Cordova-sqlite-storage";SQLite.platforms=["Android","iOS","macOS","Windows"];SQLite.decorators=[{type:core$1.Injectable}];return SQLite}(core.AwesomeCordovaNativePlugin);var Sqlite=Object.freeze({__proto__:null,SQLite:SQLite,SQLiteObject:SQLiteObject});var Vibration=function(_super){tslib.__extends(Vibration,_super);function Vibration(){return _super!==null&&_super.apply(this,arguments)||this}Vibration.prototype.vibrate=function(time){return core.cordova(this,"vibrate",{sync:true},arguments)};Vibration.pluginName="Vibration";Vibration.plugin="cordova-plugin-vibration";Vibration.pluginRef="navigator";Vibration.repo="https://github.com/apache/cordova-plugin-vibration";Vibration.platforms=["Android","iOS","Windows"];Vibration.decorators=[{type:core$1.Injectable}];return Vibration}(core.AwesomeCordovaNativePlugin);var Vibration$1=Object.freeze({__proto__:null,Vibration:Vibration});var LocationAccuracy=function(_super){tslib.__extends(LocationAccuracy,_super);function LocationAccuracy(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.REQUEST_PRIORITY_NO_POWER=0;_this.REQUEST_PRIORITY_LOW_POWER=1;_this.REQUEST_PRIORITY_BALANCED_POWER_ACCURACY=2;_this.REQUEST_PRIORITY_HIGH_ACCURACY=3;_this.SUCCESS_SETTINGS_SATISFIED=0;_this.SUCCESS_USER_AGREED=1;_this.ERROR_ALREADY_REQUESTING=-1;_this.ERROR_INVALID_ACTION=0;_this.ERROR_INVALID_ACCURACY=1;_this.ERROR_EXCEPTION=1;_this.ERROR_CANNOT_CHANGE_ACCURACY=3;_this.ERROR_USER_DISAGREED=4;_this.ERROR_GOOGLE_API_CONNECTION_FAILED=4;return _this}LocationAccuracy.prototype.canRequest=function(){return core.cordova(this,"canRequest",{},arguments)};LocationAccuracy.prototype.isRequesting=function(){return core.cordova(this,"isRequesting",{},arguments)};LocationAccuracy.prototype.request=function(accuracy){return core.cordova(this,"request",{callbackOrder:"reverse"},arguments)};LocationAccuracy.pluginName="LocationAccuracy";LocationAccuracy.plugin="cordova-plugin-request-location-accuracy";LocationAccuracy.pluginRef="cordova.plugins.locationAccuracy";LocationAccuracy.repo="https://github.com/dpa99c/cordova-plugin-request-location-accuracy";LocationAccuracy.platforms=["Android","iOS"];LocationAccuracy.decorators=[{type:core$1.Injectable}];return LocationAccuracy}(core.AwesomeCordovaNativePlugin);var LocationAccuracy$1=Object.freeze({__proto__:null,LocationAccuracy:LocationAccuracy});var Diagnostic=function(_super){tslib.__extends(Diagnostic,_super);function Diagnostic(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.permission={READ_CALENDAR:"READ_CALENDAR",WRITE_CALENDAR:"WRITE_CALENDAR",CAMERA:"CAMERA",READ_CONTACTS:"READ_CONTACTS",WRITE_CONTACTS:"WRITE_CONTACTS",GET_ACCOUNTS:"GET_ACCOUNTS",ACCESS_FINE_LOCATION:"ACCESS_FINE_LOCATION",ACCESS_COARSE_LOCATION:"ACCESS_COARSE_LOCATION",RECORD_AUDIO:"RECORD_AUDIO",READ_PHONE_STATE:"READ_PHONE_STATE",CALL_PHONE:"CALL_PHONE",ADD_VOICEMAIL:"ADD_VOICEMAIL",USE_SIP:"USE_SIP",PROCESS_OUTGOING_CALLS:"PROCESS_OUTGOING_CALLS",READ_CALL_LOG:"READ_CALL_LOG",WRITE_CALL_LOG:"WRITE_CALL_LOG",SEND_SMS:"SEND_SMS",RECEIVE_SMS:"RECEIVE_SMS",READ_SMS:"READ_SMS",RECEIVE_WAP_PUSH:"RECEIVE_WAP_PUSH",RECEIVE_MMS:"RECEIVE_MMS",WRITE_EXTERNAL_STORAGE:"WRITE_EXTERNAL_STORAGE",READ_EXTERNAL_STORAGE:"READ_EXTERNAL_STORAGE",BODY_SENSORS:"BODY_SENSORS"};_this.locationAuthorizationMode={ALWAYS:"always",WHEN_IN_USE:"when_in_use"};_this.permissionGroups={CALENDAR:["READ_CALENDAR","WRITE_CALENDAR"],CAMERA:["CAMERA"],CONTACTS:["READ_CONTACTS","WRITE_CONTACTS","GET_ACCOUNTS"],LOCATION:["ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION"],MICROPHONE:["RECORD_AUDIO"],PHONE:["READ_PHONE_STATE","CALL_PHONE","ADD_VOICEMAIL","USE_SIP","PROCESS_OUTGOING_CALLS","READ_CALL_LOG","WRITE_CALL_LOG"],SENSORS:["BODY_SENSORS"],SMS:["SEND_SMS","RECEIVE_SMS","READ_SMS","RECEIVE_WAP_PUSH","RECEIVE_MMS"],STORAGE:["READ_EXTERNAL_STORAGE","WRITE_EXTERNAL_STORAGE"]};_this.locationMode={HIGH_ACCURACY:"high_accuracy",DEVICE_ONLY:"device_only",BATTERY_SAVING:"battery_saving",LOCATION_OFF:"location_off"};_this.bluetoothState={UNKNOWN:"unknown",RESETTING:"resetting",UNSUPPORTED:"unsupported",UNAUTHORIZED:"unauthorized",POWERED_OFF:"powered_off",POWERED_ON:"powered_on",POWERING_OFF:"powering_off",POWERING_ON:"powering_on"};return _this}Diagnostic.prototype.isLocationAvailable=function(){return core.cordova(this,"isLocationAvailable",{},arguments)};Diagnostic.prototype.isWifiAvailable=function(){return core.cordova(this,"isWifiAvailable",{},arguments)};Diagnostic.prototype.isCameraAvailable=function(externalStorage){return core.cordova(this,"isCameraAvailable",{callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isBluetoothAvailable=function(){return core.cordova(this,"isBluetoothAvailable",{},arguments)};Diagnostic.prototype.switchToLocationSettings=function(){return core.cordova(this,"switchToLocationSettings",{sync:true,platforms:["Android","Windows 10","iOS"]},arguments)};Diagnostic.prototype.switchToMobileDataSettings=function(){return core.cordova(this,"switchToMobileDataSettings",{sync:true,platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.switchToBluetoothSettings=function(){return core.cordova(this,"switchToBluetoothSettings",{sync:true,platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.switchToWifiSettings=function(){return core.cordova(this,"switchToWifiSettings",{sync:true,platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.isWifiEnabled=function(){return core.cordova(this,"isWifiEnabled",{platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.setWifiState=function(state){return core.cordova(this,"setWifiState",{callbackOrder:"reverse",platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.setBluetoothState=function(state){return core.cordova(this,"setBluetoothState",{callbackOrder:"reverse",platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.isLocationEnabled=function(){return core.cordova(this,"isLocationEnabled",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isLocationAuthorized=function(){return core.cordova(this,"isLocationAuthorized",{},arguments)};Diagnostic.prototype.getLocationAuthorizationStatus=function(){return core.cordova(this,"getLocationAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestLocationAuthorization=function(mode){return core.cordova(this,"requestLocationAuthorization",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isCameraPresent=function(){return core.cordova(this,"isCameraPresent",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isCameraAuthorized=function(externalStorage){return core.cordova(this,"isCameraAuthorized",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.getCameraAuthorizationStatus=function(externalStorage){return core.cordova(this,"getCameraAuthorizationStatus",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.requestCameraAuthorization=function(externalStorage){return core.cordova(this,"requestCameraAuthorization",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isMicrophoneAuthorized=function(){return core.cordova(this,"isMicrophoneAuthorized",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getMicrophoneAuthorizationStatus=function(){return core.cordova(this,"getMicrophoneAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestMicrophoneAuthorization=function(){return core.cordova(this,"requestMicrophoneAuthorization",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isContactsAuthorized=function(){return core.cordova(this,"isContactsAuthorized",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getContactsAuthorizationStatus=function(){return core.cordova(this,"getContactsAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestContactsAuthorization=function(){return core.cordova(this,"requestContactsAuthorization",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isCalendarAuthorized=function(){return core.cordova(this,"isCalendarAuthorized",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getCalendarAuthorizationStatus=function(){return core.cordova(this,"getCalendarAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestCalendarAuthorization=function(){return core.cordova(this,"requestCalendarAuthorization",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.switchToSettings=function(){return core.cordova(this,"switchToSettings",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getBluetoothState=function(){return core.cordova(this,"getBluetoothState",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.registerBluetoothStateChangeHandler=function(handler){return core.cordova(this,"registerBluetoothStateChangeHandler",{platforms:["Android","iOS"],sync:true},arguments)};Diagnostic.prototype.registerLocationStateChangeHandler=function(handler){return core.cordova(this,"registerLocationStateChangeHandler",{platforms:["Android","iOS"],sync:true},arguments)};Diagnostic.prototype.isGpsLocationAvailable=function(){return core.cordova(this,"isGpsLocationAvailable",{platforms:["Android"]},arguments)};Diagnostic.prototype.isGpsLocationEnabled=function(){return core.cordova(this,"isGpsLocationEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNetworkLocationAvailable=function(){return core.cordova(this,"isNetworkLocationAvailable",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNetworkLocationEnabled=function(){return core.cordova(this,"isNetworkLocationEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.getLocationMode=function(){return core.cordova(this,"getLocationMode",{platforms:["Android"]},arguments)};Diagnostic.prototype.getPermissionAuthorizationStatus=function(permission){return core.cordova(this,"getPermissionAuthorizationStatus",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.getPermissionsAuthorizationStatus=function(permissions){return core.cordova(this,"getPermissionsAuthorizationStatus",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.requestRuntimePermission=function(permission){return core.cordova(this,"requestRuntimePermission",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.requestRuntimePermissions=function(permissions){return core.cordova(this,"requestRuntimePermissions",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isRequestingPermission=function(){return core.cordova(this,"isRequestingPermission",{sync:true},arguments)};Diagnostic.prototype.registerPermissionRequestCompleteHandler=function(handler){return core.cordova(this,"registerPermissionRequestCompleteHandler",{sync:true},arguments)};Diagnostic.prototype.isBluetoothEnabled=function(){return core.cordova(this,"isBluetoothEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.hasBluetoothSupport=function(){return core.cordova(this,"hasBluetoothSupport",{platforms:["Android"]},arguments)};Diagnostic.prototype.hasBluetoothLESupport=function(){return core.cordova(this,"hasBluetoothLESupport",{platforms:["Android"]},arguments)};Diagnostic.prototype.hasBluetoothLEPeripheralSupport=function(){return core.cordova(this,"hasBluetoothLEPeripheralSupport",{platforms:["Android"]},arguments)};Diagnostic.prototype.isExternalStorageAuthorized=function(){return core.cordova(this,"isExternalStorageAuthorized",{platforms:["Android"]},arguments)};Diagnostic.prototype.getExternalStorageAuthorizationStatus=function(){return core.cordova(this,"getExternalStorageAuthorizationStatus",{platforms:["Android"]},arguments)};Diagnostic.prototype.requestExternalStorageAuthorization=function(){return core.cordova(this,"requestExternalStorageAuthorization",{platforms:["Android"]},arguments)};Diagnostic.prototype.getExternalSdCardDetails=function(){return core.cordova(this,"getExternalSdCardDetails",{platforms:["Android"]},arguments)};Diagnostic.prototype.switchToWirelessSettings=function(){return core.cordova(this,"switchToWirelessSettings",{platforms:["Android"],sync:true},arguments)};Diagnostic.prototype.switchToNFCSettings=function(){return core.cordova(this,"switchToNFCSettings",{platforms:["Android"],sync:true},arguments)};Diagnostic.prototype.isNFCPresent=function(){return core.cordova(this,"isNFCPresent",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNFCEnabled=function(){return core.cordova(this,"isNFCEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNFCAvailable=function(){return core.cordova(this,"isNFCAvailable",{platforms:["Android"]},arguments)};Diagnostic.prototype.registerNFCStateChangeHandler=function(handler){return core.cordova(this,"registerNFCStateChangeHandler",{platforms:["Android"],sync:true},arguments)};Diagnostic.prototype.isDataRoamingEnabled=function(){return core.cordova(this,"isDataRoamingEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isADBModeEnabled=function(){return core.cordova(this,"isADBModeEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isDeviceRooted=function(){return core.cordova(this,"isDeviceRooted",{platforms:["Android"]},arguments)};Diagnostic.prototype.isCameraRollAuthorized=function(){return core.cordova(this,"isCameraRollAuthorized",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getCameraRollAuthorizationStatus=function(){return core.cordova(this,"getCameraRollAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestCameraRollAuthorization=function(){return core.cordova(this,"requestCameraRollAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isRemoteNotificationsEnabled=function(){return core.cordova(this,"isRemoteNotificationsEnabled",{platforms:["iOS","Android"]},arguments)};Diagnostic.prototype.isRegisteredForRemoteNotifications=function(){return core.cordova(this,"isRegisteredForRemoteNotifications",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getRemoteNotificationsAuthorizationStatus=function(){return core.cordova(this,"getRemoteNotificationsAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestRemoteNotificationsAuthorization=function(types,omitRegistration){return core.cordova(this,"requestRemoteNotificationsAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getRemoteNotificationTypes=function(){return core.cordova(this,"getRemoteNotificationTypes",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isRemindersAuthorized=function(){return core.cordova(this,"isRemindersAuthorized",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getRemindersAuthorizationStatus=function(){return core.cordova(this,"getRemindersAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestRemindersAuthorization=function(){return core.cordova(this,"requestRemindersAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isBackgroundRefreshAuthorized=function(){return core.cordova(this,"isBackgroundRefreshAuthorized",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getBackgroundRefreshStatus=function(){return core.cordova(this,"getBackgroundRefreshStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestBluetoothAuthorization=function(){return core.cordova(this,"requestBluetoothAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isMotionAvailable=function(){return core.cordova(this,"isMotionAvailable",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isMotionRequestOutcomeAvailable=function(){return core.cordova(this,"isMotionRequestOutcomeAvailable",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestMotionAuthorization=function(){return core.cordova(this,"requestMotionAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getMotionAuthorizationStatus=function(){return core.cordova(this,"getMotionAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getLocationAccuracyAuthorization=function(){return core.cordova(this,"getLocationAccuracyAuthorization",{platform:["iOS"]},arguments)};Diagnostic.prototype.requestTemporaryFullAccuracyAuthorization=function(purpose){return core.cordova(this,"requestTemporaryFullAccuracyAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.registerLocationAccuracyAuthorizationChangeHandler=function(handler){return core.cordova(this,"registerLocationAccuracyAuthorizationChangeHandler",{platforms:["iOS"],sync:true},arguments)};Object.defineProperty(Diagnostic.prototype,"permissionStatus",{get:function(){return core.cordovaPropertyGet(this,"permissionStatus")},set:function(value){core.cordovaPropertySet(this,"permissionStatus",value)},enumerable:false,configurable:true});Object.defineProperty(Diagnostic.prototype,"NFCState",{get:function(){return core.cordovaPropertyGet(this,"NFCState")},set:function(value){core.cordovaPropertySet(this,"NFCState",value)},enumerable:false,configurable:true});Object.defineProperty(Diagnostic.prototype,"motionStatus",{get:function(){return core.cordovaPropertyGet(this,"motionStatus")},set:function(value){core.cordovaPropertySet(this,"motionStatus",value)},enumerable:false,configurable:true});Diagnostic.pluginName="Diagnostic";Diagnostic.plugin="cordova.plugins.diagnostic";Diagnostic.pluginRef="cordova.plugins.diagnostic";Diagnostic.repo="https://github.com/dpa99c/cordova-diagnostic-plugin";Diagnostic.platforms=["Android","iOS","Windows"];Diagnostic.decorators=[{type:core$1.Injectable}];return Diagnostic}(core.AwesomeCordovaNativePlugin);var Diagnostic$1=Object.freeze({__proto__:null,Diagnostic:Diagnostic});var awesomeCordovaPlugins={...AppVersion$1,...BarcodeScanner$1,...Calendar$1,...Camera$1,...Device$1,...File$1,...FileOpener$1,...GeoLocation,...MediaCapture$1,...Network$1,...Sqlite,...Vibration$1,...LocationAccuracy$1,...Diagnostic$1};return awesomeCordovaPlugins}));/*! iScroll v5.2.0 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
847
+ !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(b,c,d){var e="DEPRECATED METHOD: "+c+"\n"+d+" AT \n";return function(){var c=new Error("get-stack-trace"),d=c&&c.stack?c.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),(function(b){a.addEventListener(b,c,!1)}))}function n(a,b,c){g(q(b),(function(b){a.removeEventListener(b,c,!1)}))}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function s(a){return Array.prototype.slice.call(a,0)}function t(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];r(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort((function(a,c){return a[b]>c[b]})):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ma.length;){if(c=ma[g],e=c?c+f:b,e in a)return e;g++}return d}function v(){return ua++}function w(b){var c=b.ownerDocument||b;return c.defaultView||c.parentWindow||a}function x(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){k(a.options.enable,[a])&&c.handler(b)},this.init()}function y(a){var b,c=a.options.inputClass;return new(b=c?c:xa?M:ya?P:wa?R:L)(a,z)}function z(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&Ea&&d-e===0,g=b&(Ga|Ha)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,A(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function A(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=D(b)),e>1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:pa(a.pointers[c].clientX),clientY:pa(a.pointers[c].clientY)},c++;return{timeStamp:ra(),pointers:b,center:E(b),deltaX:a.deltaX,deltaY:a.deltaY}}function E(a){var b=a.length;if(1===b)return{x:pa(a[0].clientX),y:pa(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Ea|Fa)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter((function(a){return o(a.target,i)})),b===Ea)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Ga|Ha)&&delete d[g[e].identifier],e++;return h.length?[t(f.concat(h),"identifier",!0),h]:void 0}function R(){x.apply(this,arguments);var a=j(this.handler,this);this.touch=new P(this.manager,a),this.mouse=new L(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}function S(a,b){a&Ea?(this.primaryTouch=b.changedPointers[0].identifier,T.call(this,b)):a&(Ga|Ha)&&T.call(this,b)}function T(a){var b=a.changedPointers[0];if(b.identifier===this.primaryTouch){var c={x:b.clientX,y:b.clientY};this.lastTouches.push(c);var d=this.lastTouches,e=function(){var a=d.indexOf(c);a>-1&&d.splice(a,1)};setTimeout(e,cb)}}function U(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d<this.lastTouches.length;d++){var e=this.lastTouches[d],f=Math.abs(b-e.x),g=Math.abs(c-e.y);if(db>=f&&db>=g)return!0}return!1}function V(a,b){this.manager=a,this.set(b)}function W(a){if(p(a,jb))return jb;var b=p(a,kb),c=p(a,lb);return b&&c?jb:b||c?b?kb:lb:p(a,ib)?ib:hb}function X(){if(!fb)return!1;var b={},c=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(d){b[d]=c?a.CSS.supports("touch-action",d):!0})),b}function Y(a){this.options=la({},this.defaults,a||{}),this.id=v(),this.manager=null,this.options.enable=l(this.options.enable,!0),this.state=nb,this.simultaneous={},this.requireFail=[]}function Z(a){return a&sb?"cancel":a&qb?"end":a&pb?"move":a&ob?"start":""}function $(a){return a==Ma?"down":a==La?"up":a==Ja?"left":a==Ka?"right":""}function _(a,b){var c=b.manager;return c?c.get(a):a}function aa(){Y.apply(this,arguments)}function ba(){aa.apply(this,arguments),this.pX=null,this.pY=null}function ca(){aa.apply(this,arguments)}function da(){Y.apply(this,arguments),this._timer=null,this._input=null}function ea(){aa.apply(this,arguments)}function fa(){aa.apply(this,arguments)}function ga(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ha(a,b){return b=b||{},b.recognizers=l(b.recognizers,ha.defaults.preset),new ia(a,b)}function ia(a,b){this.options=la({},ha.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=y(this),this.touchAction=new V(this,this.options.touchAction),ja(this,!0),g(this.options.recognizers,(function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])}),this)}function ja(a,b){var c=a.element;if(c.style){var d;g(a.options.cssProps,(function(e,f){d=u(c.style,f),b?(a.oldCssProps[d]=c.style[d],c.style[d]=e):c.style[d]=a.oldCssProps[d]||""})),b||(a.oldCssProps={})}}function ka(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var la,ma=["","webkit","Moz","MS","ms","o"],na=b.createElement("div"),oa="function",pa=Math.round,qa=Math.abs,ra=Date.now;la="function"!=typeof Object.assign?function(a){if(a===d||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var e=arguments[c];if(e!==d&&null!==e)for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b}:Object.assign;var sa=h((function(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a}),"extend","Use `assign`."),ta=h((function(a,b){return sa(a,b,!0)}),"merge","Use `assign`."),ua=1,va=/mobile|tablet|ip(ad|hone|od)|android/i,wa="ontouchstart"in a,xa=u(a,"PointerEvent")!==d,ya=wa&&va.test(navigator.userAgent),za="touch",Aa="pen",Ba="mouse",Ca="kinect",Da=25,Ea=1,Fa=2,Ga=4,Ha=8,Ia=1,Ja=2,Ka=4,La=8,Ma=16,Na=Ja|Ka,Oa=La|Ma,Pa=Na|Oa,Qa=["x","y"],Ra=["clientX","clientY"];x.prototype={handler:function(){},init:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(w(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(w(this.element),this.evWin,this.domHandler)}};var Sa={mousedown:Ea,mousemove:Fa,mouseup:Ga},Ta="mousedown",Ua="mousemove mouseup";i(L,x,{handler:function(a){var b=Sa[a.type];b&Ea&&0===a.button&&(this.pressed=!0),b&Fa&&1!==a.which&&(b=Ga),this.pressed&&(b&Ga&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:Ba,srcEvent:a}))}});var Va={pointerdown:Ea,pointermove:Fa,pointerup:Ga,pointercancel:Ha,pointerout:Ha},Wa={2:za,3:Aa,4:Ba,5:Ca},Xa="pointerdown",Ya="pointermove pointerup pointercancel";a.MSPointerEvent&&!a.PointerEvent&&(Xa="MSPointerDown",Ya="MSPointerMove MSPointerUp MSPointerCancel"),i(M,x,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Va[d],f=Wa[a.pointerType]||a.pointerType,g=f==za,h=r(b,a.pointerId,"pointerId");e&Ea&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Ga|Ha)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Za={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},$a="touchstart",_a="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Za[a.type];if(b===Ea&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ga|Ha)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}}});var ab={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},bb="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=ab[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}});var cb=2500,db=25;i(R,x,{handler:function(a,b,c){var d=c.pointerType==za,e=c.pointerType==Ba;if(!(e&&c.sourceCapabilities&&c.sourceCapabilities.firesTouchEvents)){if(d)S.call(this,b,c);else if(e&&U.call(this,c))return;this.callback(a,b,c)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var eb=u(na.style,"touchAction"),fb=eb!==d,gb="compute",hb="auto",ib="manipulation",jb="none",kb="pan-x",lb="pan-y",mb=X();V.prototype={set:function(a){a==gb&&(a=this.compute()),fb&&this.manager.element.style&&mb[a]&&(this.manager.element.style[eb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,(function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))})),W(a.join(" "))},preventDefaults:function(a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,jb)&&!mb[jb],f=p(d,lb)&&!mb[lb],g=p(d,kb)&&!mb[kb];if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}return g&&f?void 0:e||f&&c&Na||g&&c&Oa?this.preventSrc(b):void 0},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var nb=1,ob=2,pb=4,qb=8,rb=qb,sb=16,tb=32;Y.prototype={defaults:{},set:function(a){return la(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=_(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=_(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=_(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;qb>d&&b(c.options.event+Z(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=qb&&b(c.options.event+Z(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=tb)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(tb|nb)))return!1;a++}return!0},recognize:function(a){var b=la({},a);return k(this.options.enable,[this,b])?(this.state&(rb|sb|tb)&&(this.state=nb),this.state=this.process(b),void(this.state&(ob|pb|qb|sb)&&this.tryEmit(b))):(this.reset(),void(this.state=tb))},process:function(a){},getTouchAction:function(){},reset:function(){}},i(aa,Y,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(ob|pb),e=this.attrTest(a);return d&&(c&Ha||!e)?b|sb:d||e?c&Ga?b|qb:b&ob?b|pb:ob:tb}}),i(ba,aa,{defaults:{event:"pan",threshold:10,pointers:1,direction:Pa},getTouchAction:function(){var a=this.options.direction,b=[];return a&Na&&b.push(lb),a&Oa&&b.push(kb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Na?(e=0===f?Ia:0>f?Ja:Ka,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ia:0>g?La:Ma,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return aa.prototype.attrTest.call(this,a)&&(this.state&ob||!(this.state&ob)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i(ca,aa,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ob)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(da,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[hb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Ga|Ha)&&!f)this.reset();else if(a.eventType&Ea)this.reset(),this._timer=e((function(){this.state=rb,this.tryEmit()}),b.time,this);else if(a.eventType&Ga)return rb;return tb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===rb&&(a&&a.eventType&Ga?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=ra(),this.manager.emit(this.options.event,this._input)))}}),i(ea,aa,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ob)}}),i(fa,aa,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Na|Oa,pointers:1},getTouchAction:function(){return ba.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Na|Oa)?b=a.overallVelocity:c&Na?b=a.overallVelocityX:c&Oa&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&qa(b)>this.options.velocity&&a.eventType&Ga},emit:function(a){var b=$(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ga,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ib]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&Ea&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=Ga)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||H(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e((function(){this.state=rb,this.tryEmit()}),b.interval,this),ob):rb}return tb},failTimeout:function(){return this._timer=e((function(){this.state=tb}),this.options.interval,this),tb},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==rb&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ha.VERSION="2.0.7",ha.defaults={domEvents:!1,touchAction:gb,enable:!0,inputTarget:null,inputClass:null,preset:[[ea,{enable:!1}],[ca,{enable:!1},["rotate"]],[fa,{direction:Na}],[ba,{direction:Na},["swipe"]],[ga],[ga,{event:"doubletap",taps:2},["tap"]],[da]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ub=1,vb=2;ia.prototype={set:function(a){return la(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?vb:ub},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&rb)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===vb||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(ob|pb|qb)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof Y)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;if(a=this.get(a)){var b=this.recognizers,c=r(b,a);-1!==c&&(b.splice(c,1),this.touchAction.update())}return this},on:function(a,b){if(a!==d&&b!==d){var c=this.handlers;return g(q(a),(function(a){c[a]=c[a]||[],c[a].push(b)})),this}},off:function(a,b){if(a!==d){var c=this.handlers;return g(q(a),(function(a){b?c[a]&&c[a].splice(r(c[a],b),1):delete c[a]})),this}},emit:function(a,b){this.options.domEvents&&ka(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&ja(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},la(ha,{INPUT_START:Ea,INPUT_MOVE:Fa,INPUT_END:Ga,INPUT_CANCEL:Ha,STATE_POSSIBLE:nb,STATE_BEGAN:ob,STATE_CHANGED:pb,STATE_ENDED:qb,STATE_RECOGNIZED:rb,STATE_CANCELLED:sb,STATE_FAILED:tb,DIRECTION_NONE:Ia,DIRECTION_LEFT:Ja,DIRECTION_RIGHT:Ka,DIRECTION_UP:La,DIRECTION_DOWN:Ma,DIRECTION_HORIZONTAL:Na,DIRECTION_VERTICAL:Oa,DIRECTION_ALL:Pa,Manager:ia,Input:x,TouchAction:V,TouchInput:P,MouseInput:L,PointerEventInput:M,TouchMouseInput:R,SingleTouchInput:N,Recognizer:Y,AttrRecognizer:aa,Tap:ga,Pan:ba,Swipe:fa,Pinch:ca,Rotate:ea,Press:da,on:m,off:n,each:g,merge:ta,extend:sa,assign:la,inherit:i,bindFn:j,prefixed:u});var wb="undefined"!=typeof a?a:"undefined"!=typeof self?self:{};wb.Hammer=ha,"function"==typeof define&&define.amd?define((function(){return ha})):"undefined"!=typeof module&&module.exports?module.exports=ha:a[c]=ha}(window,document,"Hammer");"use strict";$.widget("wm.datatable",{options:{data:[],statusMsg:"",colDefs:[],rowActions:[],headerConfig:[],sortInfo:{field:"",direction:""},isMobile:false,enableSort:true,filtermode:"",filteronkeypress:false,activeRow:undefined,height:"100%",showHeader:true,selectFirstRow:false,showNewRow:true,showRowIndex:false,enableRowSelection:true,enableColumnSelection:false,multiselect:false,filterNullRecords:true,navigation:"",isdynamictable:"",cssClassNames:{tableRow:"app-datagrid-row",headerCell:"app-datagrid-header-cell",groupHeaderCell:"app-datagrid-group-header-cell",tableCell:"app-datagrid-cell",grid:"",gridDefault:"table",gridBody:"app-datagrid-body",gridFooter:"app-datagrid-footer",deleteRow:"danger",ascIcon:"wi wi-long-arrow-up",descIcon:"wi wi-long-arrow-down",selectedColumn:"selected-column",rowExpandIcon:"wi wi-minus-square",rowCollapseIcon:"wi wi-plus-square",gridRowExpansionClass:"table-row-expansion",expandedRowClass:"expanded"},dataStates:{loading:"Loading...",ready:"",error:"An error occurred in loading the data.",nodata:"No data found."},messages:{selectField:"Select Field"},loadingicon:"",startRowIndex:1,editmode:"",actionsEnabled:{edit:true,new:true},rowExpansionEnabled:false,rowDef:{position:"0",closeothers:false,columnwidth:"30px"},summaryRow:false,summaryRowDefs:[],summaryRowDefsObject:[],searchHandler:function(){},sortHandler:function(){}},customColumnDefs:{checkbox:{field:"checkbox",type:"custom",displayName:"",sortable:false,searchable:false,resizable:false,selectable:false,readonly:true,style:"width: 50px; text-align: center;",textAlignment:"center",isMultiSelectCol:true,show:true},radio:{field:"radio",type:"custom",displayName:"",sortable:false,searchable:false,resizable:false,selectable:false,readonly:true,style:"width: 50px; text-align: center;",textAlignment:"center",show:true},__expand:{field:"__expand",type:"custom",displayName:"",sortable:false,searchable:false,resizable:false,selectable:false,readonly:true,style:"text-align: center;",textAlignment:"center",show:true,width:"30px"},rowIndex:{field:"rowIndex",type:"custom",displayName:"S. No.",sortable:false,searchable:false,selectable:false,readonly:true,style:"text-align: left;",textAlignment:"left",show:true}},CONSTANTS:{QUICK_EDIT:"quickedit",INLINE:"inline",FORM:"form",DIALOG:"dialog",SEARCH:"search",MULTI_COLUMN:"multicolumn"},Utils:{random:function(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)},isDefined:function(value){return value!==undefined},isObject:function(value){return value!==null&&typeof value==="object"},getObjectIndex:function(data,obj){var matchIndex=-1;if(!Array.isArray(data)){return-1}data.some((function(data,index){if(_.isEqual(data,obj)){matchIndex=index;return true}}));return matchIndex},generateGuid:function(){var random=this.random;return random()+random()+"-"+random()+"-"+random()+"-"+random()+"-"+random()+random()+random()},isValidHtml:function(htm){var validHtmlRegex=/<[a-z][\s\S]*>/i;return validHtmlRegex.test(htm)},isMac:function(){return navigator.platform.toUpperCase().indexOf("MAC")>=0},isDeleteKey:function(event){return this.isMac()&&event.which===8||event.which===46}},_setStyles:function($el,styleString){if(!styleString){return}var styles=styleString.split(";");styles.forEach((function(styleBit){var parts=styleBit.split(":");var property,value;if(parts.length===2){property=parts[0].trim();value=parts[1].trim();$el.css(property,value)}}));return styleString},_getColumnSortDirection:function(field){var sortInfo=this.options.sortInfo;return field===sortInfo.field?sortInfo.direction:""},_toggleSpacingClasses:function(value){switch(value){case"normal":this.tableContainer.removeClass("table-condensed");if(this.gridSearch){this.gridSearch.find(".form-group").removeClass("form-group-sm");this.gridSearch.find("select").removeClass("input-sm");this.gridSearch.find(".input-group").removeClass("input-group-sm")}break;case"condensed":this.tableContainer.addClass("table-condensed");if(this.gridSearch){this.gridSearch.find(".form-group").addClass("form-group-sm");this.gridSearch.find("select").addClass("input-sm");this.gridSearch.find(".input-group").addClass("input-group-sm")}break}},_getColSpan:function(cols){var colSpan=0,self=this;_.forEach(cols,(function(col){var colDef;if(col.isGroup){colSpan+=self._getColSpan(col.columns)}else{colDef=_.find(self.preparedHeaderData,{field:col.field});colSpan=!_.isUndefined(colDef.show)&&!colDef.show?colSpan:colSpan+1}}));return colSpan},_setColSpan:function(config){var self=this;_.forEach(config,(function(col){if(col.isGroup){col.colspan=self._getColSpan(col.columns);self.gridHeaderElement.find('th[data-col-group="'+col.field+'"]').attr("colspan",col.colspan);self._setColSpan(col.columns)}}))},_getHeaderTemplate:function(){var $colgroup=$("<colgroup></colgroup>"),$htm=this.gridHeaderElement.empty(),isDefined=this.Utils.isDefined,sortInfo=this.options.sortInfo,sortField=sortInfo.field,self=this,rowTemplates=[],headerConfig=this.options.headerConfig,headerGroupClass=self.options.cssClassNames.groupHeaderCell,$row;function generateHeaderCell(value,index){var id=index,field=value.field,headerLabel=self.Utils.isDefined(value.displayName)?value.displayName:field||"",titleLabel=headerLabel,sortEnabled=self.options.enableSort&&(_.isUndefined(value.show)||value.show)&&(_.isUndefined(value.sortable)||value.sortable),headerClasses=self.options.cssClassNames.headerCell,sortClass,tl="",$th,$col,$sortSpan,$sortIcon;headerLabel=!self.Utils.isDefined(headerLabel)||headerLabel===""?"&nbsp;":headerLabel;$col=$("<col/>");if(value.style){self._setStyles($col,value.style)}$colgroup.append($col);if(isDefined(value.class)){headerClasses+=" "+value.class}if(value.selected){headerClasses+=" "+self.options.cssClassNames.selectedColumn+" "}if(field==="checkbox"||field==="radio"){headerClasses+=" grid-col-small"}tl+="<th";if((_.isUndefined(value.resizable)||value.resizable)&&(_.isUndefined(value.show)||value.show)){tl+=" data-col-resizable"}if(self.options.enableColumnSelection&&(_.isUndefined(value.selectable)||value.selectable)){tl+=" data-col-selectable"}if(sortEnabled){tl+=" data-col-sortable"}tl+="></th>";$th=$(tl);$th.attr({"data-col-id":id,"data-col-field":field,title:titleLabel});self._setStyles($th,"text-align: "+value.textAlignment);$th.addClass(headerClasses);if(field==="checkbox"){$th.append('<input type="checkbox" />')}$th.append('<span class="header-data">'+headerLabel+"</span>");if(sortEnabled){$sortSpan=$('<span class="sort-buttons-container"></span>');$sortIcon=$('<i class="sort-icon"></i>');if(sortField&&sortField===value.field&&sortInfo.direction){sortClass=sortInfo.direction==="asc"?self.options.cssClassNames.ascIcon:self.options.cssClassNames.descIcon;$sortSpan.addClass("active");$sortIcon.addClass(sortClass+" "+sortInfo.direction)}$th.append($sortSpan.append($sortIcon))}return $th}function generateRow(cols,i){var $thList=[];_.forEach(cols,(function(col){var index,value,classes,styles,$groupTl;if(col.columns&&col.columns.length){$groupTl=$("<th></th>");classes=headerGroupClass+" "+(col.class||"");styles="text-align: "+col.textAlignment+";background-color: "+(col.backgroundColor||"")+";";$groupTl.attr({"data-col-group":col.field,class:classes,title:col.displayName});self._setStyles($groupTl,styles);$groupTl.append('<span class="header-data">'+col.displayName+"</span>");$thList.push($groupTl);generateRow(col.columns,i+1)}else{index=_.findIndex(self.preparedHeaderData,{field:col.field});value=self.preparedHeaderData[index];if(value){$thList.push(generateHeaderCell(value,index))}}}));rowTemplates[i]=rowTemplates[i]||[];rowTemplates[i]=rowTemplates[i].concat($thList)}if(_.isEmpty(headerConfig)){$row=$("<tr></tr>");self.preparedHeaderData.forEach((function(value,index){$row.append(generateHeaderCell(value,index))}));$htm.append($row)}else{generateRow(headerConfig,0);rowTemplates.forEach((function($thList,index){$row=$('<tr role="row" tabindex="0"></tr>');var rowSpan=rowTemplates.length-index;$thList.forEach((function($th){if(rowSpan>1&&$th.hasClass("app-datagrid-header-cell")){$th.attr("rowspan",rowSpan)}$row.append($th)}));$htm.append($row)}))}return{colgroup:$colgroup,header:$htm}},_getSearchEl:function(){var htm,sel='<select name="wm-datatable" data-element="dgFilterValue" '+'class="form-control app-select">'+'<option value="" selected class="placeholder">'+this.options.messages.selectField+"</option>",searchLabel=this.Utils.isDefined(this.options.searchLabel)&&this.options.searchLabel.length?this.options.searchLabel:"";this.options.colDefs.forEach((function(colDef,index){if(colDef.field!=="none"&&colDef.field!=="rowOperations"&&colDef.searchable&&_.toString(colDef.showinfilter)!=="false"){sel+='<option value="'+colDef.field+'" data-coldef-index="'+index+'">'+(colDef.displayName||colDef.field)+"</option>"}}));sel+="</select>";htm='<form class="form-search form-inline" onsubmit="return false;"><div class="form-group">'+'<input type="text" data-element="dgSearchText" class="form-control app-textbox" value="" placeholder="'+searchLabel+'"/>'+'</div><div class="input-append input-group">'+sel+'<span class="input-group-addon"><button type="button" data-element="dgSearchButton" class="app-search-button" title="'+searchLabel+'">'+'<i class="wi wi-search"></i>'+"</button></span>"+"</div>"+"</div></form>";var $htm=$(htm);this._setStyles($htm.find('[data-element="dgSearchText"]'),"display: inline-block;");return $htm},_appendRowExpansionButtons:function($htm){var self=this;$htm.find("[data-identifier='rowExpansionButtons']").each((function(index){var _rowData,$row,rowId,rowIndex=index;$row=$(this).closest("tr.app-datagrid-row");rowId=parseInt($row.attr("data-row-id"),10);_rowData=_.clone(self.options.data[rowId]);_rowData.$index=rowIndex+1;self.options.generateRowExpansionCell(_rowData,rowIndex);$(this).empty().append(self.options.getRowExpansionAction(rowIndex))}))},setSummaryRowDef:function(key,data,rowIndex,refreshIndicator){this.options.summaryRow=true;if(this.options.summaryRowDefs[rowIndex]==undefined){this.options.summaryRowDefs[rowIndex]={};this.options.summaryRowDefsObject[rowIndex]={}}this.options.summaryRowDefsObject[rowIndex][key]=data;this.options.summaryRowDefs[rowIndex][key]=data&&data.value?data.value:data;if(refreshIndicator)this.refreshGridData()},_getSummaryRowTemplate:function(){var self=this,$tfoot=$('<tfoot class="'+this.options.cssClassNames.gridFooter+'"></tfoot>');this._setStyles($tfoot,"border-top: 3px solid #eee;");_.forEach(this.options.summaryRowDefs,(function(row,index){row.$$pk=index;$tfoot.append(self._getRowTemplate(row,index,true))}));return $tfoot},getPageStartIndex:function(){var currentPage=this.options.getCurrentPage(),pagesize=this.options.getPageSize();var isPrevPageUpdated=this.options.actionRowPage<currentPage;var pageIndex=isPrevPageUpdated?this.options.actionRowPage:currentPage;return(pageIndex-1)*pagesize},_getPreparedDataForInfiniteScroll:function($tbody,preparedData){preparedData=preparedData.filter((function(row,index){var isExists=$tbody.find("tr.app-datagrid-row[data-row-id="+row.$$pk+"]");if(!isExists.length){return row}}));return preparedData},_updateTrData:function($tbody){var editedRow,updatedRowData,self=this;editedRow=$tbody.find("tr.app-datagrid-row[data-row-id="+self.options.actionRowIndex+"]");updatedRowData=self.preparedData[self.options.actionRowIndex];self.options.generateCustomExpressions(updatedRowData,self.options.actionRowIndex);var rowTemplate=self._getRowTemplate(updatedRowData,self.options.actionRowIndex);editedRow.replaceWith(rowTemplate[0])},_handleCRUDForInfiniteScroll:function($tbody){var self=this;if((self.options.lastActionPerformed===self.options.ACTIONS.SEARCH_OR_SORT||self.options.lastActionPerformed===self.options.ACTIONS.FILTER_CRITERIA||self.options.lastActionPerformed===self.options.ACTIONS.DATASET_UPDATE)&&(self.options.isSearchTrigerred||self.options.isDatasetUpdated||self.options.isDataUpdatedByUser)){$tbody.html("");if(this.options.navigation==="On-Demand"&&!this.options.isLastPage)this.element.find(".on-demand-datagrid").show();self.options.clearCustomExpression();self.options.clearRowDetailExpression();self.options.setIsSearchTrigerred(false);self.options.setIsDatasetUpdated(false)}else if(self.options.lastActionPerformed===self.options.ACTIONS.EDIT&&self.options.actionRowIndex!==undefined&&self.options.editmode!==this.CONSTANTS.QUICK_EDIT){self._updateTrData($tbody)}},_getGridTemplate:function(){var self=this,preparedData,$tbody,pageStartIndex=self.getPageStartIndex(),startRowIndex=self.options.startRowIndex,isScrollorOnDemand=self.options.isNavTypeScrollOrOndemand();if(isScrollorOnDemand){$tbody=this.gridElement;if(this.renderTableOnViewLess){$tbody=this.gridElement.empty();this.hideLoadingIndicator();this.renderTableOnViewLess=false}}else{$tbody=this.gridElement.empty()}if(isScrollorOnDemand){this._handleCRUDForInfiniteScroll($tbody);if(self.options.lastActionPerformed===self.options.ACTIONS.DELETE){startRowIndex=self.options.actionRowIndex+1}preparedData=this._getPreparedDataForInfiniteScroll($tbody,this.preparedData.slice(pageStartIndex))}else{this.options.clearCustomExpression();this.options.clearRowDetailExpression();preparedData=this.preparedData}_.forEach(preparedData,(function(row,index){var _row=_.clone(row),rowIndex=isScrollorOnDemand?startRowIndex+index-1:index,rowTemplate;_row.$index=rowIndex+1;self.options.generateCustomExpressions(_row,rowIndex);self.options.registerRowNgClassWatcher(_row,rowIndex);rowTemplate=self._getRowTemplate(row,rowIndex);$tbody.append(rowTemplate);if(self.options.rowExpansionEnabled){var rowHeight=self.options.rowDef.height;var rowPosition=self.options.rowDef.position;var colSpanLength=_.filter(self.preparedHeaderData,(function(c){return c.show})).length-1;var $tr=$('<tr class="app-datagrid-detail-row" tabindex="0" role="row" data-row-id="'+row.$$pk+'"><td></td><td colspan="'+colSpanLength+'" class="app-datagrid-row-details-cell">'+'<div class="row-overlay"><div class="row-status"><i class="'+self.options.loadingicon+'"></i></div></div><div class="details-section"></div>'+"</td></tr>");if(rowPosition==="-1"){$tr=$('<tr class="app-datagrid-detail-row" tabindex="0" role="row" data-row-id="'+row.$$pk+'"><td colspan="'+colSpanLength+'" class="app-datagrid-row-details-cell">'+'<div class="row-overlay"><div class="row-status"><i class="'+self.options.loadingicon+'"></i></div></div><div class="details-section"></div>'+"</td><td></td></tr>")}if(rowHeight){$tr.find("div.row-overlay").css("min-height",rowHeight)}$tr.css("display","none");$tr.find(".details-section").css("display","none");$tbody.append($tr)}}));if(!this.options.isdynamictable){this.options.setLastActionPerformed(this.options.ACTIONS.DEFAULT);this.options.setIsDataUpdatedByUser(false);this.options.clearActionRowIndex()}return $tbody},_getRowTemplate:function(row,rowIndex,summaryRow){var $htm,self=this,gridOptions=self.options;$htm=$('<tr role="row" tabindex="0" class="'+gridOptions.cssClassNames.tableRow+" "+(gridOptions.rowClass||"")+'" data-row-id="'+row.$$pk+'"></tr>');this.preparedHeaderData.forEach((function(current,colIndex){$htm.append(self._getColumnTemplate(row,colIndex,current,rowIndex,summaryRow))}));return $htm},_getRowActionsColumnDefIndex:function(){var i,len=this.preparedHeaderData.length;for(i=0;i<len;i+=1){if(this.preparedHeaderData[i].field==="rowOperations"){return i}}return-1},_getRowActionsColumnDef:function(){var index=this._getRowActionsColumnDefIndex();if(index!==-1){return this.preparedHeaderData[index]}return null},_getCheckboxTemplate:function(row,isMultiSelectCol){var checked=row._checked===true?" checked":"",disabled=row.disabed?" disabled":"",chkBoxName=isMultiSelectCol?"gridMultiSelect":"";return'<input name="'+chkBoxName+'" type="checkbox"'+checked+disabled+"/>"},_getRadioTemplate:function(row){var checked=row._checked===true?" checked":"",disabled=row.disabed?" disabled":"";return'<input type="radio" rowSelectInput name="" value=""'+checked+disabled+"/>"},_getColumnTemplate:function(row,colId,colDef,rowIndex,summaryRow){var $htm,columnValue,columnValueObject,cellPreloader='<div class="overlay"><span aria-hidden="true" class="form-field-spinner fa fa-circle-o-notch fa-spin form-control-feedback"></span></div>',customExpressionHtml,innerTmpl,classes=this.options.cssClassNames.tableCell+" "+(colDef.class||""),colExpression=colDef.customExpression,styles="text-align: "+colDef.textAlignment+";position: relative;";$htm=$('<td class="'+classes+'" data-col-id="'+colId+'" role="cell"></td>');this._setStyles($htm,styles);columnValue=_.get(row,colDef.field);if(summaryRow){columnValueObject=this.options.summaryRowDefsObject[rowIndex][colDef.field];if(columnValueObject instanceof Object){if(columnValueObject.class){$htm.addClass(columnValueObject.class)}}if(columnValue instanceof Promise){customExpressionHtml=cellPreloader;$htm.html(customExpressionHtml)}else{innerTmpl=_.isUndefined(columnValue)||columnValue===null?"":columnValue;$htm.html(innerTmpl)}}else if(colExpression){$htm.html(this.options.getCustomExpression(colDef.field,rowIndex))}else{if(colDef.type!=="custom"){columnValue=_.get(row,colDef.field);if(this.options.filterNullRecords&&columnValue===null||_.isUndefined(columnValue)){columnValue=""}$htm.attr("title",columnValue);$htm.text(""+columnValue)}else{switch(colDef.field){case"checkbox":innerTmpl=this._getCheckboxTemplate(row,colDef.isMultiSelectCol);break;case"__expand":innerTmpl='<span class="row-expansion-column" data-identifier="rowExpansionButtons"></span>';break;case"radio":innerTmpl=this._getRadioTemplate(row);break;case"rowOperations":innerTmpl='<span class="actions-column" data-identifier="actionButtons"></span>';break;case"rowIndex":innerTmpl=row.$$index;break;case"none":innerTmpl="";break;default:innerTmpl=_.isUndefined(columnValue)||columnValue===null?"":columnValue}$htm.html(innerTmpl)}}row.$index=rowIndex+1;this.options.registerColNgClassWatcher(row,colDef,rowIndex,colId);return $htm},_getEventTemplate:function(colDef){var events=_.filter(_.keys(colDef),(function(key){return _.startsWith(key,"on")})),changeEvt,template="";changeEvt=colDef.editWidgetType==="autocomplete"?"onSubmit":"onChange";events=_.union(events,[changeEvt]);_.forEach(events,(function(eventName){template+=" "+_.kebabCase(eventName)+'="';if(eventName==="onSubmit"||eventName==="onChange"){template+="_"+eventName+"Field($event, $scope, newVal, oldVal);"}template+=(colDef[eventName]||"")+'" '}));return template},_insertFieldInHeaderConfig:function(headerConfig,fieldName,position){var index=_.findIndex(headerConfig,{field:position}),self=this;if(index===-1){_.forEach(headerConfig,(function(config){if(config.isGroup){self._insertFieldInHeaderConfig(config.columns,fieldName,position)}}))}else{headerConfig.splice(index+1,0,{field:fieldName,isPredefined:true})}},setHeaderConfigForDefaultFields:function(name,position){if(_.isEmpty(this.options.headerConfig)){return}var fieldName=this.customColumnDefs[name].field;_.remove(this.options.headerConfig,{field:fieldName});if(position==="0"){this.options.headerConfig.unshift({field:fieldName,isPredefined:true})}else if(position==="-1"){this.options.headerConfig.push({field:fieldName,isPredefined:true})}else{this._insertFieldInHeaderConfig(this.options.headerConfig,fieldName,position)}},setDefaultColsData:function(header){if(_.isEmpty(this.preparedHeaderData)){return}var rowExpandPosition,rowExpandCol;if(this.options.rowExpansionEnabled){rowExpandPosition=this.options.rowDef.position;rowExpandCol=_.clone(this.customColumnDefs.__expand);rowExpandCol.width=this.options.rowDef.columnwidth;if(header){if(rowExpandPosition==="-1"){this.preparedHeaderData.push(rowExpandCol)}else if(rowExpandPosition==="0"){this.preparedHeaderData.unshift(rowExpandCol)}else{var index=_.findIndex(this.preparedHeaderData,{field:rowExpandPosition});this.preparedHeaderData.splice(index+1,0,rowExpandCol)}}this.setHeaderConfigForDefaultFields("__expand",rowExpandPosition)}if(this.options.showRowIndex){if(header){this.preparedHeaderData.unshift(this.customColumnDefs.rowIndex)}this.setHeaderConfigForDefaultFields("rowIndex","0")}if(this.options.multiselect){if(header){this.preparedHeaderData.unshift(this.customColumnDefs.checkbox)}this.setHeaderConfigForDefaultFields("checkbox","0")}if(!this.options.multiselect&&this.options.showRadioColumn){if(header){this.preparedHeaderData.unshift(this.customColumnDefs.radio)}this.setHeaderConfigForDefaultFields("radio","0")}},_prepareHeaderData:function(){this.preparedHeaderData=[];$.extend(this.preparedHeaderData,this.options.colDefs);this.setDefaultColsData(true)},_generateCustomColDefs:function(){var colDefs=[],generatedColDefs={};function generateColumnDef(key){if(!generatedColDefs[key]){var colDef={type:"string",field:key};colDefs.push(colDef);generatedColDefs[key]=true}}this.options.data.forEach((function(item){_.keys(item).forEach(generateColumnDef)}));this.options.colDefs=colDefs;this._prepareHeaderData()},_prepareData:function(){var data=[],colDefs=this.options.colDefs,self=this,gridData=[],pageStartIndex=self.getPageStartIndex(),isObject=this.Utils.isObject,isDefined=this.Utils.isDefined;if(!this.options.colDefs.length&&this.options.data.length){this._generateCustomColDefs()}gridData=this.options.isNavTypeScrollOrOndemand()?this.options.data.slice(pageStartIndex):this.options.data;gridData.forEach((function(item,i){var rowData=$.extend(true,{},item);colDefs.forEach((function(colDef){if(!colDef.field){return}var fields=colDef.field.split("."),text=item,j,len=fields.length,key,isArray;for(j=0;j<len;j++){key=fields[j];isArray=undefined;if(key.indexOf("[0]")!==-1){key=key.replace("[0]","");isArray=true}if(isObject(text)&&!isArray){text=_.get(text,key)}else if(isArray){text=_.get(text,key+"[0]")}else{text=undefined;break}}if(isDefined(text)){rowData[colDef.field]=text}else if(fields.length>1&&_.has(item,colDef.field)){rowData[colDef.field]=item[colDef.field]}}));rowData.$$index=pageStartIndex+i+1;rowData.$$pk=self.options.isNavTypeScrollOrOndemand()?pageStartIndex+i:i;data.push(rowData)}));if(self.options.isNavTypeScrollOrOndemand()){if(self.options.isSearchTrigerred&&!self.emptySearch||self.options.isDatasetUpdated){self.preparedData=data}else if(self.preparedData.length){data.forEach((function(rowData,index){var rowId=pageStartIndex+index;if(self.preparedData[rowId]&&rowData.$$index===self.preparedData[rowId].$$index){self.preparedData[rowId]=rowData}else{self.preparedData.push(rowData)}}))}else{self.preparedData.push(...data)}}else{self.preparedData=data}},_reselectColumns:function(){var selectedColumns=[],self=this;if(this.gridHeaderElement&&this.options.enableColumnSelection){selectedColumns=this.gridHeaderElement.find("th."+this.options.cssClassNames.selectedColumn);if(selectedColumns.length){selectedColumns.each((function(){self.columnSelectionHandler(undefined,$(this))}))}}if(this.options.multiselect){this.updateSelectAllCheckboxState()}},_create:function(){$.extend(this,{dataStatus:{message:"",state:"ready"},preparedData:[],preparedHeaderData:[],dataStatusContainer:null,gridContainer:null,gridElement:null,gridHeader:null,gridBody:null,columnClickInfo:{},gridFooter:null,gridSearch:null,tableId:null,searchObj:{field:"",value:"",event:null},compiledCellTemplates:{}});this._setStatus=_.debounce((function(isCreated){this.__setStatus(isCreated)}),100);this._debounceOnEnter=_.debounce((function($target,$row,quickEdit,event){this._onEnter($target,$row,quickEdit,event)}),150);this.options.summaryRow=false;this.options.summaryRowDefs=[];this._prepareHeaderData();this._prepareData();this._render(true)},_setGridEditMode:function(val){if(_.isFunction(this.options.setGridEditMode)){this.options.setGridEditMode(val)}},_refreshGrid:function(){this._prepareHeaderData();this._prepareData();this._render();this.addOrRemoveScroll();this._setGridEditMode(false)},refreshGrid:function(){window.clearTimeout(this.refreshGridTimeout);this.refreshGridTimeout=window.setTimeout(this._refreshGrid.bind(this),50)},callRenderGridForInfiniteScroll:function(){this.gridFooter.remove();var $alwaysNewRow=this.gridElement.find("> tr.app-datagrid-row.always-new-row");if($alwaysNewRow.length){$alwaysNewRow.remove()}this._renderGrid(undefined)},refreshGridData:function(){this._prepareData();if(!this.options.isNavTypeScrollOrOndemand()){this.gridFooter.remove();this._renderGrid()}else{this.callRenderGridForInfiniteScroll()}this._reselectColumns();this.addOrRemoveScroll();this._setGridEditMode(false);this.toggleNewRowActions(false)},setDefaultRowData:function(rowData){_.forEach(this.preparedHeaderData,(function(colDef){rowData[colDef.field]=colDef.defaultvalue}))},addNewRow:function(skipFocus,alwaysNewRow){var rowId=this.gridElement.find("> tr.app-datagrid-row:visible").length||99999,self=this,rowData={},$row,$gridBody,$alwaysNewRow;if(!alwaysNewRow&&_.isFunction(this.options.beforeRowInsert)){this.options.beforeRowInsert()}$gridBody=this.gridElement;$alwaysNewRow=$gridBody.find("> tr.app-datagrid-row.always-new-row");if($alwaysNewRow.length){this.setFocusOnElement(undefined,$alwaysNewRow);if(this.options.editmode===this.CONSTANTS.QUICK_EDIT){var $qTarget=$alwaysNewRow.find("input").length>0?$($alwaysNewRow.find("input")[0]):null;if($qTarget!==null){var event=$.Event("keydown");event.which=13;$qTarget.trigger(event)}}return}rowData.$index=rowId;rowData.$$pk=rowId;if(this.options.editmode!==this.CONSTANTS.FORM&&this.options.editmode!==this.CONSTANTS.DIALOG){$row=$(this._getRowTemplate(rowData,rowData.$index));if(!this.preparedData.length){this.setStatus("ready",this.dataStatus.ready)}if(this.options.formPosition==="top"){$gridBody.prepend($row)}else{$gridBody.append($row)}this._appendRowActions($row,true,rowData);this.attachEventHandlers($row);if(alwaysNewRow||this.options.editmode!==this.CONSTANTS.QUICK_EDIT){$row.find(".delete-row-button").hide();if(alwaysNewRow){$row.find(".edit-row-button").hide()}}this._findAndReplaceCompiledTemplates();if(alwaysNewRow){this.setDefaultRowData(rowData);$row.addClass("always-new-row").addClass("row-editing");this.options.runInNgZone((function(){self.makeRowEditable($row,rowData,true)}))}else{$row.trigger("click",[undefined,{action:"edit",operation:"new",skipFocus:skipFocus}])}this.updateSelectAllCheckboxState();this.addOrRemoveScroll();this.options.timeoutCall((function(){self.setColGroupWidths()}),100)}},addLoadMoreBtn:function(onDemandMsg,loadingdatamsg,cb,infScroll){var $btnEl;if(!this.options.isLastPage||infScroll){var self=this;var $parenEl=$('<div class="on-demand-datagrid"><a class="app-button btn btn-block on-demand-load-btn"></a></div>');$btnEl=$parenEl.find("a");$btnEl.append(onDemandMsg);this.element.find(".app-grid-header-inner").append($parenEl);if(infScroll){if(this.element.find(".on-demand-load-btn").length){this.element.find(".on-demand-load-btn").text(this.options.viewlessmessage)}}$btnEl.on("click",(function(e){var lastPage=self.options.getCurrentPage()==self.options.getPageCount();if(!lastPage){self.showLoadingIndicator(loadingdatamsg,false)}if(!self.options.showviewlessbutton){$btnEl.hide()}if(infScroll){if(lastPage){self.element.find(".on-demand-datagrid").remove()}}if(lastPage&&self.options.showviewlessbutton){$btnEl.hide();self.renderTableOnViewLess=true;self.renderPaginationOnViewLess=true;self.options.enableNavigation();self._renderGrid()}if(cb&&typeof cb==="function"){cb(e)}}))}},showLoadingIndicator:function(loadingdatamsg,infScroll){var hasLoadingEl=this.element.find(".loading-data-msg");var $dataGrid=this.element.find(".on-demand-datagrid");if(hasLoadingEl.length&&!infScroll){hasLoadingEl.show()}else if(infScroll&&$dataGrid.length){$dataGrid.show()}else{var $loadingEl=$('<div class="loading-data-msg spin-icon-in-center"><span><i class="app-icon panel-icon fa-spin '+this.options.loadingicon+'"></i>'+'<span class="sr-only">Loading</span><span class="loading-text"></span></span></div>');$loadingEl.find(".loading-text").html(loadingdatamsg);if($dataGrid.length){$dataGrid.append($loadingEl)}else{var gridEl=$('<div class="on-demand-datagrid">'+$loadingEl[0].outerHTML+"</div>");this.element.find(".app-grid-header-inner").append(gridEl)}}},hideLoadingIndicator:function(showLoadBtn,infScroll){if(!showLoadBtn&&!infScroll){this.element.find(".loading-data-msg").hide();this.element.find(".on-demand-load-btn").text(this.options.ondemandmessage);this.element.find(".on-demand-load-btn").show()}else if(this.options.getCurrentPage()==this.options.getPageCount()&&this.options.showviewlessbutton){this.element.find(".on-demand-load-btn").show().text(this.options.viewlessmessage);this.element.find(".loading-data-msg").hide();if(infScroll){if(!this.element.find(".on-demand-load-btn").length){this.options.addLoadMoreBtn()}this.element.find(".loading-data-msg").hide()}}else{this.element.find(".on-demand-datagrid").hide()}},getSelectedRows:function(){this.getSelectedColumns();var selectedRowsData=[],self=this;this.preparedData.forEach((function(data,i){if(data._selected){selectedRowsData.push(self.options.data[i])}}));return selectedRowsData},selectRows:function(rows){var self=this;self.gridElement.find("tr.app-datagrid-row").each((function(index){if(self.preparedData[index]&&self.preparedData[index]._selected===true){$(this).trigger("click",[$(this),{skipSingleCheck:true}])}}));if(_.isArray(rows)){_.forEach(rows,(function(row){self.selectRow(row,true)}))}else{self.selectRow(rows,true)}},toggleRowFilter:function(show){if(this.options.filtermode===this.CONSTANTS.MULTI_COLUMN&&this.gridSearch){if(show){this.gridSearch.show()}else{this.gridSearch.hide()}}},setColGroupWidths:function(){var self=this,headerCols=this.options.isMobile?this.tableContainer.find("col"):this.tableContainer.find("col"),bodyCols=this.tableContainer.find("col"),headerCells=this.options.showHeader?this.gridContainer.find("th.app-datagrid-header-cell"):this.gridElement.find("tr.app-datagrid-row").first().find("td"),colLength=this.preparedHeaderData.length,scrollLeft=this.gridElement.parent().prop("scrollLeft");if(!headerCols.length&&!headerCells.length){return}this._setColSpan(this.options.headerConfig);this.toggleRowFilter();var definedColWidth=0;var colsLen=headerCols.length;headerCols.each((function(){var eachColWidth=$(this).width();if(eachColWidth){definedColWidth=definedColWidth+eachColWidth;colsLen=colsLen-1}}));headerCells.each((function(){var id=Number($(this).attr("data-col-id")),colDef=self.preparedHeaderData[id],$headerCell=self.gridContainer.find('th[data-col-id="'+id+'"]'),$tdCell=self.gridElement.find('td.app-datagrid-cell[data-col-id="'+id+'"]'),$footCell=self.tableContainer.find('tfoot tr.app-datagrid-row td.app-datagrid-cell[data-col-id="'+id+'"]'),$headerCol=$(headerCols[id]),$bodyCol=$(bodyCols[id]),definedWidth,width;if(!colDef){return}definedWidth=colDef.width;if(!_.isUndefined(colDef.show)&&!colDef.show){$headerCell.hide();$tdCell.hide();$headerCol.hide();$bodyCol.hide();$footCell.hide()}else{$headerCell.show();$tdCell.show();$headerCol.show();$bodyCol.show();$footCell.show()}if($headerCol.length&&$headerCol[0].style.width==="90px"){width=_.isUndefined(definedWidth)?"":definedWidth;$headerCol.css("width",width);$bodyCol.css("width",width)}}));headerCells.each((function(){var $header=$(this),id=Number($header.attr("data-col-id")),colDef=self.preparedHeaderData[id],definedWidth,width,tempWidth,$headerCol;if(!colDef){return}definedWidth=colDef.width;if(!_.isUndefined(colDef.show)&&!colDef.show){width=0}else{if($header.hasClass("grid-col-small")){width=50}else{if(_.isUndefined(definedWidth)||definedWidth===""||_.includes(definedWidth,"%")){$headerCol=$(headerCols[id]);if($headerCol.length){tempWidth=$headerCol[0].style.width;if(tempWidth===""||tempWidth==="0px"||tempWidth==="90px"||_.includes(tempWidth,"%")){width=$header.width();if(width<=0){var currentNode=$header;var elemWidth=width;var padding=0;while(elemWidth<=0){currentNode=currentNode.parent();elemWidth=currentNode.width();if(currentNode.find("table").length&&currentNode.prop("style")){padding=padding+parseFloat(currentNode.css("padding-left"))+parseFloat(currentNode.css("padding-right"))}}if(elemWidth>0){if(padding){elemWidth=elemWidth-padding}if(_.includes(tempWidth,"%")){var widthPercent=parseInt(tempWidth);var pixelWidth=elemWidth*(widthPercent/100);width=pixelWidth}else{var parentWidth=definedColWidth&&definedColWidth>0?elemWidth-definedColWidth:elemWidth;var totalCols=colsLen?colsLen:headerCols.length;width=parentWidth/totalCols;width=width>90?colLength===id+1?width-17:width:90}}else{width=width>90?colLength===id+1?width-17:width:90}}else{width=width>90?colLength===id+1?width-17:width:90}}else{width=tempWidth}}}else{width=definedWidth}}}$(headerCols[id]).css("width",width);$(bodyCols[id]).css("width",width)}));this.toggleRowFilter(true);this.gridElement.parent().prop("scrollLeft",scrollLeft);this.gridHeaderElement.parent().prop("scrollLeft",scrollLeft)},getSelectedColumns:function(){var selectedColsData={},headerData=[],self=this,multiSelectColIndex,radioColIndex,colIndex;$.extend(headerData,this.preparedHeaderData);if(this.options.multiselect){headerData.some((function(item,i){if(item.field==="checkbox"){multiSelectColIndex=i;return true}}));headerData.splice(multiSelectColIndex,1)}else if(this.options.showRadioColumn){headerData.some((function(item,i){if(item.field==="radio"){radioColIndex=i;return true}}));headerData.splice(radioColIndex,1)}if(this.options.showRowIndex){headerData.some((function(item,i){if(item.field==="rowIndex"){colIndex=i;return true}}));headerData.splice(colIndex,1)}headerData.forEach((function(colDef){var field=colDef.field;if(colDef.selected){selectedColsData[field]={colDef:colDef,colData:self.options.data.map((function(data){return data[field]}))}}}));return selectedColsData},_setOption:function(key,value){this._super(key,value);switch(key){case"showHeader":this._toggleHeader();this._toggleSearch();this.setColGroupWidths();this.addOrRemoveScroll();break;case"filtermode":this._toggleSearch();break;case"searchLabel":if(this.gridSearch){this.gridSearch.find('[data-element="dgSearchText"]').attr("placeholder",value);this.gridSearch.find('[data-element="dgSearchButton"]').attr("title",value)}break;case"selectFirstRow":this.selectFirstRow(value);break;case"data":if(!this.isResetSortIconsDone){this.setSortIconDefault()}this.refreshGridData();break;case"dataStates":if(this.dataStatus.state==="nodata"){this.setStatus("nodata",this.dataStatus.nodata)}else if(this.dataStatus.state==="loading"){this.setStatus("loading")}break;case"loadingicon":this.dataStatusContainer.find("i").removeClass().addClass(this.options.loadingicon);break;case"colDefs":if(this.options.isNavTypeScrollOrOndemand()&&this.options.isNextPageData){this.tableContainer.find("colgroup").remove();this._prepareHeaderData();this.setColGroupWidths();this._renderHeader();this._renderSearch();this.attachEventHandlers(this.gridElement);this._reselectColumns();this.addOrRemoveScroll();break}case"multiselect":case"showRadioColumn":case"rowActions":case"filterNullRecords":case"showRowIndex":this.refreshGrid();break;case"cssClassNames":var gridClass=this.options.cssClassNames.gridDefault+" "+this.options.cssClassNames.grid;if(this.options.rowExpansionEnabled){gridClass=gridClass+" "+this.options.cssClassNames.gridRowExpansionClass}this.tableContainer.attr("class",gridClass);if(this.options.spacing==="condensed"){this._toggleSpacingClasses("condensed")}break;case"spacing":this._toggleSpacingClasses(value);break;case"messages":this.gridSearch&&this.gridSearch.find("option.placeholder").text(value&&value.selectField);break}},getOptions:function(){return this.options},_toggleHeader:function(){if(this.gridHeaderElement){this.gridHeaderElement.empty()}if(this.tableContainer){this.tableContainer.find("colgroup").remove();this.tableContainer.find("thead").remove()}this.setDefaultColsData();if(this.options.showHeader){this._renderHeader()}},_toggleSearch:function(){if(this.gridSearch){this.gridSearch.remove()}if(this.options.filtermode===this.CONSTANTS.SEARCH){this._renderSearch()}else if(this.options.filtermode===this.CONSTANTS.MULTI_COLUMN){this._renderRowFilter();this.setColGroupWidths()}},selectFirstRow:function(value,visible){var $row,id;if(visible&&this.gridElement.find("tr").is(":visible")){this.__setStatus();$row=this.gridElement.find("tr.app-datagrid-row:visible:not(.always-new-row)").first()}else{$row=this.gridElement.find("tr.app-datagrid-row:not(.always-new-row)").first()}id=$row.attr("data-row-id");if($row.length&&this.preparedData.length){this.preparedData[id]._selected=!value;$row[0].click()}},selectRow:function(row,value){var rowIndex=_.isNumber(row)?row:this.Utils.getObjectIndex(this.options.data,row),selector,$row;if(rowIndex!==-1){selector="tr.app-datagrid-row[data-row-id="+rowIndex+"]";$row=this.gridElement.find(selector);if($row.length){this.preparedData[rowIndex]._selected=!value}if(value){$row.trigger("click")}else{this.toggleRowSelection($row,value);this.options.callOnRowDeselectEvent(this.preparedData[rowIndex])}}},deselectRow:function(row){this.selectRow(row,false)},toggleRowSelection:function($row,selected,e,isSelectAll){if(!$row.length){return}var rowId=$row.attr("data-row-id"),$checkbox,$radio;if(!this.preparedData[rowId]){return}this.preparedData[rowId]._selected=selected;if(selected){$row.addClass("active")}else{$row.removeClass("active")}if(this.options.showRadioColumn){$radio=$row.find("td input[rowSelectInput]:radio:not(:disabled)");$radio.prop("checked",selected);this.preparedData[rowId]._checked=selected}if(this.options.multiselect){$checkbox=$row.find('td input[name="gridMultiSelect"]:checkbox:not(:disabled)');$checkbox.prop("checked",selected);this.preparedData[rowId]._checked=selected;if(!isSelectAll){this.updateSelectAllCheckboxState()}}else{this._deselectPreviousSelection($row,e)}},updateSelectAllCheckboxState:function(){if(!this.options.showHeader||!this.options.multiselect){return}this.__setStatus();var $headerCheckbox=this.gridHeaderElement.find("th.app-datagrid-header-cell input:checkbox"),$tbody=this.gridElement,checkedItemsLength=$tbody.find('tr.app-datagrid-row:visible input[name="gridMultiSelect"]:checkbox:checked').length,visibleRowsLength=$tbody.find("tr.app-datagrid-row:visible").length;if(!visibleRowsLength){$headerCheckbox.prop("checked",false);return}if(checkedItemsLength===visibleRowsLength){$headerCheckbox.prop("checked",true)}else{$headerCheckbox.prop("checked",false)}},rowClickHandlerOnCapture:function(e,$row,options){if(this.getColInfo(e)&&e.target.type!="checkbox"){return}$row=$row||$(e.target).closest("tr.app-datagrid-row");var gridRow=this.gridElement.find($row);if(gridRow.length&&gridRow.closest("tbody").attr("id")===this.gridElement.attr("id")){var rowId=$row.attr("data-row-id");var rowData=this.preparedData[rowId];var data=this.options.data[rowId];this.options.assignSelectedItems(data,e,{rowId:rowId,_selected:rowData?._selected})}},rowSelectionHandler:function(e,$row,options){if(this.getColInfo(e)&&e.target.type!="checkbox"){return}options=options||{};var rowId,rowData,data,selected,self=this,action=options.action,$target=$(e.target),isQuickEdit=this.options.editmode===this.CONSTANTS.QUICK_EDIT;function callRowSelectionEvents(){if(selected&&_.isFunction(self.options.onRowSelect)){self.options.onRowSelect(data,e)}if(!selected&&_.isFunction(self.options.onRowDeselect)){self.options.onRowDeselect(data,e)}}$row=$row||$target.closest("tr.app-datagrid-row");if(action||isQuickEdit&&($target.hasClass("app-datagrid-cell")||$target.closest("td.app-datagrid-cell").length)&&!$row.hasClass("always-new-row")){options.action=options.action||"edit";if(options.operation==="new"||self.options.actionsEnabled.edit){self.toggleEditRow(e,options)}if(options.skipSelect){return}}rowId=$row.attr("data-row-id");rowData=this.preparedData[rowId];data=this.options.data[rowId];selected=rowData&&rowData._selected||false;if(!options.skipSingleCheck&&($row.hasClass("active")&&!this.options.multiselect||!rowData)){if(!isQuickEdit&&options.operation!=="new"){callRowSelectionEvents()}return}this.options.callOnRowClickEvent(data,e);selected=!selected;this.toggleRowSelection($row,selected,e);callRowSelectionEvents()},rowDblClickHandler:function(e,$row){e.stopPropagation();$row=$row||$(e.target).closest("tr.app-datagrid-row");var rowData,rowId=$row.attr("data-row-id");rowData=this.preparedData[rowId];if(!rowData){return}if(_.isFunction(this.options.onRowDblClick)){this.options.onRowDblClick(rowData,e)}},closePopover:function(){this.options.closePopover(this.element)},headerClickHandler:function(e){var $th=$(e.target).closest("th.app-datagrid-header-cell"),id=$th.attr("data-col-id");this.closePopover();this.options.onHeaderClick(this.preparedHeaderData[id],e)},columnSelectionHandler:function(e,$headerCell){if(e){e.stopImmediatePropagation()}var $th=e?$(e.target).closest("th.app-datagrid-header-cell"):$headerCell,id=$th.attr("data-col-id"),colDef=this.preparedHeaderData[id],field=colDef.field,selector='td[data-col-id="'+id+'"]',$column=this.gridElement.find(selector),selected=$column.data("selected")||false,colInfo={colDef:colDef,data:this.options.data.map((function(data){return data[field]})),sortDirection:this._getColumnSortDirection(colDef.field)},selectedClass=this.options.cssClassNames.selectedColumn;selected=!selected;colDef.selected=selected;$column.data("selected",selected);if(selected){$column.addClass(selectedClass);$th.addClass(selectedClass);if(_.isFunction(this.options.onColumnSelect)&&e){this.options.onColumnSelect(colInfo,e)}}else{$column.removeClass(selectedClass);$th.removeClass(selectedClass);if(_.isFunction(this.options.onColumnDeselect)&&e){this.options.onColumnDeselect(colInfo,e)}}},getTextValue:function(fieldName,alwaysNewRow){return this.options.getFieldValue(alwaysNewRow?fieldName+"_new":fieldName)},getUploadedFiles:function($el,fieldName){return _.get(document.forms,[$el.find("form").attr("name"),fieldName,"files",0])},isDataModified:function($editableElements,rowData,alwaysNewRow){var isDataChanged=false,self=this;function getEpoch(val){return val?moment(val).valueOf():val}$editableElements.each((function(){var $el=$(this),colId=$el.attr("data-col-id"),colDef=self.preparedHeaderData[colId],text=self.getTextValue(colDef.field,alwaysNewRow),originalData=_.get(rowData,colDef.field);if(colDef.editWidgetType==="upload"){isDataChanged=self.getUploadedFiles($el,colDef.field)instanceof File}else{if(!self.Utils.isDefined(text)&&(originalData===null||originalData===undefined)){isDataChanged=false}else{if(colDef.editWidgetType==="datetime"){isDataChanged=!(getEpoch(originalData)===getEpoch(text))}else{isDataChanged=!(originalData==text)}}}if(isDataChanged){return!isDataChanged}}));return isDataChanged},focusActiveRow:function(){this.gridElement.find("tr.app-datagrid-row.active").focus()},focusNewRow:function(){var newRow=this.gridElement.find("tr.always-new-row");var newRowInputs=newRow&&newRow.find("input")||[];newRowInputs.length&&newRowInputs[0].focus()},disableActions:function(val){var $deleteBtns=this.gridElement.find(".delete-row-button"),$editBtns=this.gridElement.find(".edit-row-button");if(val){$editBtns.addClass("disabled-action");$deleteBtns.addClass("disabled-action")}else{$editBtns.removeClass("disabled-action");$deleteBtns.removeClass("disabled-action")}},setFocusOnElement:function(e,$el,skipDelay){var $firstEl,$target=e&&$(e.target),$focusEl;if($target&&$target.hasClass("app-datagrid-cell")){$firstEl=$target.find("input")}else{if(!$el){$el=$target.closest("tr.app-datagrid-row").find("td.cell-editing")}else if($el.hasClass("app-datagrid-row")){$el=$el.find("td.cell-editing")}$firstEl=$($el).first().find("input");if(!$firstEl.length){$firstEl=$($el).first().find("textarea")}if(!$firstEl.length){$firstEl=$($el).first().find("select")}}if($firstEl.length){$focusEl=$firstEl.first();if(skipDelay){$focusEl.focus();$focusEl.select()}else{this.options.timeoutCall((function(){$focusEl.focus();$focusEl.select()}))}}},removeNewRow:function($row){this.disableActions(false);this._setGridEditMode(false);if($row.hasClass("always-new-row")){return}$row.attr("data-removed",true);$row.remove();if(!this.preparedData.length){this.setStatus("nodata",this.dataStatus.nodata)}this.addOrRemoveScroll();this.toggleNewRowActions(false)},saveRow:function(callBack){this.gridElement.find("tr.app-datagrid-row.row-editing:not(.always-new-row)").each((function(){$(this).trigger("click",[undefined,{action:"save",skipSelect:true,noMsg:true,success:callBack}])}))},makeRowEditable:function($row,rowData,alwaysNewRow){var self=this,$originalElements=$row.find("td.app-datagrid-cell"),rowId=parseInt($row.attr("data-row-id"),10),$editableElements,_rowData=_.clone(rowData);_rowData.$index=rowId+1;this.options.removeValidations(alwaysNewRow);this.options.generateInlineEditRow(_rowData,alwaysNewRow);$originalElements.each((function(){var $el=$(this),cellText=$el.text(),id=$el.attr("data-col-id"),colDef=self.preparedHeaderData[id],value,editableTemplate;if(!colDef.readonly){value=_.get(rowData,colDef.field);editableTemplate=self.options.getInlineEditWidget(colDef.field,value,alwaysNewRow);if(!(colDef.customExpression||colDef.formatpattern&&colDef.formatpattern!=="None")){$el.addClass("cell-editing").html(editableTemplate).data("originalText",cellText)}else{$el.addClass("cell-editing editable-expression").data("originalValue",{rowIndex:rowId,fieldName:colDef.field});$el.addClass("cell-editing editable-expression").html(editableTemplate).data("originalText",cellText)}$el.addClass("form-group");if(colDef.binding!=="rowOperations"){self.options.timeoutCall((function(){self.options.applyValidations(colDef,alwaysNewRow);if(colDef.required){$el.addClass("required-field")}}))}else if(colDef.required){$el.addClass("required-field")}}}));$editableElements=$row.find("td.cell-editing");$editableElements.on("click",(function(e){e.stopPropagation()}));$editableElements.on("keydown",(function(e){if((e.which===38||e.which===40)&&(e.currentTarget&&!e.currentTarget.closest(".always-new-row"))){e.stopPropagation()}}))},toggleNewRowActions:function(saveInd){var self=this,$gridActions=$(this.element).siblings("div.panel-footer, div.panel-heading").find("div.app-datagrid-actions"),$newRow=this.gridElement.find("tr.app-datagrid-row.row-editing"),$newRowButton=$gridActions.find("i.wi-plus").closest(".app-button");if(this.options.editmode===this.CONSTANTS.INLINE&&(this.options.rowActions.length===0||!_.some(this.options.rowActions,{action:"editRow($event)"}))){if(saveInd){$gridActions.append('<button type="button" wmbutton="" class="btn app-button btn-default cancelNewRow" tabindex="0" accesskey="" title="Cancel">'+'<i aria-hidden="true" class="app-icon wi wi-cancel"></i>'+'<span class="sr-only">Cancel Icon</span><span class="btn-caption">Cancel</span>'+"</button>"+'<button type="button" wmbutton="" class="btn app-button btn-primary saveNewRow" tabindex="0" accesskey="" title="Save">'+'<i aria-hidden="true" class="app-icon wi wi-done"></i>'+'<span class="sr-only">Save Icon</span><span class="btn-caption">Save</span>'+"</button>");$gridActions.find(".cancelNewRow").on("click",(function(event){self.toggleEditRow(event,{action:"cancel",$row:$newRow})}));$gridActions.find(".saveNewRow").on("click",(function(event){self.toggleEditRow(event,{action:"save",$row:$newRow})}));$newRowButton.hide()}else{$("typeahead-container").removeClass("open");$gridActions.find(".cancelNewRow").remove();$gridActions.find(".saveNewRow").remove();$newRowButton.show()}}},_isNewRow:function($row){var rowId=parseInt($row.attr("data-row-id"),10);return rowId>=this.preparedData.length||$row.hasClass("always-new-row")},toggleEditRow:function(e,options){options=options||{};if(e){e.stopPropagation()}this.closePopover();var $row=options.$row||$(e.target).closest("tr.app-datagrid-row"),$editButton=$row.find(".edit-row-button"),$cancelButton=$row.find(".cancel-edit-row-button"),$saveButton=$row.find(".save-edit-row-button"),$deleteButton=$row.find(".delete-row-button"),rowData=_.cloneDeep(this.options.data[$row.attr("data-row-id")])||{},self=this,action,isNewRow,$editableElements,isDataChanged=false,isValid,$requiredEls,alwaysNewRow=$row.hasClass("always-new-row"),advancedEdit=self.options.editmode===self.CONSTANTS.QUICK_EDIT,editOptions={};this.options.setActionRowIndex($row.attr("data-row-id"));this.options.setLastActionPerformed(this.options.ACTIONS.EDIT);function onSaveSuccess(skipFocus,error){if(_.isFunction(options.success)){options.success(skipFocus,error)}if(!advancedEdit||self.options.actionsEnabled.edit){self.focusActiveRow()}}if($row.attr("data-removed")==="true"){return}if(options.selectRow){this.selectRow(rowData,true)}e=e||{};e.data=e.data||{};action=e.data.action||options.action;if(action==="edit"){if(this.options.editmode===this.CONSTANTS.INLINE){this.options.callLoadInlineWidgetData()}if(advancedEdit&&self.gridElement.find("tr.app-datagrid-row.row-editing:not(.always-new-row)").length){self.saveRow((function(skipFocus,error){self.editSuccessHandler(skipFocus,error,e,$row,true)}));return}$row.addClass("row-editing");if(_.isFunction(this.options.beforeRowUpdate)){this.options.beforeRowUpdate(rowData,e)}if(self.options.editmode===self.CONSTANTS.FORM||self.options.editmode===self.CONSTANTS.DIALOG){return}if(options.operation==="new"){self.setDefaultRowData(rowData);self.toggleNewRowActions(true)}if(_.isFunction(this.options.onBeforeFormRender)){isValid=this.options.onBeforeFormRender(rowData,e,options.operation||action);if(isValid===false){return}}this._setGridEditMode(true);this.disableActions(true);$deleteButton.removeClass("disabled-action");this.options.runInNgZone((function(){self.makeRowEditable($row,rowData)}));$editButton.addClass("hidden");$cancelButton.removeClass("hidden");$saveButton.removeClass("hidden");$editableElements=$row.find("td.cell-editing");if(!options.skipFocus&&$editableElements){this.options.timeoutCall((function(){self.setFocusOnElement(e,$editableElements)}))}if(_.isFunction(this.options.onFormRender)){this.options.onFormRender($row,e,options.operation||action,$row.hasClass("always-new-row"))}}else{$editableElements=$row.find("td.cell-editing");isNewRow=self._isNewRow($row);if(action==="save"){if(isNewRow){isDataChanged=true}else{isDataChanged=this.isDataModified($editableElements,rowData,alwaysNewRow)}if(isDataChanged){$editableElements.each((function(){var $el=$(this),colId=$el.attr("data-col-id"),colDef=self.preparedHeaderData[colId],fields=_.split(colDef.field,"."),text;text=self.getTextValue(colDef.field,alwaysNewRow);if(fields.length===1&&colDef.editWidgetType==="upload"){_.set(rowData,colDef.field,self.getUploadedFiles($el,colDef.field))}else{text=(fields.length===1||isNewRow)&&text===""?undefined:text;if(self.Utils.isDefined(text)){text=text==="null"?null:text;if(text===null){if(fields.length>1){_.set(rowData,fields[0],text)}else{if(!isNewRow){_.set(rowData,colDef.field,"")}}}else{_.set(rowData,colDef.field,text)}}else{if(fields.length===1&&!isNewRow){_.set(rowData,colDef.field,text)}}}}));if($editableElements.find(".ng-pending").length>0){setTimeout(this.toggleEditRow.bind(this,e,options),200);return}$requiredEls=$editableElements.find(".ng-invalid");if($requiredEls.length>0){$requiredEls.each((function(index){var $invalidTd=$(this).closest("td.app-datagrid-cell");if(index===0){$invalidTd.find("[focus-target]").focus()}self.options.setTouched($invalidTd.find("[formcontrolname]").attr("formcontrolname"))}));if(_.isFunction(options.success)){options.success(false,true)}return}if(isNewRow&&advancedEdit&&_.isEmpty(rowData)){self.removeNewRow($row);if(_.isFunction(options.success)){options.success(false,undefined,true)}return}if(isNewRow){if(_.isFunction(this.options.onBeforeRowInsert)){isValid=this.options.onBeforeRowInsert(rowData,e,editOptions);if(isValid===false){return}}this.options.onRowInsert(rowData,e,onSaveSuccess,editOptions);self.toggleNewRowActions(false);if(!$row.hasClass("always-new-row")&&self.options.isNavTypeScrollOrOndemand()){self.removeNewRow($row)}}else{if(_.isFunction(this.options.onBeforeRowUpdate)){isValid=this.options.onBeforeRowUpdate(rowData,e,editOptions);if(isValid===false){return}}this.options.afterRowUpdate(rowData,e,onSaveSuccess,editOptions)}}else{this.cancelEdit($row);if(!options.noMsg){this.options.noChangesDetected()}if(_.isFunction(options.success)){options.success(false)}}}else{if(isNewRow){self.removeNewRow($row);return}this.cancelEdit($row)}}this.addOrRemoveScroll()},cancelEdit:function($row){var self=this,$editableElements=$row.find("td.cell-editing"),$cancelButton=$row.find(".cancel-edit-row-button"),$saveButton=$row.find(".save-edit-row-button"),$editButton=$row.find(".edit-row-button");this.options.clearActionRowIndex();this.disableActions(false);$row.removeClass("row-editing");$editableElements.off("click");$editableElements.each((function(){var $el=$(this),value=$el.data("originalValue");$el.removeClass("datetime-wrapper cell-editing required-field form-group");if(!value){$el.text($el.data("originalText")||"")}else{$el.html(self.options.getCustomExpression(value.fieldName,value.rowIndex))}}));$("typeahead-container").removeClass("open");$editButton.removeClass("hidden");$cancelButton.addClass("hidden");$saveButton.addClass("hidden");this._setGridEditMode(false)},closeEditedRow:function(){var $row=this.gridElement.find("tr.app-datagrid-row.row-editing");if($row.length){if(this._isNewRow($row)){this.removeNewRow($row)}else{this.cancelEdit($row)}}},hideRowEditMode:function($row){if($row.hasClass("always-new-row")&&this.options.isNavTypeScrollOrOndemand()){this.resetNewRow($row);return}var $editableElements=$row.find("td.cell-editing"),$editButton=$row.find(".edit-row-button"),$cancelButton=$row.find(".cancel-edit-row-button"),$saveButton=$row.find(".save-edit-row-button"),self=this;$row.removeClass("row-editing");$editableElements.off("click");this.disableActions(false);this._setGridEditMode(false);$editableElements.each((function(){var $el=$(this),value=$el.data("originalValue"),text,colDef;$el.removeClass("datetime-wrapper cell-editing required-field form-group");if(!value){colDef=self.preparedHeaderData[$el.attr("data-col-id")];text=self.getTextValue(colDef.field);$el.text(self.Utils.isDefined(text)?text:"")}else{$el.html(self.options.getCustomExpression(value.fieldName,value.rowIndex))}}));$editButton.removeClass("hidden");$cancelButton.addClass("hidden");$saveButton.addClass("hidden");this.addOrRemoveScroll()},deleteRow:function(e){e.stopPropagation();var $row=$(e.target).closest("tr.app-datagrid-row"),rowId=$row.attr("data-row-id"),rowData=this.options.data[rowId],isNewRow=this._isNewRow($row),className,isActiveRow,isValid,options={},self=this;this.options.setActionRowIndex(rowId);this.options.setLastActionPerformed(this.options.ACTIONS.DELETE);if(_.isFunction(this.options.beforeRowDelete)){this.options.beforeRowDelete(rowData,e)}if(isNewRow){this.disableActions(false);this._setGridEditMode(false);$row.attr("data-removed",true);$row.remove();if(!this.preparedData.length){this.setStatus("nodata",this.dataStatus.nodata)}this.addOrRemoveScroll();return}if(_.isFunction(this.options.onBeforeRowDelete)){isValid=this.options.onBeforeRowDelete(rowData,e,options);if(isValid===false){return}}if(_.isFunction(this.options.onRowDelete)){className=this.options.cssClassNames.deleteRow;isActiveRow=$row.attr("class").indexOf("active")!==-1;if(isActiveRow){$row.removeClass("active")}$row.addClass(className);this.options.onRowDelete(rowData,(function(){if(isActiveRow){$row.addClass("active")}$row.removeClass(className);self.addOrRemoveScroll()}),e,(function(skipFocus,error){if(self.options.isNavTypeScrollOrOndemand()){var rowId=+$(e.target).closest("tr.app-datagrid-row").attr("data-row-id");var $row=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowId+'"]');self.options.setDeletedRowIndex(rowId);self.preparedData.splice(rowId,1);self.options.data.splice(rowId,1);self.gridElement.find("tr.app-datagrid-row:gt("+rowId+")").each((function(index,row){if(!$row.is(":last-child")&&!$(row).hasClass("always-new-row")){$(row).attr("data-row-id",rowId);self.preparedData[rowId].$$pk--;self.preparedData[rowId].$$index--;self.preparedData[rowId].$index--;rowId++}}));$row.remove()}if(self.options.editmode!==self.CONSTANTS.QUICK_EDIT||!($(e.target).hasClass("delete-row-button")||self.Utils.isDeleteKey(e))){return}self.__setStatus();var rowID,$nextRow;if(error){return}rowID=+$(e.target).closest("tr.app-datagrid-row").attr("data-row-id");$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowID+'"]');if(!$nextRow.length){$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+(rowID-1)+'"]')}$nextRow.trigger("click",[undefined,{action:"edit",skipFocus:skipFocus}])}),options)}},deleteRowAndUpdateSelectAll:function(e){this.deleteRow(e);this.updateSelectAllCheckboxState()},_deselectPreviousSelection:function($row,e){var selectedRows=this.gridElement.find("tr.app-datagrid-row.active"),rowId=$row.attr("data-row-id"),self=this;selectedRows.each((function(){var id=$(this).attr("data-row-id"),preparedData=self.preparedData[id];if(id!==rowId&&preparedData){$(this).find("input[rowSelectInput]:radio").prop("checked",false);preparedData._selected=preparedData._checked=false;$(this).removeClass("active");self.options.callOnRowDeselectEvent(preparedData,e)}}))},resetSortIcons:function($el){this.isResetSortIconsDone=true;var $sortContainer;if(!$el&&this.gridHeaderElement){$sortContainer=this.gridHeaderElement.find(".sort-buttons-container.active");$el=$sortContainer.find("i.sort-icon");$sortContainer.removeClass("active")}$el.removeClass("desc asc").removeClass(this.options.cssClassNames.descIcon).removeClass(this.options.cssClassNames.ascIcon)},setSortIconDefault:function(){const sortInfo=this.options.sortInfo,$e=this.tableContainer,$th=$e.find("[data-col-field='"+sortInfo.field+"']"),$sortContainer=$th.find(".sort-buttons-container"),$sortIcon=$sortContainer.find("i.sort-icon"),direction=sortInfo.direction;if(direction==="asc"){$sortIcon.addClass(direction+" "+this.options.cssClassNames.ascIcon);$sortContainer.addClass("active")}else if(direction==="desc"){$sortIcon.addClass(direction+" "+this.options.cssClassNames.descIcon);$sortContainer.addClass("active")}},sortHandler:function(e){e.stopImmediatePropagation();if($(e.target).hasClass("header-data")&&this.options.enableColumnSelection){this.headerClickHandler(e)}var $e=$(e.target),$th=$e.closest("th.app-datagrid-header-cell"),id=$th.attr("data-col-id"),$sortContainer=$th.find(".sort-buttons-container"),$sortIcon=$sortContainer.find("i.sort-icon"),direction=$sortIcon.hasClass("asc")?"desc":"asc",sortInfo=this.options.sortInfo,$previousSortMarker=this.gridHeaderElement.find(".sort-buttons-container.active"),field=$th.attr("data-col-field"),$previousSortedColumn,$previousSortIcon,colId,colDef;this.resetSortIcons($sortIcon);$sortIcon.addClass(direction);if(direction==="asc"){$sortIcon.addClass(this.options.cssClassNames.ascIcon);$sortContainer.addClass("active")}else if(direction==="desc"){$sortIcon.addClass(this.options.cssClassNames.descIcon);$sortContainer.addClass("active")}if($previousSortMarker.length){$previousSortedColumn=$previousSortMarker.closest("th.app-datagrid-header-cell");colId=$previousSortedColumn.attr("data-col-id");colDef=this.preparedHeaderData[colId];$previousSortIcon=$previousSortMarker.find("i.sort-icon");if(colDef.field!==field){$previousSortMarker.removeClass("active");this.resetSortIcons($previousSortIcon)}colDef.sortInfo={sorted:false,direction:""}}sortInfo.direction=direction;sortInfo.field=field;if(direction!==""){this.preparedHeaderData[id].sortInfo={sorted:true,direction:direction}}this._setGridEditMode(false);this.closeEditedRow();this.options.sortHandler.call(this,this.options.sortInfo,e,"sort")},processUpDownKeys:function(event,$row,direction){var self=this;var rowData=$row.find("input").val();if($row.hasClass("row-editing")&&self.options.editmode===self.CONSTANTS.QUICK_EDIT&&rowData){self.toggleEditRow(event,{action:"save",noMsg:true,success:function(skipFocus,error){self.editSuccessHandler(skipFocus,error,event,$row,true,direction)}})}else{$row=direction==="down"?$row.next():$row.prev();if(this.options.rowExpansionEnabled&&!$row.is(":visible")){$row=direction==="down"?$row.next():$row.prev()}$row.focus()}},resetNewRow:function($row){var rowData={},self=this;this.options.clearForm(true);self.setDefaultRowData(rowData);$row.find("[data-field-name]").each((function(){var $input=$(this),fieldName=$input.attr("data-field-name")+"_new";self.options.setFieldValue(fieldName,rowData[$input.attr("data-field-name")]||"")}));self.options.safeApply();self.setFocusOnElement(undefined,$row,true)},_onEnter:function($target,$row,quickEdit,event){var self=this;if($target.is("button")){return}if(quickEdit&&$target.hasClass("app-datagrid-row")&&!$target.hasClass("row-editing")){$row.trigger("click",[undefined,{action:"edit"}])}else{if($row.hasClass("row-editing")&&$target.closest("[data-field-name]").length){$target.blur();self.toggleEditRow(event,{action:"save",success:function(skipFocus,error){if(error){$target.focus()}else{self.focusActiveRow();self.focusNewRow()}}})}else{$row.trigger("click");if(quickEdit&&$target.hasClass("always-new-row")&&$target.hasClass("row-editing")){self.focusNewRow()}}}if(!$target.is("button")){event.stopPropagation()}},onKeyDown:function(event){var $target=$(event.target),$row=$target.closest("tr.app-datagrid-row"),self=this,quickEdit=this.options.editmode===this.CONSTANTS.QUICK_EDIT,isNewRow;if(this.options.rowExpansionEnabled&&!$row.length){$row=$target.closest("tr.app-datagrid-detail-row")}if(this.Utils.isDeleteKey(event)){if(!this.options.actionsEnabled.delete||$target.is("input")||$target.hasClass("form-control")){return}this.deleteRow(event);return}if(event.which===27){isNewRow=this._isNewRow($row);if(isNewRow&&$row.hasClass("always-new-row")){$target.blur();self.resetNewRow($row)}else{$row.trigger("click",[undefined,{action:"cancel"}])}if(!isNewRow){$row.focus()}return}if(event.which===13){event.stopPropagation();this._debounceOnEnter($target,$row,quickEdit,event);return}if(event.which===38){this.processUpDownKeys(event,$row,"up");return}if(event.which===40){this.processUpDownKeys(event,$row,"down")}},editSuccessHandler:function(skipFocus,error,e,$row,isSameRow,direction){var self=this,rowID,$nextRow;self.__setStatus();if(error){self.setFocusOnElement(e);return}rowID=+$row.attr("data-row-id");if(direction){rowID=direction==="down"?++rowID:--rowID;$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowID+'"]');if($nextRow.length){$nextRow.focus()}else{$row.focus()}return}if(!isSameRow&&!_.isUndefined(isSameRow)){rowID++}$nextRow=self.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowID+'"]');if($nextRow.hasClass("always-new-row")){if(self.options.formPosition!=="top"||$row.hasClass("always-new-row")){self.addNewRow(skipFocus)}}else if($nextRow.length){$nextRow.trigger("click",[undefined,{action:"edit",skipFocus:skipFocus,skipSelect:self.options.multiselect}])}else if(self.options.actionsEnabled.new){self.addNewRow(skipFocus)}},isLastColumn:function($target){var $cell=$target.closest("td.app-datagrid-cell"),$editCells;if($cell.is(":last-child")){return true}if($cell.hasClass("cell-editing")){$editCells=$cell.closest("tr.app-datagrid-row").find(".cell-editing").has('> :not([disabled="disabled"])');return $cell.attr("data-col-id")===$editCells.last().attr("data-col-id")}return false},getColInfo:function(event){var row=$(event.target).closest("tr.app-datagrid-row");var rowId=row.attr("data-row-id");var column=$(event.target).closest("td.app-datagrid-cell");var colId=column.attr("data-col-id");if(this.columnClickInfo&&this.columnClickInfo[rowId]&&this.columnClickInfo[rowId][colId]){return this.columnClickInfo[rowId][colId]}return false},attachEventHandlers:function($htm){var $header=this.gridHeaderElement,self=this;if(this.options.enableRowSelection){$htm[0].removeEventListener("click",this.rowClickHandlerOnCapture.bind(this));$htm.off();$htm[0].addEventListener("click",this.rowClickHandlerOnCapture.bind(this));$htm.on("click",this.rowSelectionHandler.bind(this));$htm.on("click","td *",(function(event){if(event.target.type!="checkbox"){var row=$(event.target).closest("tr.app-datagrid-row");var rowId=row.attr("data-row-id");var column=$(event.target).closest("td.app-datagrid-cell");var colId=column.attr("data-col-id");var id=Number(colId);var colDefination=self.preparedHeaderData[id];if(colDefination.readonly){self.columnClickInfo[rowId]={};self.columnClickInfo[rowId][colId]=true}}}));$htm.on("dblclick",this.rowDblClickHandler.bind(this));$htm.on("keydown",this.onKeyDown.bind(this))}if($header){if(this.options.enableColumnSelection){$header.find("th[data-col-selectable]").off("click",this.columnSelectionHandler.bind(this));$header.find("th[data-col-selectable]").on("click",this.columnSelectionHandler.bind(this))}else{$header.find("th[data-col-selectable]").off("click")}if(this.options.enableSort){if(this.options.enableColumnSelection){$header.find("th[data-col-sortable] .header-data").off("click",this.sortHandler.bind(this));$header.find("th[data-col-sortable] .header-data").on("click",this.sortHandler.bind(this))}else{$header.find("th[data-col-sortable]").off("click",this.sortHandler.bind(this));$header.find("th[data-col-sortable]").on("click",this.sortHandler.bind(this))}}else{if(this.options.enableColumnSelection){$header.find("th[data-col-sortable] .header-data").off("click")}else{$header.find("th[data-col-sortable]").off("click")}}}if(this.options.rowActions.length){$htm.find(".cancel-edit-row-button").off("click");$htm.find(".save-edit-row-button").off("click");$htm.find(".cancel-edit-row-button").on("click",{action:"cancel"},this.toggleEditRow.bind(this));$htm.find(".save-edit-row-button").on("click",{action:"save"},this.toggleEditRow.bind(this))}if(self.options.editmode===self.CONSTANTS.QUICK_EDIT){$htm.on("focusout","tr.app-datagrid-row",(function(e){var $target=$(e.target),$row=$target.closest("tr.app-datagrid-row"),$relatedTarget=$(e.relatedTarget),isLastColumn=self.isLastColumn($target,$relatedTarget),isTargetRowAction=$target.closest("span.actions-column").length>0,isRelatedTargetRowAction=$relatedTarget.closest("span.actions-column").length>0,isTargetGridAction=$relatedTarget.closest("div.app-datagrid-actions").length>0,isRelatedTargetGridAction=$relatedTarget.closest("div.app-datagrid-actions").length>0,invalidTargets='.row-editing:not(".always-new-row"), .row-action-button, .app-datagrid-cell, .caption, button.btn-time, button.btn-date';function isInvalidTarget(){if(!$relatedTarget.closest(".app-grid").length){return true}return $relatedTarget.is(invalidTargets)}if($relatedTarget.is("tr.app-datagrid-row")){if($relatedTarget.attr("data-row-id")===$row.attr("data-row-id")){return}}if(isRelatedTargetRowAction||$row.hasClass("danger")||isRelatedTargetGridAction||isTargetRowAction&&isRelatedTargetRowAction||isTargetRowAction&&e.relatedTarget===null||isInvalidTarget()||$relatedTarget.attr("focus-target")===""){return}if(!isTargetGridAction&&!isTargetRowAction){if(!isLastColumn||isLastColumn&&e.relatedTarget===null||$target.hasClass("file-upload")){return}}self.options.timeoutCall((function(){self.toggleEditRow(e,{action:"save",noMsg:true,success:function(skipFocus,error,isNewRow){if(!isNewRow){self.editSuccessHandler(skipFocus,error,e,$row)}}})}))}))}$htm.find('[data-identifier="rowExpansionButtons"]').off("click");$htm.find('[data-identifier="rowExpansionButtons"]').on("click",(function(e){var $row=$(e.target).closest("tr.app-datagrid-row");if($(this).find(".app-button").attr("disabled")){return}self.toggleExpandRow(+$row.attr("data-row-id"),undefined,e)}))},expandRow:function(rowId){this.toggleExpandRow(rowId,true)},collapseRow:function(rowId){this.toggleExpandRow(rowId,false)},_collapseRow:function(e,rowData,rowId,$nextDetailRow,$icon){var self=this,$tbody=self.gridElement,$row=$($tbody.find('> tr.app-datagrid-row[data-row-id="'+rowId+'"]'));$row.removeClass(self.options.cssClassNames.expandedRowClass);$row.find("button, a").attr("aria-expanded","false").attr("aria-live","polite");if(this.options.onBeforeRowCollapse(e,rowData,rowId)===false){return}if($icon.length&&$icon.hasClass(this.options.cssClassNames.rowExpandIcon)){$icon.removeClass(this.options.cssClassNames.rowExpandIcon).addClass(this.options.cssClassNames.rowCollapseIcon)}$nextDetailRow.hide();this.options.onRowCollapse(e,rowData)},toggleExpandRow:function(rowId,isExpand,e){var self=this,$tbody=self.gridElement,$row=$($tbody.find('> tr.app-datagrid-row[data-row-id="'+rowId+'"]')),rowData=_.clone(self.options.data[rowId]),$nextDetailRow=$row.next("tr.app-datagrid-detail-row"),isClosed=!$nextDetailRow.is(":visible"),$icon=$row.find('[data-identifier="rowExpansionButtons"] i.app-icon');rowData.$index=rowId+1;if(isExpand&&!isClosed){return}if(isExpand===false&&isClosed){return}if(isClosed){$row.addClass(self.options.cssClassNames.expandedRowClass);$row.find("button, a").attr("aria-expanded","true");if(e&&self.preparedData[rowId]._selected){e.stopPropagation()}if(self.options.rowDef.closeothers){$tbody.find("> tr.app-datagrid-detail-row:visible").each((function(){var $otherDetailRow=$(this),$otherIcon=$otherDetailRow.prev("tr.app-datagrid-row").find('[data-identifier="rowExpansionButtons"] i.app-icon'),otherRowId=+$otherDetailRow.attr("data-row-id"),otherRowData=self.options.data[otherRowId];$otherDetailRow.hide();self._collapseRow(e,otherRowData,otherRowId,$otherDetailRow,$otherIcon)}))}self.options.generateRowDetailView(e,rowData,rowId,$nextDetailRow.find("td.app-datagrid-row-details-cell .details-section"),$nextDetailRow.find("td.app-datagrid-row-details-cell .row-overlay"),(function(){if($icon.length&&$icon.hasClass(self.options.cssClassNames.rowCollapseIcon)){$icon.removeClass(self.options.cssClassNames.rowCollapseIcon).addClass(self.options.cssClassNames.rowExpandIcon)}$nextDetailRow.show()}))}else{self._collapseRow(e,rowData,rowId,$nextDetailRow,$icon)}},_findAndReplaceCompiledTemplates:function(){if(!this.gridElement){return}var $compiledCells=this.gridElement.find("td[data-compiled-template]"),self=this;$compiledCells.each((function(){var $cell=$(this),id=$cell.attr("data-compiled-template");$cell.replaceWith(self.compiledCellTemplates[id])}))},_renderSearch:function(){var $htm=$(this._getSearchEl()),self=this,$searchBox;function search(e){e.stopPropagation();var searchText=$htm.find('[data-element="dgSearchText"]')[0].value,$filterField=$htm.find('[data-element="dgFilterValue"]'),field=$filterField[0].value,colDefIndex=$htm.find("option:selected").attr("data-coldef-index"),colDef=self.options.colDefs[colDefIndex],type=colDef&&colDef.type?colDef.type:"";self.searchObj={field:field,value:searchText,type:type,event:e};self.options.searchHandler.call(self,self.searchObj,e,"search")}this.element.find(".form-search").remove();$htm.insertBefore(this.gridContainer);this.gridSearch=this.element.find(".form-search");$searchBox=this.gridSearch.find('[data-element="dgSearchText"]');this.gridSearch.find(".app-search-button").on("click",search);this.gridSearch.find('[data-element="dgFilterValue"]').on("change",(function(e){if(self.dataStatusContainer.find(".status").text()===self.options.dataStates.nodata){search(e)}}));$searchBox.on("keyup",(function(e){e.stopPropagation();if(!$(this).val()){self.emptySearch=true;if(self.searchObj.value){self.searchObj.value="";search(e)}}else{self.emptySearch=false}if(e.which===13||self.options.filteronkeypress){search(e)}}))},_renderRowFilter:function(){var $row=$('<tr class="filter-row"></tr>'),self=this,$headerElement=this.options.isMobile&&!this.options.showHeader?this.gridElement:this.gridHeaderElement;$headerElement.find(".filter-row").remove();this.options.generateFilterRow();this.preparedHeaderData.forEach((function(field,index){var fieldName=field.field,$th=$('<th data-col-id="'+index+'"></th>');if(!field.searchable){$row.append($th);return}$th.append(self.options.getFilterWidget(fieldName));$row.append($th)}),this);if(this.options.showHeader){this.gridHeaderElement.append($row)}else{if(this.options.isMobile){$headerElement.empty().append($row)}else{$headerElement.empty().append($row)}}this.gridSearch=$headerElement.find(".filter-row")},_renderHeader:function(){var headerTemplate=this._getHeaderTemplate(),$colgroup=headerTemplate.colgroup,self=this,$header;this.gridElement.parent().scroll((function(){self.gridHeaderElement.parent().prop("scrollLeft",this.scrollLeft)}));if(!this.options.showHeader){this.tableContainer.append($colgroup);this.gridHeaderElement.hide();return}else{this.gridHeaderElement.show()}$header=headerTemplate.header;function toggleSelectAll(e){var $checkboxes=$('tr.app-datagrid-row:not(.always-new-row):visible td input[name="gridMultiSelect"]:checkbox',self.gridElement),checked=this.checked;$checkboxes.prop("checked",checked);$checkboxes.each((function(){var $row=$(this).closest("tr.app-datagrid-row"),rowId=$row.attr("data-row-id"),rowData=self.options.data[rowId];self.options.assignSelectedItems(rowData,e,{rowId:rowId,_selected:self.preparedData[rowId]?._selected});self.toggleRowSelection($row,checked,e,true);if(checked&&_.isFunction(self.options.onRowSelect)){self.options.onRowSelect(rowData,e)}if(!checked&&_.isFunction(self.options.onRowDeselect)){self.options.onRowDeselect(rowData,e)}}))}var headerCells=$header.find("th.app-datagrid-header-cell");var headerCols=$colgroup.find("col");headerCells.each((function(){var id=Number($(this).attr("data-col-id")),colDef=self.preparedHeaderData[id],$headerCol=$(headerCols[id]);if(!colDef){return}if(!_.isUndefined(colDef.show)&&!colDef.show){$(this).hide();$headerCol.hide()}}));if(this.options.isMobile){this.tableContainer.append($colgroup)}else{this.tableContainer.append($colgroup)}$header.on("click",".app-datagrid-header-cell input:checkbox",toggleSelectAll);if(_.isFunction(this.options.onHeaderClick)){this.gridHeaderElement.find("th.app-datagrid-header-cell").on("click",this.headerClickHandler.bind(this))}if(!this.options.isMobile&&this.gridHeaderElement.length){this.gridHeaderElement.find("th[data-col-resizable]").resizable({handles:"e",minWidth:50,resize:function(evt,ui){var $colElement,$colHeaderElement,$cellElements,colIndex=+ui.helper.attr("data-col-id")+1,originalWidth=ui.helper.width(),newWidth=ui.size.width,originalTableWidth,newTableWidth;$colHeaderElement=self.tableContainer.find("colgroup > col:nth-child("+colIndex+")");$colElement=self.tableContainer.find("colgroup > col:nth-child("+colIndex+")");$cellElements=self.gridElement.find("tr.app-datagrid-row > td:nth-child("+colIndex+") > div");$colElement.width(newWidth);$colHeaderElement.width(newWidth);$cellElements.width(newWidth);$(this).css("height","auto");if(newWidth>ui.originalSize.width){originalTableWidth=self.gridHeaderElement.width();newTableWidth=originalTableWidth+newWidth-originalWidth;self.gridHeaderElement.width(newTableWidth);self.gridElement.width(newTableWidth)}self.addOrRemoveScroll();self.options.redrawWidgets()}})}if(!this.isResetSortIconsDone){this.setSortIconDefault()}},addOrRemoveScroll:function(){var gridContent=this.gridContainer.find("tbody"),gridHeader=this.gridContainer.find(".table-header");if(gridContent.scrollHeight>gridContent.clientHeight&&!this.Utils.isMac()){gridHeader.addClass("scroll-visible")}else{gridHeader.removeClass("scroll-visible")}},_handleCustomEvents:function(e,options){this.options.handleCustomEvents(e,options)},_setActionsEnabled:function(){var self=this;_.forEach(this.options.rowActions,(function(def){if(_.includes(def.action,"editRow(")){self.options.actionsEnabled.edit=true}else if(_.includes(def.action,"deleteRow(")){self.options.actionsEnabled.delete=true}}))},_appendRowActions:function($htm,isNewRow,rowData){var self,rowOperationsCol=this._getRowActionsColumnDef();if(this.options.rowActions.length||rowOperationsCol){this._setActionsEnabled();self=this;$htm.find("[data-identifier='actionButtons']").each((function(index){var _rowData,$row,rowId,rowIndex=index;if(isNewRow){_rowData=rowData}else{$row=$(this).closest("tr.app-datagrid-row");rowId=parseInt($row.attr("data-row-id"),10);_rowData=_.clone(self.options.data[rowId]);_rowData.$index=rowIndex+1}self.options.generateRowActions(_rowData,rowIndex);$(this).empty().append(self.options.getRowAction(rowIndex))}))}},_renderGrid:function(isCreated){var $htm,isScrollorOnDemand=this.options.isNavTypeScrollOrOndemand(),pageStartIndex=this.getPageStartIndex();$("table.table-bordered").parents(".app-grid-header-inner").addClass("table_border");if(isScrollorOnDemand){var $tbody=this.gridElement;var template=this._getGridTemplate();$htm=$(template);if(template&&!$tbody.length){this.gridElement.append($htm)}}else{var templates=this._getGridTemplate();$htm=$(templates);if(templates){this.gridElement.append($htm)}}if(this.options.summaryRow){var $summaryRowHtm=$(this._getSummaryRowTemplate());this.tableContainer.find("tfoot").remove();if(this.options.data.length){this.tableContainer.append($summaryRowHtm)}}if(!this.options.data.length&&this.dataStatus.state==="nodata"){this.setStatus("nodata")}else{this.dataStatus.state=this.dataStatus.state||"loading";this.dataStatus.message=this.dataStatus.message||this.options.dataStates.loading;this.setStatus(this.dataStatus.state,this.dataStatus.message,isCreated)}this.gridBody=this.gridElement.find("tbody");this.gridFooter=this.tableContainer.find("tfoot");this._findAndReplaceCompiledTemplates();this.options.clearRowActions();this._appendRowExpansionButtons($htm);this._appendRowActions($htm);this.attachEventHandlers($htm);this.__setStatus(isCreated);if(this.options.editmode===this.CONSTANTS.QUICK_EDIT&&this.options.showNewRow){this.addNewRow(false,true)}if(isCreated){this._setColSpan(this.options.headerConfig)}if(_.isFunction(this.options.onDataRender)){this.options.onDataRender()}if(!isCreated&&this.options.selectFirstRow){if(this.options.multiselect){this.options.selectFirstRow=false}if(this.gridElement.find("tr.app-datagrid-row.active").length<=0){this.selectFirstRow(true,true)}}},_render:function(isCreated){if(!this.tableId){this.tableId=this.Utils.generateGuid()}var overflow=this.options.isNavTypeScrollOrOndemand()&&(this.options.height==="100%"||this.options.height==="auto")?"hidden":"auto";var statusContainer='<div class="overlay">'+'<div class="status"><i class="'+this.options.loadingicon+'"></i><span class="message"></span></div>'+"</div>",table='<div class="table-container table-responsive">'+'<div class="app-grid-header">'+'<div class="app-grid-header-inner">'+'<table tabindex="0" class="'+this.options.cssClassNames.gridDefault+" "+this.options.cssClassNames.grid+'">'+'<thead tabindex="0" class="table-header thead-sticky" id="table_header_'+this.tableId+'">'+'</thead><tbody class="app-grid-content app-datagrid-body" id="table_'+this.tableId+'">'+"</tbody></table>"+"</div></div></div>",$statusContainer=$(statusContainer),$tableContainer=this.element.find(".table-container");this.gridContainer=$(table);this.gridHeaderElement=this.gridContainer.find(".table-header");this._setStyles($statusContainer.find("div.overlay"),"display:none");this._setStyles(this.gridContainer.find("div.app-grid-header-inner"),"height:"+this.options.height+"; overflow: auto;");this.tableContainer=this.gridContainer.find("table");this.gridElement=this.gridContainer.find(".app-grid-content");if(this.options.isNavTypeScrollOrOndemand()&&(!$tableContainer.length||!this.options.isNextPageData)||!this.options.isNavTypeScrollOrOndemand()){this.element.find(".table-container").remove();this.element.append(this.gridContainer)}this.options.setIsNextPageData(false);if(!this.gridContainer.find(".overlay").length){this.dataStatusContainer=$(statusContainer);this.gridContainer.append(this.dataStatusContainer)}if(this.gridHeaderElement){this.gridHeaderElement.empty();this.gridElement.find("colgroup").remove()}this._renderHeader();if(this.options.filtermode===this.CONSTANTS.SEARCH&&(_.isEmpty(this.searchObj)||this.searchObj&&!this.searchObj.field&&!this.searchObj.value)){this._renderSearch()}else if(this.options.filtermode===this.CONSTANTS.MULTI_COLUMN){this._renderRowFilter()}if(this.options.spacing==="condensed"){this._toggleSpacingClasses("condensed")}this._renderGrid(isCreated);this.addNavigationControls()},addNavigationControls:function(){if(this.options.isdynamictable){this.element.find(".on-demand-datagrid").remove();if(this.options.navigation==="On-Demand"&&!this.element.find(".on-demand-datagrid").length){this.options.addLoadMoreBtn()}else if(this.options.navigation==="Scroll"){this.options.bindScrollEvt()}}},__setStatus:function(isCreated){var loadingIndicator=this.dataStatusContainer.find("i"),state=this.dataStatus.state,isScrollOrOndemand=this.options.isNavTypeScrollOrOndemand();this.dataStatusContainer.find(".message").text(this.dataStatus.message);if(state==="loading"){loadingIndicator.removeClass("hidden")}else{loadingIndicator.addClass("hidden")}if(state==="ready"){this.dataStatusContainer.hide()}else{if(this.options.isNavTypeScrollOrOndemand()&&(state==="nodata"||this.options.getCurrentPage()==this.options.getPageCount()&&!this.options.showviewlessbutton)){this.element.find(".on-demand-datagrid a").hide()}this.dataStatusContainer.show()}if(state==="nodata"||state==="loading"||state==="error"){if(this.options.height==="100%"||this.options.height==="auto"){if(state==="nodata"){this.dataStatusContainer.css("height","auto");this.dataStatus.contentHeight=0}else if(this.options.isNavTypeScrollOrOndemand()&&this.options.getCurrentPage()>1){this.dataStatusContainer.hide()}else{this.dataStatus.height=this.dataStatus.height||this.dataStatusContainer.outerHeight();this.dataStatus.contentHeight=this.gridElement.outerHeight()||this.dataStatus.contentHeight;this.dataStatusContainer.css("height",this.dataStatus.height>this.dataStatus.contentHeight?"auto":this.dataStatus.contentHeight)}}if(!isScrollOrOndemand||isScrollOrOndemand&&this.options.getCurrentPage()===1){this.gridContainer.addClass("show-msg")}}else{this.gridContainer.removeClass("show-msg");if(this.options.editmode===this.CONSTANTS.QUICK_EDIT){if(this.options.activeRow){this.attachHandlersToActiveRow(this.options.activeRow)}this.options.activeRow=undefined}}if(!isCreated){this.setColGroupWidths()}this.addOrRemoveScroll()},attachHandlersToActiveRow(rowObj){var rowIndex=this.Utils.getObjectIndex(this.options.data,rowObj);var row=this.gridElement.find("tr.app-datagrid-row[data-row-id="+rowIndex+"]");if(!row.length){return}else if(!row.hasClass("active")){row.addClass("active")}this.focusActiveRow();this.attachEventHandlers(row)},setActiveRow(row){this.options.activeRow=row},setStatus:function(state,message,isCreated){var $newRow;if(state==="nodata"){$newRow=this.gridElement&&this.gridElement.find("tr.app-datagrid-row.always-new-row");state=$newRow&&$newRow.length?"ready":state}this.dataStatus.state=state;this.options.setGridState(state);this.dataStatus.message=message||this.options.dataStates[state];if(this._setStatusCalled){this._setStatus(isCreated)}else{this.__setStatus(isCreated);this._setStatusCalled=true}},setGridDimensions:function(key,value){if(value.indexOf("px")===-1&&value.indexOf("%")===-1&&value.indexOf("em")===-1&&value!="auto"){value=value+"px"}this.options[key]=value;if(key==="height"){var elements=this.gridHeaderElement.find("th");this.gridContainer.find(".app-grid-header-inner").css(key,value);if(this.options.isNavTypeScrollOrOndemand()&&(this.options.height!="100%"&&this.options.height!="auto")){this.gridContainer.find(".app-grid-header-inner").css("overflow","auto")}this.dataStatusContainer.css(key,value)}this.addOrRemoveScroll()},setColumnProp:function(fieldName,property,val,isGroup){var $col;if(property==="displayName"){if(isGroup){$col=this.gridHeaderElement.find('th[data-col-group="'+fieldName+'"]')}else{$col=this.gridHeaderElement.find('th[data-col-field="'+fieldName+'"]')}$col.attr("title",val);$col.find(".header-data").html(val);if(this.options.filtermode===this.CONSTANTS.SEARCH&&this.gridSearch){this.gridSearch.find('select option[value="'+fieldName+'"]').text(val)}}},applyRowNgClass:function(val,index){var $row=this.gridElement.find('tr.app-datagrid-row[data-row-id="'+index+'"]');$row.removeClass(val.toRemove);$row.addClass(val.toAdd)},applyColNgClass:function(val,rowIndex,colIndex){var $cell=this.gridElement.find('tr.app-datagrid-row[data-row-id="'+rowIndex+'"] td.app-datagrid-cell[data-col-id="'+colIndex+'"]');$cell.removeClass(val.toRemove);$cell.addClass(val.toAdd)},_destroy:function(){this.element.text("");window.clearTimeout(this.refreshGridTimeout)}});(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("rxjs")):typeof define==="function"&&define.amd?define(["exports","rxjs"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory((global.awesomeCordova=global.awesomeCordova||{},global.awesomeCordova.core={}),global.rxjs))})(this,(function(exports,rxjs){"use strict";function checkReady(){if(typeof process==="undefined"){var win_1=typeof window!=="undefined"?window:{};var DEVICE_READY_TIMEOUT_1=5e3;var before_1=Date.now();var didFireReady_1=false;win_1.document.addEventListener("deviceready",(function(){console.log("Ionic Native: deviceready event fired after "+(Date.now()-before_1)+" ms");didFireReady_1=true}));setTimeout((function(){if(!didFireReady_1&&win_1.cordova){console.warn("Ionic Native: deviceready did not fire within "+DEVICE_READY_TIMEOUT_1+"ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.")}}),DEVICE_READY_TIMEOUT_1)}}var ERR_CORDOVA_NOT_AVAILABLE={error:"cordova_not_available"};var ERR_PLUGIN_NOT_INSTALLED={error:"plugin_not_installed"};function getPromise(callback){var tryNativePromise=function(){if(Promise){return new Promise((function(resolve,reject){callback(resolve,reject)}))}else{console.error("No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.")}};if(typeof window!=="undefined"&&window.angular){var doc=window.document;var injector=window.angular.element(doc.querySelector("[ng-app]")||doc.body).injector();if(injector){var $q=injector.get("$q");return $q((function(resolve,reject){callback(resolve,reject)}))}console.warn("Angular 1 was detected but $q couldn't be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won't trigger an automatic digest when promises resolve.")}return tryNativePromise()}function wrapPromise(pluginObj,methodName,args,opts){if(opts===void 0){opts={}}var pluginResult,rej;var p=getPromise((function(resolve,reject){if(opts.destruct){pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return resolve(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return reject(args)}))}else{pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,resolve,reject)}rej=reject}));if(pluginResult&&pluginResult.error){p.catch((function(){}));typeof rej==="function"&&rej(pluginResult.error)}return p}function wrapOtherPromise(pluginObj,methodName,args,opts){if(opts===void 0){opts={}}return getPromise((function(resolve,reject){var pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts);if(pluginResult){if(pluginResult.error){reject(pluginResult.error)}else if(pluginResult.then){pluginResult.then(resolve).catch(reject)}}else{reject({error:"unexpected_error"})}}))}function wrapObservable(pluginObj,methodName,args,opts){if(opts===void 0){opts={}}return new rxjs.Observable((function(observer){var pluginResult;if(opts.destruct){pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.next(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.error(args)}))}else{pluginResult=callCordovaPlugin(pluginObj,methodName,args,opts,observer.next.bind(observer),observer.error.bind(observer))}if(pluginResult&&pluginResult.error){observer.error(pluginResult.error);observer.complete()}return function(){try{if(opts.clearFunction){if(opts.clearWithArgs){return callCordovaPlugin(pluginObj,opts.clearFunction,args,opts,observer.next.bind(observer),observer.error.bind(observer))}return callCordovaPlugin(pluginObj,opts.clearFunction,[])}}catch(e){console.warn("Unable to clear the previous observable watch for",pluginObj.constructor.getPluginName(),methodName);console.warn(e)}}}))}function wrapEventObservable(event,element){element=typeof window!=="undefined"&&element?get$1(window,element):element||(typeof window!=="undefined"?window:{});return rxjs.fromEvent(element,event)}function checkAvailability(plugin,methodName,pluginName){var pluginRef,pluginPackage;if(typeof plugin==="string"){pluginRef=plugin}else{pluginRef=plugin.constructor.getPluginRef();pluginName=plugin.constructor.getPluginName();pluginPackage=plugin.constructor.getPluginInstallName()}var pluginInstance=getPlugin(pluginRef);if(!pluginInstance||!!methodName&&typeof pluginInstance[methodName]==="undefined"){if(typeof window==="undefined"||!window.cordova){cordovaWarn(pluginName,methodName);return ERR_CORDOVA_NOT_AVAILABLE}pluginWarn(pluginName,pluginPackage,methodName);return ERR_PLUGIN_NOT_INSTALLED}return true}function instanceAvailability(pluginObj,methodName){return pluginObj._objectInstance&&(!methodName||typeof pluginObj._objectInstance[methodName]!=="undefined")}function setIndex(args,opts,resolve,reject){if(opts===void 0){opts={}}if(opts.sync){return args}if(opts.callbackOrder==="reverse"){args.unshift(reject);args.unshift(resolve)}else if(opts.callbackStyle==="node"){args.push((function(err,result){if(err){reject(err)}else{resolve(result)}}))}else if(opts.callbackStyle==="object"&&opts.successName&&opts.errorName){var obj={};obj[opts.successName]=resolve;obj[opts.errorName]=reject;args.push(obj)}else if(typeof opts.successIndex!=="undefined"||typeof opts.errorIndex!=="undefined"){var setSuccessIndex=function(){if(opts.successIndex>args.length){args[opts.successIndex]=resolve}else{args.splice(opts.successIndex,0,resolve)}};var setErrorIndex=function(){if(opts.errorIndex>args.length){args[opts.errorIndex]=reject}else{args.splice(opts.errorIndex,0,reject)}};if(opts.successIndex>opts.errorIndex){setErrorIndex();setSuccessIndex()}else{setSuccessIndex();setErrorIndex()}}else{args.push(resolve);args.push(reject)}return args}function callCordovaPlugin(pluginObj,methodName,args,opts,resolve,reject){if(opts===void 0){opts={}}args=setIndex(args,opts,resolve,reject);var availabilityCheck=checkAvailability(pluginObj,methodName);if(availabilityCheck===true){var pluginInstance=getPlugin(pluginObj.constructor.getPluginRef());return pluginInstance[methodName].apply(pluginInstance,args)}else{return availabilityCheck}}function callInstance(pluginObj,methodName,args,opts,resolve,reject){if(opts===void 0){opts={}}args=setIndex(args,opts,resolve,reject);if(instanceAvailability(pluginObj,methodName)){return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance,args)}}function getPlugin(pluginRef){if(typeof window!=="undefined"){return get$1(window,pluginRef)}return null}function get$1(element,path){var paths=path.split(".");var obj=element;for(var i=0;i<paths.length;i++){if(!obj){return null}obj=obj[paths[i]]}return obj}function pluginWarn(pluginName,plugin,method){if(method){console.warn("Native: tried calling "+pluginName+"."+method+", but the "+pluginName+" plugin is not installed.")}else{console.warn("Native: tried accessing the "+pluginName+" plugin but it's not installed.")}if(plugin){console.warn("Install the "+pluginName+" plugin: 'ionic cordova plugin add "+plugin+"'")}}function cordovaWarn(pluginName,method){if(typeof process==="undefined"){if(method){console.warn("Native: tried calling "+pluginName+"."+method+", but Cordova is not available. Make sure to include cordova.js or run in a device/simulator")}else{console.warn("Native: tried accessing the "+pluginName+" plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator")}}}var wrap=function(pluginObj,methodName,opts){if(opts===void 0){opts={}}return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}if(opts.sync){return callCordovaPlugin(pluginObj,methodName,args,opts)}else if(opts.observable){return wrapObservable(pluginObj,methodName,args,opts)}else if(opts.eventObservable&&opts.event){return wrapEventObservable(opts.event,opts.element)}else if(opts.otherPromise){return wrapOtherPromise(pluginObj,methodName,args,opts)}else{return wrapPromise(pluginObj,methodName,args,opts)}}};function wrapInstance(pluginObj,methodName,opts){if(opts===void 0){opts={}}return function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}if(opts.sync){return callInstance(pluginObj,methodName,args,opts)}else if(opts.observable){return new rxjs.Observable((function(observer){var pluginResult;if(opts.destruct){pluginResult=callInstance(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.next(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return observer.error(args)}))}else{pluginResult=callInstance(pluginObj,methodName,args,opts,observer.next.bind(observer),observer.error.bind(observer))}if(pluginResult&&pluginResult.error){observer.error(pluginResult.error)}return function(){try{if(opts.clearWithArgs){return callInstance(pluginObj,opts.clearFunction,args,opts,observer.next.bind(observer),observer.error.bind(observer))}return callInstance(pluginObj,opts.clearFunction,[])}catch(e){console.warn("Unable to clear the previous observable watch for",pluginObj.constructor.getPluginName(),methodName);console.warn(e)}}}))}else if(opts.otherPromise){return getPromise((function(resolve,reject){var result;if(opts.destruct){result=callInstance(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return resolve(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return reject(args)}))}else{result=callInstance(pluginObj,methodName,args,opts,resolve,reject)}if(result&&result.then){result.then(resolve,reject)}else{reject()}}))}else{var pluginResult_1,rej_1;var p=getPromise((function(resolve,reject){if(opts.destruct){pluginResult_1=callInstance(pluginObj,methodName,args,opts,(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return resolve(args)}),(function(){var args=[];for(var _i=0;_i<arguments.length;_i++){args[_i]=arguments[_i]}return reject(args)}))}else{pluginResult_1=callInstance(pluginObj,methodName,args,opts,resolve,reject)}rej_1=reject}));if(pluginResult_1&&pluginResult_1.error){p.catch((function(){}));typeof rej_1==="function"&&rej_1(pluginResult_1.error)}return p}}}function get(element,path){var paths=path.split(".");var obj=element;for(var i=0;i<paths.length;i++){if(!obj){return null}obj=obj[paths[i]]}return obj}var AwesomeCordovaNativePlugin=function(){function AwesomeCordovaNativePlugin(){}AwesomeCordovaNativePlugin.installed=function(){var isAvailable=checkAvailability(this.pluginRef)===true;return isAvailable};AwesomeCordovaNativePlugin.getPlugin=function(){if(typeof window!=="undefined"){return get(window,this.pluginRef)}return null};AwesomeCordovaNativePlugin.getPluginName=function(){var pluginName=this.pluginName;return pluginName};AwesomeCordovaNativePlugin.getPluginRef=function(){var pluginRef=this.pluginRef;return pluginRef};AwesomeCordovaNativePlugin.getPluginInstallName=function(){var plugin=this.plugin;return plugin};AwesomeCordovaNativePlugin.getSupportedPlatforms=function(){var platform=this.platforms;return platform};AwesomeCordovaNativePlugin.pluginName="";AwesomeCordovaNativePlugin.pluginRef="";AwesomeCordovaNativePlugin.plugin="";AwesomeCordovaNativePlugin.repo="";AwesomeCordovaNativePlugin.platforms=[];AwesomeCordovaNativePlugin.install="";return AwesomeCordovaNativePlugin}();function cordova(pluginObj,methodName,config,args){return wrap(pluginObj,methodName,config).apply(this,args)}function overrideFunction(pluginObj,methodName){return new rxjs.Observable((function(observer){var availabilityCheck=checkAvailability(pluginObj,methodName);if(availabilityCheck===true){var pluginInstance_1=getPlugin(pluginObj.constructor.getPluginRef());pluginInstance_1[methodName]=observer.next.bind(observer);return function(){return pluginInstance_1[methodName]=function(){}}}else{observer.error(availabilityCheck);observer.complete()}}))}function cordovaFunctionOverride(pluginObj,methodName,args){return overrideFunction(pluginObj,methodName)}function cordovaInstance(pluginObj,methodName,config,args){args=Array.from(args);return wrapInstance(pluginObj,methodName,config).apply(this,args)}function cordovaPropertyGet(pluginObj,key){if(checkAvailability(pluginObj,key)===true){return getPlugin(pluginObj.constructor.getPluginRef())[key]}return null}function cordovaPropertySet(pluginObj,key,value){if(checkAvailability(pluginObj,key)===true){getPlugin(pluginObj.constructor.getPluginRef())[key]=value}}function instancePropertyGet(pluginObj,key){if(pluginObj._objectInstance&&pluginObj._objectInstance[key]){return pluginObj._objectInstance[key]}return null}function instancePropertySet(pluginObj,key,value){if(pluginObj._objectInstance){pluginObj._objectInstance[key]=value}}checkReady();window.rxjs._throw=window.rxjs.throwError;exports.AwesomeCordovaNativePlugin=AwesomeCordovaNativePlugin;exports.checkAvailability=checkAvailability;exports.cordova=cordova;exports.cordovaFunctionOverride=cordovaFunctionOverride;exports.cordovaInstance=cordovaInstance;exports.cordovaPropertyGet=cordovaPropertyGet;exports.cordovaPropertySet=cordovaPropertySet;exports.getPromise=getPromise;exports.instanceAvailability=instanceAvailability;exports.instancePropertyGet=instancePropertyGet;exports.instancePropertySet=instancePropertySet;exports.wrap=wrap}));(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory(require("tslib"),require("@angular/core"),require("@awesome-cordova-plugins/core"),require("rxjs"),require("rxjs/operators")):typeof define==="function"&&define.amd?define(["tslib","@angular/core","@awesome-cordova-plugins/core","rxjs","rxjs/operators"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.awesomeCordova=global.awesomeCordova||{},global.awesomeCordova.plugins=factory(global.tslib,global.ng.core,global.awesomeCordova.core,global.rxjs,global.rxjs.operators))})(this,(function(tslib,core$1,core,rxjs,operators){"use strict";var AppVersion=function(_super){tslib.__extends(AppVersion,_super);function AppVersion(){return _super!==null&&_super.apply(this,arguments)||this}AppVersion.prototype.getAppName=function(){return core.cordova(this,"getAppName",{},arguments)};AppVersion.prototype.getPackageName=function(){return core.cordova(this,"getPackageName",{},arguments)};AppVersion.prototype.getVersionCode=function(){return core.cordova(this,"getVersionCode",{},arguments)};AppVersion.prototype.getVersionNumber=function(){return core.cordova(this,"getVersionNumber",{},arguments)};AppVersion.pluginName="AppVersion";AppVersion.plugin="cordova-plugin-app-version";AppVersion.pluginRef="cordova.getAppVersion";AppVersion.repo="https://github.com/whiteoctober/cordova-plugin-app-version";AppVersion.platforms=["Android","iOS","Windows"];AppVersion.decorators=[{type:core$1.Injectable}];return AppVersion}(core.AwesomeCordovaNativePlugin);var AppVersion$1=Object.freeze({__proto__:null,AppVersion:AppVersion});var BarcodeScanner=function(_super){tslib.__extends(BarcodeScanner,_super);function BarcodeScanner(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.Encode={TEXT_TYPE:"TEXT_TYPE",EMAIL_TYPE:"EMAIL_TYPE",PHONE_TYPE:"PHONE_TYPE",SMS_TYPE:"SMS_TYPE"};return _this}BarcodeScanner.prototype.scan=function(options){return core.cordova(this,"scan",{callbackOrder:"reverse"},arguments)};BarcodeScanner.prototype.encode=function(type,data){return core.cordova(this,"encode",{},arguments)};BarcodeScanner.pluginName="BarcodeScanner";BarcodeScanner.plugin="phonegap-plugin-barcodescanner";BarcodeScanner.pluginRef="cordova.plugins.barcodeScanner";BarcodeScanner.repo="https://github.com/phonegap/phonegap-plugin-barcodescanner";BarcodeScanner.platforms=["Android","BlackBerry 10","Browser","iOS","Windows"];BarcodeScanner.decorators=[{type:core$1.Injectable}];return BarcodeScanner}(core.AwesomeCordovaNativePlugin);var BarcodeScanner$1=Object.freeze({__proto__:null,BarcodeScanner:BarcodeScanner});var Calendar=function(_super){tslib.__extends(Calendar,_super);function Calendar(){return _super!==null&&_super.apply(this,arguments)||this}Calendar.prototype.hasReadWritePermission=function(){return core.cordova(this,"hasReadWritePermission",{},arguments)};Calendar.prototype.hasReadPermission=function(){return core.cordova(this,"hasReadPermission",{},arguments)};Calendar.prototype.hasWritePermission=function(){return core.cordova(this,"hasWritePermission",{},arguments)};Calendar.prototype.requestWritePermission=function(){return core.cordova(this,"requestWritePermission",{},arguments)};Calendar.prototype.requestReadPermission=function(){return core.cordova(this,"requestReadPermission",{},arguments)};Calendar.prototype.requestReadWritePermission=function(){return core.cordova(this,"requestReadWritePermission",{},arguments)};Calendar.prototype.createCalendar=function(nameOrOptions){return core.cordova(this,"createCalendar",{},arguments)};Calendar.prototype.deleteCalendar=function(name){return core.cordova(this,"deleteCalendar",{},arguments)};Calendar.prototype.getCalendarOptions=function(){return core.cordova(this,"getCalendarOptions",{sync:true},arguments)};Calendar.prototype.getCreateCalendarOptions=function(){return core.cordova(this,"getCreateCalendarOptions",{sync:true},arguments)};Calendar.prototype.createEvent=function(title,location,notes,startDate,endDate){return core.cordova(this,"createEvent",{},arguments)};Calendar.prototype.createEventWithOptions=function(title,location,notes,startDate,endDate,options){return core.cordova(this,"createEventWithOptions",{},arguments)};Calendar.prototype.createEventInteractively=function(title,location,notes,startDate,endDate){return core.cordova(this,"createEventInteractively",{},arguments)};Calendar.prototype.createEventInteractivelyWithOptions=function(title,location,notes,startDate,endDate,options){return core.cordova(this,"createEventInteractivelyWithOptions",{},arguments)};Calendar.prototype.findEvent=function(title,location,notes,startDate,endDate){return core.cordova(this,"findEvent",{},arguments)};Calendar.prototype.findEventWithOptions=function(title,location,notes,startDate,endDate,options){return core.cordova(this,"findEventWithOptions",{},arguments)};Calendar.prototype.listEventsInRange=function(startDate,endDate){return core.cordova(this,"listEventsInRange",{platforms:["Android"]},arguments)};Calendar.prototype.listCalendars=function(){return core.cordova(this,"listCalendars",{},arguments)};Calendar.prototype.findAllEventsInNamedCalendar=function(calendarName){return core.cordova(this,"findAllEventsInNamedCalendar",{platforms:["iOS"]},arguments)};Calendar.prototype.modifyEvent=function(title,location,notes,startDate,endDate,newTitle,newLocation,newNotes,newStartDate,newEndDate){return core.cordova(this,"modifyEvent",{platforms:["iOS"]},arguments)};Calendar.prototype.modifyEventWithOptions=function(title,location,notes,startDate,endDate,newTitle,newLocation,newNotes,newStartDate,newEndDate,filterOptions,newOptions){return core.cordova(this,"modifyEventWithOptions",{platforms:["iOS"]},arguments)};Calendar.prototype.deleteEvent=function(title,location,notes,startDate,endDate){return core.cordova(this,"deleteEvent",{},arguments)};Calendar.prototype.deleteEventFromNamedCalendar=function(title,location,notes,startDate,endDate,calendarName){return core.cordova(this,"deleteEventFromNamedCalendar",{platforms:["iOS"]},arguments)};Calendar.prototype.deleteEventById=function(id,fromDate){return core.cordova(this,"deleteEventById",{},arguments)};Calendar.prototype.openCalendar=function(date){return core.cordova(this,"openCalendar",{},arguments)};Calendar.pluginName="Calendar";Calendar.plugin="cordova-plugin-calendar";Calendar.pluginRef="plugins.calendar";Calendar.repo="https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin";Calendar.platforms=["Android","iOS"];Calendar.decorators=[{type:core$1.Injectable}];return Calendar}(core.AwesomeCordovaNativePlugin);var Calendar$1=Object.freeze({__proto__:null,Calendar:Calendar});var DestinationType;(function(DestinationType){DestinationType[DestinationType["DATA_URL"]=0]="DATA_URL";DestinationType[DestinationType["FILE_URL"]=1]="FILE_URL";DestinationType[DestinationType["NATIVE_URI"]=2]="NATIVE_URI"})(DestinationType||(DestinationType={}));var EncodingType;(function(EncodingType){EncodingType[EncodingType["JPEG"]=0]="JPEG";EncodingType[EncodingType["PNG"]=1]="PNG"})(EncodingType||(EncodingType={}));var MediaType;(function(MediaType){MediaType[MediaType["PICTURE"]=0]="PICTURE";MediaType[MediaType["VIDEO"]=1]="VIDEO";MediaType[MediaType["ALLMEDIA"]=2]="ALLMEDIA"})(MediaType||(MediaType={}));var PictureSourceType;(function(PictureSourceType){PictureSourceType[PictureSourceType["PHOTOLIBRARY"]=0]="PHOTOLIBRARY";PictureSourceType[PictureSourceType["CAMERA"]=1]="CAMERA";PictureSourceType[PictureSourceType["SAVEDPHOTOALBUM"]=2]="SAVEDPHOTOALBUM"})(PictureSourceType||(PictureSourceType={}));var PopoverArrowDirection;(function(PopoverArrowDirection){PopoverArrowDirection[PopoverArrowDirection["ARROW_UP"]=1]="ARROW_UP";PopoverArrowDirection[PopoverArrowDirection["ARROW_DOWN"]=2]="ARROW_DOWN";PopoverArrowDirection[PopoverArrowDirection["ARROW_LEFT"]=3]="ARROW_LEFT";PopoverArrowDirection[PopoverArrowDirection["ARROW_RIGHT"]=4]="ARROW_RIGHT";PopoverArrowDirection[PopoverArrowDirection["ARROW_ANY"]=5]="ARROW_ANY"})(PopoverArrowDirection||(PopoverArrowDirection={}));var Direction;(function(Direction){Direction[Direction["BACK"]=0]="BACK";Direction[Direction["FRONT"]=1]="FRONT"})(Direction||(Direction={}));var Camera=function(_super){tslib.__extends(Camera,_super);function Camera(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.DestinationType={DATA_URL:0,FILE_URI:1,NATIVE_URI:2};_this.EncodingType={JPEG:0,PNG:1};_this.MediaType={PICTURE:0,VIDEO:1,ALLMEDIA:2};_this.PictureSourceType={PHOTOLIBRARY:0,CAMERA:1,SAVEDPHOTOALBUM:2};_this.PopoverArrowDirection={ARROW_UP:1,ARROW_DOWN:2,ARROW_LEFT:4,ARROW_RIGHT:8,ARROW_ANY:15};_this.Direction={BACK:0,FRONT:1};return _this}Camera.prototype.getPicture=function(options){return core.cordova(this,"getPicture",{callbackOrder:"reverse"},arguments)};Camera.prototype.cleanup=function(){return core.cordova(this,"cleanup",{platforms:["iOS"]},arguments)};Camera.pluginName="Camera";Camera.plugin="cordova-plugin-camera";Camera.pluginRef="navigator.camera";Camera.repo="https://github.com/apache/cordova-plugin-camera";Camera.platforms=["Android","Browser","iOS","Windows"];Camera.decorators=[{type:core$1.Injectable}];return Camera}(core.AwesomeCordovaNativePlugin);var Camera$1=Object.freeze({__proto__:null,Camera:Camera,get DestinationType(){return DestinationType},get Direction(){return Direction},get EncodingType(){return EncodingType},get MediaType(){return MediaType},get PictureSourceType(){return PictureSourceType},get PopoverArrowDirection(){return PopoverArrowDirection}});var Device=function(_super){tslib.__extends(Device,_super);function Device(){return _super!==null&&_super.apply(this,arguments)||this}Object.defineProperty(Device.prototype,"cordova",{get:function(){return core.cordovaPropertyGet(this,"cordova")},set:function(value){core.cordovaPropertySet(this,"cordova",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"model",{get:function(){return core.cordovaPropertyGet(this,"model")},set:function(value){core.cordovaPropertySet(this,"model",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"platform",{get:function(){return core.cordovaPropertyGet(this,"platform")},set:function(value){core.cordovaPropertySet(this,"platform",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"uuid",{get:function(){return core.cordovaPropertyGet(this,"uuid")},set:function(value){core.cordovaPropertySet(this,"uuid",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"version",{get:function(){return core.cordovaPropertyGet(this,"version")},set:function(value){core.cordovaPropertySet(this,"version",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"manufacturer",{get:function(){return core.cordovaPropertyGet(this,"manufacturer")},set:function(value){core.cordovaPropertySet(this,"manufacturer",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"isVirtual",{get:function(){return core.cordovaPropertyGet(this,"isVirtual")},set:function(value){core.cordovaPropertySet(this,"isVirtual",value)},enumerable:false,configurable:true});Object.defineProperty(Device.prototype,"serial",{get:function(){return core.cordovaPropertyGet(this,"serial")},set:function(value){core.cordovaPropertySet(this,"serial",value)},enumerable:false,configurable:true});Device.pluginName="Device";Device.plugin="cordova-plugin-device";Device.pluginRef="device";Device.repo="https://github.com/apache/cordova-plugin-device";Device.platforms=["Android","Browser","iOS","macOS","Windows"];Device.decorators=[{type:core$1.Injectable}];return Device}(core.AwesomeCordovaNativePlugin);var Device$1=Object.freeze({__proto__:null,Device:Device});var File=function(_super){tslib.__extends(File,_super);function File(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.cordovaFileError={1:"NOT_FOUND_ERR",2:"SECURITY_ERR",3:"ABORT_ERR",4:"NOT_READABLE_ERR",5:"ENCODING_ERR",6:"NO_MODIFICATION_ALLOWED_ERR",7:"INVALID_STATE_ERR",8:"SYNTAX_ERR",9:"INVALID_MODIFICATION_ERR",10:"QUOTA_EXCEEDED_ERR",11:"TYPE_MISMATCH_ERR",12:"PATH_EXISTS_ERR",13:"WRONG_ENTRY_TYPE",14:"DIR_READ_ERR"};return _this}File.prototype.getFreeDiskSpace=function(){var _this=this;return function(){if(core.checkAvailability(_this)===true){return core.getPromise((function(resolve,reject){cordova.exec(resolve,reject,"File","getFreeDiskSpace",[])}))}}()};File.prototype.checkDir=function(path,dir){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dir)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}var fullPath=path+dir;return _this.resolveDirectoryUrl(fullPath).then((function(){return true}))}}()};File.prototype.createDir=function(path,dirName,replace){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}var options={create:true};if(!replace){options.exclusive=true}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,options)}))}}()};File.prototype.removeDir=function(path,dirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(de){return _this.remove(de)}))}}()};File.prototype.moveDir=function(path,dirName,newPath,newDirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){newDirName=newDirName||dirName;if(/^\//.test(newDirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(srcde){return _this.resolveDirectoryUrl(newPath).then((function(destenation){return _this.move(srcde,destenation,newDirName)}))}))}}()};File.prototype.copyDir=function(path,dirName,newPath,newDirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(newDirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(srcde){return _this.resolveDirectoryUrl(newPath).then((function(deste){return _this.copy(srcde,deste,newDirName)}))}))}}()};File.prototype.listDir=function(path,dirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false,exclusive:false})})).then((function(de){var reader=de.createReader();return _this.readEntries(reader)}))}}()};File.prototype.removeRecursively=function(path,dirName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(dirName)){var err=new FileError(5);err.message="directory cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getDirectory(fse,dirName,{create:false})})).then((function(de){return _this.rimraf(de)}))}}()};File.prototype.checkFile=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(file)){var err=new FileError(5);err.message="file cannot start with /";return Promise.reject(err)}return _this.resolveLocalFilesystemUrl(path+file).then((function(fse){if(fse.isFile){return true}else{var err=new FileError(13);err.message="input is not a file";return Promise.reject(err)}}))}}()};File.prototype.createFile=function(path,fileName,replace){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(fileName)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}var options={create:true};if(!replace){options.exclusive=true}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,options)}))}}()};File.prototype.removeFile=function(path,fileName){var _this=this;return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(fileName)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,{create:false})})).then((function(fe){return _this.remove(fe)}))}}()};File.prototype.writeFile=function(path,fileName,text,options){var _this=this;if(options===void 0){options={}}return function(){if(core.checkAvailability(_this)===true){if(/^\//.test(fileName)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}var getFileOpts={create:!options.append,exclusive:!options.replace};return _this.resolveDirectoryUrl(path).then((function(directoryEntry){return _this.getFile(directoryEntry,fileName,getFileOpts)})).then((function(fileEntry){return _this.writeFileEntry(fileEntry,text,options)}))}}()};File.prototype.writeFileEntry=function(fe,text,options){var _this=this;return this.createWriter(fe).then((function(writer){if(options.append){writer.seek(writer.length)}if(options.truncate){writer.truncate(options.truncate)}return _this.write(writer,text)})).then((function(){return fe}))};File.prototype.writeExistingFile=function(path,fileName,text){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.writeFile(path,fileName,text,{replace:true})}}()};File.prototype.readAsText=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"Text")}}()};File.prototype.readAsDataURL=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"DataURL")}}()};File.prototype.readAsBinaryString=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"BinaryString")}}()};File.prototype.readAsArrayBuffer=function(path,file){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.readFile(path,file,"ArrayBuffer")}}()};File.prototype.moveFile=function(path,fileName,newPath,newFileName){var _this=this;return function(){if(core.checkAvailability(_this)===true){newFileName=newFileName||fileName;if(/^\//.test(newFileName)){var err=new FileError(5);err.message="file name cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,{create:false})})).then((function(srcfe){return _this.resolveDirectoryUrl(newPath).then((function(deste){return _this.move(srcfe,deste,newFileName)}))}))}}()};File.prototype.copyFile=function(path,fileName,newPath,newFileName){var _this=this;return function(){if(core.checkAvailability(_this)===true){newFileName=newFileName||fileName;if(/^\//.test(newFileName)){var err=new FileError(5);err.message="file name cannot start with /";return Promise.reject(err)}return _this.resolveDirectoryUrl(path).then((function(fse){return _this.getFile(fse,fileName,{create:false})})).then((function(srcfe){return _this.resolveDirectoryUrl(newPath).then((function(deste){return _this.copy(srcfe,deste,newFileName)}))}))}}()};File.prototype.fillErrorMessage=function(err){try{err.message=this.cordovaFileError[err.code]}catch(e){}};File.prototype.resolveLocalFilesystemUrl=function(fileUrl){var _this=this;return function(){if(core.checkAvailability(_this)===true){return core.getPromise((function(resolve,reject){try{window.resolveLocalFileSystemURL(fileUrl,(function(entry){resolve(entry)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}catch(xc){_this.fillErrorMessage(xc);reject(xc)}}))}}()};File.prototype.resolveDirectoryUrl=function(directoryUrl){var _this=this;return function(){if(core.checkAvailability(_this)===true){return _this.resolveLocalFilesystemUrl(directoryUrl).then((function(de){if(de.isDirectory){return de}else{var err=new FileError(13);err.message="input is not a directory";return Promise.reject(err)}}))}}()};File.prototype.getDirectory=function(directoryEntry,directoryName,flags){var _this=this;return function(){if(core.checkAvailability(_this)===true){return new Promise((function(resolve,reject){try{directoryEntry.getDirectory(directoryName,flags,(function(de){resolve(de)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}catch(xc){_this.fillErrorMessage(xc);reject(xc)}}))}}()};File.prototype.getFile=function(directoryEntry,fileName,flags){var _this=this;return function(){if(core.checkAvailability(_this)===true){return new Promise((function(resolve,reject){try{directoryEntry.getFile(fileName,flags,resolve,(function(err){_this.fillErrorMessage(err);reject(err)}))}catch(xc){_this.fillErrorMessage(xc);reject(xc)}}))}}()};File.prototype.readFile=function(path,file,readAs){var _this=this;if(/^\//.test(file)){var err=new FileError(5);err.message="file-name cannot start with /";return Promise.reject(err)}return this.resolveDirectoryUrl(path).then((function(directoryEntry){return _this.getFile(directoryEntry,file,{create:false})})).then((function(fileEntry){var reader=new FileReader;return core.getPromise((function(resolve,reject){reader.onloadend=function(){if(reader.result!==undefined||reader.result!==null){resolve(reader.result)}else if(reader.error!==undefined||reader.error!==null){reject(reader.error)}else{reject({code:null,message:"READER_ONLOADEND_ERR"})}};fileEntry.file((function(file){reader["readAs"+readAs].call(reader,file)}),(function(error){reject(error)}))}))}))};File.prototype.remove=function(fe){var _this=this;return new Promise((function(resolve,reject){fe.remove((function(){resolve({success:true,fileRemoved:fe})}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.move=function(srce,destdir,newName){var _this=this;return new Promise((function(resolve,reject){srce.moveTo(destdir,newName,(function(deste){resolve(deste)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.copy=function(srce,destdir,newName){var _this=this;return new Promise((function(resolve,reject){srce.copyTo(destdir,newName,(function(deste){resolve(deste)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.readEntries=function(dr){var _this=this;return new Promise((function(resolve,reject){dr.readEntries((function(entries){resolve(entries)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.rimraf=function(de){var _this=this;return new Promise((function(resolve,reject){de.removeRecursively((function(){resolve({success:true,fileRemoved:de})}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.createWriter=function(fe){var _this=this;return new Promise((function(resolve,reject){fe.createWriter((function(writer){resolve(writer)}),(function(err){_this.fillErrorMessage(err);reject(err)}))}))};File.prototype.write=function(writer,gu){if(gu instanceof Blob){return this.writeFileInChunks(writer,gu)}return new Promise((function(resolve,reject){writer.onwriteend=function(evt){if(writer.error){reject(writer.error)}else{resolve(evt)}};writer.write(gu)}))};File.prototype.writeFileInChunks=function(writer,file){var BLOCK_SIZE=1024*1024;var writtenSize=0;function writeNextChunk(){var size=Math.min(BLOCK_SIZE,file.size-writtenSize);var chunk=file.slice(writtenSize,writtenSize+size);writtenSize+=size;writer.write(chunk)}return core.getPromise((function(resolve,reject){writer.onerror=reject;writer.onwrite=function(){if(writtenSize<file.size){writeNextChunk()}else{resolve()}};writeNextChunk()}))};Object.defineProperty(File.prototype,"applicationDirectory",{get:function(){return core.cordovaPropertyGet(this,"applicationDirectory")},set:function(value){core.cordovaPropertySet(this,"applicationDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"applicationStorageDirectory",{get:function(){return core.cordovaPropertyGet(this,"applicationStorageDirectory")},set:function(value){core.cordovaPropertySet(this,"applicationStorageDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"dataDirectory",{get:function(){return core.cordovaPropertyGet(this,"dataDirectory")},set:function(value){core.cordovaPropertySet(this,"dataDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"cacheDirectory",{get:function(){return core.cordovaPropertyGet(this,"cacheDirectory")},set:function(value){core.cordovaPropertySet(this,"cacheDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalApplicationStorageDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalApplicationStorageDirectory")},set:function(value){core.cordovaPropertySet(this,"externalApplicationStorageDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalDataDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalDataDirectory")},set:function(value){core.cordovaPropertySet(this,"externalDataDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalCacheDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalCacheDirectory")},set:function(value){core.cordovaPropertySet(this,"externalCacheDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"externalRootDirectory",{get:function(){return core.cordovaPropertyGet(this,"externalRootDirectory")},set:function(value){core.cordovaPropertySet(this,"externalRootDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"tempDirectory",{get:function(){return core.cordovaPropertyGet(this,"tempDirectory")},set:function(value){core.cordovaPropertySet(this,"tempDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"syncedDataDirectory",{get:function(){return core.cordovaPropertyGet(this,"syncedDataDirectory")},set:function(value){core.cordovaPropertySet(this,"syncedDataDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"documentsDirectory",{get:function(){return core.cordovaPropertyGet(this,"documentsDirectory")},set:function(value){core.cordovaPropertySet(this,"documentsDirectory",value)},enumerable:false,configurable:true});Object.defineProperty(File.prototype,"sharedDirectory",{get:function(){return core.cordovaPropertyGet(this,"sharedDirectory")},set:function(value){core.cordovaPropertySet(this,"sharedDirectory",value)},enumerable:false,configurable:true});File.pluginName="File";File.plugin="cordova-plugin-file";File.pluginRef="cordova.file";File.repo="https://github.com/apache/cordova-plugin-file";File.platforms=["Android","Browser","iOS","macOS","Windows"];File.decorators=[{type:core$1.Injectable}];return File}(core.AwesomeCordovaNativePlugin);var File$1=Object.freeze({__proto__:null,File:File});var FileOpener=function(_super){tslib.__extends(FileOpener,_super);function FileOpener(){return _super!==null&&_super.apply(this,arguments)||this}FileOpener.prototype.open=function(filePath,fileMIMEType){return core.cordova(this,"open",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.prototype.uninstall=function(packageId){return core.cordova(this,"uninstall",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.prototype.appIsInstalled=function(packageId){return core.cordova(this,"appIsInstalled",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.prototype.showOpenWithDialog=function(filePath,fileMIMEType){return core.cordova(this,"showOpenWithDialog",{callbackStyle:"object",successName:"success",errorName:"error"},arguments)};FileOpener.pluginName="FileOpener";FileOpener.plugin="cordova-plugin-file-opener2";FileOpener.pluginRef="cordova.plugins.fileOpener2";FileOpener.repo="https://github.com/pwlin/cordova-plugin-file-opener2";FileOpener.platforms=["Android","iOS","Windows","Windows Phone 8"];FileOpener.decorators=[{type:core$1.Injectable}];return FileOpener}(core.AwesomeCordovaNativePlugin);var FileOpener$1=Object.freeze({__proto__:null,FileOpener:FileOpener});var Geolocation=function(_super){tslib.__extends(Geolocation,_super);function Geolocation(){return _super!==null&&_super.apply(this,arguments)||this}Geolocation.prototype.getCurrentPosition=function(options){return core.cordova(this,"getCurrentPosition",{callbackOrder:"reverse"},arguments)};Geolocation.prototype.watchPosition=function(options){return new rxjs.Observable((function(observer){var watchId=navigator.geolocation.watchPosition(observer.next.bind(observer),observer.next.bind(observer),options);return function(){return navigator.geolocation.clearWatch(watchId)}}))};Geolocation.pluginName="Geolocation";Geolocation.plugin="cordova-plugin-geolocation";Geolocation.pluginRef="navigator.geolocation";Geolocation.repo="https://github.com/apache/cordova-plugin-geolocation";Geolocation.install='ionic cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="To locate you"';Geolocation.installVariables=["GEOLOCATION_USAGE_DESCRIPTION"];Geolocation.platforms=["Amazon Fire OS","Android","Browser","iOS","Windows"];Geolocation.decorators=[{type:core$1.Injectable}];return Geolocation}(core.AwesomeCordovaNativePlugin);var GeoLocation=Object.freeze({__proto__:null,Geolocation:Geolocation});var MediaCapture=function(_super){tslib.__extends(MediaCapture,_super);function MediaCapture(){return _super!==null&&_super.apply(this,arguments)||this}MediaCapture.prototype.captureAudio=function(options){return core.cordova(this,"captureAudio",{callbackOrder:"reverse"},arguments)};MediaCapture.prototype.captureImage=function(options){return core.cordova(this,"captureImage",{callbackOrder:"reverse"},arguments)};MediaCapture.prototype.captureVideo=function(options){return core.cordova(this,"captureVideo",{callbackOrder:"reverse"},arguments)};MediaCapture.prototype.onPendingCaptureResult=function(){return core.cordova(this,"onPendingCaptureResult",{eventObservable:true,event:"pendingcaptureresult"},arguments)};MediaCapture.prototype.onPendingCaptureError=function(){return core.cordova(this,"onPendingCaptureError",{eventObservable:true,event:"pendingcaptureerror"},arguments)};Object.defineProperty(MediaCapture.prototype,"supportedImageModes",{get:function(){return core.cordovaPropertyGet(this,"supportedImageModes")},set:function(value){core.cordovaPropertySet(this,"supportedImageModes",value)},enumerable:false,configurable:true});Object.defineProperty(MediaCapture.prototype,"supportedAudioModes",{get:function(){return core.cordovaPropertyGet(this,"supportedAudioModes")},set:function(value){core.cordovaPropertySet(this,"supportedAudioModes",value)},enumerable:false,configurable:true});Object.defineProperty(MediaCapture.prototype,"supportedVideoModes",{get:function(){return core.cordovaPropertyGet(this,"supportedVideoModes")},set:function(value){core.cordovaPropertySet(this,"supportedVideoModes",value)},enumerable:false,configurable:true});MediaCapture.pluginName="MediaCapture";MediaCapture.plugin="cordova-plugin-media-capture";MediaCapture.pluginRef="navigator.device.capture";MediaCapture.repo="https://github.com/apache/cordova-plugin-media-capture";MediaCapture.platforms=["Android","Browser","iOS","Windows"];MediaCapture.decorators=[{type:core$1.Injectable}];return MediaCapture}(core.AwesomeCordovaNativePlugin);var MediaCapture$1=Object.freeze({__proto__:null,MediaCapture:MediaCapture});var Connection;(function(Connection){Connection["UNKNOWN"]="unknown";Connection["ETHERNET"]="ethernet";Connection["WIFI"]="wifi";Connection["CELL_2G"]="2g";Connection["CELL_3G"]="3g";Connection["CELL_4G"]="4g";Connection["CELL"]="cellular";Connection["NONE"]="none"})(Connection||(Connection={}));var Network=function(_super){tslib.__extends(Network,_super);function Network(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.Connection={UNKNOWN:"unknown",ETHERNET:"ethernet",WIFI:"wifi",CELL_2G:"2g",CELL_3G:"3g",CELL_4G:"4g",CELL:"cellular",NONE:"none"};return _this}Network.prototype.onChange=function(){var _this=this;return function(){if(core.checkAvailability(_this)===true){return rxjs.merge(_this.onConnect().pipe(operators.mapTo("connected")),_this.onDisconnect().pipe(operators.mapTo("disconnected")))}}()};Network.prototype.onDisconnect=function(){return core.cordova(this,"onDisconnect",{eventObservable:true,event:"offline",element:"document"},arguments)};Network.prototype.onConnect=function(){return core.cordova(this,"onConnect",{eventObservable:true,event:"online",element:"document"},arguments)};Object.defineProperty(Network.prototype,"type",{get:function(){return core.cordovaPropertyGet(this,"type")},set:function(value){core.cordovaPropertySet(this,"type",value)},enumerable:false,configurable:true});Object.defineProperty(Network.prototype,"downlinkMax",{get:function(){return core.cordovaPropertyGet(this,"downlinkMax")},set:function(value){core.cordovaPropertySet(this,"downlinkMax",value)},enumerable:false,configurable:true});Network.pluginName="Network";Network.plugin="cordova-plugin-network-information";Network.pluginRef="navigator.connection";Network.repo="https://github.com/apache/cordova-plugin-network-information";Network.platforms=["Amazon Fire OS","Android","Browser","iOS","Windows"];Network.decorators=[{type:core$1.Injectable}];return Network}(core.AwesomeCordovaNativePlugin);var Network$1=Object.freeze({__proto__:null,get Connection(){return Connection},Network:Network});var SQLiteObject=function(){function SQLiteObject(_objectInstance){this._objectInstance=_objectInstance}SQLiteObject.prototype.addTransaction=function(transaction){return core.cordovaInstance(this,"addTransaction",{sync:true},arguments)};SQLiteObject.prototype.transaction=function(fn){return core.cordovaInstance(this,"transaction",{successIndex:2,errorIndex:1},arguments)};SQLiteObject.prototype.readTransaction=function(fn){return core.cordovaInstance(this,"readTransaction",{},arguments)};SQLiteObject.prototype.startNextTransaction=function(){return core.cordovaInstance(this,"startNextTransaction",{sync:true},arguments)};SQLiteObject.prototype.open=function(){return core.cordovaInstance(this,"open",{},arguments)};SQLiteObject.prototype.close=function(){return core.cordovaInstance(this,"close",{},arguments)};SQLiteObject.prototype.executeSql=function(statement,params){return core.cordovaInstance(this,"executeSql",{},arguments)};SQLiteObject.prototype.sqlBatch=function(sqlStatements){return core.cordovaInstance(this,"sqlBatch",{},arguments)};SQLiteObject.prototype.abortallPendingTransactions=function(){return core.cordovaInstance(this,"abortallPendingTransactions",{sync:true},arguments)};Object.defineProperty(SQLiteObject.prototype,"databaseFeatures",{get:function(){return core.instancePropertyGet(this,"databaseFeatures")},set:function(value){core.instancePropertySet(this,"databaseFeatures",value)},enumerable:false,configurable:true});Object.defineProperty(SQLiteObject.prototype,"openDBs",{get:function(){return core.instancePropertyGet(this,"openDBs")},set:function(value){core.instancePropertySet(this,"openDBs",value)},enumerable:false,configurable:true});return SQLiteObject}();var SQLite=function(_super){tslib.__extends(SQLite,_super);function SQLite(){return _super!==null&&_super.apply(this,arguments)||this}SQLite.prototype.create=function(config){var _this=this;return function(){if(core.checkAvailability(_this)===true){return new Promise((function(resolve,reject){sqlitePlugin.openDatabase(config,(function(db){return resolve(new SQLiteObject(db))}),reject)}))}}()};SQLite.prototype.echoTest=function(){return core.cordova(this,"echoTest",{},arguments)};SQLite.prototype.selfTest=function(){return core.cordova(this,"selfTest",{},arguments)};SQLite.prototype.deleteDatabase=function(config){return core.cordova(this,"deleteDatabase",{},arguments)};SQLite.pluginName="SQLite";SQLite.pluginRef="sqlitePlugin";SQLite.plugin="cordova-sqlite-storage";SQLite.repo="https://github.com/litehelpers/Cordova-sqlite-storage";SQLite.platforms=["Android","iOS","macOS","Windows"];SQLite.decorators=[{type:core$1.Injectable}];return SQLite}(core.AwesomeCordovaNativePlugin);var Sqlite=Object.freeze({__proto__:null,SQLite:SQLite,SQLiteObject:SQLiteObject});var Vibration=function(_super){tslib.__extends(Vibration,_super);function Vibration(){return _super!==null&&_super.apply(this,arguments)||this}Vibration.prototype.vibrate=function(time){return core.cordova(this,"vibrate",{sync:true},arguments)};Vibration.pluginName="Vibration";Vibration.plugin="cordova-plugin-vibration";Vibration.pluginRef="navigator";Vibration.repo="https://github.com/apache/cordova-plugin-vibration";Vibration.platforms=["Android","iOS","Windows"];Vibration.decorators=[{type:core$1.Injectable}];return Vibration}(core.AwesomeCordovaNativePlugin);var Vibration$1=Object.freeze({__proto__:null,Vibration:Vibration});var LocationAccuracy=function(_super){tslib.__extends(LocationAccuracy,_super);function LocationAccuracy(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.REQUEST_PRIORITY_NO_POWER=0;_this.REQUEST_PRIORITY_LOW_POWER=1;_this.REQUEST_PRIORITY_BALANCED_POWER_ACCURACY=2;_this.REQUEST_PRIORITY_HIGH_ACCURACY=3;_this.SUCCESS_SETTINGS_SATISFIED=0;_this.SUCCESS_USER_AGREED=1;_this.ERROR_ALREADY_REQUESTING=-1;_this.ERROR_INVALID_ACTION=0;_this.ERROR_INVALID_ACCURACY=1;_this.ERROR_EXCEPTION=1;_this.ERROR_CANNOT_CHANGE_ACCURACY=3;_this.ERROR_USER_DISAGREED=4;_this.ERROR_GOOGLE_API_CONNECTION_FAILED=4;return _this}LocationAccuracy.prototype.canRequest=function(){return core.cordova(this,"canRequest",{},arguments)};LocationAccuracy.prototype.isRequesting=function(){return core.cordova(this,"isRequesting",{},arguments)};LocationAccuracy.prototype.request=function(accuracy){return core.cordova(this,"request",{callbackOrder:"reverse"},arguments)};LocationAccuracy.pluginName="LocationAccuracy";LocationAccuracy.plugin="cordova-plugin-request-location-accuracy";LocationAccuracy.pluginRef="cordova.plugins.locationAccuracy";LocationAccuracy.repo="https://github.com/dpa99c/cordova-plugin-request-location-accuracy";LocationAccuracy.platforms=["Android","iOS"];LocationAccuracy.decorators=[{type:core$1.Injectable}];return LocationAccuracy}(core.AwesomeCordovaNativePlugin);var LocationAccuracy$1=Object.freeze({__proto__:null,LocationAccuracy:LocationAccuracy});var Diagnostic=function(_super){tslib.__extends(Diagnostic,_super);function Diagnostic(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.permission={READ_CALENDAR:"READ_CALENDAR",WRITE_CALENDAR:"WRITE_CALENDAR",CAMERA:"CAMERA",READ_CONTACTS:"READ_CONTACTS",WRITE_CONTACTS:"WRITE_CONTACTS",GET_ACCOUNTS:"GET_ACCOUNTS",ACCESS_FINE_LOCATION:"ACCESS_FINE_LOCATION",ACCESS_COARSE_LOCATION:"ACCESS_COARSE_LOCATION",RECORD_AUDIO:"RECORD_AUDIO",READ_PHONE_STATE:"READ_PHONE_STATE",CALL_PHONE:"CALL_PHONE",ADD_VOICEMAIL:"ADD_VOICEMAIL",USE_SIP:"USE_SIP",PROCESS_OUTGOING_CALLS:"PROCESS_OUTGOING_CALLS",READ_CALL_LOG:"READ_CALL_LOG",WRITE_CALL_LOG:"WRITE_CALL_LOG",SEND_SMS:"SEND_SMS",RECEIVE_SMS:"RECEIVE_SMS",READ_SMS:"READ_SMS",RECEIVE_WAP_PUSH:"RECEIVE_WAP_PUSH",RECEIVE_MMS:"RECEIVE_MMS",WRITE_EXTERNAL_STORAGE:"WRITE_EXTERNAL_STORAGE",READ_EXTERNAL_STORAGE:"READ_EXTERNAL_STORAGE",BODY_SENSORS:"BODY_SENSORS"};_this.locationAuthorizationMode={ALWAYS:"always",WHEN_IN_USE:"when_in_use"};_this.permissionGroups={CALENDAR:["READ_CALENDAR","WRITE_CALENDAR"],CAMERA:["CAMERA"],CONTACTS:["READ_CONTACTS","WRITE_CONTACTS","GET_ACCOUNTS"],LOCATION:["ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION"],MICROPHONE:["RECORD_AUDIO"],PHONE:["READ_PHONE_STATE","CALL_PHONE","ADD_VOICEMAIL","USE_SIP","PROCESS_OUTGOING_CALLS","READ_CALL_LOG","WRITE_CALL_LOG"],SENSORS:["BODY_SENSORS"],SMS:["SEND_SMS","RECEIVE_SMS","READ_SMS","RECEIVE_WAP_PUSH","RECEIVE_MMS"],STORAGE:["READ_EXTERNAL_STORAGE","WRITE_EXTERNAL_STORAGE"]};_this.locationMode={HIGH_ACCURACY:"high_accuracy",DEVICE_ONLY:"device_only",BATTERY_SAVING:"battery_saving",LOCATION_OFF:"location_off"};_this.bluetoothState={UNKNOWN:"unknown",RESETTING:"resetting",UNSUPPORTED:"unsupported",UNAUTHORIZED:"unauthorized",POWERED_OFF:"powered_off",POWERED_ON:"powered_on",POWERING_OFF:"powering_off",POWERING_ON:"powering_on"};return _this}Diagnostic.prototype.isLocationAvailable=function(){return core.cordova(this,"isLocationAvailable",{},arguments)};Diagnostic.prototype.isWifiAvailable=function(){return core.cordova(this,"isWifiAvailable",{},arguments)};Diagnostic.prototype.isCameraAvailable=function(externalStorage){return core.cordova(this,"isCameraAvailable",{callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isBluetoothAvailable=function(){return core.cordova(this,"isBluetoothAvailable",{},arguments)};Diagnostic.prototype.switchToLocationSettings=function(){return core.cordova(this,"switchToLocationSettings",{sync:true,platforms:["Android","Windows 10","iOS"]},arguments)};Diagnostic.prototype.switchToMobileDataSettings=function(){return core.cordova(this,"switchToMobileDataSettings",{sync:true,platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.switchToBluetoothSettings=function(){return core.cordova(this,"switchToBluetoothSettings",{sync:true,platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.switchToWifiSettings=function(){return core.cordova(this,"switchToWifiSettings",{sync:true,platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.isWifiEnabled=function(){return core.cordova(this,"isWifiEnabled",{platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.setWifiState=function(state){return core.cordova(this,"setWifiState",{callbackOrder:"reverse",platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.setBluetoothState=function(state){return core.cordova(this,"setBluetoothState",{callbackOrder:"reverse",platforms:["Android","Windows 10"]},arguments)};Diagnostic.prototype.isLocationEnabled=function(){return core.cordova(this,"isLocationEnabled",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isLocationAuthorized=function(){return core.cordova(this,"isLocationAuthorized",{},arguments)};Diagnostic.prototype.getLocationAuthorizationStatus=function(){return core.cordova(this,"getLocationAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestLocationAuthorization=function(mode){return core.cordova(this,"requestLocationAuthorization",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isCameraPresent=function(){return core.cordova(this,"isCameraPresent",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isCameraAuthorized=function(externalStorage){return core.cordova(this,"isCameraAuthorized",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.getCameraAuthorizationStatus=function(externalStorage){return core.cordova(this,"getCameraAuthorizationStatus",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.requestCameraAuthorization=function(externalStorage){return core.cordova(this,"requestCameraAuthorization",{platforms:["Android","iOS"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isMicrophoneAuthorized=function(){return core.cordova(this,"isMicrophoneAuthorized",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getMicrophoneAuthorizationStatus=function(){return core.cordova(this,"getMicrophoneAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestMicrophoneAuthorization=function(){return core.cordova(this,"requestMicrophoneAuthorization",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isContactsAuthorized=function(){return core.cordova(this,"isContactsAuthorized",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getContactsAuthorizationStatus=function(){return core.cordova(this,"getContactsAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestContactsAuthorization=function(){return core.cordova(this,"requestContactsAuthorization",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.isCalendarAuthorized=function(){return core.cordova(this,"isCalendarAuthorized",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getCalendarAuthorizationStatus=function(){return core.cordova(this,"getCalendarAuthorizationStatus",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.requestCalendarAuthorization=function(){return core.cordova(this,"requestCalendarAuthorization",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.switchToSettings=function(){return core.cordova(this,"switchToSettings",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.getBluetoothState=function(){return core.cordova(this,"getBluetoothState",{platforms:["Android","iOS"]},arguments)};Diagnostic.prototype.registerBluetoothStateChangeHandler=function(handler){return core.cordova(this,"registerBluetoothStateChangeHandler",{platforms:["Android","iOS"],sync:true},arguments)};Diagnostic.prototype.registerLocationStateChangeHandler=function(handler){return core.cordova(this,"registerLocationStateChangeHandler",{platforms:["Android","iOS"],sync:true},arguments)};Diagnostic.prototype.isGpsLocationAvailable=function(){return core.cordova(this,"isGpsLocationAvailable",{platforms:["Android"]},arguments)};Diagnostic.prototype.isGpsLocationEnabled=function(){return core.cordova(this,"isGpsLocationEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNetworkLocationAvailable=function(){return core.cordova(this,"isNetworkLocationAvailable",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNetworkLocationEnabled=function(){return core.cordova(this,"isNetworkLocationEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.getLocationMode=function(){return core.cordova(this,"getLocationMode",{platforms:["Android"]},arguments)};Diagnostic.prototype.getPermissionAuthorizationStatus=function(permission){return core.cordova(this,"getPermissionAuthorizationStatus",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.getPermissionsAuthorizationStatus=function(permissions){return core.cordova(this,"getPermissionsAuthorizationStatus",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.requestRuntimePermission=function(permission){return core.cordova(this,"requestRuntimePermission",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.requestRuntimePermissions=function(permissions){return core.cordova(this,"requestRuntimePermissions",{platforms:["Android"],callbackOrder:"reverse"},arguments)};Diagnostic.prototype.isRequestingPermission=function(){return core.cordova(this,"isRequestingPermission",{sync:true},arguments)};Diagnostic.prototype.registerPermissionRequestCompleteHandler=function(handler){return core.cordova(this,"registerPermissionRequestCompleteHandler",{sync:true},arguments)};Diagnostic.prototype.isBluetoothEnabled=function(){return core.cordova(this,"isBluetoothEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.hasBluetoothSupport=function(){return core.cordova(this,"hasBluetoothSupport",{platforms:["Android"]},arguments)};Diagnostic.prototype.hasBluetoothLESupport=function(){return core.cordova(this,"hasBluetoothLESupport",{platforms:["Android"]},arguments)};Diagnostic.prototype.hasBluetoothLEPeripheralSupport=function(){return core.cordova(this,"hasBluetoothLEPeripheralSupport",{platforms:["Android"]},arguments)};Diagnostic.prototype.isExternalStorageAuthorized=function(){return core.cordova(this,"isExternalStorageAuthorized",{platforms:["Android"]},arguments)};Diagnostic.prototype.getExternalStorageAuthorizationStatus=function(){return core.cordova(this,"getExternalStorageAuthorizationStatus",{platforms:["Android"]},arguments)};Diagnostic.prototype.requestExternalStorageAuthorization=function(){return core.cordova(this,"requestExternalStorageAuthorization",{platforms:["Android"]},arguments)};Diagnostic.prototype.getExternalSdCardDetails=function(){return core.cordova(this,"getExternalSdCardDetails",{platforms:["Android"]},arguments)};Diagnostic.prototype.switchToWirelessSettings=function(){return core.cordova(this,"switchToWirelessSettings",{platforms:["Android"],sync:true},arguments)};Diagnostic.prototype.switchToNFCSettings=function(){return core.cordova(this,"switchToNFCSettings",{platforms:["Android"],sync:true},arguments)};Diagnostic.prototype.isNFCPresent=function(){return core.cordova(this,"isNFCPresent",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNFCEnabled=function(){return core.cordova(this,"isNFCEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isNFCAvailable=function(){return core.cordova(this,"isNFCAvailable",{platforms:["Android"]},arguments)};Diagnostic.prototype.registerNFCStateChangeHandler=function(handler){return core.cordova(this,"registerNFCStateChangeHandler",{platforms:["Android"],sync:true},arguments)};Diagnostic.prototype.isDataRoamingEnabled=function(){return core.cordova(this,"isDataRoamingEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isADBModeEnabled=function(){return core.cordova(this,"isADBModeEnabled",{platforms:["Android"]},arguments)};Diagnostic.prototype.isDeviceRooted=function(){return core.cordova(this,"isDeviceRooted",{platforms:["Android"]},arguments)};Diagnostic.prototype.isCameraRollAuthorized=function(){return core.cordova(this,"isCameraRollAuthorized",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getCameraRollAuthorizationStatus=function(){return core.cordova(this,"getCameraRollAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestCameraRollAuthorization=function(){return core.cordova(this,"requestCameraRollAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isRemoteNotificationsEnabled=function(){return core.cordova(this,"isRemoteNotificationsEnabled",{platforms:["iOS","Android"]},arguments)};Diagnostic.prototype.isRegisteredForRemoteNotifications=function(){return core.cordova(this,"isRegisteredForRemoteNotifications",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getRemoteNotificationsAuthorizationStatus=function(){return core.cordova(this,"getRemoteNotificationsAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestRemoteNotificationsAuthorization=function(types,omitRegistration){return core.cordova(this,"requestRemoteNotificationsAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getRemoteNotificationTypes=function(){return core.cordova(this,"getRemoteNotificationTypes",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isRemindersAuthorized=function(){return core.cordova(this,"isRemindersAuthorized",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getRemindersAuthorizationStatus=function(){return core.cordova(this,"getRemindersAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestRemindersAuthorization=function(){return core.cordova(this,"requestRemindersAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isBackgroundRefreshAuthorized=function(){return core.cordova(this,"isBackgroundRefreshAuthorized",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getBackgroundRefreshStatus=function(){return core.cordova(this,"getBackgroundRefreshStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestBluetoothAuthorization=function(){return core.cordova(this,"requestBluetoothAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isMotionAvailable=function(){return core.cordova(this,"isMotionAvailable",{platforms:["iOS"]},arguments)};Diagnostic.prototype.isMotionRequestOutcomeAvailable=function(){return core.cordova(this,"isMotionRequestOutcomeAvailable",{platforms:["iOS"]},arguments)};Diagnostic.prototype.requestMotionAuthorization=function(){return core.cordova(this,"requestMotionAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getMotionAuthorizationStatus=function(){return core.cordova(this,"getMotionAuthorizationStatus",{platforms:["iOS"]},arguments)};Diagnostic.prototype.getLocationAccuracyAuthorization=function(){return core.cordova(this,"getLocationAccuracyAuthorization",{platform:["iOS"]},arguments)};Diagnostic.prototype.requestTemporaryFullAccuracyAuthorization=function(purpose){return core.cordova(this,"requestTemporaryFullAccuracyAuthorization",{platforms:["iOS"]},arguments)};Diagnostic.prototype.registerLocationAccuracyAuthorizationChangeHandler=function(handler){return core.cordova(this,"registerLocationAccuracyAuthorizationChangeHandler",{platforms:["iOS"],sync:true},arguments)};Object.defineProperty(Diagnostic.prototype,"permissionStatus",{get:function(){return core.cordovaPropertyGet(this,"permissionStatus")},set:function(value){core.cordovaPropertySet(this,"permissionStatus",value)},enumerable:false,configurable:true});Object.defineProperty(Diagnostic.prototype,"NFCState",{get:function(){return core.cordovaPropertyGet(this,"NFCState")},set:function(value){core.cordovaPropertySet(this,"NFCState",value)},enumerable:false,configurable:true});Object.defineProperty(Diagnostic.prototype,"motionStatus",{get:function(){return core.cordovaPropertyGet(this,"motionStatus")},set:function(value){core.cordovaPropertySet(this,"motionStatus",value)},enumerable:false,configurable:true});Diagnostic.pluginName="Diagnostic";Diagnostic.plugin="cordova.plugins.diagnostic";Diagnostic.pluginRef="cordova.plugins.diagnostic";Diagnostic.repo="https://github.com/dpa99c/cordova-diagnostic-plugin";Diagnostic.platforms=["Android","iOS","Windows"];Diagnostic.decorators=[{type:core$1.Injectable}];return Diagnostic}(core.AwesomeCordovaNativePlugin);var Diagnostic$1=Object.freeze({__proto__:null,Diagnostic:Diagnostic});var awesomeCordovaPlugins={...AppVersion$1,...BarcodeScanner$1,...Calendar$1,...Camera$1,...Device$1,...File$1,...FileOpener$1,...GeoLocation,...MediaCapture$1,...Network$1,...Sqlite,...Vibration$1,...LocationAccuracy$1,...Diagnostic$1};return awesomeCordovaPlugins}));/*! iScroll v5.2.0 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
848
848
  (function(window,document,Math){var rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1e3/60)};var utils=function(){var me={};var _elementStyle=document.createElement("div").style;var _vendor=function(){var vendors=["t","webkitT","MozT","msT","OT"],transform,i=0,l=vendors.length;for(;i<l;i++){transform=vendors[i]+"ransform";if(transform in _elementStyle)return vendors[i].substr(0,vendors[i].length-1)}return false}();function _prefixStyle(style){if(_vendor===false)return false;if(_vendor==="")return style;return _vendor+style.charAt(0).toUpperCase()+style.substr(1)}me.getTime=Date.now||function getTime(){return(new Date).getTime()};me.extend=function(target,obj){for(var i in obj){target[i]=obj[i]}};me.addEvent=function(el,type,fn,capture){el.addEventListener(type,fn,!!capture)};me.removeEvent=function(el,type,fn,capture){el.removeEventListener(type,fn,!!capture)};me.prefixPointerEvent=function(pointerEvent){return window.MSPointerEvent?"MSPointer"+pointerEvent.charAt(7).toUpperCase()+pointerEvent.substr(8):pointerEvent};me.momentum=function(current,start,time,lowerMargin,wrapperSize,deceleration){var distance=current-start,speed=Math.abs(distance)/time,destination,duration;deceleration=deceleration===undefined?6e-4:deceleration;destination=current+speed*speed/(2*deceleration)*(distance<0?-1:1);duration=speed/deceleration;if(destination<lowerMargin){destination=wrapperSize?lowerMargin-wrapperSize/2.5*(speed/8):lowerMargin;distance=Math.abs(destination-current);duration=distance/speed}else if(destination>0){destination=wrapperSize?wrapperSize/2.5*(speed/8):0;distance=Math.abs(current)+destination;duration=distance/speed}return{destination:Math.round(destination),duration:duration}};var _transform=_prefixStyle("transform");me.extend(me,{hasTransform:_transform!==false,hasPerspective:_prefixStyle("perspective")in _elementStyle,hasTouch:"ontouchstart"in window,hasPointer:!!(window.PointerEvent||window.MSPointerEvent),hasTransition:_prefixStyle("transition")in _elementStyle});me.isBadAndroid=function(){var appVersion=window.navigator.appVersion;if(/Android/.test(appVersion)&&!/Chrome\/\d/.test(appVersion)){var safariVersion=appVersion.match(/Safari\/(\d+.\d)/);if(safariVersion&&typeof safariVersion==="object"&&safariVersion.length>=2){return parseFloat(safariVersion[1])<535.19}else{return true}}else{return false}}();me.extend(me.style={},{transform:_transform,transitionTimingFunction:_prefixStyle("transitionTimingFunction"),transitionDuration:_prefixStyle("transitionDuration"),transitionDelay:_prefixStyle("transitionDelay"),transformOrigin:_prefixStyle("transformOrigin")});me.hasClass=function(e,c){var re=new RegExp("(^|\\s)"+c+"(\\s|$)");return re.test(e.className)};me.addClass=function(e,c){if(me.hasClass(e,c)){return}var newclass=e.className.split(" ");newclass.push(c);e.className=newclass.join(" ")};me.removeClass=function(e,c){if(!me.hasClass(e,c)){return}var re=new RegExp("(^|\\s)"+c+"(\\s|$)","g");e.className=e.className.replace(re," ")};me.offset=function(el){var left=-el.offsetLeft,top=-el.offsetTop;while(el=el.offsetParent){left-=el.offsetLeft;top-=el.offsetTop}return{left:left,top:top}};me.preventDefaultException=function(el,exceptions){for(var i in exceptions){if(exceptions[i].test(el[i])){return true}}return false};me.extend(me.eventType={},{touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2,pointerdown:3,pointermove:3,pointerup:3,MSPointerDown:3,MSPointerMove:3,MSPointerUp:3});me.extend(me.ease={},{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(k){return k*(2-k)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(k){return Math.sqrt(1- --k*k)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fn:function(k){var b=4;return(k=k-1)*k*((b+1)*k+b)+1}},bounce:{style:"",fn:function(k){if((k/=1)<1/2.75){return 7.5625*k*k}else if(k<2/2.75){return 7.5625*(k-=1.5/2.75)*k+.75}else if(k<2.5/2.75){return 7.5625*(k-=2.25/2.75)*k+.9375}else{return 7.5625*(k-=2.625/2.75)*k+.984375}}},elastic:{style:"",fn:function(k){var f=.22,e=.4;if(k===0){return 0}if(k==1){return 1}return e*Math.pow(2,-10*k)*Math.sin((k-f/4)*(2*Math.PI)/f)+1}}});me.tap=function(e,eventName){var ev=document.createEvent("Event");ev.initEvent(eventName,true,true);ev.pageX=e.pageX;ev.pageY=e.pageY;e.target.dispatchEvent(ev)};me.click=function(e){var target=e.target,ev;if(!/(SELECT|INPUT|TEXTAREA)/i.test(target.tagName)){ev=document.createEvent("MouseEvents");ev.initMouseEvent("click",true,true,e.view,1,target.screenX,target.screenY,target.clientX,target.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null);ev._constructed=true;target.dispatchEvent(ev)}};return me}();function IScroll(el,options){this.wrapper=typeof el=="string"?document.querySelector(el):el;this.scroller=this.wrapper.children[0];this.scrollerStyle=this.scroller.style;this.options={resizeScrollbars:true,mouseWheelSpeed:20,snapThreshold:.334,disablePointer:!utils.hasPointer,disableTouch:utils.hasPointer||!utils.hasTouch,disableMouse:utils.hasPointer||utils.hasTouch,startX:0,startY:0,scrollY:true,directionLockThreshold:5,momentum:true,bounce:true,bounceTime:600,bounceEasing:"",preventDefault:true,preventDefaultException:{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/},HWCompositing:true,useTransition:true,useTransform:true,bindToWrapper:typeof window.onmousedown==="undefined"};for(var i in options){this.options[i]=options[i]}this.translateZ=this.options.HWCompositing&&utils.hasPerspective?" translateZ(0)":"";this.options.useTransition=utils.hasTransition&&this.options.useTransition;this.options.useTransform=utils.hasTransform&&this.options.useTransform;this.options.eventPassthrough=this.options.eventPassthrough===true?"vertical":this.options.eventPassthrough;this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault;this.options.scrollY=this.options.eventPassthrough=="vertical"?false:this.options.scrollY;this.options.scrollX=this.options.eventPassthrough=="horizontal"?false:this.options.scrollX;this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough;this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold;this.options.bounceEasing=typeof this.options.bounceEasing=="string"?utils.ease[this.options.bounceEasing]||utils.ease.circular:this.options.bounceEasing;this.options.resizePolling=this.options.resizePolling===undefined?60:this.options.resizePolling;if(this.options.tap===true){this.options.tap="tap"}if(this.options.shrinkScrollbars=="scale"){this.options.useTransition=false}this.options.invertWheelDirection=this.options.invertWheelDirection?-1:1;this.x=0;this.y=0;this.directionX=0;this.directionY=0;this._events={};this._init();this.refresh();this.scrollTo(this.options.startX,this.options.startY);this.enable()}IScroll.prototype={version:"5.2.0",_init:function(){this._initEvents();if(this.options.scrollbars||this.options.indicators){this._initIndicators()}if(this.options.mouseWheel){this._initWheel()}if(this.options.snap){this._initSnap()}if(this.options.keyBindings){this._initKeys()}},destroy:function(){this._initEvents(true);clearTimeout(this.resizeTimeout);this.resizeTimeout=null;this._execEvent("destroy")},_transitionEnd:function(e){if(e.target!=this.scroller||!this.isInTransition){return}this._transitionTime();if(!this.resetPosition(this.options.bounceTime)){this.isInTransition=false;this._execEvent("scrollEnd")}},_start:function(e){if(utils.eventType[e.type]!=1){var button;if(!e.which){button=e.button<2?0:e.button==4?1:2}else{button=e.button}if(button!==0){return}}if(!this.enabled||this.initiated&&utils.eventType[e.type]!==this.initiated){return}if(this.options.preventDefault&&!utils.isBadAndroid&&!utils.preventDefaultException(e.target,this.options.preventDefaultException)){e.preventDefault()}var point=e.touches?e.touches[0]:e,pos;this.initiated=utils.eventType[e.type];this.moved=false;this.distX=0;this.distY=0;this.directionX=0;this.directionY=0;this.directionLocked=0;this.startTime=utils.getTime();if(this.options.useTransition&&this.isInTransition){this._transitionTime();this.isInTransition=false;pos=this.getComputedPosition();this._translate(Math.round(pos.x),Math.round(pos.y));this._execEvent("scrollEnd")}else if(!this.options.useTransition&&this.isAnimating){this.isAnimating=false;this._execEvent("scrollEnd")}this.startX=this.x;this.startY=this.y;this.absStartX=this.x;this.absStartY=this.y;this.pointX=point.pageX;this.pointY=point.pageY;this._execEvent("beforeScrollStart")},_move:function(e){if(!this.enabled||utils.eventType[e.type]!==this.initiated){return}if(this.options.preventDefault){e.preventDefault()}var point=e.touches?e.touches[0]:e,deltaX=point.pageX-this.pointX,deltaY=point.pageY-this.pointY,timestamp=utils.getTime(),newX,newY,absDistX,absDistY;this.pointX=point.pageX;this.pointY=point.pageY;this.distX+=deltaX;this.distY+=deltaY;absDistX=Math.abs(this.distX);absDistY=Math.abs(this.distY);if(timestamp-this.endTime>300&&(absDistX<10&&absDistY<10)){return}if(!this.directionLocked&&!this.options.freeScroll){if(absDistX>absDistY+this.options.directionLockThreshold){this.directionLocked="h"}else if(absDistY>=absDistX+this.options.directionLockThreshold){this.directionLocked="v"}else{this.directionLocked="n"}}if(this.directionLocked=="h"){if(this.options.eventPassthrough=="vertical"){e.preventDefault()}else if(this.options.eventPassthrough=="horizontal"){this.initiated=false;return}deltaY=0}else if(this.directionLocked=="v"){if(this.options.eventPassthrough=="horizontal"){e.preventDefault()}else if(this.options.eventPassthrough=="vertical"){this.initiated=false;return}deltaX=0}deltaX=this.hasHorizontalScroll?deltaX:0;deltaY=this.hasVerticalScroll?deltaY:0;newX=this.x+deltaX;newY=this.y+deltaY;if(newX>0||newX<this.maxScrollX){newX=this.options.bounce?this.x+deltaX/3:newX>0?0:this.maxScrollX}if(newY>0||newY<this.maxScrollY){newY=this.options.bounce?this.y+deltaY/3:newY>0?0:this.maxScrollY}this.directionX=deltaX>0?-1:deltaX<0?1:0;this.directionY=deltaY>0?-1:deltaY<0?1:0;if(!this.moved){this._execEvent("scrollStart")}this.moved=true;this._translate(newX,newY);if(timestamp-this.startTime>300){this.startTime=timestamp;this.startX=this.x;this.startY=this.y}},_end:function(e){if(!this.enabled||utils.eventType[e.type]!==this.initiated){return}if(this.options.preventDefault&&!utils.preventDefaultException(e.target,this.options.preventDefaultException)){e.preventDefault()}var point=e.changedTouches?e.changedTouches[0]:e,momentumX,momentumY,duration=utils.getTime()-this.startTime,newX=Math.round(this.x),newY=Math.round(this.y),distanceX=Math.abs(newX-this.startX),distanceY=Math.abs(newY-this.startY),time=0,easing="";this.isInTransition=0;this.initiated=0;this.endTime=utils.getTime();if(this.resetPosition(this.options.bounceTime)){return}this.scrollTo(newX,newY);if(!this.moved){if(this.options.tap){utils.tap(e,this.options.tap)}if(this.options.click){utils.click(e)}this._execEvent("scrollCancel");return}if(this._events.flick&&duration<200&&distanceX<100&&distanceY<100){this._execEvent("flick");return}if(this.options.momentum&&duration<300){momentumX=this.hasHorizontalScroll?utils.momentum(this.x,this.startX,duration,this.maxScrollX,this.options.bounce?this.wrapperWidth:0,this.options.deceleration):{destination:newX,duration:0};momentumY=this.hasVerticalScroll?utils.momentum(this.y,this.startY,duration,this.maxScrollY,this.options.bounce?this.wrapperHeight:0,this.options.deceleration):{destination:newY,duration:0};newX=momentumX.destination;newY=momentumY.destination;time=Math.max(momentumX.duration,momentumY.duration);this.isInTransition=1}if(this.options.snap){var snap=this._nearestSnap(newX,newY);this.currentPage=snap;time=this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(newX-snap.x),1e3),Math.min(Math.abs(newY-snap.y),1e3)),300);newX=snap.x;newY=snap.y;this.directionX=0;this.directionY=0;easing=this.options.bounceEasing}if(newX!=this.x||newY!=this.y){if(newX>0||newX<this.maxScrollX||newY>0||newY<this.maxScrollY){easing=utils.ease.quadratic}this.scrollTo(newX,newY,time,easing);return}this._execEvent("scrollEnd")},_resize:function(){var that=this;clearTimeout(this.resizeTimeout);this.resizeTimeout=setTimeout((function(){that.refresh()}),this.options.resizePolling)},resetPosition:function(time){var x=this.x,y=this.y;time=time||0;if(!this.hasHorizontalScroll||this.x>0){x=0}else if(this.x<this.maxScrollX){x=this.maxScrollX}if(!this.hasVerticalScroll||this.y>0){y=0}else if(this.y<this.maxScrollY){y=this.maxScrollY}if(x==this.x&&y==this.y){return false}this.scrollTo(x,y,time,this.options.bounceEasing);return true},disable:function(){this.enabled=false},enable:function(){this.enabled=true},refresh:function(){var rf=this.wrapper.offsetHeight;this.wrapperWidth=this.wrapper.clientWidth;this.wrapperHeight=this.wrapper.clientHeight;this.scrollerWidth=this.scroller.offsetWidth;this.scrollerHeight=this.scroller.offsetHeight;this.maxScrollX=this.wrapperWidth-this.scrollerWidth;this.maxScrollY=this.wrapperHeight-this.scrollerHeight;this.hasHorizontalScroll=this.options.scrollX&&this.maxScrollX<0;this.hasVerticalScroll=this.options.scrollY&&this.maxScrollY<0;if(!this.hasHorizontalScroll){this.maxScrollX=0;this.scrollerWidth=this.wrapperWidth}if(!this.hasVerticalScroll){this.maxScrollY=0;this.scrollerHeight=this.wrapperHeight}this.endTime=0;this.directionX=0;this.directionY=0;this.wrapperOffset=utils.offset(this.wrapper);this._execEvent("refresh");this.resetPosition()},on:function(type,fn){if(!this._events[type]){this._events[type]=[]}this._events[type].push(fn)},off:function(type,fn){if(!this._events[type]){return}var index=this._events[type].indexOf(fn);if(index>-1){this._events[type].splice(index,1)}},_execEvent:function(type){if(!this._events[type]){return}var i=0,l=this._events[type].length;if(!l){return}for(;i<l;i++){this._events[type][i].apply(this,[].slice.call(arguments,1))}},scrollBy:function(x,y,time,easing){x=this.x+x;y=this.y+y;time=time||0;this.scrollTo(x,y,time,easing)},scrollTo:function(x,y,time,easing){easing=easing||utils.ease.circular;this.isInTransition=this.options.useTransition&&time>0;var transitionType=this.options.useTransition&&easing.style;if(!time||transitionType){if(transitionType){this._transitionTimingFunction(easing.style);this._transitionTime(time)}this._translate(x,y)}else{this._animate(x,y,time,easing.fn)}},scrollToElement:function(el,time,offsetX,offsetY,easing){el=el.nodeType?el:this.scroller.querySelector(el);if(!el){return}var pos=utils.offset(el);pos.left-=this.wrapperOffset.left;pos.top-=this.wrapperOffset.top;if(offsetX===true){offsetX=Math.round(el.offsetWidth/2-this.wrapper.offsetWidth/2)}if(offsetY===true){offsetY=Math.round(el.offsetHeight/2-this.wrapper.offsetHeight/2)}pos.left-=offsetX||0;pos.top-=offsetY||0;pos.left=pos.left>0?0:pos.left<this.maxScrollX?this.maxScrollX:pos.left;pos.top=pos.top>0?0:pos.top<this.maxScrollY?this.maxScrollY:pos.top;time=time===undefined||time===null||time==="auto"?Math.max(Math.abs(this.x-pos.left),Math.abs(this.y-pos.top)):time;this.scrollTo(pos.left,pos.top,time,easing)},_transitionTime:function(time){time=time||0;var durationProp=utils.style.transitionDuration;this.scrollerStyle[durationProp]=time+"ms";if(!time&&utils.isBadAndroid){this.scrollerStyle[durationProp]="0.0001ms";var self=this;rAF((function(){if(self.scrollerStyle[durationProp]==="0.0001ms"){self.scrollerStyle[durationProp]="0s"}}))}if(this.indicators){for(var i=this.indicators.length;i--;){this.indicators[i].transitionTime(time)}}},_transitionTimingFunction:function(easing){this.scrollerStyle[utils.style.transitionTimingFunction]=easing;if(this.indicators){for(var i=this.indicators.length;i--;){this.indicators[i].transitionTimingFunction(easing)}}},_translate:function(x,y){if(this.options.useTransform){this.scrollerStyle[utils.style.transform]="translate("+x+"px,"+y+"px)"+this.translateZ}else{x=Math.round(x);y=Math.round(y);this.scrollerStyle.left=x+"px";this.scrollerStyle.top=y+"px"}this.x=x;this.y=y;if(this.indicators){for(var i=this.indicators.length;i--;){this.indicators[i].updatePosition()}}},_initEvents:function(remove){var eventType=remove?utils.removeEvent:utils.addEvent,target=this.options.bindToWrapper?this.wrapper:window;eventType(window,"orientationchange",this);eventType(window,"resize",this);if(this.options.click){eventType(this.wrapper,"click",this,true)}if(!this.options.disableMouse){eventType(this.wrapper,"mousedown",this);eventType(target,"mousemove",this);eventType(target,"mousecancel",this);eventType(target,"mouseup",this)}if(utils.hasPointer&&!this.options.disablePointer){eventType(this.wrapper,utils.prefixPointerEvent("pointerdown"),this);eventType(target,utils.prefixPointerEvent("pointermove"),this);eventType(target,utils.prefixPointerEvent("pointercancel"),this);eventType(target,utils.prefixPointerEvent("pointerup"),this)}if(utils.hasTouch&&!this.options.disableTouch){eventType(this.wrapper,"touchstart",this);eventType(target,"touchmove",this);eventType(target,"touchcancel",this);eventType(target,"touchend",this)}eventType(this.scroller,"transitionend",this);eventType(this.scroller,"webkitTransitionEnd",this);eventType(this.scroller,"oTransitionEnd",this);eventType(this.scroller,"MSTransitionEnd",this)},getComputedPosition:function(){var matrix=window.getComputedStyle(this.scroller,null),x,y;if(this.options.useTransform){matrix=matrix[utils.style.transform].split(")")[0].split(", ");x=+(matrix[12]||matrix[4]);y=+(matrix[13]||matrix[5])}else{x=+matrix.left.replace(/[^-\d.]/g,"");y=+matrix.top.replace(/[^-\d.]/g,"")}return{x:x,y:y}},_initIndicators:function(){var interactive=this.options.interactiveScrollbars,customStyle=typeof this.options.scrollbars!="string",indicators=[],indicator;var that=this;this.indicators=[];if(this.options.scrollbars){if(this.options.scrollY){indicator={el:createDefaultScrollbar("v",interactive,this.options.scrollbars),interactive:interactive,defaultScrollbars:true,customStyle:customStyle,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenX:false};this.wrapper.appendChild(indicator.el);indicators.push(indicator)}if(this.options.scrollX){indicator={el:createDefaultScrollbar("h",interactive,this.options.scrollbars),interactive:interactive,defaultScrollbars:true,customStyle:customStyle,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenY:false};this.wrapper.appendChild(indicator.el);indicators.push(indicator)}}if(this.options.indicators){indicators=indicators.concat(this.options.indicators)}for(var i=indicators.length;i--;){this.indicators.push(new Indicator(this,indicators[i]))}function _indicatorsMap(fn){if(that.indicators){for(var i=that.indicators.length;i--;){fn.call(that.indicators[i])}}}if(this.options.fadeScrollbars){this.on("scrollEnd",(function(){_indicatorsMap((function(){this.fade()}))}));this.on("scrollCancel",(function(){_indicatorsMap((function(){this.fade()}))}));this.on("scrollStart",(function(){_indicatorsMap((function(){this.fade(1)}))}));this.on("beforeScrollStart",(function(){_indicatorsMap((function(){this.fade(1,true)}))}))}this.on("refresh",(function(){_indicatorsMap((function(){this.refresh()}))}));this.on("destroy",(function(){_indicatorsMap((function(){this.destroy()}));delete this.indicators}))},_initWheel:function(){utils.addEvent(this.wrapper,"wheel",this);utils.addEvent(this.wrapper,"mousewheel",this);utils.addEvent(this.wrapper,"DOMMouseScroll",this);this.on("destroy",(function(){clearTimeout(this.wheelTimeout);this.wheelTimeout=null;utils.removeEvent(this.wrapper,"wheel",this);utils.removeEvent(this.wrapper,"mousewheel",this);utils.removeEvent(this.wrapper,"DOMMouseScroll",this)}))},_wheel:function(e){if(!this.enabled){return}e.preventDefault();var wheelDeltaX,wheelDeltaY,newX,newY,that=this;if(this.wheelTimeout===undefined){that._execEvent("scrollStart")}clearTimeout(this.wheelTimeout);this.wheelTimeout=setTimeout((function(){if(!that.options.snap){that._execEvent("scrollEnd")}that.wheelTimeout=undefined}),400);if("deltaX"in e){if(e.deltaMode===1){wheelDeltaX=-e.deltaX*this.options.mouseWheelSpeed;wheelDeltaY=-e.deltaY*this.options.mouseWheelSpeed}else{wheelDeltaX=-e.deltaX;wheelDeltaY=-e.deltaY}}else if("wheelDeltaX"in e){wheelDeltaX=e.wheelDeltaX/120*this.options.mouseWheelSpeed;wheelDeltaY=e.wheelDeltaY/120*this.options.mouseWheelSpeed}else if("wheelDelta"in e){wheelDeltaX=wheelDeltaY=e.wheelDelta/120*this.options.mouseWheelSpeed}else if("detail"in e){wheelDeltaX=wheelDeltaY=-e.detail/3*this.options.mouseWheelSpeed}else{return}wheelDeltaX*=this.options.invertWheelDirection;wheelDeltaY*=this.options.invertWheelDirection;if(!this.hasVerticalScroll){wheelDeltaX=wheelDeltaY;wheelDeltaY=0}if(this.options.snap){newX=this.currentPage.pageX;newY=this.currentPage.pageY;if(wheelDeltaX>0){newX--}else if(wheelDeltaX<0){newX++}if(wheelDeltaY>0){newY--}else if(wheelDeltaY<0){newY++}this.goToPage(newX,newY);return}newX=this.x+Math.round(this.hasHorizontalScroll?wheelDeltaX:0);newY=this.y+Math.round(this.hasVerticalScroll?wheelDeltaY:0);this.directionX=wheelDeltaX>0?-1:wheelDeltaX<0?1:0;this.directionY=wheelDeltaY>0?-1:wheelDeltaY<0?1:0;if(newX>0){newX=0}else if(newX<this.maxScrollX){newX=this.maxScrollX}if(newY>0){newY=0}else if(newY<this.maxScrollY){newY=this.maxScrollY}this.scrollTo(newX,newY,0)},_initSnap:function(){this.currentPage={};if(typeof this.options.snap=="string"){this.options.snap=this.scroller.querySelectorAll(this.options.snap)}this.on("refresh",(function(){var i=0,l,m=0,n,cx,cy,x=0,y,stepX=this.options.snapStepX||this.wrapperWidth,stepY=this.options.snapStepY||this.wrapperHeight,el;this.pages=[];if(!this.wrapperWidth||!this.wrapperHeight||!this.scrollerWidth||!this.scrollerHeight){return}if(this.options.snap===true){cx=Math.round(stepX/2);cy=Math.round(stepY/2);while(x>-this.scrollerWidth){this.pages[i]=[];l=0;y=0;while(y>-this.scrollerHeight){this.pages[i][l]={x:Math.max(x,this.maxScrollX),y:Math.max(y,this.maxScrollY),width:stepX,height:stepY,cx:x-cx,cy:y-cy};y-=stepY;l++}x-=stepX;i++}}else{el=this.options.snap;l=el.length;n=-1;for(;i<l;i++){if(i===0||el[i].offsetLeft<=el[i-1].offsetLeft){m=0;n++}if(!this.pages[m]){this.pages[m]=[]}x=Math.max(-el[i].offsetLeft,this.maxScrollX);y=Math.max(-el[i].offsetTop,this.maxScrollY);cx=x-Math.round(el[i].offsetWidth/2);cy=y-Math.round(el[i].offsetHeight/2);this.pages[m][n]={x:x,y:y,width:el[i].offsetWidth,height:el[i].offsetHeight,cx:cx,cy:cy};if(x>this.maxScrollX){m++}}}this.goToPage(this.currentPage.pageX||0,this.currentPage.pageY||0,0);if(this.options.snapThreshold%1===0){this.snapThresholdX=this.options.snapThreshold;this.snapThresholdY=this.options.snapThreshold}else{this.snapThresholdX=Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width*this.options.snapThreshold);this.snapThresholdY=Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height*this.options.snapThreshold)}}));this.on("flick",(function(){var time=this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(this.x-this.startX),1e3),Math.min(Math.abs(this.y-this.startY),1e3)),300);this.goToPage(this.currentPage.pageX+this.directionX,this.currentPage.pageY+this.directionY,time)}))},_nearestSnap:function(x,y){if(!this.pages.length){return{x:0,y:0,pageX:0,pageY:0}}var i=0,l=this.pages.length,m=0;if(Math.abs(x-this.absStartX)<this.snapThresholdX&&Math.abs(y-this.absStartY)<this.snapThresholdY){return this.currentPage}if(x>0){x=0}else if(x<this.maxScrollX){x=this.maxScrollX}if(y>0){y=0}else if(y<this.maxScrollY){y=this.maxScrollY}for(;i<l;i++){if(x>=this.pages[i][0].cx){x=this.pages[i][0].x;break}}l=this.pages[i].length;for(;m<l;m++){if(y>=this.pages[0][m].cy){y=this.pages[0][m].y;break}}if(i==this.currentPage.pageX){i+=this.directionX;if(i<0){i=0}else if(i>=this.pages.length){i=this.pages.length-1}x=this.pages[i][0].x}if(m==this.currentPage.pageY){m+=this.directionY;if(m<0){m=0}else if(m>=this.pages[0].length){m=this.pages[0].length-1}y=this.pages[0][m].y}return{x:x,y:y,pageX:i,pageY:m}},goToPage:function(x,y,time,easing){easing=easing||this.options.bounceEasing;if(x>=this.pages.length){x=this.pages.length-1}else if(x<0){x=0}if(y>=this.pages[x].length){y=this.pages[x].length-1}else if(y<0){y=0}var posX=this.pages[x][y].x,posY=this.pages[x][y].y;time=time===undefined?this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(posX-this.x),1e3),Math.min(Math.abs(posY-this.y),1e3)),300):time;this.currentPage={x:posX,y:posY,pageX:x,pageY:y};this.scrollTo(posX,posY,time,easing)},next:function(time,easing){var x=this.currentPage.pageX,y=this.currentPage.pageY;x++;if(x>=this.pages.length&&this.hasVerticalScroll){x=0;y++}this.goToPage(x,y,time,easing)},prev:function(time,easing){var x=this.currentPage.pageX,y=this.currentPage.pageY;x--;if(x<0&&this.hasVerticalScroll){x=0;y--}this.goToPage(x,y,time,easing)},_initKeys:function(e){var keys={pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40};var i;if(typeof this.options.keyBindings=="object"){for(i in this.options.keyBindings){if(typeof this.options.keyBindings[i]=="string"){this.options.keyBindings[i]=this.options.keyBindings[i].toUpperCase().charCodeAt(0)}}}else{this.options.keyBindings={}}for(i in keys){this.options.keyBindings[i]=this.options.keyBindings[i]||keys[i]}utils.addEvent(window,"keydown",this);this.on("destroy",(function(){utils.removeEvent(window,"keydown",this)}))},_key:function(e){if(!this.enabled){return}var snap=this.options.snap,newX=snap?this.currentPage.pageX:this.x,newY=snap?this.currentPage.pageY:this.y,now=utils.getTime(),prevTime=this.keyTime||0,acceleration=.25,pos;if(this.options.useTransition&&this.isInTransition){pos=this.getComputedPosition();this._translate(Math.round(pos.x),Math.round(pos.y));this.isInTransition=false}this.keyAcceleration=now-prevTime<200?Math.min(this.keyAcceleration+acceleration,50):0;switch(e.keyCode){case this.options.keyBindings.pageUp:if(this.hasHorizontalScroll&&!this.hasVerticalScroll){newX+=snap?1:this.wrapperWidth}else{newY+=snap?1:this.wrapperHeight}break;case this.options.keyBindings.pageDown:if(this.hasHorizontalScroll&&!this.hasVerticalScroll){newX-=snap?1:this.wrapperWidth}else{newY-=snap?1:this.wrapperHeight}break;case this.options.keyBindings.end:newX=snap?this.pages.length-1:this.maxScrollX;newY=snap?this.pages[0].length-1:this.maxScrollY;break;case this.options.keyBindings.home:newX=0;newY=0;break;case this.options.keyBindings.left:newX+=snap?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.up:newY+=snap?1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.right:newX-=snap?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.down:newY-=snap?1:5+this.keyAcceleration>>0;break;default:return}if(snap){this.goToPage(newX,newY);return}if(newX>0){newX=0;this.keyAcceleration=0}else if(newX<this.maxScrollX){newX=this.maxScrollX;this.keyAcceleration=0}if(newY>0){newY=0;this.keyAcceleration=0}else if(newY<this.maxScrollY){newY=this.maxScrollY;this.keyAcceleration=0}this.scrollTo(newX,newY,0);this.keyTime=now},_animate:function(destX,destY,duration,easingFn){var that=this,startX=this.x,startY=this.y,startTime=utils.getTime(),destTime=startTime+duration;function step(){var now=utils.getTime(),newX,newY,easing;if(now>=destTime){that.isAnimating=false;that._translate(destX,destY);if(!that.resetPosition(that.options.bounceTime)){that._execEvent("scrollEnd")}return}now=(now-startTime)/duration;easing=easingFn(now);newX=(destX-startX)*easing+startX;newY=(destY-startY)*easing+startY;that._translate(newX,newY);if(that.isAnimating){rAF(step)}}this.isAnimating=true;step()},handleEvent:function(e){switch(e.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(e);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":this._move(e);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":this._end(e);break;case"orientationchange":case"resize":this._resize();break;case"transitionend":case"webkitTransitionEnd":case"oTransitionEnd":case"MSTransitionEnd":this._transitionEnd(e);break;case"wheel":case"DOMMouseScroll":case"mousewheel":this._wheel(e);break;case"keydown":this._key(e);break;case"click":if(this.enabled&&!e._constructed){e.preventDefault();e.stopPropagation()}break}}};function createDefaultScrollbar(direction,interactive,type){var scrollbar=document.createElement("div"),indicator=document.createElement("div");if(type===true){scrollbar.style.cssText="position:absolute;z-index:9999";indicator.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px"}indicator.className="iScrollIndicator";if(direction=="h"){if(type===true){scrollbar.style.cssText+=";height:7px;left:2px;right:2px;bottom:0";indicator.style.height="100%"}scrollbar.className="iScrollHorizontalScrollbar"}else{if(type===true){scrollbar.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px";indicator.style.width="100%"}scrollbar.className="iScrollVerticalScrollbar"}scrollbar.style.cssText+=";overflow:hidden";if(!interactive){scrollbar.style.pointerEvents="none"}scrollbar.appendChild(indicator);return scrollbar}function Indicator(scroller,options){this.wrapper=typeof options.el=="string"?document.querySelector(options.el):options.el;this.wrapperStyle=this.wrapper.style;this.indicator=this.wrapper.children[0];this.indicatorStyle=this.indicator.style;this.scroller=scroller;this.options={listenX:true,listenY:true,interactive:false,resize:true,defaultScrollbars:false,shrink:false,fade:false,speedRatioX:0,speedRatioY:0};for(var i in options){this.options[i]=options[i]}this.sizeRatioX=1;this.sizeRatioY=1;this.maxPosX=0;this.maxPosY=0;if(this.options.interactive){if(!this.options.disableTouch){utils.addEvent(this.indicator,"touchstart",this);utils.addEvent(window,"touchend",this)}if(!this.options.disablePointer){utils.addEvent(this.indicator,utils.prefixPointerEvent("pointerdown"),this);utils.addEvent(window,utils.prefixPointerEvent("pointerup"),this)}if(!this.options.disableMouse){utils.addEvent(this.indicator,"mousedown",this);utils.addEvent(window,"mouseup",this)}}if(this.options.fade){this.wrapperStyle[utils.style.transform]=this.scroller.translateZ;var durationProp=utils.style.transitionDuration;this.wrapperStyle[durationProp]=utils.isBadAndroid?"0.0001ms":"0ms";var self=this;if(utils.isBadAndroid){rAF((function(){if(self.wrapperStyle[durationProp]==="0.0001ms"){self.wrapperStyle[durationProp]="0s"}}))}this.wrapperStyle.opacity="0"}}Indicator.prototype={handleEvent:function(e){switch(e.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(e);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":this._move(e);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":this._end(e);break}},destroy:function(){if(this.options.fadeScrollbars){clearTimeout(this.fadeTimeout);this.fadeTimeout=null}if(this.options.interactive){utils.removeEvent(this.indicator,"touchstart",this);utils.removeEvent(this.indicator,utils.prefixPointerEvent("pointerdown"),this);utils.removeEvent(this.indicator,"mousedown",this);utils.removeEvent(window,"touchmove",this);utils.removeEvent(window,utils.prefixPointerEvent("pointermove"),this);utils.removeEvent(window,"mousemove",this);utils.removeEvent(window,"touchend",this);utils.removeEvent(window,utils.prefixPointerEvent("pointerup"),this);utils.removeEvent(window,"mouseup",this)}if(this.options.defaultScrollbars){this.wrapper.parentNode.removeChild(this.wrapper)}},_start:function(e){var point=e.touches?e.touches[0]:e;e.preventDefault();e.stopPropagation();this.transitionTime();this.initiated=true;this.moved=false;this.lastPointX=point.pageX;this.lastPointY=point.pageY;this.startTime=utils.getTime();if(!this.options.disableTouch){utils.addEvent(window,"touchmove",this)}if(!this.options.disablePointer){utils.addEvent(window,utils.prefixPointerEvent("pointermove"),this)}if(!this.options.disableMouse){utils.addEvent(window,"mousemove",this)}this.scroller._execEvent("beforeScrollStart")},_move:function(e){var point=e.touches?e.touches[0]:e,deltaX,deltaY,newX,newY,timestamp=utils.getTime();if(!this.moved){this.scroller._execEvent("scrollStart")}this.moved=true;deltaX=point.pageX-this.lastPointX;this.lastPointX=point.pageX;deltaY=point.pageY-this.lastPointY;this.lastPointY=point.pageY;newX=this.x+deltaX;newY=this.y+deltaY;this._pos(newX,newY);e.preventDefault();e.stopPropagation()},_end:function(e){if(!this.initiated){return}this.initiated=false;e.preventDefault();e.stopPropagation();utils.removeEvent(window,"touchmove",this);utils.removeEvent(window,utils.prefixPointerEvent("pointermove"),this);utils.removeEvent(window,"mousemove",this);if(this.scroller.options.snap){var snap=this.scroller._nearestSnap(this.scroller.x,this.scroller.y);var time=this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(this.scroller.x-snap.x),1e3),Math.min(Math.abs(this.scroller.y-snap.y),1e3)),300);if(this.scroller.x!=snap.x||this.scroller.y!=snap.y){this.scroller.directionX=0;this.scroller.directionY=0;this.scroller.currentPage=snap;this.scroller.scrollTo(snap.x,snap.y,time,this.scroller.options.bounceEasing)}}if(this.moved){this.scroller._execEvent("scrollEnd")}},transitionTime:function(time){time=time||0;var durationProp=utils.style.transitionDuration;this.indicatorStyle[durationProp]=time+"ms";if(!time&&utils.isBadAndroid){this.indicatorStyle[durationProp]="0.0001ms";var self=this;rAF((function(){if(self.indicatorStyle[durationProp]==="0.0001ms"){self.indicatorStyle[durationProp]="0s"}}))}},transitionTimingFunction:function(easing){this.indicatorStyle[utils.style.transitionTimingFunction]=easing},refresh:function(){this.transitionTime();if(this.options.listenX&&!this.options.listenY){this.indicatorStyle.display=this.scroller.hasHorizontalScroll?"block":"none"}else if(this.options.listenY&&!this.options.listenX){this.indicatorStyle.display=this.scroller.hasVerticalScroll?"block":"none"}else{this.indicatorStyle.display=this.scroller.hasHorizontalScroll||this.scroller.hasVerticalScroll?"block":"none"}if(this.scroller.hasHorizontalScroll&&this.scroller.hasVerticalScroll){utils.addClass(this.wrapper,"iScrollBothScrollbars");utils.removeClass(this.wrapper,"iScrollLoneScrollbar");if(this.options.defaultScrollbars&&this.options.customStyle){if(this.options.listenX){this.wrapper.style.right="8px"}else{this.wrapper.style.bottom="8px"}}}else{utils.removeClass(this.wrapper,"iScrollBothScrollbars");utils.addClass(this.wrapper,"iScrollLoneScrollbar");if(this.options.defaultScrollbars&&this.options.customStyle){if(this.options.listenX){this.wrapper.style.right="2px"}else{this.wrapper.style.bottom="2px"}}}var r=this.wrapper.offsetHeight;if(this.options.listenX){this.wrapperWidth=this.wrapper.clientWidth;if(this.options.resize){this.indicatorWidth=Math.max(Math.round(this.wrapperWidth*this.wrapperWidth/(this.scroller.scrollerWidth||this.wrapperWidth||1)),8);this.indicatorStyle.width=this.indicatorWidth+"px"}else{this.indicatorWidth=this.indicator.clientWidth}this.maxPosX=this.wrapperWidth-this.indicatorWidth;if(this.options.shrink=="clip"){this.minBoundaryX=-this.indicatorWidth+8;this.maxBoundaryX=this.wrapperWidth-8}else{this.minBoundaryX=0;this.maxBoundaryX=this.maxPosX}this.sizeRatioX=this.options.speedRatioX||this.scroller.maxScrollX&&this.maxPosX/this.scroller.maxScrollX}if(this.options.listenY){this.wrapperHeight=this.wrapper.clientHeight;if(this.options.resize){this.indicatorHeight=Math.max(Math.round(this.wrapperHeight*this.wrapperHeight/(this.scroller.scrollerHeight||this.wrapperHeight||1)),8);this.indicatorStyle.height=this.indicatorHeight+"px"}else{this.indicatorHeight=this.indicator.clientHeight}this.maxPosY=this.wrapperHeight-this.indicatorHeight;if(this.options.shrink=="clip"){this.minBoundaryY=-this.indicatorHeight+8;this.maxBoundaryY=this.wrapperHeight-8}else{this.minBoundaryY=0;this.maxBoundaryY=this.maxPosY}this.maxPosY=this.wrapperHeight-this.indicatorHeight;this.sizeRatioY=this.options.speedRatioY||this.scroller.maxScrollY&&this.maxPosY/this.scroller.maxScrollY}this.updatePosition()},updatePosition:function(){var x=this.options.listenX&&Math.round(this.sizeRatioX*this.scroller.x)||0,y=this.options.listenY&&Math.round(this.sizeRatioY*this.scroller.y)||0;if(!this.options.ignoreBoundaries){if(x<this.minBoundaryX){if(this.options.shrink=="scale"){this.width=Math.max(this.indicatorWidth+x,8);this.indicatorStyle.width=this.width+"px"}x=this.minBoundaryX}else if(x>this.maxBoundaryX){if(this.options.shrink=="scale"){this.width=Math.max(this.indicatorWidth-(x-this.maxPosX),8);this.indicatorStyle.width=this.width+"px";x=this.maxPosX+this.indicatorWidth-this.width}else{x=this.maxBoundaryX}}else if(this.options.shrink=="scale"&&this.width!=this.indicatorWidth){this.width=this.indicatorWidth;this.indicatorStyle.width=this.width+"px"}if(y<this.minBoundaryY){if(this.options.shrink=="scale"){this.height=Math.max(this.indicatorHeight+y*3,8);this.indicatorStyle.height=this.height+"px"}y=this.minBoundaryY}else if(y>this.maxBoundaryY){if(this.options.shrink=="scale"){this.height=Math.max(this.indicatorHeight-(y-this.maxPosY)*3,8);this.indicatorStyle.height=this.height+"px";y=this.maxPosY+this.indicatorHeight-this.height}else{y=this.maxBoundaryY}}else if(this.options.shrink=="scale"&&this.height!=this.indicatorHeight){this.height=this.indicatorHeight;this.indicatorStyle.height=this.height+"px"}}this.x=x;this.y=y;if(this.scroller.options.useTransform){this.indicatorStyle[utils.style.transform]="translate("+x+"px,"+y+"px)"+this.scroller.translateZ}else{this.indicatorStyle.left=x+"px";this.indicatorStyle.top=y+"px"}},_pos:function(x,y){if(x<0){x=0}else if(x>this.maxPosX){x=this.maxPosX}if(y<0){y=0}else if(y>this.maxPosY){y=this.maxPosY}x=this.options.listenX?Math.round(x/this.sizeRatioX):this.scroller.x;y=this.options.listenY?Math.round(y/this.sizeRatioY):this.scroller.y;this.scroller.scrollTo(x,y)},fade:function(val,hold){if(hold&&!this.visible){return}clearTimeout(this.fadeTimeout);this.fadeTimeout=null;var time=val?250:500,delay=val?0:300;val=val?"1":"0";this.wrapperStyle[utils.style.transitionDuration]=time+"ms";this.fadeTimeout=setTimeout(function(val){this.wrapperStyle.opacity=val;this.visible=+val}.bind(this,val),delay)}};IScroll.utils=utils;if(typeof module!="undefined"&&module.exports){module.exports=IScroll}else if(typeof define=="function"&&define.amd){define((function(){return IScroll}))}else{window.IScroll=IScroll}})(window,document,Math);(function(factory){var registeredInModuleLoader=false;if(typeof define==="function"&&define.amd){define(factory);registeredInModuleLoader=true}if(typeof exports==="object"){module.exports=factory();registeredInModuleLoader=true}if(!registeredInModuleLoader){var OldCookies=window.Cookies;var api=window.Cookies=factory();api.noConflict=function(){window.Cookies=OldCookies;return api}}})((function(){function extend(){var i=0;var result={};for(;i<arguments.length;i++){var attributes=arguments[i];for(var key in attributes){result[key]=attributes[key]}}return result}function init(converter){function api(key,value,attributes){var result;if(typeof document==="undefined"){return}if(arguments.length>1){attributes=extend({path:"/"},api.defaults,attributes);if(typeof attributes.expires==="number"){var expires=new Date;expires.setMilliseconds(expires.getMilliseconds()+attributes.expires*864e5);attributes.expires=expires}attributes.expires=attributes.expires?attributes.expires.toUTCString():"";try{result=JSON.stringify(value);if(/^[\{\[]/.test(result)){value=result}}catch(e){}if(!converter.write){value=encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)}else{value=converter.write(value,key)}key=encodeURIComponent(String(key));key=key.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);key=key.replace(/[\(\)]/g,escape);var stringifiedAttributes="";for(var attributeName in attributes){if(!attributes[attributeName]){continue}stringifiedAttributes+="; "+attributeName;if(attributes[attributeName]===true){continue}stringifiedAttributes+="="+attributes[attributeName]}return document.cookie=key+"="+value+stringifiedAttributes}if(!key){result={}}var cookies=document.cookie?document.cookie.split("; "):[];var rdecode=/(%[0-9A-Z]{2})+/g;var i=0;for(;i<cookies.length;i++){var parts=cookies[i].split("=");var cookie=parts.slice(1).join("=");if(!this.json&&cookie.charAt(0)==='"'){cookie=cookie.slice(1,-1)}try{var name=parts[0].replace(rdecode,decodeURIComponent);cookie=converter.read?converter.read(cookie,name):converter(cookie,name)||cookie.replace(rdecode,decodeURIComponent);if(this.json){try{cookie=JSON.parse(cookie)}catch(e){}}if(key===name){result=cookie;break}if(!key){result[name]=cookie}}catch(e){}}return result}api.set=api;api.get=function(key){return api.call(api,key)};api.getJSON=function(){return api.apply({json:true},[].slice.call(arguments))};api.defaults={};api.remove=function(key,attributes){api(key,"",extend(attributes,{expires:-1}))};api.withConverter=init;return api}return init((function(){}))}));"use strict";window.requestAnimationFrame=function(){"use strict";return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimaitonFrame||function(callback){window.setTimeout(callback,1e3/60)}}();(function($){"use strict";var DIRECTIONS={NONE:0,HORIZONTAL:1,LEFT_TO_RIGHT:2,RIGHT_TO_LEFT:3,VERTICAL:4,TOP_TO_DOWN:5,DOWN_TO_TOP:6};var abs=Math.abs;var max=Math.max;var TAG_WHITE_LIST=["INPUT","SELECT","OPTION"];var SwipeTracer;var activeEventProcessor;var swipeMask=$("<div></div>");swipeMask.css({"background-color":"rgba(0, 0, 0, 0)",position:"fixed",top:0,width:"100vw",height:"100vh","z-index":1e5});var touchMoveListeners=[];var touchEndListeners=[];var pointerId=null;var onTouch=function(e){if(e&&(e.pointerId&&e.pointerId!==pointerId||e.touches&&e.touches.length>1)){onTouchEnd(e)}$.each(touchMoveListeners,(function(i,fn){return fn(e)}))};var onTouchEnd=function(e){pointerId=null;$.each(touchEndListeners,(function(i,fn){return fn(e)}));touchMoveListeners.length=0;touchEndListeners.length=0};function addEventListener(target,event,callback){(target.__zone_symbol__addEventListener||target.addEventListener).call(target,event,callback,{passive:true})}function iOSversion(){if(/iP(hone|od|ad)/.test(navigator.platform)){var v=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return parseInt(v[1],10)}}if(window["PointerEvent"]&&iOSversion()>=13){addEventListener(document,"pointerdown",(function(e){if(pointerId&&pointerId!==e.pointerId){onTouchEnd(e)}else{pointerId=e.pointerId}}));addEventListener(document,"pointermove",onTouch);addEventListener(document,"pointerup",onTouchEnd);addEventListener(document,"pointercancel",onTouchEnd)}else{addEventListener(document,"mousemove",onTouch);addEventListener(document,"touchmove",onTouch);addEventListener(document,"mouseup",onTouchEnd);addEventListener(document,"touchcancel",onTouchEnd);addEventListener(document,"touchend",onTouchEnd)}function ScrollObserver(parent,child,direction){var elementsToObserve=function(array){var iter=child;while(iter){array.push({$ele:$(iter),last:{scrollLeft:iter.iscroll?iter.iscroll.x:iter.scrollLeft,scrollTop:iter.iscroll?iter.iscroll.y:iter.scrollTop}});iter=iter.parentElement}return array}([]);function isVerticalScroll(){var result;$.each(elementsToObserve,(function(){if(this.$ele[0].iscroll){if(!isNaN(this.$ele[0].iscroll.y)&&this.$ele[0].iscroll.y!==0){result=true}}else if(this.$ele[0].scrollTop!==0){result=true}}));return result}function isHorizontalScroll(){var result;$.each(elementsToObserve,(function(){if(this.$ele[0].iscroll){if(!isNaN(this.$ele[0].iscroll.x)&&this.$ele[0].iscroll.x!==0){result=true}}else if(this.$ele[0].scrollLeft!==0){result=true}}));return result}this.hasSrcolled=function(){if(direction===$.fn.swipey.DIRECTIONS.VERTICAL){return isVerticalScroll()}if(direction===$.fn.swipey.DIRECTIONS.HORIZONTAL){return isHorizontalScroll()}}}function SwipeEventSmoother(){var queue=[];var isProcessing=false;var time;function process(){if(queue.length>0){try{queue.shift()()}catch(e){console.error("Function invocation failed",e)}window.requestAnimationFrame(process)}else{isProcessing=false}}this.push=function(fn){queue.push(fn)};this.process=function(){if(!isProcessing){isProcessing=true;process()}}}activeEventProcessor=new SwipeEventSmoother;function getTouchEvent(event){if(event.originalEvent&&event.originalEvent.pointerType!=="mouse"){return event.originalEvent}return event.originalEvent&&event.originalEvent.touches&&event.originalEvent.touches[0]||event&&event.touches&&event.touches[0]||event}function computeDistance(startPoint,endPoint,direction){var distance=0,deltaX,deltaY;if(direction===DIRECTIONS.HORIZONTAL){distance=endPoint.x-startPoint.x}else if(direction===DIRECTIONS.LEFT_TO_RIGHT){distance=max(endPoint.x-startPoint.x,0)}else if(direction===DIRECTIONS.RIGHT_TO_LEFT){distance=max(startPoint.x-endPoint.x,0)}else if(direction===DIRECTIONS.VERTICAL){distance=endPoint.y-startPoint.y}else if(direction===DIRECTIONS.TOP_TO_DOWN){distance=max(endPoint.y-startPoint.y,0)}else if(direction===DIRECTIONS.DOWN_TO_TOP){distance=max(startPoint.y-endPoint.y,0)}else{deltaX=endPoint.x-startPoint.x;deltaY=endPoint.y-startPoint.y;distance=max(abs(deltaX),abs(deltaY));if(deltaX<0&&abs(deltaX)===distance||deltaY<0&&abs(deltaY)===distance){distance=-distance}}return distance}function onActiveSwipe(event,settings){var touch=getTouchEvent(event);var startPoint=settings.data.path[0];var point={x:touch.pageX,y:touch.pageY};var distance=computeDistance(startPoint,point,settings.direction);var eventSplits=[];var increment;var limit;settings.renderInProgress=false;if(distance!==settings.lastDistance){increment=(distance<settings.lastDistance?-1:1)*30;limit=distance-settings.lastDistance;for(var i=increment;increment>0&&i<=limit||increment<0&&i>=limit;i+=increment){eventSplits.push(i+settings.lastDistance)}if(limit%increment!==0){eventSplits.push(limit%abs(increment)+(eventSplits.length===0?settings.lastDistance:eventSplits[eventSplits.length-1]))}settings.lastDistance=distance;$.each(eventSplits,(function(){var d=this;activeEventProcessor.push((function(){settings.data.length=d;settings.data.totalLength+=abs(d);settings.data.velocity=abs(settings.data.totalLength/(Date.now()-settings.data.startTime));settings.data.path.push(point);if(settings.onSwipe.call(settings.target,event,settings.data)===false){onActiveSwipeEnd(event,settings)}SwipeTracer.onSwipe(event,settings.data)}))}));activeEventProcessor.process()}}function onActiveSwipeEnd(event,settings){var touch=getTouchEvent(event);if(touch){settings.data.path.push({x:touch.pageX,y:touch.pageY})}activeEventProcessor.push((function(){SwipeTracer.onSwipeEnd(event,settings.data);settings.onSwipeEnd.call(settings.target,event,settings.data)}));activeEventProcessor.process()}function listenActiveSwipe(event,settings){var touch=getTouchEvent(event);var swipeHandler;var swipeEndHandler;var passiveDistance;var passiveSwipeStartPoint=settings.data.path[0];var activeSwipeStartPoint={x:touch.pageX,y:touch.pageY};passiveDistance=computeDistance(passiveSwipeStartPoint,activeSwipeStartPoint,settings.direction);settings.data.length=passiveDistance<0?-1:1;settings.lastDistance=settings.data.length;settings.data.path=[activeSwipeStartPoint];settings.data.totalLength=abs(settings.data.length);settings.data.startTime=Date.now();if(settings.onSwipeStart.call(settings.target,event,settings.data)===false){return false}swipeMask.appendTo($("body"));swipeHandler=function(em){onActiveSwipe(em,settings)};swipeEndHandler=function(ee){swipeMask.remove();onActiveSwipeEnd(ee,settings)};touchMoveListeners=[];touchMoveListeners.push(swipeHandler);touchEndListeners=[];touchEndListeners.push(swipeEndHandler);SwipeTracer.onSwipeStart(event,settings.data);return true}function isThresholdAngleReached(startPoint,endPoint,direction){if(direction===DIRECTIONS.HORIZONTAL){if(Math.abs((endPoint.y-startPoint.y)/(endPoint.x-startPoint.x))<=.36397023426){return true}}else if(direction===DIRECTIONS.VERTICAL){if(Math.abs((endPoint.y-startPoint.y)/(endPoint.x-startPoint.x))>=2.74747741945){return true}}return false}function isThresholdReached(touch,settings){var startPoint=settings.data.path[0];var endPoint={x:touch.pageX,y:touch.pageY};var distance=computeDistance(startPoint,endPoint,settings.direction);return abs(distance)>settings.threshold&&isThresholdAngleReached(startPoint,endPoint,settings.direction)}function listenPassiveSwipe(touch,settings){var passiveSwipeHandler;settings.scrollObserver=new ScrollObserver(event.currentTarget,event.target,settings.direction);passiveSwipeHandler=function(em){if(isThresholdReached(getTouchEvent(em),settings)){if(settings.scrollObserver.hasSrcolled()||listenActiveSwipe(em,settings)){return false}}};touchMoveListeners.push(passiveSwipeHandler);settings.data={path:[{x:touch.pageX,y:touch.pageY}]}}function bind(settings){var events=settings.bindEvents;var listenFor="";if(_.includes(events,"touch")){listenFor+="touchstart"}else if(_.includes(events,"mouse")){listenFor+="mousedown"}else if(_.includes(events,"pointer")){listenFor+="pointerdown"}if(!listenFor){return}addEventListener(settings.target[0],listenFor,(function(es){if(settings.disableMouse&&es.pointerType==="mouse"){return}if(es.pointerType!=="mouse"&&es.MSPOINTER_TYPE_MOUSE&&es.pointerType!==es.MSPOINTER_TYPE_MOUSE){if(TAG_WHITE_LIST.indexOf(es.target.tagName)<0){es.preventDefault()}else{return}}var touch=getTouchEvent(es);if(touch){listenPassiveSwipe(touch,settings)}}))}$.fn.swipey=function(settings){this.each((function(){bind($.extend({direction:DIRECTIONS.NONE,target:$(this),bindEvents:["touch","mouse"],swipeTarget:document,threshold:30,onSwipeStart:$.noop,onSwipe:$.noop,onSwipeEnd:$.noop,disableMouse:true},settings))}));return this};SwipeTracer={onSwipeStart:function(e,data){if($.fn.swipey.trace){var $svg='<svg height="100vh" width="100vw" id ="canvas">'+' <path stroke="rgba(0, 0, 0, 0.5)" stroke-linecap="round" stroke-width="20" fill-opacity="0" '+' stroke-opacity="0.8" d="M'+data.path[0].x+" "+data.path[0].y+' " />'+" </svg>";$svg.css({position:"fixed",top:0,left:0,width:"100vw",height:"100vh","z-index":1e4});$("body").append($svg);data.tracer={pathd:$("#canvas path")}}},onSwipe:function(e,data){if(data.tracer){var d=data.tracer.pathd.attr("d");var p=data.path[data.path.length-1];data.tracer.pathd.attr("d",d+" L"+p.x+" "+p.y+" ")}},onSwipeEnd:function(e,data){if(data.tracer){var firstPoint=data.path[0];var expected_1=[firstPoint,{y:firstPoint.y-50},{x:firstPoint.x+50},{y:firstPoint.y+50}];var trace_1=0;_.forEach(data.path,(function(p){var ep;if(trace_1!==expected_1.length){ep=expected_1[trace_1];if((!ep.x||ep.x<=p.x)&&(!ep.y||ep.y<=p.y)){trace_1++}}}));setTimeout((function(){$("body >#canvas").remove()}),500)}}};$.fn.swipey.DIRECTIONS=DIRECTIONS})(jQuery);(function($){var $parse;var expressionRegex=/\$\{\{[a-zA-Z\+-/%\.\*\s\(\)\d,\\'"\$_]*\}\}/;function getParseService(){if($.fn.swipeAnimation.expressionEvaluator){return $.fn.swipeAnimation.expressionEvaluator}if(window.exprEval&&window.exprEval.Parser){return function(exp){var parser=(new window.exprEval.Parser).parse(exp);return function(context){return parser.evaluate(context)}}}}function compile(script){var tArr=[];var match;$parse=$parse||getParseService();if(_.isFunction(script)){return script}else if($parse){while((match=expressionRegex.exec(script))!==null){var expression=match[0];var prefix=script.substring(0,match.index);script=script.substring(match.index+expression.length);expression=expression.substring(3,expression.length-2);tArr.push(prefix);tArr.push($parse(expression).bind({}))}tArr.push(script);return function(){var args=arguments;return _.map(tArr,(function(v){return _.isFunction(v)?v.apply(undefined,args):v})).join("")}}}function getObject(obj,$ele,args){if(_.isFunction(obj)){return obj.apply($ele,args)}return obj}function VelocityComputator(){var lastDistance=0;var lastTime=0;var v=0;return{addDistance:function(d){var currentTime=Date.now();if(Math.abs(d-lastDistance)>10&&currentTime!==lastTime){v=(d-lastDistance)/(currentTime-lastTime);lastDistance=d;lastTime=currentTime}if(v<0){v=Math.min(v,-1)}else{v=Math.max(v,1)}return this},getVelocity:function(){return v},getTime:function(d){return Math.abs(d/v)}}}function calculateBounds($el,settings,args){var centerVal=0;var bounds=getObject(settings.bounds,$el,args);if(!_.isUndefined(bounds.center)){centerVal=bounds.center}if(!_.isUndefined(bounds.lower)){bounds.lower=bounds.lower+centerVal}if(!_.isUndefined(bounds.upper)){bounds.upper=bounds.upper+centerVal}return bounds}function retrieveTargets(settings){_.forEach(settings.animation,(function(a){if(_.isFunction(a.target)||a.targetFn){a.targetFn=_.isUndefined(a.targetFn)?a.target:a.targetFn;a.target=a.targetFn()}}))}function SettingsProperty(){this.setSettings=function(settings,$el){$el.data("swipeAnimationDefaults",settings)};this.getSettings=function($el){return $el.data("swipeAnimationDefaults")}}function animate(settings,metaData,time,$el,distanceMoved,e){_.forEach(settings.animation,(function(a){if(!a.target){return}if(a.target.length>1){a.target.each((function(i){metaData.$i=i;$(this).css(_.mapValues(a.css,(function(v,k){return v(metaData)})))}))}else{metaData.$i=0;a.target.css(_.mapValues(a.css,(function(v,k){return v(metaData)})))}a.target.css({transition:"all ease-out "+time+"ms"});a.target.one("webkitTransitionEnd transitionend",(function(){a.target.css({transition:""})}))}));setTimeout((function(){window.requestAnimationFrame((function(){if(metaData.$D===metaData.bounds.lower){settings.onLower.call($el,e)}else if(metaData.$D===metaData.bounds.upper){settings.onUpper.call($el,e)}settings.onAnimation(e,distanceMoved)}))}),time)}var methods={gotoUpper:function(){swipeToEnd(this,"upper",arguments[1])},gotoLower:function(time){swipeToEnd(this,"lower",arguments[1])}};function swipeToEnd($ele,moveTo,time){var settingsObj=new SettingsProperty;var settings=settingsObj.getSettings($ele);var metaData={};var bounds=calculateBounds($ele,settings);var context;retrieveTargets(settings);time=time||300;context=getObject(settings.context,$ele);metaData=_.extend({},context);metaData.$d=0;metaData.$D=moveTo==="lower"?bounds.lower:bounds.upper;metaData.bounds=bounds;animate(settings,metaData,time,$ele)}function addSwipey($ele,settings){var state={$D:0};var baseContext={max:Math.max,min:Math.min,abs:Math.abs};if(!_.isArray(settings.animation)){var target=settings.animation.target||$ele;var css=settings.animation.css||settings.animation;delete css[$ele];settings.animation=[{target:target,css:css}]}_.forEach(settings.animation,(function(a){a.css=_.mapValues(a.css,(function(v,k){return compile(v)}))}));var settingsObj=new SettingsProperty;settingsObj.setSettings(settings,$ele);$ele.swipey({direction:settings.direction,threshold:settings.threshold,bindEvents:settings.bindEvents,target:settings.target,onSwipeStart:function(e,data){var cd;state.$d=0;state.bounds=calculateBounds(this,settings,[e,data.length]);if(!_.isUndefined(state.bounds.center)){state.$D=state.bounds.center}else{state.$D=0}cd=state.$D+data.length;state.bounds.strictLower=!(state.bounds.strict===false||state.bounds.strictLower===false);state.bounds.strictUpper=!(state.bounds.strict===false||state.bounds.strictUpper===false);if(!settings.enableGestures()||state.bounds.strictLower&&(_.isUndefined(state.bounds.lower)&&data.length<0||!_.isUndefined(state.bounds.lower)&&state.bounds.lower>cd)||state.bounds.strictUpper&&(_.isUndefined(state.bounds.upper)&&data.length>0||!_.isUndefined(state.bounds.upper)&&state.bounds.upper<cd)){return false}state.vc=VelocityComputator();state.context=_.extend(baseContext,getObject(settings.context,$ele));state.localState=_.extend({},state.context);retrieveTargets(settings);_.forEach(settings.animation,(function(a){if(a.target){a.target.css({transition:"none"})}}))},onSwipe:function(e,data){var localState=state.localState;var cd=state.$D+data.length;localState.$d=data.length;localState.$D=state.$D;if(state.bounds.strictLower&&!_.isUndefined(state.bounds.lower)&&state.bounds.lower>cd){localState.$d=state.bounds.lower-state.$D}else if(state.bounds.strictUpper&&!_.isUndefined(state.bounds.upper)&&state.bounds.upper<cd){localState.$d=state.bounds.upper-state.$D}state.vc.addDistance(data.length);_.forEach(settings.animation,(function(a){if(a.target){if(a.target.length>1){a.target.each((function(i){localState.$i=i;$(this).css(_.mapValues(a.css,(function(v,k){return v(localState)})))}))}else{localState.$i=0;a.target.css(_.mapValues(a.css,(function(v,k){return v(localState)})))}}}))},onSwipeEnd:function(e,data){var localState=state.localState;var cd=state.$D+data.length;var v=state.vc.getVelocity();var time;localState.$d=data.length;localState.$D=state.$D;if(!_.isUndefined(state.bounds.lower)&&v<=0&&state.$D>cd){localState.$D=state.bounds.lower}else if(!_.isUndefined(state.bounds.upper)&&v>=0&&state.$D<cd){localState.$D=state.bounds.upper}localState.$d=0;localState.bounds=state.bounds;state.$D=localState.$D;time=state.vc.getTime(localState.$D-cd);animate(settings,localState,time,$ele,cd,e)}})}$.fn.swipeAnimation=function(settings){if(methods[settings]){return methods[settings].apply(this,arguments)}this.each((function(){addSwipey($(this),$.extend({direction:$.fn.swipey.DIRECTIONS.HORIZONTAL,target:$(this),threshold:30,enableGestures:function(){return true},bindEvents:["touch"],bounds:{},context:{},animation:{},onLower:$.noop,onUpper:$.noop,onAnimation:$.noop},settings))}));return this}})(jQuery);
849
849
  /*!
850
850
  * jQuery UI Touch Punch 0.2.3
@@ -856,7 +856,7 @@ var FullCalendar=function(e){"use strict";var t=function(e,n){return(t=Object.se
856
856
  * jquery.ui.widget.js
857
857
  * jquery.ui.mouse.js
858
858
  */
859
- !function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){$(a.target).is("input")||$(a.target).is("textarea")||$(a.target).is("select")||$(a.target).is("button")||$(a.target).is("option")?a.stopPropagation():a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IMask={})}(this,(function(t){"use strict";function e(t){return"string"==typeof t||t instanceof String}function s(t){var e;return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(e=t.constructor)?void 0:e.name)}function i(t,e){return Array.isArray(e)?i(t,((t,s)=>e.includes(s))):Object.entries(t).reduce(((t,s)=>{let[i,a]=s;return e(a,i)&&(t[i]=a),t}),{})}const a={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function u(t){switch(t){case a.LEFT:return a.FORCE_LEFT;case a.RIGHT:return a.FORCE_RIGHT;default:return t}}function n(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function r(t,e){if(e===t)return!0;const s=Array.isArray(e),i=Array.isArray(t);let a;if(s&&i){if(e.length!=t.length)return!1;for(a=0;a<e.length;a++)if(!r(e[a],t[a]))return!1;return!0}if(s!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const s=e instanceof Date,i=t instanceof Date;if(s&&i)return e.getTime()==t.getTime();if(s!=i)return!1;const u=e instanceof RegExp,n=t instanceof RegExp;if(u&&n)return e.toString()==t.toString();if(u!=n)return!1;const h=Object.keys(e);for(a=0;a<h.length;a++)if(!Object.prototype.hasOwnProperty.call(t,h[a]))return!1;for(a=0;a<h.length;a++)if(!r(t[h[a]],e[h[a]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class h{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?a.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?a.LEFT:a.RIGHT}}function o(t,e){return new o.InputMask(t,e)}function l(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?o.MaskedRegExp:e(t)?o.MaskedPattern:t===Date?o.MaskedDate:t===Number?o.MaskedNumber:Array.isArray(t)||t===Array?o.MaskedDynamic:o.Masked&&t.prototype instanceof o.Masked?t:o.Masked&&t instanceof o.Masked?t.constructor:t instanceof Function?o.MaskedFunction:(console.warn("Mask not found for mask",t),o.Masked)}function p(t){if(!t)throw new Error("Options in not defined");if(o.Masked){if(t.prototype instanceof o.Masked)return{mask:t};const{mask:e,...a}=t instanceof o.Masked?{mask:t}:s(t)&&t.mask instanceof o.Masked?t:{};if(e){const t=e.mask;return{...i(e,((t,e)=>!e.startsWith("_"))),mask:e.constructor,_mask:t,...a}}}return s(t)?{...t}:{mask:t}}function d(t){if(o.Masked&&t instanceof o.Masked)return t;const e=p(t),s=l(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}o.createMask=d;class c{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}o.MaskElement=c;class g extends c{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,s;return null!=(t=null==(e=(s=this.input).getRootNode)?void 0:e.call(s))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}o.HTMLMaskElement=g;class k extends g{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}o.HTMLMaskElement=g;class m extends g{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}o.HTMLContenteditableMaskElement=m;class _{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>_.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}_.MAX_LENGTH=100;class f{constructor(t,e){this.el=t instanceof c?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new m(t):new k(t),this.masked=d(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new _,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof o.Masked)&&this.masked.constructor===l(t))return void this.masked.updateOptions({mask:t});const e=t instanceof o.Masked?t:d({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach((t=>t(e)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,u=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),u&&this._fireChangeEvents(),this._historyChanging||!u&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout((()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())}),10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,a.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new h({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,u=s===this.masked.rawInputValue?e.removeDirection:a.NONE;let n=this.masked.nearestInputPos(e.startChangePos+i,u);u!==a.NONE&&(n=this.masked.nearestInputPos(n,a.NONE)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}o.InputMask=f;class v{static normalize(t){return Array.isArray(t)?t:[t,new v]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}o.ChangeDetails=v;class E{constructor(t,e,s){void 0===t&&(t=""),void 0===e&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class C{constructor(t){this._value="",this._update({...C.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E(this.extractInput(t,e),t)}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new v({inserted:t,rawInserted:t})):new v}_appendChar(t,e,s){void 0===e&&(e={});const i=this.state;let a;if([t,a]=this.doPrepareChar(t,e),t&&(a=a.aggregate(this._appendCharRaw(t,e)),!a.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=i;let u=this.pad(e);const n=this._appendCharRaw(t,e);u=u.aggregate(n),n.rawInserted||u.equals(a)?a=u:this.state=s}if(a.inserted){let t,u=!1!==this.doValidate(e);if(u&&null!=s){const e=this.state;if(!0===this.overwrite){t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.unshift(this.displayValue.length-a.tailShift)}let i=this.appendTail(s);if(u=i.rawInserted.length===s.toString().length,!(u&&i.inserted||"shift"!==this.overwrite)){this.state=e,t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.shift();i=this.appendTail(s),u=i.rawInserted.length===s.toString().length}u&&i.inserted&&(this.state=e)}u||(a=new v,this.state=i,s&&t&&(s.state=t))}return a}_appendPlaceholder(){return new v}_appendEager(){return new v}append(t,s,i){if(!e(t))throw new Error("value should be string");const a=e(i)?new E(String(i)):i;let u;null!=s&&s.tail&&(s._beforeTailState=this.state),[t,u]=this.doPrepare(t,s);for(let e=0;e<t.length;++e){const i=this._appendChar(t[e],s,a);if(!i.rawInserted&&!this.doSkipInvalid(t[e],s,a))break;u.aggregate(i)}return(!0===this.eager||"append"===this.eager)&&null!=s&&s.input&&t&&u.aggregate(this._appendEager()),null!=a&&(u.tailShift+=this.appendTail(a).tailShift),u}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new v}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),v.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),v.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,n){void 0===s&&(s=""),void 0===i&&(i=a.NONE),void 0===n&&(n={input:!0});const r=t+e,h=this.extractTail(r),o=!0===this.eager||"remove"===this.eager;let l;o&&(i=u(i),l=this.extractInput(0,r,{raw:!0}));let p=t;const d=new v;if(i!==a.NONE&&(p=this.nearestInputPos(t,e>1&&0!==t&&!o?a.NONE:i),d.tailShift=p-t),d.aggregate(this.remove(p)),o&&i!==a.NONE&&l===this.rawInputValue)if(i===a.FORCE_LEFT){let t;for(;l===this.rawInputValue&&(t=this.displayValue.length);)d.aggregate(new v({tailShift:-1})).aggregate(this.remove(t-1))}else i===a.FORCE_RIGHT&&h.unshift();return d.aggregate(this.append(s,n,h))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!r(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||C.EMPTY_VALUES.includes(t)&&C.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new v}}C.DEFAULTS={skipInvalid:!0},C.EMPTY_VALUES=[void 0,null,""],o.Masked=C;class A{constructor(t,e){void 0===t&&(t=[]),void 0===e&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=e(t)?new E(String(t)):t;const s=this.chunks[this.chunks.length-1],i=s&&(s.stop===t.stop||null==t.stop)&&t.from===s.from+s.toString().length;if(t instanceof E)i?s.extend(t.toString()):this.chunks.push(t);else if(t instanceof A){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof o.MaskedPattern)){return new E(this.toString()).appendTo(t)}const e=new v;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=t._mapPosToBlock(t.displayValue.length),u=i.stop;let n;if(null!=u&&(!a||a.index<=u)&&((i instanceof A||t._stops.indexOf(u)>=0)&&e.aggregate(t._appendPlaceholder(u)),n=i instanceof A&&t._blocks[u]),n){const s=n.appendTail(i);e.aggregate(s);const a=i.toString().slice(s.rawInserted.length);a&&e.aggregate(t.append(a,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map((t=>t.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map((t=>{const e="chunks"in t?new A:new E;return e.state=t,e}))}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let s=0;for(;s<this.chunks.length;){const t=this.chunks[s],i=t.unshift(e);if(t.toString()){if(!i)break;++s}else this.chunks.splice(s,1);if(i)return i}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class F{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_LEFT),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_RIGHT),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}}class x{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new v}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this._value.length;switch(e){case a.LEFT:case a.FORCE_LEFT:return 0;default:return s}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=!0===this.eager||"append"===this.eager,i=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,a=new v({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(e.raw||e.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new v;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new E("")}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return null!=s&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class S{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n,...r}=t;this.masked=d(r),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new v}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&!1===this.doValidate(e)&&(i=new v,this.masked.state=s),i.inserted||this.isOptional||this.lazy||e.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new v:(this.isFilled=!0,new v({inserted:this.placeholderChar}))}_appendEager(){return new v}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this.value.length,i=Math.min(Math.max(t,0),s);switch(e){case a.LEFT:case a.FORCE_LEFT:return this.isComplete?i:0;case a.RIGHT:case a.FORCE_RIGHT:return this.isComplete?i:s;default:return i}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new v}}S.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\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\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-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\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-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\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-\u2C2E\u2C30-\u2C5E\u2C60-\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-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\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]/,"*":/./};class B extends C{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>t.search(e)>=0),super._update(t)}}o.MaskedRegExp=B;class b extends C{constructor(t){super({...b.DEFAULTS,...t,definitions:Object.assign({},S.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let a=0;a<e.length;++a){if(this.blocks){const t=e.slice(a),s=Object.keys(this.blocks).filter((e=>0===t.indexOf(e)));s.sort(((t,e)=>e.length-t.length));const i=s[0];if(i){const{expose:t,repeat:e,...s}=p(this.blocks[i]),u={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:e,parent:this},n=null!=e?new o.RepeatBlock(u):d(u);n&&(this._blocks.push(n),t&&(this.exposeBlock=n),this._maskedBlocks[i]||(this._maskedBlocks[i]=[]),this._maskedBlocks[i].push(this._blocks.length-1)),a+=i.length-1;continue}}let u=e[a],n=u in t;if(u===b.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===u||"}"===u){s=!s;continue}if("["===u||"]"===u){i=!i;continue}if(u===b.ESCAPE_CHAR){if(++a,u=e[a],!u)break;n=!1}const r=n?new S({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...p(t[u]),parent:this}):new x({char:u,eager:this.eager,isUnmasking:s});this._blocks.push(r)}}get state(){return{...super.state,_blocks:this._blocks.map((t=>t.state))}}set state(t){if(!t)return void this.reset();const{_blocks:e,...s}=t;this._blocks.forEach(((t,s)=>t.state=e[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((t=>t.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((t=>t.isComplete))}get isFilled(){return this._blocks.every((t=>t.isFilled))}get isFixed(){return this._blocks.every((t=>t.isFixed))}get isOptional(){return this._blocks.every((t=>t.isOptional))}doCommit(){this._blocks.forEach((t=>t.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((t,e)=>t+e.unmaskedValue),"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((t,e)=>t+e.value),"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce(((t,e)=>t+e.displayValue),"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new v;let s=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null==s)return e;this._blocks[s].isFilled&&++s;for(let t=s;t<this._blocks.length;++t){const s=this._blocks[t]._appendEager();if(!s.inserted)break;e.aggregate(s)}return e}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new v;if(!s)return i;for(let u,n=s.index;u=this._blocks[n];++n){var a;const s=u._appendChar(t,{...e,_beforeTailState:null==(a=e._beforeTailState)||null==(a=a._blocks)?void 0:a[n]});if(i.aggregate(s),s.consumed)break}return i}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=new A;return t===e||this._forEachBlocksInRange(t,e,((t,e,i,a)=>{const u=t.extractTail(i,a);u.stop=this._findStopBefore(e),u.from=this._blockStartPos(e),u instanceof A&&(u.blockIndex=e),s.extend(u)})),s}extractInput(t,e,s){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),void 0===s&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,((t,e,a,u)=>{i+=t.extractInput(a,u,s)})),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(!(i<=t))break;e=i}return e}_appendPlaceholder(t){const e=new v;if(this.lazy&&null==t)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,a=null!=t?t:this._blocks.length;return this._blocks.slice(i,a).forEach((s=>{var i;s.lazy&&null==t||e.aggregate(s._appendPlaceholder(null==(i=s._blocks)?void 0:i.length))})),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce(((t,e)=>t+e.displayValue.length),0)}_forEachBlocksInRange(t,e,s){void 0===e&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const t=this._mapPosToBlock(e),a=t&&i.index===t.index,u=i.offset,n=t&&a?t.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,u,n),t&&!a){for(let e=i.index+1;e<t.index;++e)s(this._blocks[e],e,0,this._blocks[e].displayValue.length);s(this._blocks[t.index],t.index,0,t.offset)}}}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s.aggregate(t.remove(i,a))})),s}nearestInputPos(t,e){if(void 0===e&&(e=a.NONE),!this._blocks.length)return 0;const s=new F(this,t);if(e===a.NONE)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(e===a.LEFT||e===a.FORCE_LEFT){if(e===a.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===a.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t)return s.pos;if(s.popState(),s.ok&&s.pos<=t)return s.pos;s.popState()}return s.ok?s.pos:e===a.FORCE_LEFT?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return e===a.RIGHT||e===a.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===a.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(t,a.LEFT)))):t}totalInputPositions(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s+=t.totalInputPositions(i,a)})),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map((t=>this._blocks[t])):[]}pad(t){const e=new v;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>e.aggregate(s.pad(t)))),e}}b.DEFAULTS={...C.DEFAULTS,lazy:!0,placeholderChar:"_"},b.STOP_CHAR="`",b.ESCAPE_CHAR="\\",b.InputDefinition=S,b.FixedDefinition=x,o.MaskedPattern=b;class D extends b{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...u}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;const n=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0");let h=0;for(;h<r.length&&r[h]===n[h];)++h;u.mask=r.slice(0,h).replace(/0/g,"\\0")+"0".repeat(this.maxLength-h),super._update(u)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",s="";const[,i,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(i.length)+a,s="9".repeat(i.length)+a),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){let s;return void 0===e&&(e={}),[t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(s.skip=!this.isComplete),[t,s]}_appendCharRaw(t,e){if(void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,u]=this.boundaries(this.value+t);return Number(u)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(-1===e.search(/[^0]/)&&e.length<=this._matchFrom)return!0;const[s,i]=this.boundaries(e);return this.from<=Number(i)&&Number(s)<=this.to&&super.doValidate(t)}pad(t){const e=new v;if(this.value.length===this.maxLength)return e;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)e.aggregate(super._appendCharRaw("0",t));s.split("").forEach((t=>this._appendCharRaw(t)))}return e}}o.MaskedRange=D;class y extends b{static extractPatternOptions(t){const{mask:s,pattern:i,...a}=t;return{...a,mask:e(s)?s:i}}constructor(t){super(y.extractPatternOptions({...y.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:s,pattern:i,blocks:a,...u}={...y.DEFAULTS,...t},n=Object.assign({},y.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,a),super._update({...u,mask:e(s)?s:i,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(y.extractPatternOptions(t))}}y.GET_DEFAULT_BLOCKS=()=>({d:{mask:D,from:1,to:31,maxLength:2},m:{mask:D,from:1,to:12,maxLength:2},Y:{mask:D,from:1900,to:9999}}),y.DEFAULTS={...b.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:(t,e)=>{const[s,i,a]=t.split(".").map(Number);return new Date(a,i-1,s)}},o.MaskedDate=y;class M extends C{constructor(t){super({...M.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map((t=>{const{expose:e,...s}=p(t),i=d({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return e&&(this.exposeMask=i),i})):[])}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){void 0===t&&(t=""),void 0===e&&(e={}),void 0===s&&(s="");const i=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,a=this.rawInputValue,u=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:a,n=a.slice(u.length),r=this.currentMask,h=new v,o=null==r?void 0:r.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==r?(this.currentMask.reset(),u&&(this.currentMask.append(u,{raw:!0}),h.tailShift=this.currentMask.value.length-i.length),n&&(h.tailShift+=this.currentMask.append(n,{raw:!0,tail:!0}).tailShift)):o&&(this.currentMask.state=o)),h}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new v;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(s=t._beforeTailState)?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return void 0===e&&(e={}),void 0===s&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){void 0===e&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let t;[s,t]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}doPrepareChar(t,e){void 0===e&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let t;[s,t]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}reset(){var t;null==(t=this.currentMask)||t.reset(),this.compiledMasks.forEach((t=>t.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask)return this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,void this._applyDispatch();let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){const s=new v;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((t=>t.state)),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...a}=t;e&&this.compiledMasks.forEach(((t,s)=>t.state=e[s])),null!=s&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every(((e,s)=>{if(!t[s])return;const{mask:i,...a}=t[s];return r(e,a)&&e.maskEquals(i)})):super.maskEquals(t)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}M.DEFAULTS={...C.DEFAULTS,dispatch:(t,e,s,i)=>{if(!e.compiledMasks.length)return;const u=e.rawInputValue,n=e.compiledMasks.map(((n,r)=>{const h=e.currentMask===n,o=h?n.displayValue.length:n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT);return n.rawInputValue!==u?(n.reset(),n.append(u,{raw:!0})):h||n.remove(o),n.append(t,e.currentMaskFlags(s)),n.appendTail(i),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT)))}}));return n.sort(((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions)),e.compiledMasks[n[0].index]}},o.MaskedDynamic=M;class I extends b{constructor(t){super({...I.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const t=e.map((t=>t.length)),i=Math.min(...t),a=Math.max(...t)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=e}super._update(s)}_appendCharRaw(t,e){void 0===e&&(e={});const s=Math.min(this.nearestInputPos(0,a.FORCE_RIGHT),this.value.length),i=this.enum.filter((e=>this.matchValue(e,this.unmaskedValue+t,s)));if(i.length){1===i.length&&this._forEachBlocksInRange(0,this.value.length,((t,s)=>{const a=i[0][s];s>=this.value.length||a===t.value||(t.reset(),t._appendChar(a,e))}));const t=super._appendCharRaw(i[0][this.value.length],e);return 1===i.length&&i[0].slice(this.unmaskedValue.length).split("").forEach((e=>t.aggregate(super._appendCharRaw(e)))),t}return new v({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E("",t)}remove(t,e){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),t===e)return new v;const s=Math.min(super.nearestInputPos(0,a.FORCE_RIGHT),this.value.length);let i;for(i=t;i>=0;--i){if(this.enum.filter((t=>this.matchValue(t,this.value.slice(s,i),s))).length>1)break}const u=super.remove(i,e);return u.tailShift+=i-t,u}get isComplete(){return this.enum.indexOf(this.value)>=0}}I.DEFAULTS={...b.DEFAULTS,matchValue:(t,e,s)=>t.indexOf(e,s)===s},o.MaskedEnum=I;class V extends C{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}var T;o.MaskedFunction=V;class w extends C{constructor(t){super({...w.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+n(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(n).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(n(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),!s||this.allowPositive||this.value||"-"===s||i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){void 0===e&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){void 0===e&&(e={});const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const u=this.number;let n,r=!isNaN(u),h=!1;if(r){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(t=this.max),null!=t&&(this.autofix?(this._value=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix),h||(h=a===this._value&&!e.tail)):r=!1),r&&(r=Boolean(this._value.match(this._numberRegExp)))}r?n=new v({inserted:this._value.slice(a.length),rawInserted:h?"":t,skip:h}):(this._value=a,n=new v),this._value=this._insertThousandsSeparators(this._value);const o=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(o);return n.tailShift+=(l-i)*this.thousandsSeparator.length,n}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const u=this._separatorsCountFromSlice(s);return new v({tailShift:(u-a)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case a.NONE:case a.LEFT:case a.FORCE_LEFT:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===a.FORCE_LEFT)return s}break}case a.RIGHT:case a.FORCE_RIGHT:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,((t,e,s,i)=>e+i)),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){void 0===e&&(e={});const i=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===w.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,w.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||w.EMPTY_VALUES.includes(t)&&w.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}T=w,w.UNMASKED_RADIX=".",w.EMPTY_VALUES=[...C.EMPTY_VALUES,0],w.DEFAULTS={...C.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[T.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},o.MaskedNumber=w;const R={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function P(t,e,s){void 0===e&&(e=R.MASKED),void 0===s&&(s=R.MASKED);const i=d(t);return t=>i.runIsolated((i=>(i[e]=t,i[s])))}function O(t,e,s,i){return P(e,s,i)(t)}o.PIPE_TYPE=R,o.createPipe=P,o.pipe=O;class L extends b{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,s,i;const{repeat:a,...u}=p(t);this._blockOpts=Object.assign({},this._blockOpts,u);const n=d(this._blockOpts);this.repeat=null!=(e=null!=(s=null!=a?a:n.repeat)?s:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(i=this._blocks)?void 0:i.length)||0,this.repeatFrom)),blocks:{m:n},eager:n.eager,overwrite:n.overwrite,skipInvalid:n.skipInvalid,lazy:n.lazy,placeholderChar:n.placeholderChar,displayChar:n.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(d(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(t,e){void 0===e&&(e={});const s=new v;for(let r,h,o=null!=(i=null==(a=this._mapPosToBlock(this.displayValue.length))?void 0:a.index)?i:Math.max(this._blocks.length-1,0);r=null!=(u=this._blocks[o])?u:h=!h&&this._allocateBlock(o);++o){var i,a,u,n;const l=r._appendChar(t,{...e,_beforeTailState:null==(n=e._beforeTailState)||null==(n=n._blocks)?void 0:n[o]});if(l.skip&&h){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(l),l.consumed)break}return s}_trimEmptyTail(t,e){var s,i;void 0===t&&(t=0);const a=Math.max((null==(s=this._mapPosToBlock(t))?void 0:s.index)||0,this.repeatFrom,0);let u;null!=e&&(u=null==(i=this._mapPosToBlock(e))?void 0:i.index),null==u&&(u=this._blocks.length-1);let n=0;for(let t=u;a<=t&&!this._blocks[t].unmaskedValue;--t,++n);n&&(this._blocks.splice(u-n+1,n),this.mask=this.mask.slice(n))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}o.RepeatBlock=L;try{globalThis.IMask=o}catch{}t.ChangeDetails=v,t.ChunksTailDetails=A,t.DIRECTION=a,t.HTMLContenteditableMaskElement=m,t.HTMLInputMaskElement=k,t.HTMLMaskElement=g,t.InputMask=f,t.MaskElement=c,t.Masked=C,t.MaskedDate=y,t.MaskedDynamic=M,t.MaskedEnum=I,t.MaskedFunction=V,t.MaskedNumber=w,t.MaskedPattern=b,t.MaskedRange=D,t.MaskedRegExp=B,t.PIPE_TYPE=R,t.PatternFixedDefinition=x,t.PatternInputDefinition=S,t.RepeatBlock=L,t.createMask=d,t.createPipe=P,t.default=o,t.forceDirection=u,t.normalizeOpts=p,t.pipe=O,Object.defineProperty(t,"__esModule",{value:!0})}));(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["wm_common_variables"]=factory();else root["wm_common_variables"]=factory()})(window,(()=>(()=>{var __webpack_modules__={"./node_modules/@metrichor/jmespath/dist/jmespath.esm.js":
859
+ !function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){$(a.target).is("input")||$(a.target).is("textarea")||$(a.target).is("select")||$(a.target).is("button")||$(a.target).is("option")?a.stopPropagation():a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).IMask={})}(this,(function(t){"use strict";function e(t){return"string"==typeof t||t instanceof String}function s(t){var e;return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(e=t.constructor)?void 0:e.name)}function i(t,e){return Array.isArray(e)?i(t,((t,s)=>e.includes(s))):Object.entries(t).reduce(((t,s)=>{let[i,a]=s;return e(a,i)&&(t[i]=a),t}),{})}const a={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function u(t){switch(t){case a.LEFT:return a.FORCE_LEFT;case a.RIGHT:return a.FORCE_RIGHT;default:return t}}function n(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function r(t,e){if(e===t)return!0;const s=Array.isArray(e),i=Array.isArray(t);let a;if(s&&i){if(e.length!=t.length)return!1;for(a=0;a<e.length;a++)if(!r(e[a],t[a]))return!1;return!0}if(s!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const s=e instanceof Date,i=t instanceof Date;if(s&&i)return e.getTime()==t.getTime();if(s!=i)return!1;const u=e instanceof RegExp,n=t instanceof RegExp;if(u&&n)return e.toString()==t.toString();if(u!=n)return!1;const h=Object.keys(e);for(a=0;a<h.length;a++)if(!Object.prototype.hasOwnProperty.call(t,h[a]))return!1;for(a=0;a<h.length;a++)if(!r(t[h[a]],e[h[a]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class h{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?a.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?a.LEFT:a.RIGHT}}function o(t,e){return new o.InputMask(t,e)}function l(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?o.MaskedRegExp:e(t)?o.MaskedPattern:t===Date?o.MaskedDate:t===Number?o.MaskedNumber:Array.isArray(t)||t===Array?o.MaskedDynamic:o.Masked&&t.prototype instanceof o.Masked?t:o.Masked&&t instanceof o.Masked?t.constructor:t instanceof Function?o.MaskedFunction:(console.warn("Mask not found for mask",t),o.Masked)}function p(t){if(!t)throw new Error("Options in not defined");if(o.Masked){if(t.prototype instanceof o.Masked)return{mask:t};const{mask:e,...a}=t instanceof o.Masked?{mask:t}:s(t)&&t.mask instanceof o.Masked?t:{};if(e){const t=e.mask;return{...i(e,((t,e)=>!e.startsWith("_"))),mask:e.constructor,_mask:t,...a}}}return s(t)?{...t}:{mask:t}}function d(t){if(o.Masked&&t instanceof o.Masked)return t;const e=p(t),s=l(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}o.createMask=d;class c{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}o.MaskElement=c;class g extends c{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,s;return null!=(t=null==(e=(s=this.input).getRootNode)?void 0:e.call(s))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}o.HTMLMaskElement=g;class k extends g{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}o.HTMLMaskElement=g;class m extends g{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}o.HTMLContenteditableMaskElement=m;class _{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>_.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}_.MAX_LENGTH=100;class f{constructor(t,e){this.el=t instanceof c?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new m(t):new k(t),this.masked=d(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new _,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof o.Masked)&&this.masked.constructor===l(t))return void this.masked.updateOptions({mask:t});const e=t instanceof o.Masked?t:d({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach((t=>t(e)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,u=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),u&&this._fireChangeEvents(),this._historyChanging||!u&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout((()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())}),10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,a.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new h({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,u=s===this.masked.rawInputValue?e.removeDirection:a.NONE;let n=this.masked.nearestInputPos(e.startChangePos+i,u);u!==a.NONE&&(n=this.masked.nearestInputPos(n,a.NONE)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}o.InputMask=f;class v{static normalize(t){return Array.isArray(t)?t:[t,new v]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}o.ChangeDetails=v;class E{constructor(t,e,s){void 0===t&&(t=""),void 0===e&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class C{constructor(t){this._value="",this._update({...C.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E(this.extractInput(t,e),t)}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new v({inserted:t,rawInserted:t})):new v}_appendChar(t,e,s){void 0===e&&(e={});const i=this.state;let a;if([t,a]=this.doPrepareChar(t,e),t&&(a=a.aggregate(this._appendCharRaw(t,e)),!a.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=i;let u=this.pad(e);const n=this._appendCharRaw(t,e);u=u.aggregate(n),n.rawInserted||u.equals(a)?a=u:this.state=s}if(a.inserted){let t,u=!1!==this.doValidate(e);if(u&&null!=s){const e=this.state;if(!0===this.overwrite){t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.unshift(this.displayValue.length-a.tailShift)}let i=this.appendTail(s);if(u=i.rawInserted.length===s.toString().length,!(u&&i.inserted||"shift"!==this.overwrite)){this.state=e,t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.shift();i=this.appendTail(s),u=i.rawInserted.length===s.toString().length}u&&i.inserted&&(this.state=e)}u||(a=new v,this.state=i,s&&t&&(s.state=t))}return a}_appendPlaceholder(){return new v}_appendEager(){return new v}append(t,s,i){if(!e(t))throw new Error("value should be string");const a=e(i)?new E(String(i)):i;let u;null!=s&&s.tail&&(s._beforeTailState=this.state),[t,u]=this.doPrepare(t,s);for(let e=0;e<t.length;++e){const i=this._appendChar(t[e],s,a);if(!i.rawInserted&&!this.doSkipInvalid(t[e],s,a))break;u.aggregate(i)}return(!0===this.eager||"append"===this.eager)&&null!=s&&s.input&&t&&u.aggregate(this._appendEager()),null!=a&&(u.tailShift+=this.appendTail(a).tailShift),u}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new v}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),v.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),v.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,n){void 0===s&&(s=""),void 0===i&&(i=a.NONE),void 0===n&&(n={input:!0});const r=t+e,h=this.extractTail(r),o=!0===this.eager||"remove"===this.eager;let l;o&&(i=u(i),l=this.extractInput(0,r,{raw:!0}));let p=t;const d=new v;if(i!==a.NONE&&(p=this.nearestInputPos(t,e>1&&0!==t&&!o?a.NONE:i),d.tailShift=p-t),d.aggregate(this.remove(p)),o&&i!==a.NONE&&l===this.rawInputValue)if(i===a.FORCE_LEFT){let t;for(;l===this.rawInputValue&&(t=this.displayValue.length);)d.aggregate(new v({tailShift:-1})).aggregate(this.remove(t-1))}else i===a.FORCE_RIGHT&&h.unshift();return d.aggregate(this.append(s,n,h))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!r(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||C.EMPTY_VALUES.includes(t)&&C.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new v}}C.DEFAULTS={skipInvalid:!0},C.EMPTY_VALUES=[void 0,null,""],o.Masked=C;class A{constructor(t,e){void 0===t&&(t=[]),void 0===e&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=e(t)?new E(String(t)):t;const s=this.chunks[this.chunks.length-1],i=s&&(s.stop===t.stop||null==t.stop)&&t.from===s.from+s.toString().length;if(t instanceof E)i?s.extend(t.toString()):this.chunks.push(t);else if(t instanceof A){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof o.MaskedPattern)){return new E(this.toString()).appendTo(t)}const e=new v;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=t._mapPosToBlock(t.displayValue.length),u=i.stop;let n;if(null!=u&&(!a||a.index<=u)&&((i instanceof A||t._stops.indexOf(u)>=0)&&e.aggregate(t._appendPlaceholder(u)),n=i instanceof A&&t._blocks[u]),n){const s=n.appendTail(i);e.aggregate(s);const a=i.toString().slice(s.rawInserted.length);a&&e.aggregate(t.append(a,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map((t=>t.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map((t=>{const e="chunks"in t?new A:new E;return e.state=t,e}))}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let s=0;for(;s<this.chunks.length;){const t=this.chunks[s],i=t.unshift(e);if(t.toString()){if(!i)break;++s}else this.chunks.splice(s,1);if(i)return i}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class F{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_LEFT),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.LEFT),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,a.FORCE_RIGHT),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a.NONE),!0}))}}class x{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new v}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this._value.length;switch(e){case a.LEFT:case a.FORCE_LEFT:return 0;default:return s}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=!0===this.eager||"append"===this.eager,i=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,a=new v({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(e.raw||e.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new v;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new E("")}appendTail(t){return e(t)&&(t=new E(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return null!=s&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class S{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n,...r}=t;this.masked=d(r),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:u,eager:n})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new v}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new v;const s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&!1===this.doValidate(e)&&(i=new v,this.masked.state=s),i.inserted||this.isOptional||this.lazy||e.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new v:(this.isFilled=!0,new v({inserted:this.placeholderChar}))}_appendEager(){return new v}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){void 0===e&&(e=a.NONE);const s=this.value.length,i=Math.min(Math.max(t,0),s);switch(e){case a.LEFT:case a.FORCE_LEFT:return this.isComplete?i:0;case a.RIGHT:case a.FORCE_RIGHT:return this.isComplete?i:s;default:return i}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new v}}S.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\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\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\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\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-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\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-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\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-\u2C2E\u2C30-\u2C5E\u2C60-\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-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\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]/,"*":/./};class B extends C{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>t.search(e)>=0),super._update(t)}}o.MaskedRegExp=B;class b extends C{constructor(t){super({...b.DEFAULTS,...t,definitions:Object.assign({},S.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let a=0;a<e.length;++a){if(this.blocks){const t=e.slice(a),s=Object.keys(this.blocks).filter((e=>0===t.indexOf(e)));s.sort(((t,e)=>e.length-t.length));const i=s[0];if(i){const{expose:t,repeat:e,...s}=p(this.blocks[i]),u={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:e,parent:this},n=null!=e?new o.RepeatBlock(u):d(u);n&&(this._blocks.push(n),t&&(this.exposeBlock=n),this._maskedBlocks[i]||(this._maskedBlocks[i]=[]),this._maskedBlocks[i].push(this._blocks.length-1)),a+=i.length-1;continue}}let u=e[a],n=u in t;if(u===b.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===u||"}"===u){s=!s;continue}if("["===u||"]"===u){i=!i;continue}if(u===b.ESCAPE_CHAR){if(++a,u=e[a],!u)break;n=!1}const r=n?new S({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...p(t[u]),parent:this}):new x({char:u,eager:this.eager,isUnmasking:s});this._blocks.push(r)}}get state(){return{...super.state,_blocks:this._blocks.map((t=>t.state))}}set state(t){if(!t)return void this.reset();const{_blocks:e,...s}=t;this._blocks.forEach(((t,s)=>t.state=e[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((t=>t.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((t=>t.isComplete))}get isFilled(){return this._blocks.every((t=>t.isFilled))}get isFixed(){return this._blocks.every((t=>t.isFixed))}get isOptional(){return this._blocks.every((t=>t.isOptional))}doCommit(){this._blocks.forEach((t=>t.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((t,e)=>t+e.unmaskedValue),"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((t,e)=>t+e.value),"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce(((t,e)=>t+e.displayValue),"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new v;let s=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null==s)return e;this._blocks[s].isFilled&&++s;for(let t=s;t<this._blocks.length;++t){const s=this._blocks[t]._appendEager();if(!s.inserted)break;e.aggregate(s)}return e}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new v;if(!s)return i;for(let u,n=s.index;u=this._blocks[n];++n){var a;const s=u._appendChar(t,{...e,_beforeTailState:null==(a=e._beforeTailState)||null==(a=a._blocks)?void 0:a[n]});if(i.aggregate(s),s.consumed)break}return i}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=new A;return t===e||this._forEachBlocksInRange(t,e,((t,e,i,a)=>{const u=t.extractTail(i,a);u.stop=this._findStopBefore(e),u.from=this._blockStartPos(e),u instanceof A&&(u.blockIndex=e),s.extend(u)})),s}extractInput(t,e,s){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),void 0===s&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,((t,e,a,u)=>{i+=t.extractInput(a,u,s)})),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(!(i<=t))break;e=i}return e}_appendPlaceholder(t){const e=new v;if(this.lazy&&null==t)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,a=null!=t?t:this._blocks.length;return this._blocks.slice(i,a).forEach((s=>{var i;s.lazy&&null==t||e.aggregate(s._appendPlaceholder(null==(i=s._blocks)?void 0:i.length))})),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce(((t,e)=>t+e.displayValue.length),0)}_forEachBlocksInRange(t,e,s){void 0===e&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const t=this._mapPosToBlock(e),a=t&&i.index===t.index,u=i.offset,n=t&&a?t.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,u,n),t&&!a){for(let e=i.index+1;e<t.index;++e)s(this._blocks[e],e,0,this._blocks[e].displayValue.length);s(this._blocks[t.index],t.index,0,t.offset)}}}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s.aggregate(t.remove(i,a))})),s}nearestInputPos(t,e){if(void 0===e&&(e=a.NONE),!this._blocks.length)return 0;const s=new F(this,t);if(e===a.NONE)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(e===a.LEFT||e===a.FORCE_LEFT){if(e===a.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===a.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t)return s.pos;if(s.popState(),s.ok&&s.pos<=t)return s.pos;s.popState()}return s.ok?s.pos:e===a.FORCE_LEFT?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return e===a.RIGHT||e===a.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===a.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(t,a.LEFT)))):t}totalInputPositions(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,((t,e,i,a)=>{s+=t.totalInputPositions(i,a)})),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map((t=>this._blocks[t])):[]}pad(t){const e=new v;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>e.aggregate(s.pad(t)))),e}}b.DEFAULTS={...C.DEFAULTS,lazy:!0,placeholderChar:"_"},b.STOP_CHAR="`",b.ESCAPE_CHAR="\\",b.InputDefinition=S,b.FixedDefinition=x,o.MaskedPattern=b;class D extends b{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...u}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;const n=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0");let h=0;for(;h<r.length&&r[h]===n[h];)++h;u.mask=r.slice(0,h).replace(/0/g,"\\0")+"0".repeat(this.maxLength-h),super._update(u)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",s="";const[,i,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(i.length)+a,s="9".repeat(i.length)+a),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){let s;return void 0===e&&(e={}),[t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(s.skip=!this.isComplete),[t,s]}_appendCharRaw(t,e){if(void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,u]=this.boundaries(this.value+t);return Number(u)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(-1===e.search(/[^0]/)&&e.length<=this._matchFrom)return!0;const[s,i]=this.boundaries(e);return this.from<=Number(i)&&Number(s)<=this.to&&super.doValidate(t)}pad(t){const e=new v;if(this.value.length===this.maxLength)return e;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)e.aggregate(super._appendCharRaw("0",t));s.split("").forEach((t=>this._appendCharRaw(t)))}return e}}o.MaskedRange=D;class y extends b{static extractPatternOptions(t){const{mask:s,pattern:i,...a}=t;return{...a,mask:e(s)?s:i}}constructor(t){super(y.extractPatternOptions({...y.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:s,pattern:i,blocks:a,...u}={...y.DEFAULTS,...t},n=Object.assign({},y.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,a),super._update({...u,mask:e(s)?s:i,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(y.extractPatternOptions(t))}}y.GET_DEFAULT_BLOCKS=()=>({d:{mask:D,from:1,to:31,maxLength:2},m:{mask:D,from:1,to:12,maxLength:2},Y:{mask:D,from:1900,to:9999}}),y.DEFAULTS={...b.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:(t,e)=>{const[s,i,a]=t.split(".").map(Number);return new Date(a,i-1,s)}},o.MaskedDate=y;class M extends C{constructor(t){super({...M.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map((t=>{const{expose:e,...s}=p(t),i=d({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return e&&(this.exposeMask=i),i})):[])}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){void 0===t&&(t=""),void 0===e&&(e={}),void 0===s&&(s="");const i=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,a=this.rawInputValue,u=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:a,n=a.slice(u.length),r=this.currentMask,h=new v,o=null==r?void 0:r.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==r?(this.currentMask.reset(),u&&(this.currentMask.append(u,{raw:!0}),h.tailShift=this.currentMask.value.length-i.length),n&&(h.tailShift+=this.currentMask.append(n,{raw:!0,tail:!0}).tailShift)):o&&(this.currentMask.state=o)),h}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new v;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(s=t._beforeTailState)?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return void 0===e&&(e={}),void 0===s&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){void 0===e&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let t;[s,t]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}doPrepareChar(t,e){void 0===e&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let t;[s,t]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}reset(){var t;null==(t=this.currentMask)||t.reset(),this.compiledMasks.forEach((t=>t.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask)return this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,void this._applyDispatch();let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){const s=new v;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((t=>t.state)),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...a}=t;e&&this.compiledMasks.forEach(((t,s)=>t.state=e[s])),null!=s&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every(((e,s)=>{if(!t[s])return;const{mask:i,...a}=t[s];return r(e,a)&&e.maskEquals(i)})):super.maskEquals(t)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}M.DEFAULTS={...C.DEFAULTS,dispatch:(t,e,s,i)=>{if(!e.compiledMasks.length)return;const u=e.rawInputValue,n=e.compiledMasks.map(((n,r)=>{const h=e.currentMask===n,o=h?n.displayValue.length:n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT);return n.rawInputValue!==u?(n.reset(),n.append(u,{raw:!0})):h||n.remove(o),n.append(t,e.currentMaskFlags(s)),n.appendTail(i),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,a.FORCE_LEFT)))}}));return n.sort(((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions)),e.compiledMasks[n[0].index]}},o.MaskedDynamic=M;class I extends b{constructor(t){super({...I.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const t=e.map((t=>t.length)),i=Math.min(...t),a=Math.max(...t)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=e}super._update(s)}_appendCharRaw(t,e){void 0===e&&(e={});const s=Math.min(this.nearestInputPos(0,a.FORCE_RIGHT),this.value.length),i=this.enum.filter((e=>this.matchValue(e,this.unmaskedValue+t,s)));if(i.length){1===i.length&&this._forEachBlocksInRange(0,this.value.length,((t,s)=>{const a=i[0][s];s>=this.value.length||a===t.value||(t.reset(),t._appendChar(a,e))}));const t=super._appendCharRaw(i[0][this.value.length],e);return 1===i.length&&i[0].slice(this.unmaskedValue.length).split("").forEach((e=>t.aggregate(super._appendCharRaw(e)))),t}return new v({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new E("",t)}remove(t,e){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),t===e)return new v;const s=Math.min(super.nearestInputPos(0,a.FORCE_RIGHT),this.value.length);let i;for(i=t;i>=0;--i){if(this.enum.filter((t=>this.matchValue(t,this.value.slice(s,i),s))).length>1)break}const u=super.remove(i,e);return u.tailShift+=i-t,u}get isComplete(){return this.enum.indexOf(this.value)>=0}}I.DEFAULTS={...b.DEFAULTS,matchValue:(t,e,s)=>t.indexOf(e,s)===s},o.MaskedEnum=I;class V extends C{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}var T;o.MaskedFunction=V;class w extends C{constructor(t){super({...w.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+n(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(n).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(n(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),!s||this.allowPositive||this.value||"-"===s||i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){void 0===e&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){void 0===e&&(e={});const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const u=this.number;let n,r=!isNaN(u),h=!1;if(r){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(t=this.max),null!=t&&(this.autofix?(this._value=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix),h||(h=a===this._value&&!e.tail)):r=!1),r&&(r=Boolean(this._value.match(this._numberRegExp)))}r?n=new v({inserted:this._value.slice(a.length),rawInserted:h?"":t,skip:h}):(this._value=a,n=new v),this._value=this._insertThousandsSeparators(this._value);const o=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(o);return n.tailShift+=(l-i)*this.thousandsSeparator.length,n}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const u=this._separatorsCountFromSlice(s);return new v({tailShift:(u-a)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case a.NONE:case a.LEFT:case a.FORCE_LEFT:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===a.FORCE_LEFT)return s}break}case a.RIGHT:case a.FORCE_RIGHT:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,((t,e,s,i)=>e+i)),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){void 0===e&&(e={});const i=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===w.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,w.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(w.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||w.EMPTY_VALUES.includes(t)&&w.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}T=w,w.UNMASKED_RADIX=".",w.EMPTY_VALUES=[...C.EMPTY_VALUES,0],w.DEFAULTS={...C.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[T.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},o.MaskedNumber=w;const R={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function P(t,e,s){void 0===e&&(e=R.MASKED),void 0===s&&(s=R.MASKED);const i=d(t);return t=>i.runIsolated((i=>(i[e]=t,i[s])))}function O(t,e,s,i){return P(e,s,i)(t)}o.PIPE_TYPE=R,o.createPipe=P,o.pipe=O;class L extends b{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,s,i;const{repeat:a,...u}=p(t);this._blockOpts=Object.assign({},this._blockOpts,u);const n=d(this._blockOpts);this.repeat=null!=(e=null!=(s=null!=a?a:n.repeat)?s:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(i=this._blocks)?void 0:i.length)||0,this.repeatFrom)),blocks:{m:n},eager:n.eager,overwrite:n.overwrite,skipInvalid:n.skipInvalid,lazy:n.lazy,placeholderChar:n.placeholderChar,displayChar:n.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(d(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(t,e){void 0===e&&(e={});const s=new v;for(let r,h,o=null!=(i=null==(a=this._mapPosToBlock(this.displayValue.length))?void 0:a.index)?i:Math.max(this._blocks.length-1,0);r=null!=(u=this._blocks[o])?u:h=!h&&this._allocateBlock(o);++o){var i,a,u,n;const l=r._appendChar(t,{...e,_beforeTailState:null==(n=e._beforeTailState)||null==(n=n._blocks)?void 0:n[o]});if(l.skip&&h){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(l),l.consumed)break}return s}_trimEmptyTail(t,e){var s,i;void 0===t&&(t=0);const a=Math.max((null==(s=this._mapPosToBlock(t))?void 0:s.index)||0,this.repeatFrom,0);let u;null!=e&&(u=null==(i=this._mapPosToBlock(e))?void 0:i.index),null==u&&(u=this._blocks.length-1);let n=0;for(let t=u;a<=t&&!this._blocks[t].unmaskedValue;--t,++n);n&&(this._blocks.splice(u-n+1,n),this.mask=this.mask.slice(n))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}o.RepeatBlock=L;try{globalThis.IMask=o}catch{}t.ChangeDetails=v,t.ChunksTailDetails=A,t.DIRECTION=a,t.HTMLContenteditableMaskElement=m,t.HTMLInputMaskElement=k,t.HTMLMaskElement=g,t.InputMask=f,t.MaskElement=c,t.Masked=C,t.MaskedDate=y,t.MaskedDynamic=M,t.MaskedEnum=I,t.MaskedFunction=V,t.MaskedNumber=w,t.MaskedPattern=b,t.MaskedRange=D,t.MaskedRegExp=B,t.PIPE_TYPE=R,t.PatternFixedDefinition=x,t.PatternInputDefinition=S,t.RepeatBlock=L,t.createMask=d,t.createPipe=P,t.default=o,t.forceDirection=u,t.normalizeOpts=p,t.pipe=O,Object.defineProperty(t,"__esModule",{value:!0})}));(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==="object"&&typeof module==="object")module.exports=factory();else if(typeof define==="function"&&define.amd)define([],factory);else if(typeof exports==="object")exports["wm_common_variables"]=factory();else root["wm_common_variables"]=factory()})(window,(()=>(()=>{var __webpack_modules__={"./node_modules/@metrichor/jmespath/dist/jmespath.esm.js":
860
860
  /*!***************************************************************!*\
861
861
  !*** ./node_modules/@metrichor/jmespath/dist/jmespath.esm.js ***!
862
862
  \***************************************************************/(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{TYPE_ANY:()=>TYPE_ANY,TYPE_ARRAY:()=>TYPE_ARRAY,TYPE_ARRAY_NUMBER:()=>TYPE_ARRAY_NUMBER,TYPE_ARRAY_STRING:()=>TYPE_ARRAY_STRING,TYPE_BOOLEAN:()=>TYPE_BOOLEAN,TYPE_EXPREF:()=>TYPE_EXPREF,TYPE_NULL:()=>TYPE_NULL,TYPE_NUMBER:()=>TYPE_NUMBER,TYPE_OBJECT:()=>TYPE_OBJECT,TYPE_STRING:()=>TYPE_STRING,TreeInterpreter:()=>TreeInterpreter,compile:()=>compile,default:()=>__WEBPACK_DEFAULT_EXPORT__,jmespath:()=>jmespath,registerFunction:()=>registerFunction,search:()=>search,tokenize:()=>tokenize});const isObject=obj=>obj!==null&&Object.prototype.toString.call(obj)==="[object Object]";const strictDeepEqual=(first,second)=>{if(first===second){return true}if(typeof first!==typeof second){return false}if(Array.isArray(first)&&Array.isArray(second)){if(first.length!==second.length){return false}for(let i=0;i<first.length;i+=1){if(!strictDeepEqual(first[i],second[i])){return false}}return true}if(isObject(first)&&isObject(second)){const firstEntries=Object.entries(first);const secondKeys=new Set(Object.keys(second));if(firstEntries.length!==secondKeys.size){return false}for(const[key,value]of firstEntries){if(!strictDeepEqual(value,second[key])){return false}secondKeys.delete(key)}return secondKeys.size===0}return false};const isFalse=obj=>{if(obj===""||obj===false||obj===null||obj===undefined){return true}if(Array.isArray(obj)&&obj.length===0){return true}if(isObject(obj)){for(const key in obj){if(obj.hasOwnProperty(key)){return false}}return true}return false};const isAlpha=ch=>ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"||ch==="_";const isNum=ch=>ch>="0"&&ch<="9"||ch==="-";const isAlphaNum=ch=>ch>="a"&&ch<="z"||ch>="A"&&ch<="Z"||ch>="0"&&ch<="9"||ch==="_";var Token;(function(Token){Token["TOK_EOF"]="EOF";Token["TOK_UNQUOTEDIDENTIFIER"]="UnquotedIdentifier";Token["TOK_QUOTEDIDENTIFIER"]="QuotedIdentifier";Token["TOK_RBRACKET"]="Rbracket";Token["TOK_RPAREN"]="Rparen";Token["TOK_COMMA"]="Comma";Token["TOK_COLON"]="Colon";Token["TOK_RBRACE"]="Rbrace";Token["TOK_NUMBER"]="Number";Token["TOK_CURRENT"]="Current";Token["TOK_ROOT"]="Root";Token["TOK_EXPREF"]="Expref";Token["TOK_PIPE"]="Pipe";Token["TOK_OR"]="Or";Token["TOK_AND"]="And";Token["TOK_EQ"]="EQ";Token["TOK_GT"]="GT";Token["TOK_LT"]="LT";Token["TOK_GTE"]="GTE";Token["TOK_LTE"]="LTE";Token["TOK_NE"]="NE";Token["TOK_FLATTEN"]="Flatten";Token["TOK_STAR"]="Star";Token["TOK_FILTER"]="Filter";Token["TOK_DOT"]="Dot";Token["TOK_NOT"]="Not";Token["TOK_LBRACE"]="Lbrace";Token["TOK_LBRACKET"]="Lbracket";Token["TOK_LPAREN"]="Lparen";Token["TOK_LITERAL"]="Literal"})(Token||(Token={}));const basicTokens={"(":Token.TOK_LPAREN,")":Token.TOK_RPAREN,"*":Token.TOK_STAR,",":Token.TOK_COMMA,".":Token.TOK_DOT,":":Token.TOK_COLON,"@":Token.TOK_CURRENT,["$"]:Token.TOK_ROOT,"]":Token.TOK_RBRACKET,"{":Token.TOK_LBRACE,"}":Token.TOK_RBRACE};const operatorStartToken={"!":true,"<":true,"=":true,">":true};const skipChars={"\t":true,"\n":true,"\r":true," ":true};class StreamLexer{constructor(){this._current=0}tokenize(stream){const tokens=[];this._current=0;let start;let identifier;let token;while(this._current<stream.length){if(isAlpha(stream[this._current])){start=this._current;identifier=this.consumeUnquotedIdentifier(stream);tokens.push({start:start,type:Token.TOK_UNQUOTEDIDENTIFIER,value:identifier})}else if(basicTokens[stream[this._current]]!==undefined){tokens.push({start:this._current,type:basicTokens[stream[this._current]],value:stream[this._current]});this._current+=1}else if(isNum(stream[this._current])){token=this.consumeNumber(stream);tokens.push(token)}else if(stream[this._current]==="["){token=this.consumeLBracket(stream);tokens.push(token)}else if(stream[this._current]==='"'){start=this._current;identifier=this.consumeQuotedIdentifier(stream);tokens.push({start:start,type:Token.TOK_QUOTEDIDENTIFIER,value:identifier})}else if(stream[this._current]===`'`){start=this._current;identifier=this.consumeRawStringLiteral(stream);tokens.push({start:start,type:Token.TOK_LITERAL,value:identifier})}else if(stream[this._current]==="`"){start=this._current;const literal=this.consumeLiteral(stream);tokens.push({start:start,type:Token.TOK_LITERAL,value:literal})}else if(operatorStartToken[stream[this._current]]!==undefined){token=this.consumeOperator(stream);token&&tokens.push(token)}else if(skipChars[stream[this._current]]!==undefined){this._current+=1}else if(stream[this._current]==="&"){start=this._current;this._current+=1;if(stream[this._current]==="&"){this._current+=1;tokens.push({start:start,type:Token.TOK_AND,value:"&&"})}else{tokens.push({start:start,type:Token.TOK_EXPREF,value:"&"})}}else if(stream[this._current]==="|"){start=this._current;this._current+=1;if(stream[this._current]==="|"){this._current+=1;tokens.push({start:start,type:Token.TOK_OR,value:"||"})}else{tokens.push({start:start,type:Token.TOK_PIPE,value:"|"})}}else{const error=new Error(`Unknown character: ${stream[this._current]}`);error.name="LexerError";throw error}}return tokens}consumeUnquotedIdentifier(stream){const start=this._current;this._current+=1;while(this._current<stream.length&&isAlphaNum(stream[this._current])){this._current+=1}return stream.slice(start,this._current)}consumeQuotedIdentifier(stream){const start=this._current;this._current+=1;const maxLength=stream.length;while(stream[this._current]!=='"'&&this._current<maxLength){let current=this._current;if(stream[current]==="\\"&&(stream[current+1]==="\\"||stream[current+1]==='"')){current+=2}else{current+=1}this._current=current}this._current+=1;return JSON.parse(stream.slice(start,this._current))}consumeRawStringLiteral(stream){const start=this._current;this._current+=1;const maxLength=stream.length;while(stream[this._current]!==`'`&&this._current<maxLength){let current=this._current;if(stream[current]==="\\"&&(stream[current+1]==="\\"||stream[current+1]===`'`)){current+=2}else{current+=1}this._current=current}this._current+=1;const literal=stream.slice(start+1,this._current-1);return literal.replace(`\\'`,`'`)}consumeNumber(stream){const start=this._current;this._current+=1;const maxLength=stream.length;while(isNum(stream[this._current])&&this._current<maxLength){this._current+=1}const value=parseInt(stream.slice(start,this._current),10);return{start:start,value:value,type:Token.TOK_NUMBER}}consumeLBracket(stream){const start=this._current;this._current+=1;if(stream[this._current]==="?"){this._current+=1;return{start:start,type:Token.TOK_FILTER,value:"[?"}}if(stream[this._current]==="]"){this._current+=1;return{start:start,type:Token.TOK_FLATTEN,value:"[]"}}return{start:start,type:Token.TOK_LBRACKET,value:"["}}consumeOperator(stream){const start=this._current;const startingChar=stream[start];this._current+=1;if(startingChar==="!"){if(stream[this._current]==="="){this._current+=1;return{start:start,type:Token.TOK_NE,value:"!="}}return{start:start,type:Token.TOK_NOT,value:"!"}}if(startingChar==="<"){if(stream[this._current]==="="){this._current+=1;return{start:start,type:Token.TOK_LTE,value:"<="}}return{start:start,type:Token.TOK_LT,value:"<"}}if(startingChar===">"){if(stream[this._current]==="="){this._current+=1;return{start:start,type:Token.TOK_GTE,value:">="}}return{start:start,type:Token.TOK_GT,value:">"}}if(startingChar==="="&&stream[this._current]==="="){this._current+=1;return{start:start,type:Token.TOK_EQ,value:"=="}}}consumeLiteral(stream){this._current+=1;const start=this._current;const maxLength=stream.length;while(stream[this._current]!=="`"&&this._current<maxLength){let current=this._current;if(stream[current]==="\\"&&(stream[current+1]==="\\"||stream[current+1]==="`")){current+=2}else{current+=1}this._current=current}let literalString=stream.slice(start,this._current).trimLeft();literalString=literalString.replace("\\`","`");const literal=this.looksLikeJSON(literalString)?JSON.parse(literalString):JSON.parse(`"${literalString}"`);this._current+=1;return literal}looksLikeJSON(literalString){const startingChars='[{"';const jsonLiterals=["true","false","null"];const numberLooking="-0123456789";if(literalString===""){return false}if(startingChars.includes(literalString[0])){return true}if(jsonLiterals.includes(literalString)){return true}if(numberLooking.includes(literalString[0])){try{JSON.parse(literalString);return true}catch(ex){return false}}return false}}const Lexer=new StreamLexer;const bindingPower={[Token.TOK_EOF]:0,[Token.TOK_UNQUOTEDIDENTIFIER]:0,[Token.TOK_QUOTEDIDENTIFIER]:0,[Token.TOK_RBRACKET]:0,[Token.TOK_RPAREN]:0,[Token.TOK_COMMA]:0,[Token.TOK_RBRACE]:0,[Token.TOK_NUMBER]:0,[Token.TOK_CURRENT]:0,[Token.TOK_EXPREF]:0,[Token.TOK_ROOT]:0,[Token.TOK_PIPE]:1,[Token.TOK_OR]:2,[Token.TOK_AND]:3,[Token.TOK_EQ]:5,[Token.TOK_GT]:5,[Token.TOK_LT]:5,[Token.TOK_GTE]:5,[Token.TOK_LTE]:5,[Token.TOK_NE]:5,[Token.TOK_FLATTEN]:9,[Token.TOK_STAR]:20,[Token.TOK_FILTER]:21,[Token.TOK_DOT]:40,[Token.TOK_NOT]:45,[Token.TOK_LBRACE]:50,[Token.TOK_LBRACKET]:55,[Token.TOK_LPAREN]:60};class TokenParser{constructor(){this.index=0;this.tokens=[]}parse(expression){this.loadTokens(expression);this.index=0;const ast=this.expression(0);if(this.lookahead(0)!==Token.TOK_EOF){const token=this.lookaheadToken(0);this.errorToken(token,`Unexpected token type: ${token.type}, value: ${token.value}`)}return ast}loadTokens(expression){this.tokens=[...Lexer.tokenize(expression),{type:Token.TOK_EOF,value:"",start:expression.length}]}expression(rbp){const leftToken=this.lookaheadToken(0);this.advance();let left=this.nud(leftToken);let currentTokenType=this.lookahead(0);while(rbp<bindingPower[currentTokenType]){this.advance();left=this.led(currentTokenType,left);currentTokenType=this.lookahead(0)}return left}lookahead(offset){return this.tokens[this.index+offset].type}lookaheadToken(offset){return this.tokens[this.index+offset]}advance(){this.index+=1}nud(token){let left;let right;let expression;switch(token.type){case Token.TOK_LITERAL:return{type:"Literal",value:token.value};case Token.TOK_UNQUOTEDIDENTIFIER:return{type:"Field",name:token.value};case Token.TOK_QUOTEDIDENTIFIER:const node={type:"Field",name:token.value};if(this.lookahead(0)===Token.TOK_LPAREN){throw new Error("Quoted identifier not allowed for function names.")}else{return node}case Token.TOK_NOT:right=this.expression(bindingPower.Not);return{type:"NotExpression",children:[right]};case Token.TOK_STAR:left={type:"Identity"};right=this.lookahead(0)===Token.TOK_RBRACKET&&{type:"Identity"}||this.parseProjectionRHS(bindingPower.Star);return{type:"ValueProjection",children:[left,right]};case Token.TOK_FILTER:return this.led(token.type,{type:"Identity"});case Token.TOK_LBRACE:return this.parseMultiselectHash();case Token.TOK_FLATTEN:left={type:Token.TOK_FLATTEN,children:[{type:"Identity"}]};right=this.parseProjectionRHS(bindingPower.Flatten);return{type:"Projection",children:[left,right]};case Token.TOK_LBRACKET:if(this.lookahead(0)===Token.TOK_NUMBER||this.lookahead(0)===Token.TOK_COLON){right=this.parseIndexExpression();return this.projectIfSlice({type:"Identity"},right)}if(this.lookahead(0)===Token.TOK_STAR&&this.lookahead(1)===Token.TOK_RBRACKET){this.advance();this.advance();right=this.parseProjectionRHS(bindingPower.Star);return{children:[{type:"Identity"},right],type:"Projection"}}return this.parseMultiselectList();case Token.TOK_CURRENT:return{type:Token.TOK_CURRENT};case Token.TOK_ROOT:return{type:Token.TOK_ROOT};case Token.TOK_EXPREF:expression=this.expression(bindingPower.Expref);return{type:"ExpressionReference",children:[expression]};case Token.TOK_LPAREN:const args=[];while(this.lookahead(0)!==Token.TOK_RPAREN){if(this.lookahead(0)===Token.TOK_CURRENT){expression={type:Token.TOK_CURRENT};this.advance()}else{expression=this.expression(0)}args.push(expression)}this.match(Token.TOK_RPAREN);return args[0];default:this.errorToken(token)}}led(tokenName,left){let right;switch(tokenName){case Token.TOK_DOT:const rbp=bindingPower.Dot;if(this.lookahead(0)!==Token.TOK_STAR){right=this.parseDotRHS(rbp);return{type:"Subexpression",children:[left,right]}}this.advance();right=this.parseProjectionRHS(rbp);return{type:"ValueProjection",children:[left,right]};case Token.TOK_PIPE:right=this.expression(bindingPower.Pipe);return{type:Token.TOK_PIPE,children:[left,right]};case Token.TOK_OR:right=this.expression(bindingPower.Or);return{type:"OrExpression",children:[left,right]};case Token.TOK_AND:right=this.expression(bindingPower.And);return{type:"AndExpression",children:[left,right]};case Token.TOK_LPAREN:const name=left.name;const args=[];let expression;while(this.lookahead(0)!==Token.TOK_RPAREN){if(this.lookahead(0)===Token.TOK_CURRENT){expression={type:Token.TOK_CURRENT};this.advance()}else{expression=this.expression(0)}if(this.lookahead(0)===Token.TOK_COMMA){this.match(Token.TOK_COMMA)}args.push(expression)}this.match(Token.TOK_RPAREN);const node={name:name,type:"Function",children:args};return node;case Token.TOK_FILTER:const condition=this.expression(0);this.match(Token.TOK_RBRACKET);right=this.lookahead(0)===Token.TOK_FLATTEN&&{type:"Identity"}||this.parseProjectionRHS(bindingPower.Filter);return{type:"FilterProjection",children:[left,right,condition]};case Token.TOK_FLATTEN:const leftNode={type:Token.TOK_FLATTEN,children:[left]};const rightNode=this.parseProjectionRHS(bindingPower.Flatten);return{type:"Projection",children:[leftNode,rightNode]};case Token.TOK_EQ:case Token.TOK_NE:case Token.TOK_GT:case Token.TOK_GTE:case Token.TOK_LT:case Token.TOK_LTE:return this.parseComparator(left,tokenName);case Token.TOK_LBRACKET:const token=this.lookaheadToken(0);if(token.type===Token.TOK_NUMBER||token.type===Token.TOK_COLON){right=this.parseIndexExpression();return this.projectIfSlice(left,right)}this.match(Token.TOK_STAR);this.match(Token.TOK_RBRACKET);right=this.parseProjectionRHS(bindingPower.Star);return{type:"Projection",children:[left,right]};default:return this.errorToken(this.lookaheadToken(0))}}match(tokenType){if(this.lookahead(0)===tokenType){this.advance();return}else{const token=this.lookaheadToken(0);this.errorToken(token,`Expected ${tokenType}, got: ${token.type}`)}}errorToken(token,message=""){const error=new Error(message||`Invalid token (${token.type}): "${token.value}"`);error.name="ParserError";throw error}parseIndexExpression(){if(this.lookahead(0)===Token.TOK_COLON||this.lookahead(1)===Token.TOK_COLON){return this.parseSliceExpression()}const node={type:"Index",value:this.lookaheadToken(0).value};this.advance();this.match(Token.TOK_RBRACKET);return node}projectIfSlice(left,right){const indexExpr={type:"IndexExpression",children:[left,right]};if(right.type==="Slice"){return{children:[indexExpr,this.parseProjectionRHS(bindingPower.Star)],type:"Projection"}}return indexExpr}parseSliceExpression(){const parts=[null,null,null];let index=0;let currentTokenType=this.lookahead(0);while(currentTokenType!==Token.TOK_RBRACKET&&index<3){if(currentTokenType===Token.TOK_COLON){index+=1;this.advance()}else if(currentTokenType===Token.TOK_NUMBER){parts[index]=this.lookaheadToken(0).value;this.advance()}else{const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error, unexpected token: ${token.value}(${token.type})`)}currentTokenType=this.lookahead(0)}this.match(Token.TOK_RBRACKET);return{children:parts,type:"Slice"}}parseComparator(left,comparator){const right=this.expression(bindingPower[comparator]);return{type:"Comparator",name:comparator,children:[left,right]}}parseDotRHS(rbp){const lookahead=this.lookahead(0);const exprTokens=[Token.TOK_UNQUOTEDIDENTIFIER,Token.TOK_QUOTEDIDENTIFIER,Token.TOK_STAR];if(exprTokens.includes(lookahead)){return this.expression(rbp)}if(lookahead===Token.TOK_LBRACKET){this.match(Token.TOK_LBRACKET);return this.parseMultiselectList()}if(lookahead===Token.TOK_LBRACE){this.match(Token.TOK_LBRACE);return this.parseMultiselectHash()}const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error, unexpected token: ${token.value}(${token.type})`)}parseProjectionRHS(rbp){if(bindingPower[this.lookahead(0)]<10){return{type:"Identity"}}if(this.lookahead(0)===Token.TOK_LBRACKET){return this.expression(rbp)}if(this.lookahead(0)===Token.TOK_FILTER){return this.expression(rbp)}if(this.lookahead(0)===Token.TOK_DOT){this.match(Token.TOK_DOT);return this.parseDotRHS(rbp)}const token=this.lookaheadToken(0);this.errorToken(token,`Syntax error, unexpected token: ${token.value}(${token.type})`)}parseMultiselectList(){const expressions=[];while(this.lookahead(0)!==Token.TOK_RBRACKET){const expression=this.expression(0);expressions.push(expression);if(this.lookahead(0)===Token.TOK_COMMA){this.match(Token.TOK_COMMA);if(this.lookahead(0)===Token.TOK_RBRACKET){throw new Error("Unexpected token Rbracket")}}}this.match(Token.TOK_RBRACKET);return{type:"MultiSelectList",children:expressions}}parseMultiselectHash(){const pairs=[];const identifierTypes=[Token.TOK_UNQUOTEDIDENTIFIER,Token.TOK_QUOTEDIDENTIFIER];let keyToken;let keyName;let value;for(;;){keyToken=this.lookaheadToken(0);if(!identifierTypes.includes(keyToken.type)){throw new Error(`Expecting an identifier token, got: ${keyToken.type}`)}keyName=keyToken.value;this.advance();this.match(Token.TOK_COLON);value=this.expression(0);pairs.push({value:value,type:"KeyValuePair",name:keyName});if(this.lookahead(0)===Token.TOK_COMMA){this.match(Token.TOK_COMMA)}else if(this.lookahead(0)===Token.TOK_RBRACE){this.match(Token.TOK_RBRACE);break}}return{type:"MultiSelectHash",children:pairs}}}const Parser=new TokenParser;var InputArgument;(function(InputArgument){InputArgument[InputArgument["TYPE_NUMBER"]=0]="TYPE_NUMBER";InputArgument[InputArgument["TYPE_ANY"]=1]="TYPE_ANY";InputArgument[InputArgument["TYPE_STRING"]=2]="TYPE_STRING";InputArgument[InputArgument["TYPE_ARRAY"]=3]="TYPE_ARRAY";InputArgument[InputArgument["TYPE_OBJECT"]=4]="TYPE_OBJECT";InputArgument[InputArgument["TYPE_BOOLEAN"]=5]="TYPE_BOOLEAN";InputArgument[InputArgument["TYPE_EXPREF"]=6]="TYPE_EXPREF";InputArgument[InputArgument["TYPE_NULL"]=7]="TYPE_NULL";InputArgument[InputArgument["TYPE_ARRAY_NUMBER"]=8]="TYPE_ARRAY_NUMBER";InputArgument[InputArgument["TYPE_ARRAY_STRING"]=9]="TYPE_ARRAY_STRING"})(InputArgument||(InputArgument={}));class Runtime{constructor(interpreter){this.TYPE_NAME_TABLE={[InputArgument.TYPE_NUMBER]:"number",[InputArgument.TYPE_ANY]:"any",[InputArgument.TYPE_STRING]:"string",[InputArgument.TYPE_ARRAY]:"array",[InputArgument.TYPE_OBJECT]:"object",[InputArgument.TYPE_BOOLEAN]:"boolean",[InputArgument.TYPE_EXPREF]:"expression",[InputArgument.TYPE_NULL]:"null",[InputArgument.TYPE_ARRAY_NUMBER]:"Array<number>",[InputArgument.TYPE_ARRAY_STRING]:"Array<string>"};this.functionAbs=([inputValue])=>Math.abs(inputValue);this.functionAvg=([inputArray])=>{let sum=0;for(let i=0;i<inputArray.length;i+=1){sum+=inputArray[i]}return sum/inputArray.length};this.functionCeil=([inputValue])=>Math.ceil(inputValue);this.functionContains=resolvedArgs=>{const[searchable,searchValue]=resolvedArgs;return searchable.includes(searchValue)};this.functionEndsWith=resolvedArgs=>{const[searchStr,suffix]=resolvedArgs;return searchStr.includes(suffix,searchStr.length-suffix.length)};this.functionFloor=([inputValue])=>Math.floor(inputValue);this.functionJoin=resolvedArgs=>{const[joinChar,listJoin]=resolvedArgs;return listJoin.join(joinChar)};this.functionKeys=([inputObject])=>Object.keys(inputObject);this.functionLength=([inputValue])=>{if(!isObject(inputValue)){return inputValue.length}return Object.keys(inputValue).length};this.functionMap=resolvedArgs=>{if(!this._interpreter){return[]}const mapped=[];const interpreter=this._interpreter;const exprefNode=resolvedArgs[0];const elements=resolvedArgs[1];for(let i=0;i<elements.length;i+=1){mapped.push(interpreter.visit(exprefNode,elements[i]))}return mapped};this.functionMax=([inputValue])=>{if(!inputValue.length){return null}const typeName=this.getTypeName(inputValue[0]);if(typeName===InputArgument.TYPE_NUMBER){return Math.max(...inputValue)}const elements=inputValue;let maxElement=elements[0];for(let i=1;i<elements.length;i+=1){if(maxElement.localeCompare(elements[i])<0){maxElement=elements[i]}}return maxElement};this.functionMaxBy=resolvedArgs=>{const exprefNode=resolvedArgs[1];const resolvedArray=resolvedArgs[0];const keyFunction=this.createKeyFunction(exprefNode,[InputArgument.TYPE_NUMBER,InputArgument.TYPE_STRING]);let maxNumber=-Infinity;let maxRecord;let current;for(let i=0;i<resolvedArray.length;i+=1){current=keyFunction&&keyFunction(resolvedArray[i]);if(current!==undefined&&current>maxNumber){maxNumber=current;maxRecord=resolvedArray[i]}}return maxRecord};this.functionMerge=resolvedArgs=>{let merged={};for(let i=0;i<resolvedArgs.length;i+=1){const current=resolvedArgs[i];merged=Object.assign(merged,current)}return merged};this.functionMin=([inputValue])=>{if(!inputValue.length){return null}const typeName=this.getTypeName(inputValue[0]);if(typeName===InputArgument.TYPE_NUMBER){return Math.min(...inputValue)}const elements=inputValue;let minElement=elements[0];for(let i=1;i<elements.length;i+=1){if(elements[i].localeCompare(minElement)<0){minElement=elements[i]}}return minElement};this.functionMinBy=resolvedArgs=>{const exprefNode=resolvedArgs[1];const resolvedArray=resolvedArgs[0];const keyFunction=this.createKeyFunction(exprefNode,[InputArgument.TYPE_NUMBER,InputArgument.TYPE_STRING]);let minNumber=Infinity;let minRecord;let current;for(let i=0;i<resolvedArray.length;i+=1){current=keyFunction&&keyFunction(resolvedArray[i]);if(current!==undefined&&current<minNumber){minNumber=current;minRecord=resolvedArray[i]}}return minRecord};this.functionNotNull=resolvedArgs=>{for(let i=0;i<resolvedArgs.length;i+=1){if(this.getTypeName(resolvedArgs[i])!==InputArgument.TYPE_NULL){return resolvedArgs[i]}}return null};this.functionReverse=([inputValue])=>{const typeName=this.getTypeName(inputValue);if(typeName===InputArgument.TYPE_STRING){const originalStr=inputValue;let reversedStr="";for(let i=originalStr.length-1;i>=0;i-=1){reversedStr+=originalStr[i]}return reversedStr}const reversedArray=inputValue.slice(0);reversedArray.reverse();return reversedArray};this.functionSort=([inputValue])=>[...inputValue].sort();this.functionSortBy=resolvedArgs=>{if(!this._interpreter){return[]}const sortedArray=resolvedArgs[0].slice(0);if(sortedArray.length===0){return sortedArray}const interpreter=this._interpreter;const exprefNode=resolvedArgs[1];const requiredType=this.getTypeName(interpreter.visit(exprefNode,sortedArray[0]));if(requiredType!==undefined&&![InputArgument.TYPE_NUMBER,InputArgument.TYPE_STRING].includes(requiredType)){throw new Error(`TypeError: unexpected type (${this.TYPE_NAME_TABLE[requiredType]})`)}const decorated=[];for(let i=0;i<sortedArray.length;i+=1){decorated.push([i,sortedArray[i]])}decorated.sort(((a,b)=>{const exprA=interpreter.visit(exprefNode,a[1]);const exprB=interpreter.visit(exprefNode,b[1]);if(this.getTypeName(exprA)!==requiredType){throw new Error(`TypeError: expected (${this.TYPE_NAME_TABLE[requiredType]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(exprA)]}`)}else if(this.getTypeName(exprB)!==requiredType){throw new Error(`TypeError: expected (${this.TYPE_NAME_TABLE[requiredType]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(exprB)]}`)}if(exprA>exprB){return 1}return exprA<exprB?-1:a[0]-b[0]}));for(let j=0;j<decorated.length;j+=1){sortedArray[j]=decorated[j][1]}return sortedArray};this.functionStartsWith=([searchable,searchStr])=>searchable.startsWith(searchStr);this.functionSum=([inputValue])=>inputValue.reduce(((x,y)=>x+y),0);this.functionToArray=([inputValue])=>{if(this.getTypeName(inputValue)===InputArgument.TYPE_ARRAY){return inputValue}return[inputValue]};this.functionToNumber=([inputValue])=>{const typeName=this.getTypeName(inputValue);let convertedValue;if(typeName===InputArgument.TYPE_NUMBER){return inputValue}if(typeName===InputArgument.TYPE_STRING){convertedValue=+inputValue;if(!isNaN(convertedValue)){return convertedValue}}return null};this.functionToString=([inputValue])=>{if(this.getTypeName(inputValue)===InputArgument.TYPE_STRING){return inputValue}return JSON.stringify(inputValue)};this.functionType=([inputValue])=>{switch(this.getTypeName(inputValue)){case InputArgument.TYPE_NUMBER:return"number";case InputArgument.TYPE_STRING:return"string";case InputArgument.TYPE_ARRAY:return"array";case InputArgument.TYPE_OBJECT:return"object";case InputArgument.TYPE_BOOLEAN:return"boolean";case InputArgument.TYPE_EXPREF:return"expref";case InputArgument.TYPE_NULL:return"null";default:return}};this.functionValues=([inputObject])=>Object.values(inputObject);this.functionTable={abs:{_func:this.functionAbs,_signature:[{types:[InputArgument.TYPE_NUMBER]}]},avg:{_func:this.functionAvg,_signature:[{types:[InputArgument.TYPE_ARRAY_NUMBER]}]},ceil:{_func:this.functionCeil,_signature:[{types:[InputArgument.TYPE_NUMBER]}]},contains:{_func:this.functionContains,_signature:[{types:[InputArgument.TYPE_STRING,InputArgument.TYPE_ARRAY]},{types:[InputArgument.TYPE_ANY]}]},ends_with:{_func:this.functionEndsWith,_signature:[{types:[InputArgument.TYPE_STRING]},{types:[InputArgument.TYPE_STRING]}]},floor:{_func:this.functionFloor,_signature:[{types:[InputArgument.TYPE_NUMBER]}]},join:{_func:this.functionJoin,_signature:[{types:[InputArgument.TYPE_STRING]},{types:[InputArgument.TYPE_ARRAY_STRING]}]},keys:{_func:this.functionKeys,_signature:[{types:[InputArgument.TYPE_OBJECT]}]},length:{_func:this.functionLength,_signature:[{types:[InputArgument.TYPE_STRING,InputArgument.TYPE_ARRAY,InputArgument.TYPE_OBJECT]}]},map:{_func:this.functionMap,_signature:[{types:[InputArgument.TYPE_EXPREF]},{types:[InputArgument.TYPE_ARRAY]}]},max:{_func:this.functionMax,_signature:[{types:[InputArgument.TYPE_ARRAY_NUMBER,InputArgument.TYPE_ARRAY_STRING]}]},max_by:{_func:this.functionMaxBy,_signature:[{types:[InputArgument.TYPE_ARRAY]},{types:[InputArgument.TYPE_EXPREF]}]},merge:{_func:this.functionMerge,_signature:[{types:[InputArgument.TYPE_OBJECT],variadic:true}]},min:{_func:this.functionMin,_signature:[{types:[InputArgument.TYPE_ARRAY_NUMBER,InputArgument.TYPE_ARRAY_STRING]}]},min_by:{_func:this.functionMinBy,_signature:[{types:[InputArgument.TYPE_ARRAY]},{types:[InputArgument.TYPE_EXPREF]}]},not_null:{_func:this.functionNotNull,_signature:[{types:[InputArgument.TYPE_ANY],variadic:true}]},reverse:{_func:this.functionReverse,_signature:[{types:[InputArgument.TYPE_STRING,InputArgument.TYPE_ARRAY]}]},sort:{_func:this.functionSort,_signature:[{types:[InputArgument.TYPE_ARRAY_STRING,InputArgument.TYPE_ARRAY_NUMBER]}]},sort_by:{_func:this.functionSortBy,_signature:[{types:[InputArgument.TYPE_ARRAY]},{types:[InputArgument.TYPE_EXPREF]}]},starts_with:{_func:this.functionStartsWith,_signature:[{types:[InputArgument.TYPE_STRING]},{types:[InputArgument.TYPE_STRING]}]},sum:{_func:this.functionSum,_signature:[{types:[InputArgument.TYPE_ARRAY_NUMBER]}]},to_array:{_func:this.functionToArray,_signature:[{types:[InputArgument.TYPE_ANY]}]},to_number:{_func:this.functionToNumber,_signature:[{types:[InputArgument.TYPE_ANY]}]},to_string:{_func:this.functionToString,_signature:[{types:[InputArgument.TYPE_ANY]}]},type:{_func:this.functionType,_signature:[{types:[InputArgument.TYPE_ANY]}]},values:{_func:this.functionValues,_signature:[{types:[InputArgument.TYPE_OBJECT]}]}};this._interpreter=interpreter}registerFunction(name,customFunction,signature){if(name in this.functionTable){throw new Error(`Function already defined: ${name}()`)}this.functionTable[name]={_func:customFunction.bind(this),_signature:signature}}callFunction(name,resolvedArgs){const functionEntry=this.functionTable[name];if(functionEntry===undefined){throw new Error(`Unknown function: ${name}()`)}this.validateArgs(name,resolvedArgs,functionEntry._signature);return functionEntry._func.call(this,resolvedArgs)}validateInputSignatures(name,signature){for(let i=0;i<signature.length;i+=1){if("variadic"in signature[i]&&i!==signature.length-1){throw new Error(`ArgumentError: ${name}() 'variadic' argument ${i+1} must occur last`)}}}validateArgs(name,args,signature){var _a,_b;let pluralized;this.validateInputSignatures(name,signature);const numberOfRequiredArgs=signature.filter((argSignature=>{var _a;return(_a=!argSignature.optional)!==null&&_a!==void 0?_a:false})).length;const lastArgIsVariadic=(_b=(_a=signature[signature.length-1])===null||_a===void 0?void 0:_a.variadic)!==null&&_b!==void 0?_b:false;const tooFewArgs=args.length<numberOfRequiredArgs;const tooManyArgs=args.length>signature.length;const tooFewModifier=tooFewArgs&&(!lastArgIsVariadic&&numberOfRequiredArgs>1||lastArgIsVariadic)?"at least ":"";if(lastArgIsVariadic&&tooFewArgs||!lastArgIsVariadic&&(tooFewArgs||tooManyArgs)){pluralized=signature.length>1;throw new Error(`ArgumentError: ${name}() takes ${tooFewModifier}${numberOfRequiredArgs} argument${pluralized&&"s"||""} but received ${args.length}`)}let currentSpec;let actualType;let typeMatched;for(let i=0;i<signature.length;i+=1){typeMatched=false;currentSpec=signature[i].types;actualType=this.getTypeName(args[i]);let j;for(j=0;j<currentSpec.length;j+=1){if(actualType!==undefined&&this.typeMatches(actualType,currentSpec[j],args[i])){typeMatched=true;break}}if(!typeMatched&&actualType!==undefined){const expected=currentSpec.map((typeIdentifier=>this.TYPE_NAME_TABLE[typeIdentifier])).join(" | ");throw new Error(`TypeError: ${name}() expected argument ${i+1} to be type (${expected}) but received type ${this.TYPE_NAME_TABLE[actualType]} instead.`)}}}typeMatches(actual,expected,argValue){if(expected===InputArgument.TYPE_ANY){return true}if(expected===InputArgument.TYPE_ARRAY_STRING||expected===InputArgument.TYPE_ARRAY_NUMBER||expected===InputArgument.TYPE_ARRAY){if(expected===InputArgument.TYPE_ARRAY){return actual===InputArgument.TYPE_ARRAY}if(actual===InputArgument.TYPE_ARRAY){let subtype;if(expected===InputArgument.TYPE_ARRAY_NUMBER){subtype=InputArgument.TYPE_NUMBER}else if(expected===InputArgument.TYPE_ARRAY_STRING){subtype=InputArgument.TYPE_STRING}for(let i=0;i<argValue.length;i+=1){const typeName=this.getTypeName(argValue[i]);if(typeName!==undefined&&subtype!==undefined&&!this.typeMatches(typeName,subtype,argValue[i])){return false}}return true}}else{return actual===expected}return false}getTypeName(obj){switch(Object.prototype.toString.call(obj)){case"[object String]":return InputArgument.TYPE_STRING;case"[object Number]":return InputArgument.TYPE_NUMBER;case"[object Array]":return InputArgument.TYPE_ARRAY;case"[object Boolean]":return InputArgument.TYPE_BOOLEAN;case"[object Null]":return InputArgument.TYPE_NULL;case"[object Object]":if(obj.jmespathType===Token.TOK_EXPREF){return InputArgument.TYPE_EXPREF}return InputArgument.TYPE_OBJECT;default:return}}createKeyFunction(exprefNode,allowedTypes){if(!this._interpreter){return}const interpreter=this._interpreter;const keyFunc=x=>{const current=interpreter.visit(exprefNode,x);if(!allowedTypes.includes(this.getTypeName(current))){const msg=`TypeError: expected one of (${allowedTypes.map((t=>this.TYPE_NAME_TABLE[t])).join(" | ")}), received ${this.TYPE_NAME_TABLE[this.getTypeName(current)]}`;throw new Error(msg)}return current};return keyFunc}}class TreeInterpreter$1{constructor(){this._rootValue=null;this.runtime=new Runtime(this)}search(node,value){this._rootValue=value;return this.visit(node,value)}visit(node,value){let matched;let current;let result;let first;let second;let field;let left;let right;let collected;let i;let base;switch(node.type){case"Field":if(value===null){return null}if(isObject(value)){field=value[node.name];if(field===undefined){return null}return field}return null;case"Subexpression":result=this.visit(node.children[0],value);for(i=1;i<node.children.length;i+=1){result=this.visit(node.children[1],result);if(result===null){return null}}return result;case"IndexExpression":left=this.visit(node.children[0],value);right=this.visit(node.children[1],left);return right;case"Index":if(!Array.isArray(value)){return null}let index=node.value;if(index<0){index=value.length+index}result=value[index];if(result===undefined){result=null}return result;case"Slice":if(!Array.isArray(value)){return null}const sliceParams=[...node.children];const computed=this.computeSliceParams(value.length,sliceParams);const[start,stop,step]=computed;result=[];if(step>0){for(i=start;i<stop;i+=step){result.push(value[i])}}else{for(i=start;i>stop;i+=step){result.push(value[i])}}return result;case"Projection":base=this.visit(node.children[0],value);if(!Array.isArray(base)){return null}collected=[];for(i=0;i<base.length;i+=1){current=this.visit(node.children[1],base[i]);if(current!==null){collected.push(current)}}return collected;case"ValueProjection":base=this.visit(node.children[0],value);if(!isObject(base)){return null}collected=[];const values=Object.values(base);for(i=0;i<values.length;i+=1){current=this.visit(node.children[1],values[i]);if(current!==null){collected.push(current)}}return collected;case"FilterProjection":base=this.visit(node.children[0],value);if(!Array.isArray(base)){return null}const filtered=[];const finalResults=[];for(i=0;i<base.length;i+=1){matched=this.visit(node.children[2],base[i]);if(!isFalse(matched)){filtered.push(base[i])}}for(let j=0;j<filtered.length;j+=1){current=this.visit(node.children[1],filtered[j]);if(current!==null){finalResults.push(current)}}return finalResults;case"Comparator":first=this.visit(node.children[0],value);second=this.visit(node.children[1],value);switch(node.name){case Token.TOK_EQ:result=strictDeepEqual(first,second);break;case Token.TOK_NE:result=!strictDeepEqual(first,second);break;case Token.TOK_GT:result=first>second;break;case Token.TOK_GTE:result=first>=second;break;case Token.TOK_LT:result=first<second;break;case Token.TOK_LTE:result=first<=second;break;default:throw new Error(`Unknown comparator: ${node.name}`)}return result;case Token.TOK_FLATTEN:const original=this.visit(node.children[0],value);if(!Array.isArray(original)){return null}let merged=[];for(i=0;i<original.length;i+=1){current=original[i];if(Array.isArray(current)){merged=[...merged,...current]}else{merged.push(current)}}return merged;case"Identity":return value;case"MultiSelectList":if(value===null){return null}collected=[];for(i=0;i<node.children.length;i+=1){collected.push(this.visit(node.children[i],value))}return collected;case"MultiSelectHash":if(value===null){return null}collected={};let child;for(i=0;i<node.children.length;i+=1){child=node.children[i];collected[child.name]=this.visit(child.value,value)}return collected;case"OrExpression":matched=this.visit(node.children[0],value);if(isFalse(matched)){matched=this.visit(node.children[1],value)}return matched;case"AndExpression":first=this.visit(node.children[0],value);if(isFalse(first)){return first}return this.visit(node.children[1],value);case"NotExpression":first=this.visit(node.children[0],value);return isFalse(first);case"Literal":return node.value;case Token.TOK_PIPE:left=this.visit(node.children[0],value);return this.visit(node.children[1],left);case Token.TOK_CURRENT:return value;case Token.TOK_ROOT:return this._rootValue;case"Function":const resolvedArgs=[];for(let j=0;j<node.children.length;j+=1){resolvedArgs.push(this.visit(node.children[j],value))}return this.runtime.callFunction(node.name,resolvedArgs);case"ExpressionReference":const refNode=node.children[0];refNode.jmespathType=Token.TOK_EXPREF;return refNode;default:throw new Error(`Unknown node type: ${node.type}`)}}computeSliceParams(arrayLength,sliceParams){let[start,stop,step]=sliceParams;if(step===null){step=1}else if(step===0){const error=new Error("Invalid slice, step cannot be 0");error.name="RuntimeError";throw error}const stepValueNegative=step<0?true:false;start=start===null?stepValueNegative?arrayLength-1:0:this.capSliceRange(arrayLength,start,step);stop=stop===null?stepValueNegative?-1:arrayLength:this.capSliceRange(arrayLength,stop,step);return[start,stop,step]}capSliceRange(arrayLength,actualValue,step){let nextActualValue=actualValue;if(nextActualValue<0){nextActualValue+=arrayLength;if(nextActualValue<0){nextActualValue=step<0?-1:0}}else if(nextActualValue>=arrayLength){nextActualValue=step<0?arrayLength-1:arrayLength}return nextActualValue}}const TreeInterpreterInstance=new TreeInterpreter$1;const TYPE_ANY=InputArgument.TYPE_ANY;const TYPE_ARRAY=InputArgument.TYPE_ARRAY;const TYPE_ARRAY_NUMBER=InputArgument.TYPE_ARRAY_NUMBER;const TYPE_ARRAY_STRING=InputArgument.TYPE_ARRAY_STRING;const TYPE_BOOLEAN=InputArgument.TYPE_BOOLEAN;const TYPE_EXPREF=InputArgument.TYPE_EXPREF;const TYPE_NULL=InputArgument.TYPE_NULL;const TYPE_NUMBER=InputArgument.TYPE_NUMBER;const TYPE_OBJECT=InputArgument.TYPE_OBJECT;const TYPE_STRING=InputArgument.TYPE_STRING;function compile(expression){const nodeTree=Parser.parse(expression);return nodeTree}function tokenize(expression){return Lexer.tokenize(expression)}const registerFunction=(functionName,customFunction,signature)=>{TreeInterpreterInstance.runtime.registerFunction(functionName,customFunction,signature)};function search(data,expression){const nodeTree=Parser.parse(expression);return TreeInterpreterInstance.search(nodeTree,data)}const TreeInterpreter=TreeInterpreterInstance;const jmespath={compile:compile,registerFunction:registerFunction,search:search,tokenize:tokenize,TreeInterpreter:TreeInterpreter,TYPE_ANY:TYPE_ANY,TYPE_ARRAY_NUMBER:TYPE_ARRAY_NUMBER,TYPE_ARRAY_STRING:TYPE_ARRAY_STRING,TYPE_ARRAY:TYPE_ARRAY,TYPE_BOOLEAN:TYPE_BOOLEAN,TYPE_EXPREF:TYPE_EXPREF,TYPE_NULL:TYPE_NULL,TYPE_NUMBER:TYPE_NUMBER,TYPE_OBJECT:TYPE_OBJECT,TYPE_STRING:TYPE_STRING};const __WEBPACK_DEFAULT_EXPORT__=jmespath},"./node_modules/he/he.js":
@@ -1690,7 +1690,7 @@ hooks.version="2.30.1";setHookCallback(createLocal);hooks.fn=proto;hooks.min=min
1690
1690
  */
1691
1691
  (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,function(){var current=global.tabbable;var exports=global.tabbable={};factory(exports);exports.noConflict=function(){global.tabbable=current;return exports}}())})(this,(function(exports){"use strict";var candidateSelectors=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"];var candidateSelector=candidateSelectors.join(",");var NoElement=typeof Element==="undefined";var matches=NoElement?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector;var getRootNode=!NoElement&&Element.prototype.getRootNode?function(element){var _element$getRootNode;return element===null||element===void 0?void 0:(_element$getRootNode=element.getRootNode)===null||_element$getRootNode===void 0?void 0:_element$getRootNode.call(element)}:function(element){return element===null||element===void 0?void 0:element.ownerDocument};var isInert=function isInert(node,lookUp){var _node$getAttribute;if(lookUp===void 0){lookUp=true}var inertAtt=node===null||node===void 0?void 0:(_node$getAttribute=node.getAttribute)===null||_node$getAttribute===void 0?void 0:_node$getAttribute.call(node,"inert");var inert=inertAtt===""||inertAtt==="true";var result=inert||lookUp&&node&&isInert(node.parentNode);return result};var isContentEditable=function isContentEditable(node){var _node$getAttribute2;var attValue=node===null||node===void 0?void 0:(_node$getAttribute2=node.getAttribute)===null||_node$getAttribute2===void 0?void 0:_node$getAttribute2.call(node,"contenteditable");return attValue===""||attValue==="true"};var getCandidates=function getCandidates(el,includeContainer,filter){if(isInert(el)){return[]}var candidates=Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));if(includeContainer&&matches.call(el,candidateSelector)){candidates.unshift(el)}candidates=candidates.filter(filter);return candidates};var getCandidatesIteratively=function getCandidatesIteratively(elements,includeContainer,options){var candidates=[];var elementsToCheck=Array.from(elements);while(elementsToCheck.length){var element=elementsToCheck.shift();if(isInert(element,false)){continue}if(element.tagName==="SLOT"){var assigned=element.assignedElements();var content=assigned.length?assigned:element.children;var nestedCandidates=getCandidatesIteratively(content,true,options);if(options.flatten){candidates.push.apply(candidates,nestedCandidates)}else{candidates.push({scopeParent:element,candidates:nestedCandidates})}}else{var validCandidate=matches.call(element,candidateSelector);if(validCandidate&&options.filter(element)&&(includeContainer||!elements.includes(element))){candidates.push(element)}var shadowRoot=element.shadowRoot||typeof options.getShadowRoot==="function"&&options.getShadowRoot(element);var validShadowRoot=!isInert(shadowRoot,false)&&(!options.shadowRootFilter||options.shadowRootFilter(element));if(shadowRoot&&validShadowRoot){var _nestedCandidates=getCandidatesIteratively(shadowRoot===true?element.children:shadowRoot.children,true,options);if(options.flatten){candidates.push.apply(candidates,_nestedCandidates)}else{candidates.push({scopeParent:element,candidates:_nestedCandidates})}}else{elementsToCheck.unshift.apply(elementsToCheck,element.children)}}}return candidates};var hasTabIndex=function hasTabIndex(node){return!isNaN(parseInt(node.getAttribute("tabindex"),10))};var getTabIndex=function getTabIndex(node){if(!node){throw new Error("No node provided")}if(node.tabIndex<0){if((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName)||isContentEditable(node))&&!hasTabIndex(node)){return 0}}return node.tabIndex};var getSortOrderTabIndex=function getSortOrderTabIndex(node,isScope){var tabIndex=getTabIndex(node);if(tabIndex<0&&isScope&&!hasTabIndex(node)){return 0}return tabIndex};var sortOrderedTabbables=function sortOrderedTabbables(a,b){return a.tabIndex===b.tabIndex?a.documentOrder-b.documentOrder:a.tabIndex-b.tabIndex};var isInput=function isInput(node){return node.tagName==="INPUT"};var isHiddenInput=function isHiddenInput(node){return isInput(node)&&node.type==="hidden"};var isDetailsWithSummary=function isDetailsWithSummary(node){var r=node.tagName==="DETAILS"&&Array.prototype.slice.apply(node.children).some((function(child){return child.tagName==="SUMMARY"}));return r};var getCheckedRadio=function getCheckedRadio(nodes,form){for(var i=0;i<nodes.length;i++){if(nodes[i].checked&&nodes[i].form===form){return nodes[i]}}};var isTabbableRadio=function isTabbableRadio(node){if(!node.name){return true}var radioScope=node.form||getRootNode(node);var queryRadios=function queryRadios(name){return radioScope.querySelectorAll('input[type="radio"][name="'+name+'"]')};var radioSet;if(typeof window!=="undefined"&&typeof window.CSS!=="undefined"&&typeof window.CSS.escape==="function"){radioSet=queryRadios(window.CSS.escape(node.name))}else{try{radioSet=queryRadios(node.name)}catch(err){console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",err.message);return false}}var checked=getCheckedRadio(radioSet,node.form);return!checked||checked===node};var isRadio=function isRadio(node){return isInput(node)&&node.type==="radio"};var isNonTabbableRadio=function isNonTabbableRadio(node){return isRadio(node)&&!isTabbableRadio(node)};var isNodeAttached=function isNodeAttached(node){var _nodeRoot;var nodeRoot=node&&getRootNode(node);var nodeRootHost=(_nodeRoot=nodeRoot)===null||_nodeRoot===void 0?void 0:_nodeRoot.host;var attached=false;if(nodeRoot&&nodeRoot!==node){var _nodeRootHost,_nodeRootHost$ownerDo,_node$ownerDocument;attached=!!((_nodeRootHost=nodeRootHost)!==null&&_nodeRootHost!==void 0&&(_nodeRootHost$ownerDo=_nodeRootHost.ownerDocument)!==null&&_nodeRootHost$ownerDo!==void 0&&_nodeRootHost$ownerDo.contains(nodeRootHost)||node!==null&&node!==void 0&&(_node$ownerDocument=node.ownerDocument)!==null&&_node$ownerDocument!==void 0&&_node$ownerDocument.contains(node));while(!attached&&nodeRootHost){var _nodeRoot2,_nodeRootHost2,_nodeRootHost2$ownerD;nodeRoot=getRootNode(nodeRootHost);nodeRootHost=(_nodeRoot2=nodeRoot)===null||_nodeRoot2===void 0?void 0:_nodeRoot2.host;attached=!!((_nodeRootHost2=nodeRootHost)!==null&&_nodeRootHost2!==void 0&&(_nodeRootHost2$ownerD=_nodeRootHost2.ownerDocument)!==null&&_nodeRootHost2$ownerD!==void 0&&_nodeRootHost2$ownerD.contains(nodeRootHost))}}return attached};var isZeroArea=function isZeroArea(node){var _node$getBoundingClie=node.getBoundingClientRect(),width=_node$getBoundingClie.width,height=_node$getBoundingClie.height;return width===0&&height===0};var isHidden=function isHidden(node,_ref){var displayCheck=_ref.displayCheck,getShadowRoot=_ref.getShadowRoot;if(getComputedStyle(node).visibility==="hidden"){return true}var isDirectSummary=matches.call(node,"details>summary:first-of-type");var nodeUnderDetails=isDirectSummary?node.parentElement:node;if(matches.call(nodeUnderDetails,"details:not([open]) *")){return true}if(!displayCheck||displayCheck==="full"||displayCheck==="legacy-full"){if(typeof getShadowRoot==="function"){var originalNode=node;while(node){var parentElement=node.parentElement;var rootNode=getRootNode(node);if(parentElement&&!parentElement.shadowRoot&&getShadowRoot(parentElement)===true){return isZeroArea(node)}else if(node.assignedSlot){node=node.assignedSlot}else if(!parentElement&&rootNode!==node.ownerDocument){node=rootNode.host}else{node=parentElement}}node=originalNode}if(isNodeAttached(node)){return!node.getClientRects().length}if(displayCheck!=="legacy-full"){return true}}else if(displayCheck==="non-zero-area"){return isZeroArea(node)}return false};var isDisabledFromFieldset=function isDisabledFromFieldset(node){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)){var parentNode=node.parentElement;while(parentNode){if(parentNode.tagName==="FIELDSET"&&parentNode.disabled){for(var i=0;i<parentNode.children.length;i++){var child=parentNode.children.item(i);if(child.tagName==="LEGEND"){return matches.call(parentNode,"fieldset[disabled] *")?true:!child.contains(node)}}return true}parentNode=parentNode.parentElement}}return false};var isNodeMatchingSelectorFocusable=function isNodeMatchingSelectorFocusable(options,node){if(node.disabled||isInert(node)||isHiddenInput(node)||isHidden(node,options)||isDetailsWithSummary(node)||isDisabledFromFieldset(node)){return false}return true};var isNodeMatchingSelectorTabbable=function isNodeMatchingSelectorTabbable(options,node){if(isNonTabbableRadio(node)||getTabIndex(node)<0||!isNodeMatchingSelectorFocusable(options,node)){return false}return true};var isValidShadowRootTabbable=function isValidShadowRootTabbable(shadowHostNode){var tabIndex=parseInt(shadowHostNode.getAttribute("tabindex"),10);if(isNaN(tabIndex)||tabIndex>=0){return true}return false};var sortByOrder=function sortByOrder(candidates){var regularTabbables=[];var orderedTabbables=[];candidates.forEach((function(item,i){var isScope=!!item.scopeParent;var element=isScope?item.scopeParent:item;var candidateTabindex=getSortOrderTabIndex(element,isScope);var elements=isScope?sortByOrder(item.candidates):element;if(candidateTabindex===0){isScope?regularTabbables.push.apply(regularTabbables,elements):regularTabbables.push(element)}else{orderedTabbables.push({documentOrder:i,tabIndex:candidateTabindex,item:item,isScope:isScope,content:elements})}}));return orderedTabbables.sort(sortOrderedTabbables).reduce((function(acc,sortable){sortable.isScope?acc.push.apply(acc,sortable.content):acc.push(sortable.content);return acc}),[]).concat(regularTabbables)};var tabbable=function tabbable(container,options){options=options||{};var candidates;if(options.getShadowRoot){candidates=getCandidatesIteratively([container],options.includeContainer,{filter:isNodeMatchingSelectorTabbable.bind(null,options),flatten:false,getShadowRoot:options.getShadowRoot,shadowRootFilter:isValidShadowRootTabbable})}else{candidates=getCandidates(container,options.includeContainer,isNodeMatchingSelectorTabbable.bind(null,options))}return sortByOrder(candidates)};var focusable=function focusable(container,options){options=options||{};var candidates;if(options.getShadowRoot){candidates=getCandidatesIteratively([container],options.includeContainer,{filter:isNodeMatchingSelectorFocusable.bind(null,options),flatten:true,getShadowRoot:options.getShadowRoot})}else{candidates=getCandidates(container,options.includeContainer,isNodeMatchingSelectorFocusable.bind(null,options))}return candidates};var isTabbable=function isTabbable(node,options){options=options||{};if(!node){throw new Error("No node provided")}if(matches.call(node,candidateSelector)===false){return false}return isNodeMatchingSelectorTabbable(options,node)};var focusableCandidateSelector=candidateSelectors.concat("iframe").join(",");var isFocusable=function isFocusable(node,options){options=options||{};if(!node){throw new Error("No node provided")}if(matches.call(node,focusableCandidateSelector)===false){return false}return isNodeMatchingSelectorFocusable(options,node)};exports.focusable=focusable;exports.getTabIndex=getTabIndex;exports.isFocusable=isFocusable;exports.isTabbable=isTabbable;exports.tabbable=tabbable;Object.defineProperty(exports,"__esModule",{value:true})}));
1692
1692
  /*!
1693
- * @wavemaker/focus-trap 1.0.0
1693
+ * @wavemaker/focus-trap 1.0.1
1694
1694
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
1695
1695
  */
1696
- (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("tabbable")):typeof define==="function"&&define.amd?define(["exports","tabbable"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,function(){var current=global.focusTrap;var exports=global.focusTrap={};factory(exports,global.tabbable);exports.noConflict=function(){global.focusTrap=current;return exports}}())})(this,(function(exports,tabbable){"use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter((function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable}))),keys.push.apply(keys,symbols)}return keys}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach((function(key){_defineProperty(target,key,source[key])})):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach((function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}))}return target}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _toPrimitive(input,hint){if(typeof input!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(typeof res!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key==="symbol"?key:String(key)}var activeFocusTraps={activateTrap:function activateTrap(trapStack,trap){if(trapStack.length>0){var activeTrap=trapStack[trapStack.length-1];if(activeTrap!==trap){activeTrap.pause()}}var trapIndex=trapStack.indexOf(trap);if(trapIndex===-1){trapStack.push(trap)}else{trapStack.splice(trapIndex,1);trapStack.push(trap)}},deactivateTrap:function deactivateTrap(trapStack,trap){var trapIndex=trapStack.indexOf(trap);if(trapIndex!==-1){trapStack.splice(trapIndex,1)}if(trapStack.length>0){trapStack[trapStack.length-1].unpause()}}};var isSelectableInput=function isSelectableInput(node){return node.tagName&&node.tagName.toLowerCase()==="input"&&typeof node.select==="function"};var isEscapeEvent=function isEscapeEvent(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27};var isTabEvent=function isTabEvent(e){return e.key==="Tab"||e.keyCode===9};var isKeyForward=function isKeyForward(e){return isTabEvent(e)&&!e.shiftKey};var isKeyBackward=function isKeyBackward(e){return isTabEvent(e)&&e.shiftKey};var delay=function delay(fn){return setTimeout(fn,0)};var findIndex=function findIndex(arr,fn){var idx=-1;arr.every((function(value,i){if(fn(value)){idx=i;return false}return true}));return idx};var valueOrHandler=function valueOrHandler(value){for(var _len=arguments.length,params=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){params[_key-1]=arguments[_key]}return typeof value==="function"?value.apply(void 0,params):value};var getActualTarget=function getActualTarget(event){return event.target.shadowRoot&&typeof event.composedPath==="function"?event.composedPath()[0]:event.target};var internalTrapStack=[];var createFocusTrap=function createFocusTrap(elements,userOptions){var doc=(userOptions===null||userOptions===void 0?void 0:userOptions.document)||document;var trapStack=(userOptions===null||userOptions===void 0?void 0:userOptions.trapStack)||internalTrapStack;var config=_objectSpread2({returnFocusOnDeactivate:true,escapeDeactivates:true,delayInitialFocus:true,isKeyForward:isKeyForward,isKeyBackward:isKeyBackward},userOptions);var state={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:false,paused:false,delayInitialFocusTimer:undefined};var trap;var getOption=function getOption(configOverrideOptions,optionName,configOptionName){return configOverrideOptions&&configOverrideOptions[optionName]!==undefined?configOverrideOptions[optionName]:config[configOptionName||optionName]};var findContainerIndex=function findContainerIndex(element){return state.containerGroups.findIndex((function(_ref){var container=_ref.container,tabbableNodes=_ref.tabbableNodes;return container.contains(element)||tabbableNodes.find((function(node){return node===element}))}))};var getNodeForOption=function getNodeForOption(optionName){var optionValue=config[optionName];if(typeof optionValue==="function"){for(var _len2=arguments.length,params=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){params[_key2-1]=arguments[_key2]}optionValue=optionValue.apply(void 0,params)}if(optionValue===true){optionValue=undefined}if(!optionValue){if(optionValue===undefined||optionValue===false){return optionValue}throw new Error("`".concat(optionName,"` was specified but was not a node, or did not return a node"))}var node=optionValue;if(typeof optionValue==="string"){node=doc.querySelector(optionValue);if(!node){throw new Error("`".concat(optionName,"` as selector refers to no known node"))}}return node};var getInitialFocusNode=function getInitialFocusNode(){var node=getNodeForOption("initialFocus");if(node===false){return false}if(node===undefined){if(findContainerIndex(doc.activeElement)>=0){node=doc.activeElement}else{var firstTabbableGroup=state.tabbableGroups[0];var firstTabbableNode=firstTabbableGroup&&firstTabbableGroup.firstTabbableNode;node=firstTabbableNode||getNodeForOption("fallbackFocus")}}if(!node){throw new Error("Your focus-trap needs to have at least one focusable element")}return node};var updateTabbableNodes=function updateTabbableNodes(){state.containerGroups=state.containers.map((function(container){var tabbableNodes=tabbable.tabbable(container,config.tabbableOptions);var focusableNodes=tabbable.focusable(container,config.tabbableOptions);return{container:container,tabbableNodes:tabbableNodes,focusableNodes:focusableNodes,firstTabbableNode:tabbableNodes.length>0?tabbableNodes[0]:null,lastTabbableNode:tabbableNodes.length>0?tabbableNodes[tabbableNodes.length-1]:null,nextTabbableNode:function nextTabbableNode(node){var forward=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var nodeIdx=focusableNodes.findIndex((function(n){return n===node}));if(nodeIdx<0){return undefined}if(forward){return focusableNodes.slice(nodeIdx+1).find((function(n){return tabbable.isTabbable(n,config.tabbableOptions)}))}return focusableNodes.slice(0,nodeIdx).reverse().find((function(n){return tabbable.isTabbable(n,config.tabbableOptions)}))}}}));state.tabbableGroups=state.containerGroups.filter((function(group){return group.tabbableNodes.length>0}));if(state.tabbableGroups.length<=0&&!getNodeForOption("fallbackFocus")){throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")}};var tryFocus=function tryFocus(node){if(node===false){return}if(node===doc.activeElement){return}if(!node||!node.focus){tryFocus(getInitialFocusNode());return}node.focus({preventScroll:!!config.preventScroll});state.mostRecentlyFocusedNode=node;if(isSelectableInput(node)){node.select()}};var getReturnFocusNode=function getReturnFocusNode(previousActiveElement){var node=getNodeForOption("setReturnFocus",previousActiveElement);return node?node:node===false?false:previousActiveElement};var checkPointerDown=function checkPointerDown(e){var target=getActualTarget(e);if(findContainerIndex(target)>=0){return}if(valueOrHandler(config.clickOutsideDeactivates,e)){trap.deactivate({returnFocus:config.returnFocusOnDeactivate&&!tabbable.isFocusable(target,config.tabbableOptions)});return}if(valueOrHandler(config.allowOutsideClick,e)){return}e.preventDefault()};var checkFocusIn=function checkFocusIn(e){var target=getActualTarget(e);var targetContained=findContainerIndex(target)>=0;if(targetContained||target instanceof Document){if(targetContained){state.mostRecentlyFocusedNode=target}}else{if(state.containers[0].nextSibling){return}e.stopImmediatePropagation();tryFocus(state.mostRecentlyFocusedNode||getInitialFocusNode())}};var checkKeyNav=function checkKeyNav(event){var isBackward=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var target=getActualTarget(event);updateTabbableNodes();var destinationNode=null;if(state.tabbableGroups.length>0){var containerIndex=findContainerIndex(target);var containerGroup=containerIndex>=0?state.containerGroups[containerIndex]:undefined;if(containerIndex<0){if(isBackward){destinationNode=state.tabbableGroups[state.tabbableGroups.length-1].lastTabbableNode}else{destinationNode=state.tabbableGroups[0].firstTabbableNode}}else if(isBackward){var startOfGroupIndex=findIndex(state.tabbableGroups,(function(_ref2){var firstTabbableNode=_ref2.firstTabbableNode;return target===firstTabbableNode}));if(startOfGroupIndex<0&&(containerGroup.container===target||tabbable.isFocusable(target,config.tabbableOptions)&&!tabbable.isTabbable(target,config.tabbableOptions)&&!containerGroup.nextTabbableNode(target,false))){startOfGroupIndex=containerIndex}if(startOfGroupIndex>=0){var destinationGroupIndex=startOfGroupIndex===0?state.tabbableGroups.length-1:startOfGroupIndex-1;var destinationGroup=state.tabbableGroups[destinationGroupIndex];destinationNode=destinationGroup.lastTabbableNode}else if(!isTabEvent(event)){destinationNode=containerGroup.nextTabbableNode(target,false)}}else{var lastOfGroupIndex=findIndex(state.tabbableGroups,(function(_ref3){var lastTabbableNode=_ref3.lastTabbableNode;return target===lastTabbableNode}));if(lastOfGroupIndex<0&&(containerGroup.container===target||tabbable.isFocusable(target,config.tabbableOptions)&&!tabbable.isTabbable(target,config.tabbableOptions)&&!containerGroup.nextTabbableNode(target))){lastOfGroupIndex=containerIndex}if(lastOfGroupIndex>=0){var _destinationGroupIndex=lastOfGroupIndex===state.tabbableGroups.length-1?0:lastOfGroupIndex+1;var _destinationGroup=state.tabbableGroups[_destinationGroupIndex];destinationNode=_destinationGroup.firstTabbableNode}else if(!isTabEvent(event)){destinationNode=containerGroup.nextTabbableNode(target)}}}else{destinationNode=getNodeForOption("fallbackFocus")}if(destinationNode){if(isTabEvent(event)){event.preventDefault()}tryFocus(destinationNode)}};var checkKey=function checkKey(event){if(isEscapeEvent(event)&&valueOrHandler(config.escapeDeactivates,event)!==false){event.preventDefault();trap.deactivate();return}if(config.isKeyForward(event)||config.isKeyBackward(event)){checkKeyNav(event,config.isKeyBackward(event))}};var checkClick=function checkClick(e){var target=getActualTarget(e);if(findContainerIndex(target)>=0){return}if(valueOrHandler(config.clickOutsideDeactivates,e)){return}if(valueOrHandler(config.allowOutsideClick,e)){return}e.preventDefault();e.stopImmediatePropagation()};var addListeners=function addListeners(){if(!state.active){return}activeFocusTraps.activateTrap(trapStack,trap);state.delayInitialFocusTimer=config.delayInitialFocus?delay((function(){tryFocus(getInitialFocusNode())})):tryFocus(getInitialFocusNode());doc.addEventListener("focusin",checkFocusIn,true);doc.addEventListener("mousedown",checkPointerDown,{capture:true,passive:false});doc.addEventListener("touchstart",checkPointerDown,{capture:true,passive:false});doc.addEventListener("click",checkClick,{capture:true,passive:false});doc.addEventListener("keydown",checkKey,{capture:true,passive:false});return trap};var removeListeners=function removeListeners(){if(!state.active){return}doc.removeEventListener("focusin",checkFocusIn,true);doc.removeEventListener("mousedown",checkPointerDown,true);doc.removeEventListener("touchstart",checkPointerDown,true);doc.removeEventListener("click",checkClick,true);doc.removeEventListener("keydown",checkKey,true);return trap};trap={get active(){return state.active},get paused(){return state.paused},activate:function activate(activateOptions){if(state.active){return this}var onActivate=getOption(activateOptions,"onActivate");var onPostActivate=getOption(activateOptions,"onPostActivate");var checkCanFocusTrap=getOption(activateOptions,"checkCanFocusTrap");if(!checkCanFocusTrap){updateTabbableNodes()}state.active=true;state.paused=false;state.nodeFocusedBeforeActivation=doc.activeElement;if(onActivate){onActivate()}var finishActivation=function finishActivation(){if(checkCanFocusTrap){updateTabbableNodes()}addListeners();if(onPostActivate){onPostActivate()}};if(checkCanFocusTrap){checkCanFocusTrap(state.containers.concat()).then(finishActivation,finishActivation);return this}finishActivation();return this},deactivate:function deactivate(deactivateOptions){if(!state.active){return this}var options=_objectSpread2({onDeactivate:config.onDeactivate,onPostDeactivate:config.onPostDeactivate,checkCanReturnFocus:config.checkCanReturnFocus},deactivateOptions);clearTimeout(state.delayInitialFocusTimer);state.delayInitialFocusTimer=undefined;removeListeners();state.active=false;state.paused=false;activeFocusTraps.deactivateTrap(trapStack,trap);var onDeactivate=getOption(options,"onDeactivate");var onPostDeactivate=getOption(options,"onPostDeactivate");var checkCanReturnFocus=getOption(options,"checkCanReturnFocus");var returnFocus=getOption(options,"returnFocus","returnFocusOnDeactivate");if(onDeactivate){onDeactivate()}var finishDeactivation=function finishDeactivation(){delay((function(){if(returnFocus){tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation))}if(onPostDeactivate){onPostDeactivate()}}))};if(returnFocus&&checkCanReturnFocus){checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation,finishDeactivation);return this}finishDeactivation();return this},pause:function pause(){if(state.paused||!state.active){return this}state.paused=true;removeListeners();return this},unpause:function unpause(){if(!state.paused||!state.active){return this}state.paused=false;updateTabbableNodes();addListeners();return this},updateContainerElements:function updateContainerElements(containerElements){var elementsAsArray=[].concat(containerElements).filter(Boolean);state.containers=elementsAsArray.map((function(element){return typeof element==="string"?doc.querySelector(element):element}));if(state.active){updateTabbableNodes()}return this}};trap.updateContainerElements(elements);return trap};exports.createFocusTrap=createFocusTrap;Object.defineProperty(exports,"__esModule",{value:true})}));(function($){var settings={},roots={},caches={},_consts={className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch",NAME:"node_name"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_setting={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:true,dblClickExpand:true,expandSpeed:"fast",fontCss:{},nodeClasses:{},nameIsHTML:false,selectedMulti:true,showIcon:true,showLine:true,showTitle:true,txtSelectedEnable:false},data:{key:{isParent:"isParent",children:"children",name:"name",title:"",url:"url",icon:"icon"},render:{name:null,title:null},simpleData:{enable:false,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:false,leaf:false}},async:{enable:false,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",headers:{},xhrFields:{},url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},_initRoot=function(setting){var r=data.getRoot(setting);if(!r){r={};data.setRoot(setting,r)}data.nodeChildren(setting,r,[]);r.expandTriggerFlag=false;r.curSelectedList=[];r.noSelection=true;r.createdNodes=[];r.zId=0;r._ver=(new Date).getTime()},_initCache=function(setting){var c=data.getCache(setting);if(!c){c={};data.setCache(setting,c)}c.nodes=[];c.doms=[]},_bindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.bind(c.NODECREATED,(function(event,treeId,node){tools.apply(setting.callback.onNodeCreated,[event,treeId,node])}));o.bind(c.CLICK,(function(event,srcEvent,treeId,node,clickFlag){tools.apply(setting.callback.onClick,[srcEvent,treeId,node,clickFlag])}));o.bind(c.EXPAND,(function(event,treeId,node){tools.apply(setting.callback.onExpand,[event,treeId,node])}));o.bind(c.COLLAPSE,(function(event,treeId,node){tools.apply(setting.callback.onCollapse,[event,treeId,node])}));o.bind(c.ASYNC_SUCCESS,(function(event,treeId,node,msg){tools.apply(setting.callback.onAsyncSuccess,[event,treeId,node,msg])}));o.bind(c.ASYNC_ERROR,(function(event,treeId,node,XMLHttpRequest,textStatus,errorThrown){tools.apply(setting.callback.onAsyncError,[event,treeId,node,XMLHttpRequest,textStatus,errorThrown])}));o.bind(c.REMOVE,(function(event,treeId,treeNode){tools.apply(setting.callback.onRemove,[event,treeId,treeNode])}));o.bind(c.SELECTED,(function(event,treeId,node){tools.apply(setting.callback.onSelected,[treeId,node])}));o.bind(c.UNSELECTED,(function(event,treeId,node){tools.apply(setting.callback.onUnSelected,[treeId,node])}))},_unbindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.unbind(c.NODECREATED).unbind(c.CLICK).unbind(c.EXPAND).unbind(c.COLLAPSE).unbind(c.ASYNC_SUCCESS).unbind(c.ASYNC_ERROR).unbind(c.REMOVE).unbind(c.SELECTED).unbind(c.UNSELECTED)},_eventProxy=function(event){var target=event.target,setting=data.getSetting(event.data.treeId),tId="",node=null,nodeEventType="",treeEventType="",nodeEventCallback=null,treeEventCallback=null,tmp=null;if(tools.eqs(event.type,"mousedown")){treeEventType="mousedown"}else if(tools.eqs(event.type,"mouseup")){treeEventType="mouseup"}else if(tools.eqs(event.type,"contextmenu")){treeEventType="contextmenu"}else if(tools.eqs(event.type,"click")){if(tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.SWITCH)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="switchNode"}else{tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="clickNode"}}}else if(tools.eqs(event.type,"dblclick")){treeEventType="dblclick";tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="switchNode"}}if(treeEventType.length>0&&tId.length==0){tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id}}if(tId.length>0){node=data.getNodeCache(setting,tId);switch(nodeEventType){case"switchNode":var isParent=data.nodeIsParent(setting,node);if(!isParent){nodeEventType=""}else if(tools.eqs(event.type,"click")||tools.eqs(event.type,"dblclick")&&tools.apply(setting.view.dblClickExpand,[setting.treeId,node],setting.view.dblClickExpand)){nodeEventCallback=handler.onSwitchNode}else{nodeEventType=""}break;case"clickNode":nodeEventCallback=handler.onClickNode;break}}switch(treeEventType){case"mousedown":treeEventCallback=handler.onZTreeMousedown;break;case"mouseup":treeEventCallback=handler.onZTreeMouseup;break;case"dblclick":treeEventCallback=handler.onZTreeDblclick;break;case"contextmenu":treeEventCallback=handler.onZTreeContextmenu;break}var proxyResult={stop:false,node:node,nodeEventType:nodeEventType,nodeEventCallback:nodeEventCallback,treeEventType:treeEventType,treeEventCallback:treeEventCallback};return proxyResult},_initNode=function(setting,level,n,parentNode,isFirstNode,isLastNode,openFlag){if(!n)return;var r=data.getRoot(setting),children=data.nodeChildren(setting,n);n.level=level;n.tId=setting.treeId+"_"+ ++r.zId;n.parentTId=parentNode?parentNode.tId:null;n.open=typeof n.open=="string"?tools.eqs(n.open,"true"):!!n.open;var isParent=data.nodeIsParent(setting,n);if(tools.isArray(children)){data.nodeIsParent(setting,n,true);n.zAsync=true}else{isParent=data.nodeIsParent(setting,n,isParent);n.open=isParent&&!setting.async.enable?n.open:false;n.zAsync=!isParent}n.isFirstNode=isFirstNode;n.isLastNode=isLastNode;n.getParentNode=function(){return data.getNodeCache(setting,n.parentTId)};n.getPreNode=function(){return data.getPreNode(setting,n)};n.getNextNode=function(){return data.getNextNode(setting,n)};n.getIndex=function(){return data.getNodeIndex(setting,n)};n.getPath=function(){return data.getNodePath(setting,n)};n.isAjaxing=false;data.fixPIdKeyValue(setting,n)},_init={bind:[_bindEvent],unbind:[_unbindEvent],caches:[_initCache],nodes:[_initNode],proxys:[_eventProxy],roots:[_initRoot],beforeA:[],afterA:[],innerBeforeA:[],innerAfterA:[],zTreeTools:[]},data={addNodeCache:function(setting,node){data.getCache(setting).nodes[data.getNodeCacheId(node.tId)]=node},getNodeCacheId:function(tId){return tId.substring(tId.lastIndexOf("_")+1)},addAfterA:function(afterA){_init.afterA.push(afterA)},addBeforeA:function(beforeA){_init.beforeA.push(beforeA)},addInnerAfterA:function(innerAfterA){_init.innerAfterA.push(innerAfterA)},addInnerBeforeA:function(innerBeforeA){_init.innerBeforeA.push(innerBeforeA)},addInitBind:function(bindEvent){_init.bind.push(bindEvent)},addInitUnBind:function(unbindEvent){_init.unbind.push(unbindEvent)},addInitCache:function(initCache){_init.caches.push(initCache)},addInitNode:function(initNode){_init.nodes.push(initNode)},addInitProxy:function(initProxy,isFirst){if(!!isFirst){_init.proxys.splice(0,0,initProxy)}else{_init.proxys.push(initProxy)}},addInitRoot:function(initRoot){_init.roots.push(initRoot)},addNodesData:function(setting,parentNode,index,nodes){var children=data.nodeChildren(setting,parentNode),params;if(!children){children=data.nodeChildren(setting,parentNode,[]);index=-1}else if(index>=children.length){index=-1}if(children.length>0&&index===0){children[0].isFirstNode=false;view.setNodeLineIcos(setting,children[0])}else if(children.length>0&&index<0){children[children.length-1].isLastNode=false;view.setNodeLineIcos(setting,children[children.length-1])}data.nodeIsParent(setting,parentNode,true);if(index<0){data.nodeChildren(setting,parentNode,children.concat(nodes))}else{params=[index,0].concat(nodes);children.splice.apply(children,params)}},addSelectedNode:function(setting,node){var root=data.getRoot(setting);if(!data.isSelectedNode(setting,node)){root.curSelectedList.push(node)}},addCreatedNode:function(setting,node){if(!!setting.callback.onNodeCreated||!!setting.view.addDiyDom){var root=data.getRoot(setting);root.createdNodes.push(node)}},addZTreeTools:function(zTreeTools){_init.zTreeTools.push(zTreeTools)},exSetting:function(s){$.extend(true,_setting,s)},fixPIdKeyValue:function(setting,node){if(setting.data.simpleData.enable){node[setting.data.simpleData.pIdKey]=node.parentTId?node.getParentNode()[setting.data.simpleData.idKey]:setting.data.simpleData.rootPId}},getAfterA:function(setting,node,array){for(var i=0,j=_init.afterA.length;i<j;i++){_init.afterA[i].apply(this,arguments)}},getBeforeA:function(setting,node,array){for(var i=0,j=_init.beforeA.length;i<j;i++){_init.beforeA[i].apply(this,arguments)}},getInnerAfterA:function(setting,node,array){for(var i=0,j=_init.innerAfterA.length;i<j;i++){_init.innerAfterA[i].apply(this,arguments)}},getInnerBeforeA:function(setting,node,array){for(var i=0,j=_init.innerBeforeA.length;i<j;i++){_init.innerBeforeA[i].apply(this,arguments)}},getCache:function(setting){return caches[setting.treeId]},getNodeIndex:function(setting,node){if(!node)return null;var p=node.parentTId?node.getParentNode():data.getRoot(setting),children=data.nodeChildren(setting,p);for(var i=0,l=children.length-1;i<=l;i++){if(children[i]===node){return i}}return-1},getNextNode:function(setting,node){if(!node)return null;var p=node.parentTId?node.getParentNode():data.getRoot(setting),children=data.nodeChildren(setting,p);for(var i=0,l=children.length-1;i<=l;i++){if(children[i]===node){return i==l?null:children[i+1]}}return null},getNodeByParam:function(setting,nodes,key,value){if(!nodes||!key)return null;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(node[key]==value){return nodes[i]}var children=data.nodeChildren(setting,node);var tmp=data.getNodeByParam(setting,children,key,value);if(tmp)return tmp}return null},getNodeCache:function(setting,tId){if(!tId)return null;var n=caches[setting.treeId].nodes[data.getNodeCacheId(tId)];return n?n:null},getNodePath:function(setting,node){if(!node)return null;var path;if(node.parentTId){path=node.getParentNode().getPath()}else{path=[]}if(path){path.push(node)}return path},getNodes:function(setting){return data.nodeChildren(setting,data.getRoot(setting))},getNodesByParam:function(setting,nodes,key,value){if(!nodes||!key)return[];var result=[];for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(node[key]==value){result.push(node)}var children=data.nodeChildren(setting,node);result=result.concat(data.getNodesByParam(setting,children,key,value))}return result},getNodesByParamFuzzy:function(setting,nodes,key,value){if(!nodes||!key)return[];var result=[];value=value.toLowerCase();for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(typeof node[key]=="string"&&nodes[i][key].toLowerCase().indexOf(value)>-1){result.push(node)}var children=data.nodeChildren(setting,node);result=result.concat(data.getNodesByParamFuzzy(setting,children,key,value))}return result},getNodesByFilter:function(setting,nodes,filter,isSingle,invokeParam){if(!nodes)return isSingle?null:[];var result=isSingle?null:[];for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(tools.apply(filter,[node,invokeParam],false)){if(isSingle){return node}result.push(node)}var children=data.nodeChildren(setting,node);var tmpResult=data.getNodesByFilter(setting,children,filter,isSingle,invokeParam);if(isSingle&&!!tmpResult){return tmpResult}result=isSingle?tmpResult:result.concat(tmpResult)}return result},getPreNode:function(setting,node){if(!node)return null;var p=node.parentTId?node.getParentNode():data.getRoot(setting),children=data.nodeChildren(setting,p);for(var i=0,l=children.length;i<l;i++){if(children[i]===node){return i==0?null:children[i-1]}}return null},getRoot:function(setting){return setting?roots[setting.treeId]:null},getRoots:function(){return roots},getSetting:function(treeId){return settings[treeId]},getSettings:function(){return settings},getZTreeTools:function(treeId){var r=this.getRoot(this.getSetting(treeId));return r?r.treeTools:null},initCache:function(setting){for(var i=0,j=_init.caches.length;i<j;i++){_init.caches[i].apply(this,arguments)}},initNode:function(setting,level,node,parentNode,preNode,nextNode){for(var i=0,j=_init.nodes.length;i<j;i++){_init.nodes[i].apply(this,arguments)}},initRoot:function(setting){for(var i=0,j=_init.roots.length;i<j;i++){_init.roots[i].apply(this,arguments)}},isSelectedNode:function(setting,node){var root=data.getRoot(setting);for(var i=0,j=root.curSelectedList.length;i<j;i++){if(node===root.curSelectedList[i])return true}return false},nodeChildren:function(setting,node,newChildren){if(!node){return null}var key=setting.data.key.children;if(typeof newChildren!=="undefined"){node[key]=newChildren}return node[key]},nodeIsParent:function(setting,node,newIsParent){if(!node){return false}var key=setting.data.key.isParent;if(typeof newIsParent!=="undefined"){if(typeof newIsParent==="string"){newIsParent=tools.eqs(newIsParent,"true")}newIsParent=!!newIsParent;node[key]=newIsParent}else if(typeof node[key]=="string"){node[key]=tools.eqs(node[key],"true")}else{node[key]=!!node[key]}return node[key]},nodeName:function(setting,node,newName){var key=setting.data.key.name;if(typeof newName!=="undefined"){node[key]=newName}var rawName=""+node[key];if(typeof setting.data.render.name==="function"){return setting.data.render.name.call(this,rawName,node)}return rawName},nodeTitle:function(setting,node){var t=setting.data.key.title===""?setting.data.key.name:setting.data.key.title;var rawTitle=""+node[t];if(typeof setting.data.render.title==="function"){return setting.data.render.title.call(this,rawTitle,node)}return rawTitle},removeNodeCache:function(setting,node){var children=data.nodeChildren(setting,node);if(children){for(var i=0,l=children.length;i<l;i++){data.removeNodeCache(setting,children[i])}}data.getCache(setting).nodes[data.getNodeCacheId(node.tId)]=null},removeSelectedNode:function(setting,node){var root=data.getRoot(setting);for(var i=0,j=root.curSelectedList.length;i<j;i++){if(node===root.curSelectedList[i]||!data.getNodeCache(setting,root.curSelectedList[i].tId)){root.curSelectedList.splice(i,1);setting.treeObj.trigger(consts.event.UNSELECTED,[setting.treeId,node]);i--;j--}}},setCache:function(setting,cache){caches[setting.treeId]=cache},setRoot:function(setting,root){roots[setting.treeId]=root},setZTreeTools:function(setting,zTreeTools){for(var i=0,j=_init.zTreeTools.length;i<j;i++){_init.zTreeTools[i].apply(this,arguments)}},transformToArrayFormat:function(setting,nodes){if(!nodes)return[];var r=[];if(tools.isArray(nodes)){for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];_do(node)}}else{_do(nodes)}return r;function _do(_node){r.push(_node);var children=data.nodeChildren(setting,_node);if(children){r=r.concat(data.transformToArrayFormat(setting,children))}}},transformTozTreeFormat:function(setting,sNodes){var i,l,key=setting.data.simpleData.idKey,parentKey=setting.data.simpleData.pIdKey;if(!key||key==""||!sNodes)return[];if(tools.isArray(sNodes)){var r=[];var tmpMap={};for(i=0,l=sNodes.length;i<l;i++){tmpMap[sNodes[i][key]]=sNodes[i]}for(i=0,l=sNodes.length;i<l;i++){var p=tmpMap[sNodes[i][parentKey]];if(p&&sNodes[i][key]!=sNodes[i][parentKey]){var children=data.nodeChildren(setting,p);if(!children){children=data.nodeChildren(setting,p,[])}children.push(sNodes[i])}else{r.push(sNodes[i])}}return r}else{return[sNodes]}}},event={bindEvent:function(setting){for(var i=0,j=_init.bind.length;i<j;i++){_init.bind[i].apply(this,arguments)}},unbindEvent:function(setting){for(var i=0,j=_init.unbind.length;i<j;i++){_init.unbind[i].apply(this,arguments)}},bindTree:function(setting){var eventParam={treeId:setting.treeId},o=setting.treeObj;if(!setting.view.txtSelectedEnable){o.bind("selectstart",handler.onSelectStart).css({"-moz-user-select":"-moz-none"})}o.bind("click",eventParam,event.proxy);o.bind("dblclick",eventParam,event.proxy);o.bind("mouseover",eventParam,event.proxy);o.bind("mouseout",eventParam,event.proxy);o.bind("mousedown",eventParam,event.proxy);o.bind("mouseup",eventParam,event.proxy);o.bind("contextmenu",eventParam,event.proxy)},unbindTree:function(setting){var o=setting.treeObj;o.unbind("selectstart",handler.onSelectStart).unbind("click",event.proxy).unbind("dblclick",event.proxy).unbind("mouseover",event.proxy).unbind("mouseout",event.proxy).unbind("mousedown",event.proxy).unbind("mouseup",event.proxy).unbind("contextmenu",event.proxy)},doProxy:function(e){var results=[];for(var i=0,j=_init.proxys.length;i<j;i++){var proxyResult=_init.proxys[i].apply(this,arguments);results.push(proxyResult);if(proxyResult.stop){break}}return results},proxy:function(e){var setting=data.getSetting(e.data.treeId);if(!tools.uCanDo(setting,e))return true;var results=event.doProxy(e),r=true,x=false;for(var i=0,l=results.length;i<l;i++){var proxyResult=results[i];if(proxyResult.nodeEventCallback){x=true;r=proxyResult.nodeEventCallback.apply(proxyResult,[e,proxyResult.node])&&r}if(proxyResult.treeEventCallback){x=true;r=proxyResult.treeEventCallback.apply(proxyResult,[e,proxyResult.node])&&r}}return r}},handler={onSwitchNode:function(event,node){var setting=data.getSetting(event.data.treeId);if(node.open){if(tools.apply(setting.callback.beforeCollapse,[setting.treeId,node],true)==false)return true;data.getRoot(setting).expandTriggerFlag=true;view.switchNode(setting,node)}else{if(tools.apply(setting.callback.beforeExpand,[setting.treeId,node],true)==false)return true;data.getRoot(setting).expandTriggerFlag=true;view.switchNode(setting,node)}return true},onClickNode:function(event,node){var setting=data.getSetting(event.data.treeId),clickFlag=setting.view.autoCancelSelected&&(event.ctrlKey||event.metaKey)&&data.isSelectedNode(setting,node)?0:setting.view.autoCancelSelected&&(event.ctrlKey||event.metaKey)&&setting.view.selectedMulti?2:1;if(tools.apply(setting.callback.beforeClick,[setting.treeId,node,clickFlag],true)==false)return true;if(clickFlag===0){view.cancelPreSelectedNode(setting,node)}else{view.selectNode(setting,node,clickFlag===2)}setting.treeObj.trigger(consts.event.CLICK,[event,setting.treeId,node,clickFlag]);return true},onZTreeMousedown:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeMouseDown,[setting.treeId,node],true)){tools.apply(setting.callback.onMouseDown,[event,setting.treeId,node])}return true},onZTreeMouseup:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeMouseUp,[setting.treeId,node],true)){tools.apply(setting.callback.onMouseUp,[event,setting.treeId,node])}return true},onZTreeDblclick:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeDblClick,[setting.treeId,node],true)){tools.apply(setting.callback.onDblClick,[event,setting.treeId,node])}return true},onZTreeContextmenu:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeRightClick,[setting.treeId,node],true)){tools.apply(setting.callback.onRightClick,[event,setting.treeId,node])}return typeof setting.callback.onRightClick!="function"},onSelectStart:function(e){var n=e.originalEvent.srcElement.nodeName.toLowerCase();return n==="input"||n==="textarea"}},tools={apply:function(fun,param,defaultValue){if(typeof fun=="function"){return fun.apply(zt,param?param:[])}return defaultValue},canAsync:function(setting,node){var children=data.nodeChildren(setting,node);var isParent=data.nodeIsParent(setting,node);return setting.async.enable&&node&&isParent&&!(node.zAsync||children&&children.length>0)},clone:function(obj){if(obj===null)return null;var o=tools.isArray(obj)?[]:{};for(var i in obj){o[i]=obj[i]instanceof Date?new Date(obj[i].getTime()):typeof obj[i]==="object"?tools.clone(obj[i]):obj[i]}return o},eqs:function(str1,str2){return str1.toLowerCase()===str2.toLowerCase()},isArray:function(arr){return Object.prototype.toString.apply(arr)==="[object Array]"},isElement:function(o){return typeof HTMLElement==="object"?o instanceof HTMLElement:o&&typeof o==="object"&&o!==null&&o.nodeType===1&&typeof o.nodeName==="string"},$:function(node,exp,setting){if(!!exp&&typeof exp!="string"){setting=exp;exp=""}if(typeof node=="string"){return $(node,setting?setting.treeObj.get(0).ownerDocument:null)}else{return $("#"+node.tId+exp,setting?setting.treeObj:null)}},getMDom:function(setting,curDom,targetExpr){if(!curDom)return null;while(curDom&&curDom.id!==setting.treeId){for(var i=0,l=targetExpr.length;curDom.tagName&&i<l;i++){if(tools.eqs(curDom.tagName,targetExpr[i].tagName)&&curDom.getAttribute(targetExpr[i].attrName)!==null){return curDom}}curDom=curDom.parentNode}return null},getNodeMainDom:function(target){return $(target).parent("li").get(0)||$(target).parentsUntil("li").parent().get(0)},isChildOrSelf:function(dom,parentId){return $(dom).closest("#"+parentId).length>0},uCanDo:function(setting,e){return true}},view={addNodes:function(setting,parentNode,index,newNodes,isSilent){var isParent=data.nodeIsParent(setting,parentNode);if(setting.data.keep.leaf&&parentNode&&!isParent){return}if(!tools.isArray(newNodes)){newNodes=[newNodes]}if(setting.data.simpleData.enable){newNodes=data.transformTozTreeFormat(setting,newNodes)}if(parentNode){var target_switchObj=$$(parentNode,consts.id.SWITCH,setting),target_icoObj=$$(parentNode,consts.id.ICON,setting),target_ulObj=$$(parentNode,consts.id.UL,setting);if(!parentNode.open){view.replaceSwitchClass(parentNode,target_switchObj,consts.folder.CLOSE);view.replaceIcoClass(parentNode,target_icoObj,consts.folder.CLOSE);parentNode.open=false;target_ulObj.css({display:"none"})}data.addNodesData(setting,parentNode,index,newNodes);view.createNodes(setting,parentNode.level+1,newNodes,parentNode,index);if(!isSilent){view.expandCollapseParentNode(setting,parentNode,true)}}else{data.addNodesData(setting,data.getRoot(setting),index,newNodes);view.createNodes(setting,0,newNodes,null,index)}},appendNodes:function(setting,level,nodes,parentNode,index,initFlag,openFlag){if(!nodes)return[];var html=[];var tmpPNode=parentNode?parentNode:data.getRoot(setting),tmpPChild=data.nodeChildren(setting,tmpPNode),isFirstNode,isLastNode;if(!tmpPChild||index>=tmpPChild.length-nodes.length){index=-1}for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(initFlag){isFirstNode=(index===0||tmpPChild.length==nodes.length)&&i==0;isLastNode=index<0&&i==nodes.length-1;data.initNode(setting,level,node,parentNode,isFirstNode,isLastNode,openFlag);data.addNodeCache(setting,node)}var isParent=data.nodeIsParent(setting,node);var childHtml=[];var children=data.nodeChildren(setting,node);if(children&&children.length>0){childHtml=view.appendNodes(setting,level+1,children,node,-1,initFlag,openFlag&&node.open)}if(openFlag){view.makeDOMNodeMainBefore(html,setting,node);view.makeDOMNodeLine(html,setting,node);data.getBeforeA(setting,node,html);view.makeDOMNodeNameBefore(html,setting,node);data.getInnerBeforeA(setting,node,html);view.makeDOMNodeIcon(html,setting,node);data.getInnerAfterA(setting,node,html);view.makeDOMNodeNameAfter(html,setting,node);data.getAfterA(setting,node,html);if(isParent&&node.open){view.makeUlHtml(setting,node,html,childHtml.join(""))}view.makeDOMNodeMainAfter(html,setting,node);data.addCreatedNode(setting,node)}}return html},appendParentULDom:function(setting,node){var html=[],nObj=$$(node,setting);if(!nObj.get(0)&&!!node.parentTId){view.appendParentULDom(setting,node.getParentNode());nObj=$$(node,setting)}var ulObj=$$(node,consts.id.UL,setting);if(ulObj.get(0)){ulObj.remove()}var children=data.nodeChildren(setting,node),childHtml=view.appendNodes(setting,node.level+1,children,node,-1,false,true);view.makeUlHtml(setting,node,html,childHtml.join(""));nObj.append(html.join(""))},asyncNode:function(setting,node,isSilent,callback){var i,l;var isParent=data.nodeIsParent(setting,node);if(node&&!isParent){tools.apply(callback);return false}else if(node&&node.isAjaxing){return false}else if(tools.apply(setting.callback.beforeAsync,[setting.treeId,node],true)==false){tools.apply(callback);return false}if(node){node.isAjaxing=true;var icoObj=$$(node,consts.id.ICON,setting);icoObj.attr({style:"",class:consts.className.BUTTON+" "+consts.className.ICO_LOADING})}var tmpParam={};var autoParam=tools.apply(setting.async.autoParam,[setting.treeId,node],setting.async.autoParam);for(i=0,l=autoParam.length;node&&i<l;i++){var pKey=autoParam[i].split("="),spKey=pKey;if(pKey.length>1){spKey=pKey[1];pKey=pKey[0]}tmpParam[spKey]=node[pKey]}var otherParam=tools.apply(setting.async.otherParam,[setting.treeId,node],setting.async.otherParam);if(tools.isArray(otherParam)){for(i=0,l=otherParam.length;i<l;i+=2){tmpParam[otherParam[i]]=otherParam[i+1]}}else{for(var p in otherParam){tmpParam[p]=otherParam[p]}}var _tmpV=data.getRoot(setting)._ver;$.ajax({contentType:setting.async.contentType,cache:false,type:setting.async.type,url:tools.apply(setting.async.url,[setting.treeId,node],setting.async.url),data:setting.async.contentType.indexOf("application/json")>-1?JSON.stringify(tmpParam):tmpParam,dataType:setting.async.dataType,headers:setting.async.headers,xhrFields:setting.async.xhrFields,success:function(msg){if(_tmpV!=data.getRoot(setting)._ver){return}var newNodes=[];try{if(!msg||msg.length==0){newNodes=[]}else if(typeof msg=="string"){newNodes=eval("("+msg+")")}else{newNodes=msg}}catch(err){newNodes=msg}if(node){node.isAjaxing=null;node.zAsync=true}view.setNodeLineIcos(setting,node);if(newNodes&&newNodes!==""){newNodes=tools.apply(setting.async.dataFilter,[setting.treeId,node,newNodes],newNodes);view.addNodes(setting,node,-1,!!newNodes?tools.clone(newNodes):[],!!isSilent)}else{view.addNodes(setting,node,-1,[],!!isSilent)}setting.treeObj.trigger(consts.event.ASYNC_SUCCESS,[setting.treeId,node,msg]);tools.apply(callback)},error:function(XMLHttpRequest,textStatus,errorThrown){if(_tmpV!=data.getRoot(setting)._ver){return}if(node)node.isAjaxing=null;view.setNodeLineIcos(setting,node);setting.treeObj.trigger(consts.event.ASYNC_ERROR,[setting.treeId,node,XMLHttpRequest,textStatus,errorThrown])}});return true},cancelPreSelectedNode:function(setting,node,excludeNode){var list=data.getRoot(setting).curSelectedList,i,n;for(i=list.length-1;i>=0;i--){n=list[i];if(node===n||!node&&(!excludeNode||excludeNode!==n)){$$(n,consts.id.A,setting).removeClass(consts.node.CURSELECTED);if(node){data.removeSelectedNode(setting,node);break}else{list.splice(i,1);setting.treeObj.trigger(consts.event.UNSELECTED,[setting.treeId,n])}}}},createNodeCallback:function(setting){if(!!setting.callback.onNodeCreated||!!setting.view.addDiyDom){var root=data.getRoot(setting);while(root.createdNodes.length>0){var node=root.createdNodes.shift();tools.apply(setting.view.addDiyDom,[setting.treeId,node]);if(!!setting.callback.onNodeCreated){setting.treeObj.trigger(consts.event.NODECREATED,[setting.treeId,node])}}}},createNodes:function(setting,level,nodes,parentNode,index){if(!nodes||nodes.length==0)return;var root=data.getRoot(setting),openFlag=!parentNode||parentNode.open||!!$$(data.nodeChildren(setting,parentNode)[0],setting).get(0);root.createdNodes=[];var zTreeHtml=view.appendNodes(setting,level,nodes,parentNode,index,true,openFlag),parentObj,nextObj;if(!parentNode){parentObj=setting.treeObj}else{var ulObj=$$(parentNode,consts.id.UL,setting);if(ulObj.get(0)){parentObj=ulObj}}if(parentObj){if(index>=0){nextObj=parentObj.children()[index]}if(index>=0&&nextObj){$(nextObj).before(zTreeHtml.join(""))}else{parentObj.append(zTreeHtml.join(""))}}view.createNodeCallback(setting)},destroy:function(setting){if(!setting)return;data.initCache(setting);data.initRoot(setting);event.unbindTree(setting);event.unbindEvent(setting);setting.treeObj.empty();delete settings[setting.treeId]},expandCollapseNode:function(setting,node,expandFlag,animateFlag,callback){var root=data.getRoot(setting);var tmpCb,_callback;if(!node){tools.apply(callback,[]);return}var children=data.nodeChildren(setting,node);var isParent=data.nodeIsParent(setting,node);if(root.expandTriggerFlag){_callback=callback;tmpCb=function(){if(_callback)_callback();if(node.open){setting.treeObj.trigger(consts.event.EXPAND,[setting.treeId,node])}else{setting.treeObj.trigger(consts.event.COLLAPSE,[setting.treeId,node])}};callback=tmpCb;root.expandTriggerFlag=false}if(!node.open&&isParent&&(!$$(node,consts.id.UL,setting).get(0)||children&&children.length>0&&!$$(children[0],setting).get(0))){view.appendParentULDom(setting,node);view.createNodeCallback(setting)}if(node.open==expandFlag){tools.apply(callback,[]);return}var ulObj=$$(node,consts.id.UL,setting),switchObj=$$(node,consts.id.SWITCH,setting),icoObj=$$(node,consts.id.ICON,setting);if(isParent){node.open=!node.open;if(node.iconOpen&&node.iconClose){icoObj.attr("style",view.makeNodeIcoStyle(setting,node))}if(node.open){view.replaceSwitchClass(node,switchObj,consts.folder.OPEN);view.replaceIcoClass(node,icoObj,consts.folder.OPEN);if(animateFlag==false||setting.view.expandSpeed==""){ulObj.show();tools.apply(callback,[])}else{if(children&&children.length>0){ulObj.slideDown(setting.view.expandSpeed,callback)}else{ulObj.show();tools.apply(callback,[])}}}else{view.replaceSwitchClass(node,switchObj,consts.folder.CLOSE);view.replaceIcoClass(node,icoObj,consts.folder.CLOSE);if(animateFlag==false||setting.view.expandSpeed==""||!(children&&children.length>0)){ulObj.hide();tools.apply(callback,[])}else{ulObj.slideUp(setting.view.expandSpeed,callback)}}}else{tools.apply(callback,[])}},expandCollapseParentNode:function(setting,node,expandFlag,animateFlag,callback){if(!node)return;if(!node.parentTId){view.expandCollapseNode(setting,node,expandFlag,animateFlag,callback);return}else{view.expandCollapseNode(setting,node,expandFlag,animateFlag)}if(node.parentTId){view.expandCollapseParentNode(setting,node.getParentNode(),expandFlag,animateFlag,callback)}},expandCollapseSonNode:function(setting,node,expandFlag,animateFlag,callback){var root=data.getRoot(setting),treeNodes=node?data.nodeChildren(setting,node):data.nodeChildren(setting,root),selfAnimateSign=node?false:animateFlag,expandTriggerFlag=data.getRoot(setting).expandTriggerFlag;data.getRoot(setting).expandTriggerFlag=false;if(treeNodes){for(var i=0,l=treeNodes.length;i<l;i++){if(treeNodes[i])view.expandCollapseSonNode(setting,treeNodes[i],expandFlag,selfAnimateSign)}}data.getRoot(setting).expandTriggerFlag=expandTriggerFlag;view.expandCollapseNode(setting,node,expandFlag,animateFlag,callback)},isSelectedNode:function(setting,node){if(!node){return false}var list=data.getRoot(setting).curSelectedList,i;for(i=list.length-1;i>=0;i--){if(node===list[i]){return true}}return false},makeDOMNodeIcon:function(html,setting,node){var nameStr=data.nodeName(setting,node),name=setting.view.nameIsHTML?nameStr:nameStr.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");html.push("<span id='",node.tId,consts.id.ICON,"' title='' treeNode",consts.id.ICON," class='",view.makeNodeIcoClass(setting,node),"' style='",view.makeNodeIcoStyle(setting,node),"'></span><span id='",node.tId,consts.id.SPAN,"' class='",consts.className.NAME,"'>",name,"</span>")},makeDOMNodeLine:function(html,setting,node){html.push("<span id='",node.tId,consts.id.SWITCH,"' title='' class='",view.makeNodeLineClass(setting,node),"' treeNode",consts.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(html,setting,node){html.push("</li>")},makeDOMNodeMainBefore:function(html,setting,node){html.push("<li id='",node.tId,"' class='",consts.className.LEVEL,node.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(html,setting,node){html.push("</a>")},makeDOMNodeNameBefore:function(html,setting,node){var title=data.nodeTitle(setting,node),url=view.makeNodeUrl(setting,node),fontcss=view.makeNodeFontCss(setting,node),nodeClasses=view.makeNodeClasses(setting,node),fontStyle=[];for(var f in fontcss){fontStyle.push(f,":",fontcss[f],";")}html.push("<a id='",node.tId,consts.id.A,"' class='",consts.className.LEVEL,node.level,nodeClasses.add?" "+nodeClasses.add.join(" "):"","' treeNode",consts.id.A,node.click?' onclick="'+node.click+'"':"",url!=null&&url.length>0?" href='"+url+"'":""," target='",view.makeNodeTarget(node),"' style='",fontStyle.join(""),"'");if(tools.apply(setting.view.showTitle,[setting.treeId,node],setting.view.showTitle)&&title){html.push("title='",title.replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"'")}html.push(">")},makeNodeFontCss:function(setting,node){var fontCss=tools.apply(setting.view.fontCss,[setting.treeId,node],setting.view.fontCss);return fontCss&&typeof fontCss!="function"?fontCss:{}},makeNodeClasses:function(setting,node){var classes=tools.apply(setting.view.nodeClasses,[setting.treeId,node],setting.view.nodeClasses);return classes&&typeof classes!=="function"?classes:{add:[],remove:[]}},makeNodeIcoClass:function(setting,node){var icoCss=["ico"];if(!node.isAjaxing){var isParent=data.nodeIsParent(setting,node);icoCss[0]=(node.iconSkin?node.iconSkin+"_":"")+icoCss[0];if(isParent){icoCss.push(node.open?consts.folder.OPEN:consts.folder.CLOSE)}else{icoCss.push(consts.folder.DOCU)}}return consts.className.BUTTON+" "+icoCss.join("_")},makeNodeIcoStyle:function(setting,node){var icoStyle=[];if(!node.isAjaxing){var isParent=data.nodeIsParent(setting,node);var icon=isParent&&node.iconOpen&&node.iconClose?node.open?node.iconOpen:node.iconClose:node[setting.data.key.icon];if(icon)icoStyle.push("background:url(",icon,") 0 0 no-repeat;");if(setting.view.showIcon==false||!tools.apply(setting.view.showIcon,[setting.treeId,node],true)){icoStyle.push("display:none;")}}return icoStyle.join("")},makeNodeLineClass:function(setting,node){var lineClass=[];if(setting.view.showLine){if(node.level==0&&node.isFirstNode&&node.isLastNode){lineClass.push(consts.line.ROOT)}else if(node.level==0&&node.isFirstNode){lineClass.push(consts.line.ROOTS)}else if(node.isLastNode){lineClass.push(consts.line.BOTTOM)}else{lineClass.push(consts.line.CENTER)}}else{lineClass.push(consts.line.NOLINE)}if(data.nodeIsParent(setting,node)){lineClass.push(node.open?consts.folder.OPEN:consts.folder.CLOSE)}else{lineClass.push(consts.folder.DOCU)}return view.makeNodeLineClassEx(node)+lineClass.join("_")},makeNodeLineClassEx:function(node){return consts.className.BUTTON+" "+consts.className.LEVEL+node.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(node){return node.target||"_blank"},makeNodeUrl:function(setting,node){var urlKey=setting.data.key.url;return node[urlKey]?node[urlKey]:null},makeUlHtml:function(setting,node,html,content){html.push("<ul id='",node.tId,consts.id.UL,"' class='",consts.className.LEVEL,node.level," ",view.makeUlLineClass(setting,node),"' style='display:",node.open?"block":"none","'>");html.push(content);html.push("</ul>")},makeUlLineClass:function(setting,node){return setting.view.showLine&&!node.isLastNode?consts.line.LINE:""},removeChildNodes:function(setting,node){if(!node)return;var nodes=data.nodeChildren(setting,node);if(!nodes)return;for(var i=0,l=nodes.length;i<l;i++){data.removeNodeCache(setting,nodes[i])}data.removeSelectedNode(setting);delete node[setting.data.key.children];if(!setting.data.keep.parent){data.nodeIsParent(setting,node,false);node.open=false;var tmp_switchObj=$$(node,consts.id.SWITCH,setting),tmp_icoObj=$$(node,consts.id.ICON,setting);view.replaceSwitchClass(node,tmp_switchObj,consts.folder.DOCU);view.replaceIcoClass(node,tmp_icoObj,consts.folder.DOCU);$$(node,consts.id.UL,setting).remove()}else{$$(node,consts.id.UL,setting).empty()}},scrollIntoView:function(setting,dom){if(!dom){return}if(typeof Element==="undefined"||typeof HTMLElement==="undefined"){var contRect=setting.treeObj.get(0).getBoundingClientRect(),findMeRect=dom.getBoundingClientRect();if(findMeRect.top<contRect.top||findMeRect.bottom>contRect.bottom||findMeRect.right>contRect.right||findMeRect.left<contRect.left){dom.scrollIntoView()}return}if(!Element.prototype.scrollIntoViewIfNeeded){Element.prototype.scrollIntoViewIfNeeded=function(centerIfNeeded){"use strict";function makeRange(start,length){return{start:start,length:length,end:start+length}}function coverRange(inner,outer){if(false===centerIfNeeded||outer.start<inner.end&&inner.start<outer.end){return Math.max(inner.end-outer.length,Math.min(outer.start,inner.start))}return(inner.start+inner.end-outer.length)/2}function makePoint(x,y){return{x:x,y:y,translate:function translate(dX,dY){return makePoint(x+dX,y+dY)}}}function absolute(elem,pt){while(elem){pt=pt.translate(elem.offsetLeft,elem.offsetTop);elem=elem.offsetParent}return pt}var target=absolute(this,makePoint(0,0)),extent=makePoint(this.offsetWidth,this.offsetHeight),elem=this.parentNode,origin;while(elem instanceof HTMLElement){origin=absolute(elem,makePoint(elem.clientLeft,elem.clientTop));elem.scrollLeft=coverRange(makeRange(target.x-origin.x,extent.x),makeRange(elem.scrollLeft,elem.clientWidth));elem.scrollTop=coverRange(makeRange(target.y-origin.y,extent.y),makeRange(elem.scrollTop,elem.clientHeight));target=target.translate(-elem.scrollLeft,-elem.scrollTop);elem=elem.parentNode}}}dom.scrollIntoViewIfNeeded()},setFirstNode:function(setting,parentNode){var children=data.nodeChildren(setting,parentNode);if(children.length>0){children[0].isFirstNode=true}},setLastNode:function(setting,parentNode){var children=data.nodeChildren(setting,parentNode);if(children.length>0){children[children.length-1].isLastNode=true}},removeNode:function(setting,node){var root=data.getRoot(setting),parentNode=node.parentTId?node.getParentNode():root;node.isFirstNode=false;node.isLastNode=false;node.getPreNode=function(){return null};node.getNextNode=function(){return null};if(!data.getNodeCache(setting,node.tId)){return}$$(node,setting).remove();data.removeNodeCache(setting,node);data.removeSelectedNode(setting,node);var children=data.nodeChildren(setting,parentNode);for(var i=0,l=children.length;i<l;i++){if(children[i].tId==node.tId){children.splice(i,1);break}}view.setFirstNode(setting,parentNode);view.setLastNode(setting,parentNode);var tmp_ulObj,tmp_switchObj,tmp_icoObj,childLength=children.length;if(!setting.data.keep.parent&&childLength==0){data.nodeIsParent(setting,parentNode,false);parentNode.open=false;delete parentNode[setting.data.key.children];tmp_ulObj=$$(parentNode,consts.id.UL,setting);tmp_switchObj=$$(parentNode,consts.id.SWITCH,setting);tmp_icoObj=$$(parentNode,consts.id.ICON,setting);view.replaceSwitchClass(parentNode,tmp_switchObj,consts.folder.DOCU);view.replaceIcoClass(parentNode,tmp_icoObj,consts.folder.DOCU);tmp_ulObj.css("display","none")}else if(setting.view.showLine&&childLength>0){var newLast=children[childLength-1];tmp_ulObj=$$(newLast,consts.id.UL,setting);tmp_switchObj=$$(newLast,consts.id.SWITCH,setting);tmp_icoObj=$$(newLast,consts.id.ICON,setting);if(parentNode==root){if(children.length==1){view.replaceSwitchClass(newLast,tmp_switchObj,consts.line.ROOT)}else{var tmp_first_switchObj=$$(children[0],consts.id.SWITCH,setting);view.replaceSwitchClass(children[0],tmp_first_switchObj,consts.line.ROOTS);view.replaceSwitchClass(newLast,tmp_switchObj,consts.line.BOTTOM)}}else{view.replaceSwitchClass(newLast,tmp_switchObj,consts.line.BOTTOM)}tmp_ulObj.removeClass(consts.line.LINE)}},replaceIcoClass:function(node,obj,newName){if(!obj||node.isAjaxing)return;var tmpName=obj.attr("class");if(tmpName==undefined)return;var tmpList=tmpName.split("_");switch(newName){case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:tmpList[tmpList.length-1]=newName;break}obj.attr("class",tmpList.join("_"))},replaceSwitchClass:function(node,obj,newName){if(!obj)return;var tmpName=obj.attr("class");if(tmpName==undefined)return;var tmpList=tmpName.split("_");switch(newName){case consts.line.ROOT:case consts.line.ROOTS:case consts.line.CENTER:case consts.line.BOTTOM:case consts.line.NOLINE:tmpList[0]=view.makeNodeLineClassEx(node)+newName;break;case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:tmpList[1]=newName;break}obj.attr("class",tmpList.join("_"));if(newName!==consts.folder.DOCU){obj.removeAttr("disabled")}else{obj.attr("disabled","disabled")}},selectNode:function(setting,node,addFlag){if(!addFlag){view.cancelPreSelectedNode(setting,null,node)}$$(node,consts.id.A,setting).addClass(consts.node.CURSELECTED);data.addSelectedNode(setting,node);setting.treeObj.trigger(consts.event.SELECTED,[setting.treeId,node])},setNodeFontCss:function(setting,treeNode){var aObj=$$(treeNode,consts.id.A,setting),fontCss=view.makeNodeFontCss(setting,treeNode);if(fontCss){aObj.css(fontCss)}},setNodeClasses:function(setting,treeNode){var aObj=$$(treeNode,consts.id.A,setting),classes=view.makeNodeClasses(setting,treeNode);if("add"in classes&&classes.add.length){aObj.addClass(classes.add.join(" "))}if("remove"in classes&&classes.remove.length){aObj.removeClass(classes.remove.join(" "))}},setNodeLineIcos:function(setting,node){if(!node)return;var switchObj=$$(node,consts.id.SWITCH,setting),ulObj=$$(node,consts.id.UL,setting),icoObj=$$(node,consts.id.ICON,setting),ulLine=view.makeUlLineClass(setting,node);if(ulLine.length==0){ulObj.removeClass(consts.line.LINE)}else{ulObj.addClass(ulLine)}switchObj.attr("class",view.makeNodeLineClass(setting,node));if(data.nodeIsParent(setting,node)){switchObj.removeAttr("disabled")}else{switchObj.attr("disabled","disabled")}icoObj.removeAttr("style");icoObj.attr("style",view.makeNodeIcoStyle(setting,node));icoObj.attr("class",view.makeNodeIcoClass(setting,node))},setNodeName:function(setting,node){var title=data.nodeTitle(setting,node),nObj=$$(node,consts.id.SPAN,setting);nObj.empty();if(setting.view.nameIsHTML){nObj.html(data.nodeName(setting,node))}else{nObj.text(data.nodeName(setting,node))}if(tools.apply(setting.view.showTitle,[setting.treeId,node],setting.view.showTitle)){var aObj=$$(node,consts.id.A,setting);aObj.attr("title",!title?"":title)}},setNodeTarget:function(setting,node){var aObj=$$(node,consts.id.A,setting);aObj.attr("target",view.makeNodeTarget(node))},setNodeUrl:function(setting,node){var aObj=$$(node,consts.id.A,setting),url=view.makeNodeUrl(setting,node);if(url==null||url.length==0){aObj.removeAttr("href")}else{aObj.attr("href",url)}},switchNode:function(setting,node){if(node.open||!tools.canAsync(setting,node)){view.expandCollapseNode(setting,node,!node.open)}else if(setting.async.enable){if(!view.asyncNode(setting,node)){view.expandCollapseNode(setting,node,!node.open);return}}else if(node){view.expandCollapseNode(setting,node,!node.open)}}};$.fn.zTree={consts:_consts,_z:{tools:tools,view:view,event:event,data:data},getZTreeObj:function(treeId){var o=data.getZTreeTools(treeId);return o?o:null},destroy:function(treeId){if(!!treeId&&treeId.length>0){view.destroy(data.getSetting(treeId))}else{for(var s in settings){view.destroy(settings[s])}}},init:function(obj,zSetting,zNodes){var setting=tools.clone(_setting);$.extend(true,setting,zSetting);setting.treeId=obj.attr("id");setting.treeObj=obj;setting.treeObj.empty();settings[setting.treeId]=setting;if(typeof document.body.style.maxHeight==="undefined"){setting.view.expandSpeed=""}data.initRoot(setting);var root=data.getRoot(setting);zNodes=zNodes?tools.clone(tools.isArray(zNodes)?zNodes:[zNodes]):[];if(setting.data.simpleData.enable){data.nodeChildren(setting,root,data.transformTozTreeFormat(setting,zNodes))}else{data.nodeChildren(setting,root,zNodes)}data.initCache(setting);event.unbindTree(setting);event.bindTree(setting);event.unbindEvent(setting);event.bindEvent(setting);var zTreeTools={setting:setting,addNodes:function(parentNode,index,newNodes,isSilent){if(!parentNode)parentNode=null;var isParent=data.nodeIsParent(setting,parentNode);if(parentNode&&!isParent&&setting.data.keep.leaf)return null;var i=parseInt(index,10);if(isNaN(i)){isSilent=!!newNodes;newNodes=index;index=-1}else{index=i}if(!newNodes)return null;var xNewNodes=tools.clone(tools.isArray(newNodes)?newNodes:[newNodes]);function addCallback(){view.addNodes(setting,parentNode,index,xNewNodes,isSilent==true)}if(tools.canAsync(setting,parentNode)){view.asyncNode(setting,parentNode,isSilent,addCallback)}else{addCallback()}return xNewNodes},cancelSelectedNode:function(node){view.cancelPreSelectedNode(setting,node)},destroy:function(){view.destroy(setting)},expandAll:function(expandFlag){expandFlag=!!expandFlag;view.expandCollapseSonNode(setting,null,expandFlag,true);return expandFlag},expandNode:function(node,expandFlag,sonSign,focus,callbackFlag){if(!node||!data.nodeIsParent(setting,node))return null;if(expandFlag!==true&&expandFlag!==false){expandFlag=!node.open}callbackFlag=!!callbackFlag;if(callbackFlag&&expandFlag&&tools.apply(setting.callback.beforeExpand,[setting.treeId,node],true)==false){return null}else if(callbackFlag&&!expandFlag&&tools.apply(setting.callback.beforeCollapse,[setting.treeId,node],true)==false){return null}if(expandFlag&&node.parentTId){view.expandCollapseParentNode(setting,node.getParentNode(),expandFlag,false)}if(expandFlag===node.open&&!sonSign){return null}data.getRoot(setting).expandTriggerFlag=callbackFlag;if(!tools.canAsync(setting,node)&&sonSign){view.expandCollapseSonNode(setting,node,expandFlag,true,showNodeFocus)}else{node.open=!expandFlag;view.switchNode(this.setting,node);showNodeFocus()}return expandFlag;function showNodeFocus(){var a=$$(node,consts.id.A,setting).get(0);if(a&&focus!==false){view.scrollIntoView(setting,a)}}},getNodes:function(){return data.getNodes(setting)},getNodeByParam:function(key,value,parentNode){if(!key)return null;return data.getNodeByParam(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),key,value)},getNodeByTId:function(tId){return data.getNodeCache(setting,tId)},getNodesByParam:function(key,value,parentNode){if(!key)return null;return data.getNodesByParam(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),key,value)},getNodesByParamFuzzy:function(key,value,parentNode){if(!key)return null;return data.getNodesByParamFuzzy(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),key,value)},getNodesByFilter:function(filter,isSingle,parentNode,invokeParam){isSingle=!!isSingle;if(!filter||typeof filter!="function")return isSingle?null:[];return data.getNodesByFilter(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),filter,isSingle,invokeParam)},getNodeIndex:function(node){if(!node)return null;var parentNode=node.parentTId?node.getParentNode():data.getRoot(setting);var children=data.nodeChildren(setting,parentNode);for(var i=0,l=children.length;i<l;i++){if(children[i]==node)return i}return-1},getSelectedNodes:function(){var r=[],list=data.getRoot(setting).curSelectedList;for(var i=0,l=list.length;i<l;i++){r.push(list[i])}return r},isSelectedNode:function(node){return data.isSelectedNode(setting,node)},reAsyncChildNodesPromise:function(parentNode,reloadType,isSilent){var promise=new Promise((function(resolve,reject){try{zTreeTools.reAsyncChildNodes(parentNode,reloadType,isSilent,(function(){resolve(parentNode)}))}catch(e){reject(e)}}));return promise},reAsyncChildNodes:function(parentNode,reloadType,isSilent,callback){if(!this.setting.async.enable)return;var isRoot=!parentNode;if(isRoot){parentNode=data.getRoot(setting)}if(reloadType=="refresh"){var children=data.nodeChildren(setting,parentNode);for(var i=0,l=children?children.length:0;i<l;i++){data.removeNodeCache(setting,children[i])}data.removeSelectedNode(setting);data.nodeChildren(setting,parentNode,[]);if(isRoot){this.setting.treeObj.empty()}else{var ulObj=$$(parentNode,consts.id.UL,setting);ulObj.empty()}}view.asyncNode(this.setting,isRoot?null:parentNode,!!isSilent,callback)},refresh:function(){this.setting.treeObj.empty();var root=data.getRoot(setting),nodes=data.nodeChildren(setting,root);data.initRoot(setting);data.nodeChildren(setting,root,nodes);data.initCache(setting);view.createNodes(setting,0,data.nodeChildren(setting,root),null,-1)},removeChildNodes:function(node){if(!node)return null;var nodes=data.nodeChildren(setting,node);view.removeChildNodes(setting,node);return nodes?nodes:null},removeNode:function(node,callbackFlag){if(!node)return;callbackFlag=!!callbackFlag;if(callbackFlag&&tools.apply(setting.callback.beforeRemove,[setting.treeId,node],true)==false)return;view.removeNode(setting,node);if(callbackFlag){this.setting.treeObj.trigger(consts.event.REMOVE,[setting.treeId,node])}},selectNode:function(node,addFlag,isSilent){if(!node)return;if(tools.uCanDo(setting)){addFlag=setting.view.selectedMulti&&addFlag;if(node.parentTId){view.expandCollapseParentNode(setting,node.getParentNode(),true,false,showNodeFocus)}else if(!isSilent){try{$$(node,setting).focus().blur()}catch(e){}}view.selectNode(setting,node,addFlag)}function showNodeFocus(){if(isSilent){return}var a=$$(node,setting).get(0);view.scrollIntoView(setting,a)}},transformTozTreeNodes:function(simpleNodes){return data.transformTozTreeFormat(setting,simpleNodes)},transformToArray:function(nodes){return data.transformToArrayFormat(setting,nodes)},updateNode:function(node,checkTypeFlag){if(!node)return;var nObj=$$(node,setting);if(nObj.get(0)&&tools.uCanDo(setting)){view.setNodeName(setting,node);view.setNodeTarget(setting,node);view.setNodeUrl(setting,node);view.setNodeLineIcos(setting,node);view.setNodeFontCss(setting,node);view.setNodeClasses(setting,node)}}};root.treeTools=zTreeTools;data.setZTreeTools(setting,zTreeTools);var children=data.nodeChildren(setting,root);if(children&&children.length>0){view.createNodes(setting,0,children,null,-1)}else if(setting.async.enable&&setting.async.url&&setting.async.url!==""){view.asyncNode(setting)}return zTreeTools}};var zt=$.fn.zTree,$$=tools.$,consts=zt.consts})(jQuery);(function($){var _consts={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},_setting={check:{enable:false,autoCheckTrigger:false,chkStyle:_consts.checkbox.STYLE,nocheckInherit:false,chkDisabledInherit:false,radioType:_consts.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}},_initRoot=function(setting){var r=data.getRoot(setting);r.radioCheckedList=[]},_initCache=function(treeId){},_bindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.bind(c.CHECK,(function(event,srcEvent,treeId,node){event.srcEvent=srcEvent;tools.apply(setting.callback.onCheck,[event,treeId,node])}))},_unbindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.unbind(c.CHECK)},_eventProxy=function(e){var target=e.target,setting=data.getSetting(e.data.treeId),tId="",node=null,nodeEventType="",treeEventType="",nodeEventCallback=null,treeEventCallback=null;if(tools.eqs(e.type,"mouseover")){if(setting.check.enable&&tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.CHECK)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="mouseoverCheck"}}else if(tools.eqs(e.type,"mouseout")){if(setting.check.enable&&tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.CHECK)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="mouseoutCheck"}}else if(tools.eqs(e.type,"click")){if(setting.check.enable&&tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.CHECK)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="checkNode"}}if(tId.length>0){node=data.getNodeCache(setting,tId);switch(nodeEventType){case"checkNode":nodeEventCallback=_handler.onCheckNode;break;case"mouseoverCheck":nodeEventCallback=_handler.onMouseoverCheck;break;case"mouseoutCheck":nodeEventCallback=_handler.onMouseoutCheck;break}}var proxyResult={stop:nodeEventType==="checkNode",node:node,nodeEventType:nodeEventType,nodeEventCallback:nodeEventCallback,treeEventType:treeEventType,treeEventCallback:treeEventCallback};return proxyResult},_initNode=function(setting,level,n,parentNode,isFirstNode,isLastNode,openFlag){if(!n)return;var checked=data.nodeChecked(setting,n);n.checkedOld=checked;if(typeof n.nocheck=="string")n.nocheck=tools.eqs(n.nocheck,"true");n.nocheck=!!n.nocheck||setting.check.nocheckInherit&&parentNode&&!!parentNode.nocheck;if(typeof n.chkDisabled=="string")n.chkDisabled=tools.eqs(n.chkDisabled,"true");n.chkDisabled=!!n.chkDisabled||setting.check.chkDisabledInherit&&parentNode&&!!parentNode.chkDisabled;if(typeof n.halfCheck=="string")n.halfCheck=tools.eqs(n.halfCheck,"true");n.halfCheck=!!n.halfCheck;n.check_Child_State=-1;n.check_Focus=false;n.getCheckStatus=function(){return data.getCheckStatus(setting,n)};if(setting.check.chkStyle==consts.radio.STYLE&&setting.check.radioType==consts.radio.TYPE_ALL&&checked){var r=data.getRoot(setting);r.radioCheckedList.push(n)}},_beforeA=function(setting,node,html){if(setting.check.enable){data.makeChkFlag(setting,node);html.push("<span ID='",node.tId,consts.id.CHECK,"' class='",view.makeChkClass(setting,node),"' treeNode",consts.id.CHECK,node.nocheck===true?" style='display:none;'":"","></span>")}},_zTreeTools=function(setting,zTreeTools){zTreeTools.checkNode=function(node,checked,checkTypeFlag,callbackFlag){var nodeChecked=data.nodeChecked(setting,node);if(node.chkDisabled===true)return;if(checked!==true&&checked!==false){checked=!nodeChecked}callbackFlag=!!callbackFlag;if(nodeChecked===checked&&!checkTypeFlag){return}else if(callbackFlag&&tools.apply(this.setting.callback.beforeCheck,[this.setting.treeId,node],true)==false){return}if(tools.uCanDo(this.setting)&&this.setting.check.enable&&node.nocheck!==true){data.nodeChecked(setting,node,checked);var checkObj=$$(node,consts.id.CHECK,this.setting);if(checkTypeFlag||this.setting.check.chkStyle===consts.radio.STYLE)view.checkNodeRelation(this.setting,node);view.setChkClass(this.setting,checkObj,node);view.repairParentChkClassWithSelf(this.setting,node);if(callbackFlag){this.setting.treeObj.trigger(consts.event.CHECK,[null,this.setting.treeId,node])}}};zTreeTools.checkAllNodes=function(checked){view.repairAllChk(this.setting,!!checked)};zTreeTools.getCheckedNodes=function(checked){checked=checked!==false;var children=data.nodeChildren(setting,data.getRoot(this.setting));return data.getTreeCheckedNodes(this.setting,children,checked)};zTreeTools.getChangeCheckedNodes=function(){var children=data.nodeChildren(setting,data.getRoot(this.setting));return data.getTreeChangeCheckedNodes(this.setting,children)};zTreeTools.setChkDisabled=function(node,disabled,inheritParent,inheritChildren){disabled=!!disabled;inheritParent=!!inheritParent;inheritChildren=!!inheritChildren;view.repairSonChkDisabled(this.setting,node,disabled,inheritChildren);view.repairParentChkDisabled(this.setting,node.getParentNode(),disabled,inheritParent)};var _updateNode=zTreeTools.updateNode;zTreeTools.updateNode=function(node,checkTypeFlag){if(_updateNode)_updateNode.apply(zTreeTools,arguments);if(!node||!this.setting.check.enable)return;var nObj=$$(node,this.setting);if(nObj.get(0)&&tools.uCanDo(this.setting)){var checkObj=$$(node,consts.id.CHECK,this.setting);if(checkTypeFlag==true||this.setting.check.chkStyle===consts.radio.STYLE)view.checkNodeRelation(this.setting,node);view.setChkClass(this.setting,checkObj,node);view.repairParentChkClassWithSelf(this.setting,node)}}},_data={getRadioCheckedList:function(setting){var checkedList=data.getRoot(setting).radioCheckedList;for(var i=0,j=checkedList.length;i<j;i++){if(!data.getNodeCache(setting,checkedList[i].tId)){checkedList.splice(i,1);i--;j--}}return checkedList},getCheckStatus:function(setting,node){if(!setting.check.enable||node.nocheck||node.chkDisabled)return null;var checked=data.nodeChecked(setting,node),r={checked:checked,half:node.halfCheck?node.halfCheck:setting.check.chkStyle==consts.radio.STYLE?node.check_Child_State===2:checked?node.check_Child_State>-1&&node.check_Child_State<2:node.check_Child_State>0};return r},getTreeCheckedNodes:function(setting,nodes,checked,results){if(!nodes)return[];var onlyOne=checked&&setting.check.chkStyle==consts.radio.STYLE&&setting.check.radioType==consts.radio.TYPE_ALL;results=!results?[]:results;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];var children=data.nodeChildren(setting,node);var nodeChecked=data.nodeChecked(setting,node);if(node.nocheck!==true&&node.chkDisabled!==true&&nodeChecked==checked){results.push(node);if(onlyOne){break}}data.getTreeCheckedNodes(setting,children,checked,results);if(onlyOne&&results.length>0){break}}return results},getTreeChangeCheckedNodes:function(setting,nodes,results){if(!nodes)return[];results=!results?[]:results;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];var children=data.nodeChildren(setting,node);var nodeChecked=data.nodeChecked(setting,node);if(node.nocheck!==true&&node.chkDisabled!==true&&nodeChecked!=node.checkedOld){results.push(node)}data.getTreeChangeCheckedNodes(setting,children,results)}return results},makeChkFlag:function(setting,node){if(!node)return;var chkFlag=-1;var children=data.nodeChildren(setting,node);if(children){for(var i=0,l=children.length;i<l;i++){var cNode=children[i];var nodeChecked=data.nodeChecked(setting,cNode);var tmp=-1;if(setting.check.chkStyle==consts.radio.STYLE){if(cNode.nocheck===true||cNode.chkDisabled===true){tmp=cNode.check_Child_State}else if(cNode.halfCheck===true){tmp=2}else if(nodeChecked){tmp=2}else{tmp=cNode.check_Child_State>0?2:0}if(tmp==2){chkFlag=2;break}else if(tmp==0){chkFlag=0}}else if(setting.check.chkStyle==consts.checkbox.STYLE){if(cNode.nocheck===true||cNode.chkDisabled===true){tmp=cNode.check_Child_State}else if(cNode.halfCheck===true){tmp=1}else if(nodeChecked){tmp=cNode.check_Child_State===-1||cNode.check_Child_State===2?2:1}else{tmp=cNode.check_Child_State>0?1:0}if(tmp===1){chkFlag=1;break}else if(tmp===2&&chkFlag>-1&&i>0&&tmp!==chkFlag){chkFlag=1;break}else if(chkFlag===2&&tmp>-1&&tmp<2){chkFlag=1;break}else if(tmp>-1){chkFlag=tmp}}}}node.check_Child_State=chkFlag}},_event={},_handler={onCheckNode:function(event,node){if(node.chkDisabled===true)return false;var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeCheck,[setting.treeId,node],true)==false)return true;var nodeChecked=data.nodeChecked(setting,node);data.nodeChecked(setting,node,!nodeChecked);view.checkNodeRelation(setting,node);var checkObj=$$(node,consts.id.CHECK,setting);view.setChkClass(setting,checkObj,node);view.repairParentChkClassWithSelf(setting,node);setting.treeObj.trigger(consts.event.CHECK,[event,setting.treeId,node]);return true},onMouseoverCheck:function(event,node){if(node.chkDisabled===true)return false;var setting=data.getSetting(event.data.treeId),checkObj=$$(node,consts.id.CHECK,setting);node.check_Focus=true;view.setChkClass(setting,checkObj,node);return true},onMouseoutCheck:function(event,node){if(node.chkDisabled===true)return false;var setting=data.getSetting(event.data.treeId),checkObj=$$(node,consts.id.CHECK,setting);node.check_Focus=false;view.setChkClass(setting,checkObj,node);return true}},_tools={},_view={checkNodeRelation:function(setting,node){var pNode,i,l,r=consts.radio;var nodeChecked=data.nodeChecked(setting,node);if(setting.check.chkStyle==r.STYLE){var checkedList=data.getRadioCheckedList(setting);if(nodeChecked){if(setting.check.radioType==r.TYPE_ALL){for(i=checkedList.length-1;i>=0;i--){pNode=checkedList[i];var pNodeChecked=data.nodeChecked(setting,pNode);if(pNodeChecked&&pNode!=node){data.nodeChecked(setting,pNode,false);checkedList.splice(i,1);view.setChkClass(setting,$$(pNode,consts.id.CHECK,setting),pNode);if(pNode.parentTId!=node.parentTId){view.repairParentChkClassWithSelf(setting,pNode)}}}checkedList.push(node)}else{var parentNode=node.parentTId?node.getParentNode():data.getRoot(setting);var children=data.nodeChildren(setting,parentNode);for(i=0,l=children.length;i<l;i++){pNode=children[i];var pNodeChecked=data.nodeChecked(setting,pNode);if(pNodeChecked&&pNode!=node){data.nodeChecked(setting,pNode,false);view.setChkClass(setting,$$(pNode,consts.id.CHECK,setting),pNode)}}}}else if(setting.check.radioType==r.TYPE_ALL){for(i=0,l=checkedList.length;i<l;i++){if(node==checkedList[i]){checkedList.splice(i,1);break}}}}else{var children=data.nodeChildren(setting,node);if(nodeChecked&&(!children||children.length==0||setting.check.chkboxType.Y.indexOf("s")>-1)){view.setSonNodeCheckBox(setting,node,true)}if(!nodeChecked&&(!children||children.length==0||setting.check.chkboxType.N.indexOf("s")>-1)){view.setSonNodeCheckBox(setting,node,false)}if(nodeChecked&&setting.check.chkboxType.Y.indexOf("p")>-1){view.setParentNodeCheckBox(setting,node,true)}if(!nodeChecked&&setting.check.chkboxType.N.indexOf("p")>-1){view.setParentNodeCheckBox(setting,node,false)}}},makeChkClass:function(setting,node){var c=consts.checkbox,r=consts.radio,fullStyle="";var nodeChecked=data.nodeChecked(setting,node);if(node.chkDisabled===true){fullStyle=c.DISABLED}else if(node.halfCheck){fullStyle=c.PART}else if(setting.check.chkStyle==r.STYLE){fullStyle=node.check_Child_State<1?c.FULL:c.PART}else{fullStyle=nodeChecked?node.check_Child_State===2||node.check_Child_State===-1?c.FULL:c.PART:node.check_Child_State<1?c.FULL:c.PART}var chkName=setting.check.chkStyle+"_"+(nodeChecked?c.TRUE:c.FALSE)+"_"+fullStyle;chkName=node.check_Focus&&node.chkDisabled!==true?chkName+"_"+c.FOCUS:chkName;return consts.className.BUTTON+" "+c.DEFAULT+" "+chkName},repairAllChk:function(setting,checked){if(setting.check.enable&&setting.check.chkStyle===consts.checkbox.STYLE){var root=data.getRoot(setting);var children=data.nodeChildren(setting,root);for(var i=0,l=children.length;i<l;i++){var node=children[i];if(node.nocheck!==true&&node.chkDisabled!==true){data.nodeChecked(setting,node,checked)}view.setSonNodeCheckBox(setting,node,checked)}}},repairChkClass:function(setting,node){if(!node)return;data.makeChkFlag(setting,node);if(node.nocheck!==true){var checkObj=$$(node,consts.id.CHECK,setting);view.setChkClass(setting,checkObj,node)}},repairParentChkClass:function(setting,node){if(!node||!node.parentTId)return;var pNode=node.getParentNode();view.repairChkClass(setting,pNode);view.repairParentChkClass(setting,pNode)},repairParentChkClassWithSelf:function(setting,node){if(!node)return;var children=data.nodeChildren(setting,node);if(children&&children.length>0){view.repairParentChkClass(setting,children[0])}else{view.repairParentChkClass(setting,node)}},repairSonChkDisabled:function(setting,node,chkDisabled,inherit){if(!node)return;if(node.chkDisabled!=chkDisabled){node.chkDisabled=chkDisabled}view.repairChkClass(setting,node);var children=data.nodeChildren(setting,node);if(children&&inherit){for(var i=0,l=children.length;i<l;i++){var sNode=children[i];view.repairSonChkDisabled(setting,sNode,chkDisabled,inherit)}}},repairParentChkDisabled:function(setting,node,chkDisabled,inherit){if(!node)return;if(node.chkDisabled!=chkDisabled&&inherit){node.chkDisabled=chkDisabled}view.repairChkClass(setting,node);view.repairParentChkDisabled(setting,node.getParentNode(),chkDisabled,inherit)},setChkClass:function(setting,obj,node){if(!obj)return;if(node.nocheck===true){obj.hide()}else{obj.show()}obj.attr("class",view.makeChkClass(setting,node))},setParentNodeCheckBox:function(setting,node,value,srcNode){var checkObj=$$(node,consts.id.CHECK,setting);if(!srcNode)srcNode=node;data.makeChkFlag(setting,node);if(node.nocheck!==true&&node.chkDisabled!==true){data.nodeChecked(setting,node,value);view.setChkClass(setting,checkObj,node);if(setting.check.autoCheckTrigger&&node!=srcNode){setting.treeObj.trigger(consts.event.CHECK,[null,setting.treeId,node])}}if(node.parentTId){var pSign=true;if(!value){var pNodes=data.nodeChildren(setting,node.getParentNode());for(var i=0,l=pNodes.length;i<l;i++){var pNode=pNodes[i];var nodeChecked=data.nodeChecked(setting,pNode);if(pNode.nocheck!==true&&pNode.chkDisabled!==true&&nodeChecked||(pNode.nocheck===true||pNode.chkDisabled===true)&&pNode.check_Child_State>0){pSign=false;break}}}if(pSign){view.setParentNodeCheckBox(setting,node.getParentNode(),value,srcNode)}}},setSonNodeCheckBox:function(setting,node,value,srcNode){if(!node)return;var checkObj=$$(node,consts.id.CHECK,setting);if(!srcNode)srcNode=node;var hasDisable=false;var children=data.nodeChildren(setting,node);if(children){for(var i=0,l=children.length;i<l;i++){var sNode=children[i];view.setSonNodeCheckBox(setting,sNode,value,srcNode);if(sNode.chkDisabled===true)hasDisable=true}}if(node!=data.getRoot(setting)&&node.chkDisabled!==true){if(hasDisable&&node.nocheck!==true){data.makeChkFlag(setting,node)}if(node.nocheck!==true&&node.chkDisabled!==true){data.nodeChecked(setting,node,value);if(!hasDisable)node.check_Child_State=children&&children.length>0?value?2:0:-1}else{node.check_Child_State=-1}view.setChkClass(setting,checkObj,node);if(setting.check.autoCheckTrigger&&node!=srcNode&&node.nocheck!==true&&node.chkDisabled!==true){setting.treeObj.trigger(consts.event.CHECK,[null,setting.treeId,node])}}}},_z={tools:_tools,view:_view,event:_event,data:_data};$.extend(true,$.fn.zTree.consts,_consts);$.extend(true,$.fn.zTree._z,_z);var zt=$.fn.zTree,tools=zt._z.tools,consts=zt.consts,view=zt._z.view,data=zt._z.data,event=zt._z.event,$$=tools.$;data.nodeChecked=function(setting,node,newChecked){if(!node){return false}var key=setting.data.key.checked;if(typeof newChecked!=="undefined"){if(typeof newChecked==="string"){newChecked=tools.eqs(newChecked,"true")}newChecked=!!newChecked;node[key]=newChecked}else if(typeof node[key]=="string"){node[key]=tools.eqs(node[key],"true")}else{node[key]=!!node[key]}return node[key]};data.exSetting(_setting);data.addInitBind(_bindEvent);data.addInitUnBind(_unbindEvent);data.addInitCache(_initCache);data.addInitNode(_initNode);data.addInitProxy(_eventProxy,true);data.addInitRoot(_initRoot);data.addBeforeA(_beforeA);data.addZTreeTools(_zTreeTools);var _createNodes=view.createNodes;view.createNodes=function(setting,level,nodes,parentNode,index){if(_createNodes)_createNodes.apply(view,arguments);if(!nodes)return;view.repairParentChkClassWithSelf(setting,parentNode)};var _removeNode=view.removeNode;view.removeNode=function(setting,node){var parentNode=node.getParentNode();if(_removeNode)_removeNode.apply(view,arguments);if(!node||!parentNode)return;view.repairChkClass(setting,parentNode);view.repairParentChkClass(setting,parentNode)};var _appendNodes=view.appendNodes;view.appendNodes=function(setting,level,nodes,parentNode,index,initFlag,openFlag){var html="";if(_appendNodes){html=_appendNodes.apply(view,arguments)}if(parentNode){data.makeChkFlag(setting,parentNode)}return html}})(jQuery);(function($){var _consts={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},_setting={edit:{enable:false,editNameSelectAll:false,showRemoveBtn:true,showRenameBtn:true,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:false,isCopy:true,isMove:true,prev:true,next:true,inner:true,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}},_initRoot=function(setting){var r=data.getRoot(setting),rs=data.getRoots();r.curEditNode=null;r.curEditInput=null;r.curHoverNode=null;r.dragFlag=0;r.dragNodeShowBefore=[];r.dragMaskList=new Array;rs.showHoverDom=true},_initCache=function(treeId){},_bindEvent=function(setting){var o=setting.treeObj;var c=consts.event;o.bind(c.RENAME,(function(event,treeId,treeNode,isCancel){tools.apply(setting.callback.onRename,[event,treeId,treeNode,isCancel])}));o.bind(c.DRAG,(function(event,srcEvent,treeId,treeNodes){tools.apply(setting.callback.onDrag,[srcEvent,treeId,treeNodes])}));o.bind(c.DRAGMOVE,(function(event,srcEvent,treeId,treeNodes){tools.apply(setting.callback.onDragMove,[srcEvent,treeId,treeNodes])}));o.bind(c.DROP,(function(event,srcEvent,treeId,treeNodes,targetNode,moveType,isCopy){tools.apply(setting.callback.onDrop,[srcEvent,treeId,treeNodes,targetNode,moveType,isCopy])}))},_unbindEvent=function(setting){var o=setting.treeObj;var c=consts.event;o.unbind(c.RENAME);o.unbind(c.DRAG);o.unbind(c.DRAGMOVE);o.unbind(c.DROP)},_eventProxy=function(e){var target=e.target,setting=data.getSetting(e.data.treeId),relatedTarget=e.relatedTarget,tId="",node=null,nodeEventType="",treeEventType="",nodeEventCallback=null,treeEventCallback=null,tmp=null;if(tools.eqs(e.type,"mouseover")){tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="hoverOverNode"}}else if(tools.eqs(e.type,"mouseout")){tmp=tools.getMDom(setting,relatedTarget,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(!tmp){tId="remove";nodeEventType="hoverOutNode"}}else if(tools.eqs(e.type,"mousedown")){tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="mousedownNode"}}if(tId.length>0){node=data.getNodeCache(setting,tId);switch(nodeEventType){case"mousedownNode":nodeEventCallback=_handler.onMousedownNode;break;case"hoverOverNode":nodeEventCallback=_handler.onHoverOverNode;break;case"hoverOutNode":nodeEventCallback=_handler.onHoverOutNode;break}}var proxyResult={stop:false,node:node,nodeEventType:nodeEventType,nodeEventCallback:nodeEventCallback,treeEventType:treeEventType,treeEventCallback:treeEventCallback};return proxyResult},_initNode=function(setting,level,n,parentNode,isFirstNode,isLastNode,openFlag){if(!n)return;n.isHover=false;n.editNameFlag=false},_zTreeTools=function(setting,zTreeTools){zTreeTools.cancelEditName=function(newName){var root=data.getRoot(this.setting);if(!root.curEditNode)return;view.cancelCurEditNode(this.setting,newName?newName:null,true)};zTreeTools.copyNode=function(targetNode,node,moveType,isSilent){if(!node)return null;var isParent=data.nodeIsParent(setting,targetNode);if(targetNode&&!isParent&&this.setting.data.keep.leaf&&moveType===consts.move.TYPE_INNER)return null;var _this=this,newNode=tools.clone(node);if(!targetNode){targetNode=null;moveType=consts.move.TYPE_INNER}if(moveType==consts.move.TYPE_INNER){function copyCallback(){view.addNodes(_this.setting,targetNode,-1,[newNode],isSilent)}if(tools.canAsync(this.setting,targetNode)){view.asyncNode(this.setting,targetNode,isSilent,copyCallback)}else{copyCallback()}}else{view.addNodes(this.setting,targetNode.parentNode,-1,[newNode],isSilent);view.moveNode(this.setting,targetNode,newNode,moveType,false,isSilent)}return newNode};zTreeTools.editName=function(node){if(!node||!node.tId||node!==data.getNodeCache(this.setting,node.tId))return;if(node.parentTId)view.expandCollapseParentNode(this.setting,node.getParentNode(),true);view.editNode(this.setting,node)};zTreeTools.moveNode=function(targetNode,node,moveType,isSilent){if(!node)return node;var isParent=data.nodeIsParent(setting,targetNode);if(targetNode&&!isParent&&this.setting.data.keep.leaf&&moveType===consts.move.TYPE_INNER){return null}else if(targetNode&&(node.parentTId==targetNode.tId&&moveType==consts.move.TYPE_INNER||$$(node,this.setting).find("#"+targetNode.tId).length>0)){return null}else if(!targetNode){targetNode=null}var _this=this;function moveCallback(){view.moveNode(_this.setting,targetNode,node,moveType,false,isSilent)}if(tools.canAsync(this.setting,targetNode)&&moveType===consts.move.TYPE_INNER){view.asyncNode(this.setting,targetNode,isSilent,moveCallback)}else{moveCallback()}return node};zTreeTools.setEditable=function(editable){this.setting.edit.enable=editable;return this.refresh()}},_data={setSonNodeLevel:function(setting,parentNode,node){if(!node)return;var children=data.nodeChildren(setting,node);var oldLevel=node.level;node.level=parentNode?parentNode.level+1:0;view.repairNodeLevelClass(setting,node,oldLevel);if(!children)return;for(var i=0,l=children.length;i<l;i++){if(children[i])data.setSonNodeLevel(setting,node,children[i])}}},_event={},_handler={onHoverOverNode:function(event,node){var setting=data.getSetting(event.data.treeId),root=data.getRoot(setting);if(root.curHoverNode!=node){_handler.onHoverOutNode(event)}root.curHoverNode=node;view.addHoverDom(setting,node)},onHoverOutNode:function(event,node){var setting=data.getSetting(event.data.treeId),root=data.getRoot(setting);if(root.curHoverNode&&!data.isSelectedNode(setting,root.curHoverNode)){view.removeTreeDom(setting,root.curHoverNode);root.curHoverNode=null}},onMousedownNode:function(eventMouseDown,_node){var i,l,setting=data.getSetting(eventMouseDown.data.treeId),root=data.getRoot(setting),roots=data.getRoots();if(eventMouseDown.button==2||!setting.edit.enable||!setting.edit.drag.isCopy&&!setting.edit.drag.isMove)return true;var target=eventMouseDown.target,_nodes=data.getRoot(setting).curSelectedList,nodes=[];if(!data.isSelectedNode(setting,_node)){nodes=[_node]}else{for(i=0,l=_nodes.length;i<l;i++){if(_nodes[i].editNameFlag&&tools.eqs(target.tagName,"input")&&target.getAttribute("treeNode"+consts.id.INPUT)!==null){return true}nodes.push(_nodes[i]);if(nodes[0].parentTId!==_nodes[i].parentTId){nodes=[_node];break}}}view.editNodeBlur=true;view.cancelCurEditNode(setting);var doc=$(setting.treeObj.get(0).ownerDocument),body=$(setting.treeObj.get(0).ownerDocument.body),curNode,tmpArrow,tmpTarget,isOtherTree=false,targetSetting=setting,sourceSetting=setting,preNode,nextNode,preTmpTargetNodeId=null,preTmpMoveType=null,tmpTargetNodeId=null,moveType=consts.move.TYPE_INNER,mouseDownX=eventMouseDown.clientX,mouseDownY=eventMouseDown.clientY,startTime=(new Date).getTime();if(tools.uCanDo(setting)){doc.bind("mousemove",_docMouseMove)}function _docMouseMove(event){if(root.dragFlag==0&&Math.abs(mouseDownX-event.clientX)<setting.edit.drag.minMoveSize&&Math.abs(mouseDownY-event.clientY)<setting.edit.drag.minMoveSize){return true}var i,l,tmpNode,tmpDom,tmpNodes;body.css("cursor","pointer");if(root.dragFlag==0){if(tools.apply(setting.callback.beforeDrag,[setting.treeId,nodes],true)==false){_docMouseUp(event);return true}for(i=0,l=nodes.length;i<l;i++){if(i==0){root.dragNodeShowBefore=[]}tmpNode=nodes[i];if(data.nodeIsParent(setting,tmpNode)&&tmpNode.open){view.expandCollapseNode(setting,tmpNode,!tmpNode.open);root.dragNodeShowBefore[tmpNode.tId]=true}else{root.dragNodeShowBefore[tmpNode.tId]=false}}root.dragFlag=1;roots.showHoverDom=false;tools.showIfameMask(setting,true);var isOrder=true,lastIndex=-1;if(nodes.length>1){var pNodes=nodes[0].parentTId?data.nodeChildren(setting,nodes[0].getParentNode()):data.getNodes(setting);tmpNodes=[];for(i=0,l=pNodes.length;i<l;i++){if(root.dragNodeShowBefore[pNodes[i].tId]!==undefined){if(isOrder&&lastIndex>-1&&lastIndex+1!==i){isOrder=false}tmpNodes.push(pNodes[i]);lastIndex=i}if(nodes.length===tmpNodes.length){nodes=tmpNodes;break}}}if(isOrder){preNode=nodes[0].getPreNode();nextNode=nodes[nodes.length-1].getNextNode()}curNode=$$("<ul class='zTreeDragUL'></ul>",setting);for(i=0,l=nodes.length;i<l;i++){tmpNode=nodes[i];tmpNode.editNameFlag=false;view.selectNode(setting,tmpNode,i>0);view.removeTreeDom(setting,tmpNode);if(i>setting.edit.drag.maxShowNodeNum-1){continue}tmpDom=$$("<li id='"+tmpNode.tId+"_tmp'></li>",setting);tmpDom.append($$(tmpNode,consts.id.A,setting).clone());tmpDom.css("padding","0");tmpDom.children("#"+tmpNode.tId+consts.id.A).removeClass(consts.node.CURSELECTED);curNode.append(tmpDom);if(i==setting.edit.drag.maxShowNodeNum-1){tmpDom=$$("<li id='"+tmpNode.tId+"_moretmp'><a> ... </a></li>",setting);curNode.append(tmpDom)}}curNode.attr("id",nodes[0].tId+consts.id.UL+"_tmp");curNode.addClass(setting.treeObj.attr("class"));curNode.appendTo(body);tmpArrow=$$("<span class='tmpzTreeMove_arrow'></span>",setting);tmpArrow.attr("id","zTreeMove_arrow_tmp");tmpArrow.appendTo(body);setting.treeObj.trigger(consts.event.DRAG,[event,setting.treeId,nodes])}if(root.dragFlag==1){if(tmpTarget&&tmpArrow.attr("id")==event.target.id&&tmpTargetNodeId&&event.clientX+doc.scrollLeft()+2>$("#"+tmpTargetNodeId+consts.id.A,tmpTarget).offset().left){var xT=$("#"+tmpTargetNodeId+consts.id.A,tmpTarget);event.target=xT.length>0?xT.get(0):event.target}else if(tmpTarget){tmpTarget.removeClass(consts.node.TMPTARGET_TREE);if(tmpTargetNodeId)$("#"+tmpTargetNodeId+consts.id.A,tmpTarget).removeClass(consts.node.TMPTARGET_NODE+"_"+consts.move.TYPE_PREV).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_INNER)}tmpTarget=null;tmpTargetNodeId=null;isOtherTree=false;targetSetting=setting;var settings=data.getSettings();for(var s in settings){if(settings[s].treeId&&settings[s].edit.enable&&settings[s].treeId!=setting.treeId&&(event.target.id==settings[s].treeId||$(event.target).parents("#"+settings[s].treeId).length>0)){isOtherTree=true;targetSetting=settings[s]}}var docScrollTop=doc.scrollTop(),docScrollLeft=doc.scrollLeft(),treeOffset=targetSetting.treeObj.offset(),scrollHeight=targetSetting.treeObj.get(0).scrollHeight,scrollWidth=targetSetting.treeObj.get(0).scrollWidth,dTop=event.clientY+docScrollTop-treeOffset.top,dBottom=targetSetting.treeObj.height()+treeOffset.top-event.clientY-docScrollTop,dLeft=event.clientX+docScrollLeft-treeOffset.left,dRight=targetSetting.treeObj.width()+treeOffset.left-event.clientX-docScrollLeft,isTop=dTop<setting.edit.drag.borderMax&&dTop>setting.edit.drag.borderMin,isBottom=dBottom<setting.edit.drag.borderMax&&dBottom>setting.edit.drag.borderMin,isLeft=dLeft<setting.edit.drag.borderMax&&dLeft>setting.edit.drag.borderMin,isRight=dRight<setting.edit.drag.borderMax&&dRight>setting.edit.drag.borderMin,isTreeInner=dTop>setting.edit.drag.borderMin&&dBottom>setting.edit.drag.borderMin&&dLeft>setting.edit.drag.borderMin&&dRight>setting.edit.drag.borderMin,isTreeTop=isTop&&targetSetting.treeObj.scrollTop()<=0,isTreeBottom=isBottom&&targetSetting.treeObj.scrollTop()+targetSetting.treeObj.height()+10>=scrollHeight,isTreeLeft=isLeft&&targetSetting.treeObj.scrollLeft()<=0,isTreeRight=isRight&&targetSetting.treeObj.scrollLeft()+targetSetting.treeObj.width()+10>=scrollWidth;if(event.target&&tools.isChildOrSelf(event.target,targetSetting.treeId)){var targetObj=event.target;while(targetObj&&targetObj.tagName&&!tools.eqs(targetObj.tagName,"li")&&targetObj.id!=targetSetting.treeId){targetObj=targetObj.parentNode}var canMove=true;for(i=0,l=nodes.length;i<l;i++){tmpNode=nodes[i];if(targetObj.id===tmpNode.tId){canMove=false;break}else if($$(tmpNode,setting).find("#"+targetObj.id).length>0){canMove=false;break}}if(canMove&&event.target&&tools.isChildOrSelf(event.target,targetObj.id+consts.id.A)){tmpTarget=$(targetObj);tmpTargetNodeId=targetObj.id}}tmpNode=nodes[0];if(isTreeInner&&tools.isChildOrSelf(event.target,targetSetting.treeId)){if(!tmpTarget&&(event.target.id==targetSetting.treeId||isTreeTop||isTreeBottom||isTreeLeft||isTreeRight)&&(isOtherTree||!isOtherTree&&tmpNode.parentTId)){tmpTarget=targetSetting.treeObj}if(isTop){targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()-10)}else if(isBottom){targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()+10)}if(isLeft){targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()-10)}else if(isRight){targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+10)}if(tmpTarget&&tmpTarget!=targetSetting.treeObj&&tmpTarget.offset().left<targetSetting.treeObj.offset().left){targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+tmpTarget.offset().left-targetSetting.treeObj.offset().left)}}curNode.css({top:event.clientY+docScrollTop+3+"px",left:event.clientX+docScrollLeft+3+"px"});var dX=0;var dY=0;if(tmpTarget&&tmpTarget.attr("id")!=targetSetting.treeId){var tmpTargetNode=tmpTargetNodeId==null?null:data.getNodeCache(targetSetting,tmpTargetNodeId),isCopy=(event.ctrlKey||event.metaKey)&&setting.edit.drag.isMove&&setting.edit.drag.isCopy||!setting.edit.drag.isMove&&setting.edit.drag.isCopy,isPrev=!!(preNode&&tmpTargetNodeId===preNode.tId),isNext=!!(nextNode&&tmpTargetNodeId===nextNode.tId),isInner=tmpNode.parentTId&&tmpNode.parentTId==tmpTargetNodeId,canPrev=(isCopy||!isNext)&&tools.apply(targetSetting.edit.drag.prev,[targetSetting.treeId,nodes,tmpTargetNode],!!targetSetting.edit.drag.prev),canNext=(isCopy||!isPrev)&&tools.apply(targetSetting.edit.drag.next,[targetSetting.treeId,nodes,tmpTargetNode],!!targetSetting.edit.drag.next),canInner=(isCopy||!isInner)&&!(targetSetting.data.keep.leaf&&!data.nodeIsParent(setting,tmpTargetNode))&&tools.apply(targetSetting.edit.drag.inner,[targetSetting.treeId,nodes,tmpTargetNode],!!targetSetting.edit.drag.inner);function clearMove(){tmpTarget=null;tmpTargetNodeId="";moveType=consts.move.TYPE_INNER;tmpArrow.css({display:"none"});if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}}if(!canPrev&&!canNext&&!canInner){clearMove()}else{var tmpTargetA=$("#"+tmpTargetNodeId+consts.id.A,tmpTarget),tmpNextA=tmpTargetNode.isLastNode?null:$("#"+tmpTargetNode.getNextNode().tId+consts.id.A,tmpTarget.next()),tmpTop=tmpTargetA.offset().top,tmpLeft=tmpTargetA.offset().left,prevPercent=canPrev?canInner?.25:canNext?.5:1:-1,nextPercent=canNext?canInner?.75:canPrev?.5:0:-1,dY_percent=(event.clientY+docScrollTop-tmpTop)/tmpTargetA.height();if((prevPercent==1||dY_percent<=prevPercent&&dY_percent>=-.2)&&canPrev){dX=1-tmpArrow.width();dY=tmpTop-tmpArrow.height()/2;moveType=consts.move.TYPE_PREV}else if((nextPercent==0||dY_percent>=nextPercent&&dY_percent<=1.2)&&canNext){dX=1-tmpArrow.width();dY=tmpNextA==null||data.nodeIsParent(setting,tmpTargetNode)&&tmpTargetNode.open?tmpTop+tmpTargetA.height()-tmpArrow.height()/2:tmpNextA.offset().top-tmpArrow.height()/2;moveType=consts.move.TYPE_NEXT}else if(canInner){dX=5-tmpArrow.width();dY=tmpTop;moveType=consts.move.TYPE_INNER}else{clearMove()}if(tmpTarget){tmpArrow.css({display:"block",top:dY+"px",left:tmpLeft+dX+"px"});tmpTargetA.addClass(consts.node.TMPTARGET_NODE+"_"+moveType);if(preTmpTargetNodeId!=tmpTargetNodeId||preTmpMoveType!=moveType){startTime=(new Date).getTime()}if(tmpTargetNode&&data.nodeIsParent(setting,tmpTargetNode)&&moveType==consts.move.TYPE_INNER){var startTimer=true;if(window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==tmpTargetNode.tId){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}else if(window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===tmpTargetNode.tId){startTimer=false}if(startTimer){window.zTreeMoveTimer=setTimeout((function(){if(moveType!=consts.move.TYPE_INNER)return;if(tmpTargetNode&&data.nodeIsParent(setting,tmpTargetNode)&&!tmpTargetNode.open&&(new Date).getTime()-startTime>targetSetting.edit.drag.autoOpenTime&&tools.apply(targetSetting.callback.beforeDragOpen,[targetSetting.treeId,tmpTargetNode],true)){view.switchNode(targetSetting,tmpTargetNode);if(targetSetting.edit.drag.autoExpandTrigger){targetSetting.treeObj.trigger(consts.event.EXPAND,[targetSetting.treeId,tmpTargetNode])}}}),targetSetting.edit.drag.autoOpenTime+50);window.zTreeMoveTargetNodeTId=tmpTargetNode.tId}}}}}else{moveType=consts.move.TYPE_INNER;if(tmpTarget&&tools.apply(targetSetting.edit.drag.inner,[targetSetting.treeId,nodes,null],!!targetSetting.edit.drag.inner)){tmpTarget.addClass(consts.node.TMPTARGET_TREE)}else{tmpTarget=null}tmpArrow.css({display:"none"});if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}}preTmpTargetNodeId=tmpTargetNodeId;preTmpMoveType=moveType;setting.treeObj.trigger(consts.event.DRAGMOVE,[event,setting.treeId,nodes])}return false}doc.bind("mouseup",_docMouseUp);function _docMouseUp(event){if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}preTmpTargetNodeId=null;preTmpMoveType=null;doc.unbind("mousemove",_docMouseMove);doc.unbind("mouseup",_docMouseUp);doc.unbind("selectstart",_docSelect);body.css("cursor","");if(tmpTarget){tmpTarget.removeClass(consts.node.TMPTARGET_TREE);if(tmpTargetNodeId)$("#"+tmpTargetNodeId+consts.id.A,tmpTarget).removeClass(consts.node.TMPTARGET_NODE+"_"+consts.move.TYPE_PREV).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_INNER)}tools.showIfameMask(setting,false);roots.showHoverDom=true;if(root.dragFlag==0)return;root.dragFlag=0;var i,l,tmpNode;for(i=0,l=nodes.length;i<l;i++){tmpNode=nodes[i];if(data.nodeIsParent(setting,tmpNode)&&root.dragNodeShowBefore[tmpNode.tId]&&!tmpNode.open){view.expandCollapseNode(setting,tmpNode,!tmpNode.open);delete root.dragNodeShowBefore[tmpNode.tId]}}if(curNode)curNode.remove();if(tmpArrow)tmpArrow.remove();var isCopy=(event.ctrlKey||event.metaKey)&&setting.edit.drag.isMove&&setting.edit.drag.isCopy||!setting.edit.drag.isMove&&setting.edit.drag.isCopy;if(!isCopy&&tmpTarget&&tmpTargetNodeId&&nodes[0].parentTId&&tmpTargetNodeId==nodes[0].parentTId&&moveType==consts.move.TYPE_INNER){tmpTarget=null}if(tmpTarget){var dragTargetNode=tmpTargetNodeId==null?null:data.getNodeCache(targetSetting,tmpTargetNodeId);if(tools.apply(setting.callback.beforeDrop,[targetSetting.treeId,nodes,dragTargetNode,moveType,isCopy],true)==false){view.selectNodes(sourceSetting,nodes);return}var newNodes=isCopy?tools.clone(nodes):nodes;function dropCallback(){if(isOtherTree){if(!isCopy){for(var i=0,l=nodes.length;i<l;i++){view.removeNode(setting,nodes[i])}}if(moveType==consts.move.TYPE_INNER){view.addNodes(targetSetting,dragTargetNode,-1,newNodes)}else{view.addNodes(targetSetting,dragTargetNode.getParentNode(),moveType==consts.move.TYPE_PREV?dragTargetNode.getIndex():dragTargetNode.getIndex()+1,newNodes)}}else{if(isCopy&&moveType==consts.move.TYPE_INNER){view.addNodes(targetSetting,dragTargetNode,-1,newNodes)}else if(isCopy){view.addNodes(targetSetting,dragTargetNode.getParentNode(),moveType==consts.move.TYPE_PREV?dragTargetNode.getIndex():dragTargetNode.getIndex()+1,newNodes)}else{if(moveType!=consts.move.TYPE_NEXT){for(i=0,l=newNodes.length;i<l;i++){view.moveNode(targetSetting,dragTargetNode,newNodes[i],moveType,false)}}else{for(i=-1,l=newNodes.length-1;i<l;l--){view.moveNode(targetSetting,dragTargetNode,newNodes[l],moveType,false)}}}}view.selectNodes(targetSetting,newNodes);var a=$$(newNodes[0],setting).get(0);view.scrollIntoView(setting,a);setting.treeObj.trigger(consts.event.DROP,[event,targetSetting.treeId,newNodes,dragTargetNode,moveType,isCopy])}if(moveType==consts.move.TYPE_INNER&&tools.canAsync(targetSetting,dragTargetNode)){view.asyncNode(targetSetting,dragTargetNode,false,dropCallback)}else{dropCallback()}}else{view.selectNodes(sourceSetting,nodes);setting.treeObj.trigger(consts.event.DROP,[event,setting.treeId,nodes,null,null,null])}}doc.bind("selectstart",_docSelect);function _docSelect(){return false}return true}},_tools={getAbs:function(obj){var oRect=obj.getBoundingClientRect(),scrollTop=document.body.scrollTop+document.documentElement.scrollTop,scrollLeft=document.body.scrollLeft+document.documentElement.scrollLeft;return[oRect.left+scrollLeft,oRect.top+scrollTop]},inputFocus:function(inputObj){if(inputObj.get(0)){inputObj.focus();tools.setCursorPosition(inputObj.get(0),inputObj.val().length)}},inputSelect:function(inputObj){if(inputObj.get(0)){inputObj.focus();inputObj.select()}},setCursorPosition:function(obj,pos){if(obj.setSelectionRange){obj.focus();obj.setSelectionRange(pos,pos)}else if(obj.createTextRange){var range=obj.createTextRange();range.collapse(true);range.moveEnd("character",pos);range.moveStart("character",pos);range.select()}},showIfameMask:function(setting,showSign){var root=data.getRoot(setting);while(root.dragMaskList.length>0){root.dragMaskList[0].remove();root.dragMaskList.shift()}if(showSign){var iframeList=$$("iframe",setting);for(var i=0,l=iframeList.length;i<l;i++){var obj=iframeList.get(i),r=tools.getAbs(obj),dragMask=$$("<div id='zTreeMask_"+i+"' class='zTreeMask' style='top:"+r[1]+"px; left:"+r[0]+"px; width:"+obj.offsetWidth+"px; height:"+obj.offsetHeight+"px;'></div>",setting);dragMask.appendTo($$("body",setting));root.dragMaskList.push(dragMask)}}}},_view={addEditBtn:function(setting,node){if(node.editNameFlag||$$(node,consts.id.EDIT,setting).length>0){return}if(!tools.apply(setting.edit.showRenameBtn,[setting.treeId,node],setting.edit.showRenameBtn)){return}var aObj=$$(node,consts.id.A,setting),editStr="<span class='"+consts.className.BUTTON+" edit' id='"+node.tId+consts.id.EDIT+"' title='"+tools.apply(setting.edit.renameTitle,[setting.treeId,node],setting.edit.renameTitle)+"' treeNode"+consts.id.EDIT+" style='display:none;'></span>";aObj.append(editStr);$$(node,consts.id.EDIT,setting).bind("click",(function(){if(!tools.uCanDo(setting)||tools.apply(setting.callback.beforeEditName,[setting.treeId,node],true)==false)return false;view.editNode(setting,node);return false})).show()},addRemoveBtn:function(setting,node){if(node.editNameFlag||$$(node,consts.id.REMOVE,setting).length>0){return}if(!tools.apply(setting.edit.showRemoveBtn,[setting.treeId,node],setting.edit.showRemoveBtn)){return}var aObj=$$(node,consts.id.A,setting),removeStr="<span class='"+consts.className.BUTTON+" remove' id='"+node.tId+consts.id.REMOVE+"' title='"+tools.apply(setting.edit.removeTitle,[setting.treeId,node],setting.edit.removeTitle)+"' treeNode"+consts.id.REMOVE+" style='display:none;'></span>";aObj.append(removeStr);$$(node,consts.id.REMOVE,setting).bind("click",(function(){if(!tools.uCanDo(setting)||tools.apply(setting.callback.beforeRemove,[setting.treeId,node],true)==false)return false;view.removeNode(setting,node);setting.treeObj.trigger(consts.event.REMOVE,[setting.treeId,node]);return false})).bind("mousedown",(function(eventMouseDown){return true})).show()},addHoverDom:function(setting,node){if(data.getRoots().showHoverDom){node.isHover=true;if(setting.edit.enable){view.addEditBtn(setting,node);view.addRemoveBtn(setting,node)}tools.apply(setting.view.addHoverDom,[setting.treeId,node])}},cancelCurEditNode:function(setting,forceName,isCancel){var root=data.getRoot(setting),node=root.curEditNode;if(node){var inputObj=root.curEditInput,newName=forceName?forceName:isCancel?data.nodeName(setting,node):inputObj.val();if(tools.apply(setting.callback.beforeRename,[setting.treeId,node,newName,isCancel],true)===false){return false}data.nodeName(setting,node,newName);var aObj=$$(node,consts.id.A,setting);aObj.removeClass(consts.node.CURSELECTED_EDIT);inputObj.unbind();view.setNodeName(setting,node);node.editNameFlag=false;root.curEditNode=null;root.curEditInput=null;view.selectNode(setting,node,false);setting.treeObj.trigger(consts.event.RENAME,[setting.treeId,node,isCancel])}root.noSelection=true;return true},editNode:function(setting,node){var root=data.getRoot(setting);view.editNodeBlur=false;if(data.isSelectedNode(setting,node)&&root.curEditNode==node&&node.editNameFlag){setTimeout((function(){tools.inputFocus(root.curEditInput)}),0);return}node.editNameFlag=true;view.removeTreeDom(setting,node);view.cancelCurEditNode(setting);view.selectNode(setting,node,false);$$(node,consts.id.SPAN,setting).html("<input type=text class='rename' id='"+node.tId+consts.id.INPUT+"' treeNode"+consts.id.INPUT+" >");var inputObj=$$(node,consts.id.INPUT,setting);inputObj.attr("value",data.nodeName(setting,node));if(setting.edit.editNameSelectAll){tools.inputSelect(inputObj)}else{tools.inputFocus(inputObj)}inputObj.bind("blur",(function(event){if(!view.editNodeBlur){view.cancelCurEditNode(setting)}})).bind("keydown",(function(event){if(event.keyCode=="13"){view.editNodeBlur=true;view.cancelCurEditNode(setting)}else if(event.keyCode=="27"){view.cancelCurEditNode(setting,null,true)}})).bind("click",(function(event){return false})).bind("dblclick",(function(event){return false}));$$(node,consts.id.A,setting).addClass(consts.node.CURSELECTED_EDIT);root.curEditInput=inputObj;root.noSelection=false;root.curEditNode=node},moveNode:function(setting,targetNode,node,moveType,animateFlag,isSilent){var root=data.getRoot(setting);if(targetNode==node)return;if(setting.data.keep.leaf&&targetNode&&!data.nodeIsParent(setting,targetNode)&&moveType==consts.move.TYPE_INNER)return;var oldParentNode=node.parentTId?node.getParentNode():root,targetNodeIsRoot=targetNode===null||targetNode==root;if(targetNodeIsRoot&&targetNode===null)targetNode=root;if(targetNodeIsRoot)moveType=consts.move.TYPE_INNER;var targetParentNode=targetNode.parentTId?targetNode.getParentNode():root;if(moveType!=consts.move.TYPE_PREV&&moveType!=consts.move.TYPE_NEXT){moveType=consts.move.TYPE_INNER}if(moveType==consts.move.TYPE_INNER){if(targetNodeIsRoot){node.parentTId=null}else{if(!data.nodeIsParent(setting,targetNode)){data.nodeIsParent(setting,targetNode,true);targetNode.open=!!targetNode.open;view.setNodeLineIcos(setting,targetNode)}node.parentTId=targetNode.tId}}var targetObj,target_ulObj;if(targetNodeIsRoot){targetObj=setting.treeObj;target_ulObj=targetObj}else{if(!isSilent&&moveType==consts.move.TYPE_INNER){view.expandCollapseNode(setting,targetNode,true,false)}else if(!isSilent){view.expandCollapseNode(setting,targetNode.getParentNode(),true,false)}targetObj=$$(targetNode,setting);target_ulObj=$$(targetNode,consts.id.UL,setting);if(!!targetObj.get(0)&&!target_ulObj.get(0)){var ulstr=[];view.makeUlHtml(setting,targetNode,ulstr,"");targetObj.append(ulstr.join(""))}target_ulObj=$$(targetNode,consts.id.UL,setting)}var nodeDom=$$(node,setting);if(!nodeDom.get(0)){nodeDom=view.appendNodes(setting,node.level,[node],null,-1,false,true).join("")}else if(!targetObj.get(0)){nodeDom.remove()}if(target_ulObj.get(0)&&moveType==consts.move.TYPE_INNER){target_ulObj.append(nodeDom)}else if(targetObj.get(0)&&moveType==consts.move.TYPE_PREV){targetObj.before(nodeDom)}else if(targetObj.get(0)&&moveType==consts.move.TYPE_NEXT){targetObj.after(nodeDom)}var i,l,tmpSrcIndex=-1,tmpTargetIndex=0,oldNeighbor=null,newNeighbor=null,oldLevel=node.level;var oldChildren=data.nodeChildren(setting,oldParentNode);var targetParentChildren=data.nodeChildren(setting,targetParentNode);var targetChildren=data.nodeChildren(setting,targetNode);if(node.isFirstNode){tmpSrcIndex=0;if(oldChildren.length>1){oldNeighbor=oldChildren[1];oldNeighbor.isFirstNode=true}}else if(node.isLastNode){tmpSrcIndex=oldChildren.length-1;oldNeighbor=oldChildren[tmpSrcIndex-1];oldNeighbor.isLastNode=true}else{for(i=0,l=oldChildren.length;i<l;i++){if(oldChildren[i].tId==node.tId){tmpSrcIndex=i;break}}}if(tmpSrcIndex>=0){oldChildren.splice(tmpSrcIndex,1)}if(moveType!=consts.move.TYPE_INNER){for(i=0,l=targetParentChildren.length;i<l;i++){if(targetParentChildren[i].tId==targetNode.tId)tmpTargetIndex=i}}if(moveType==consts.move.TYPE_INNER){if(!targetChildren){targetChildren=data.nodeChildren(setting,targetNode,[])}if(targetChildren.length>0){newNeighbor=targetChildren[targetChildren.length-1];newNeighbor.isLastNode=false}targetChildren.splice(targetChildren.length,0,node);node.isLastNode=true;node.isFirstNode=targetChildren.length==1}else if(targetNode.isFirstNode&&moveType==consts.move.TYPE_PREV){targetParentChildren.splice(tmpTargetIndex,0,node);newNeighbor=targetNode;newNeighbor.isFirstNode=false;node.parentTId=targetNode.parentTId;node.isFirstNode=true;node.isLastNode=false}else if(targetNode.isLastNode&&moveType==consts.move.TYPE_NEXT){targetParentChildren.splice(tmpTargetIndex+1,0,node);newNeighbor=targetNode;newNeighbor.isLastNode=false;node.parentTId=targetNode.parentTId;node.isFirstNode=false;node.isLastNode=true}else{if(moveType==consts.move.TYPE_PREV){targetParentChildren.splice(tmpTargetIndex,0,node)}else{targetParentChildren.splice(tmpTargetIndex+1,0,node)}node.parentTId=targetNode.parentTId;node.isFirstNode=false;node.isLastNode=false}data.fixPIdKeyValue(setting,node);data.setSonNodeLevel(setting,node.getParentNode(),node);view.setNodeLineIcos(setting,node);view.repairNodeLevelClass(setting,node,oldLevel);if(!setting.data.keep.parent&&oldChildren.length<1){data.nodeIsParent(setting,oldParentNode,false);oldParentNode.open=false;var tmp_ulObj=$$(oldParentNode,consts.id.UL,setting),tmp_switchObj=$$(oldParentNode,consts.id.SWITCH,setting),tmp_icoObj=$$(oldParentNode,consts.id.ICON,setting);view.replaceSwitchClass(oldParentNode,tmp_switchObj,consts.folder.DOCU);view.replaceIcoClass(oldParentNode,tmp_icoObj,consts.folder.DOCU);tmp_ulObj.css("display","none")}else if(oldNeighbor){view.setNodeLineIcos(setting,oldNeighbor)}if(newNeighbor){view.setNodeLineIcos(setting,newNeighbor)}if(!!setting.check&&setting.check.enable&&view.repairChkClass){view.repairChkClass(setting,oldParentNode);view.repairParentChkClassWithSelf(setting,oldParentNode);if(oldParentNode!=node.parent)view.repairParentChkClassWithSelf(setting,node)}if(!isSilent){view.expandCollapseParentNode(setting,node.getParentNode(),true,animateFlag)}},removeEditBtn:function(setting,node){$$(node,consts.id.EDIT,setting).unbind().remove()},removeRemoveBtn:function(setting,node){$$(node,consts.id.REMOVE,setting).unbind().remove()},removeTreeDom:function(setting,node){node.isHover=false;view.removeEditBtn(setting,node);view.removeRemoveBtn(setting,node);tools.apply(setting.view.removeHoverDom,[setting.treeId,node])},repairNodeLevelClass:function(setting,node,oldLevel){if(oldLevel===node.level)return;var liObj=$$(node,setting),aObj=$$(node,consts.id.A,setting),ulObj=$$(node,consts.id.UL,setting),oldClass=consts.className.LEVEL+oldLevel,newClass=consts.className.LEVEL+node.level;liObj.removeClass(oldClass);liObj.addClass(newClass);aObj.removeClass(oldClass);aObj.addClass(newClass);ulObj.removeClass(oldClass);ulObj.addClass(newClass)},selectNodes:function(setting,nodes){for(var i=0,l=nodes.length;i<l;i++){view.selectNode(setting,nodes[i],i>0)}}},_z={tools:_tools,view:_view,event:_event,data:_data};$.extend(true,$.fn.zTree.consts,_consts);$.extend(true,$.fn.zTree._z,_z);var zt=$.fn.zTree,tools=zt._z.tools,consts=zt.consts,view=zt._z.view,data=zt._z.data,event=zt._z.event,$$=tools.$;data.exSetting(_setting);data.addInitBind(_bindEvent);data.addInitUnBind(_unbindEvent);data.addInitCache(_initCache);data.addInitNode(_initNode);data.addInitProxy(_eventProxy);data.addInitRoot(_initRoot);data.addZTreeTools(_zTreeTools);var _cancelPreSelectedNode=view.cancelPreSelectedNode;view.cancelPreSelectedNode=function(setting,node){var list=data.getRoot(setting).curSelectedList;for(var i=0,j=list.length;i<j;i++){if(!node||node===list[i]){view.removeTreeDom(setting,list[i]);if(node)break}}if(_cancelPreSelectedNode)_cancelPreSelectedNode.apply(view,arguments)};var _createNodes=view.createNodes;view.createNodes=function(setting,level,nodes,parentNode,index){if(_createNodes){_createNodes.apply(view,arguments)}if(!nodes)return;if(view.repairParentChkClassWithSelf){view.repairParentChkClassWithSelf(setting,parentNode)}};var _makeNodeUrl=view.makeNodeUrl;view.makeNodeUrl=function(setting,node){return setting.edit.enable?null:_makeNodeUrl.apply(view,arguments)};var _removeNode=view.removeNode;view.removeNode=function(setting,node){var root=data.getRoot(setting);if(root.curEditNode===node)root.curEditNode=null;if(_removeNode){_removeNode.apply(view,arguments)}};var _selectNode=view.selectNode;view.selectNode=function(setting,node,addFlag){var root=data.getRoot(setting);if(data.isSelectedNode(setting,node)&&root.curEditNode==node&&node.editNameFlag){return false}if(_selectNode)_selectNode.apply(view,arguments);view.addHoverDom(setting,node);return true};var _uCanDo=tools.uCanDo;tools.uCanDo=function(setting,e){var root=data.getRoot(setting);if(e&&(tools.eqs(e.type,"mouseover")||tools.eqs(e.type,"mouseout")||tools.eqs(e.type,"mousedown")||tools.eqs(e.type,"mouseup"))){return true}if(root.curEditNode){view.editNodeBlur=false;root.curEditInput.focus()}return!root.curEditNode&&(_uCanDo?_uCanDo.apply(view,arguments):true)}})(jQuery);(function($){$.fn.zTreeKeyboardNavigationDestroy=function(){};$.fn.zTreeKeyboardNavigation=function(zTree,element,selectedNodes=null,treeicon){if(typeof element==="string"||element instanceof String){element=$(element)}var rootNodes=zTree.getNodes();if(!rootNodes)return;var focusSelectedNode=function(){if((selectedNodes=zTree.getSelectedNodes())&&selectedNodes.length){$("#"+selectedNodes[0].tId).focus()}};$.fn.zTreeKeyboardNavigationDestroy();$.fn.zTreeKeyboardNavigationDestroy=function(){$(element).off("keydown")};$.fn.changeTreeIcons=function(){let eleClose=$(".app-tree li span.button.switch");$(eleClose).map(((idx,ele)=>{$(ele).addClass(treeicon);$(ele).on("click",(function(e){setTimeout((()=>{$(ele).addClass(treeicon)}),0)}))}))};$(element).on("keydown",(function(e){var selectedNodes=zTree.getSelectedNodes();var selectedNode=selectedNodes.length?selectedNodes[0]:null;var processSpace=function(){if(selectedNode&&selectedNode.isParent){zTree.expandNode(selectedNode,selectedNode.open?false:true,true,true);$.fn.changeTreeIcons()}};var processHome=function(){zTree.selectNode(rootNodes[0],false,true)};var processEnd=function(){var nodes=zTree.transformToArray(rootNodes);zTree.selectNode(nodes[nodes.length-1])};var processUp=function(){var priorNode;if(selectedNode){priorNode=selectedNode.getPreNode();if(!priorNode)return}else{processEnd()}if(!priorNode)return;zTree.selectNode(priorNode)};var processDown=function(){var nextNode;if(selectedNode){nextNode=selectedNode.getNextNode();if(!nextNode)return}else{processHome()}if(!nextNode)return;zTree.selectNode(nextNode)};var processOut=function(){if(!selectedNode)return;var parentNode=selectedNode.getParentNode();var priorNode=selectedNode.getPreNode();if(!parentNode&&!priorNode)return;if(priorNode){if(priorNode.isParent){while(priorNode){if(!priorNode.isParent||!priorNode.open||!priorNode.children)break;priorNode=priorNode.children[priorNode.children.length-1]}zTree.selectNode(priorNode);return}else{zTree.selectNode(priorNode);return}}if(parentNode){zTree.selectNode(parentNode,false,true)}};var processIn=function(){if(!selectedNode)return;if(selectedNode.isParent&&selectedNode.open&&selectedNode.children){zTree.selectNode(selectedNode.children[0]);return}var nextNode=selectedNode.getNextNode();if(nextNode){zTree.selectNode(nextNode)}else{var node=selectedNode;while(node=node.getParentNode()){var nextNode=node.getNextNode();if(nextNode){zTree.selectNode(nextNode);break}}}};var processLetter=function(keyCode){if(!Array.from({length:26},((v,i)=>i+65)).includes(keyCode&95))return false;var nodes=zTree.transformToArray(rootNodes);nodes=nodes.filter((node=>"accesskey"in node&&node.accesskey.length&&(node.accesskey.charCodeAt(0)&95)==keyCode));if(!nodes.length)return false;var selectedNodes=zTree.getSelectedNodes();if(!selectedNodes.length)return false;if(selectedNodes[0]==nodes[0])return false;zTree.selectNode(nodes[0]);return true};switch(e.keyCode){case 32:processSpace();return;case 36:processHome();break;case 35:processEnd();break;case 33:break;case 34:break;case 37:processOut();break;case 38:processUp();break;case 39:processIn();break;case 40:processDown();break;default:if(!processLetter(e.keyCode&95))return;break}focusSelectedNode()}));if(selectedNodes&&selectedNodes.length){zTree.selectNode(selectedNodes[0]);focusSelectedNode()}else{$(element).trigger({type:"keydown",which:36,keyCode:36})}}})(jQuery);
1696
+ (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("tabbable")):typeof define==="function"&&define.amd?define(["exports","tabbable"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,function(){var current=global.focusTrap;var exports=global.focusTrap={};factory(exports,global.tabbable);exports.noConflict=function(){global.focusTrap=current;return exports}}())})(this,(function(exports,tabbable){"use strict";function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _toPrimitive(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==typeof i?i:i+""}var activeFocusTraps={activateTrap:function activateTrap(trapStack,trap){if(trapStack.length>0){var activeTrap=trapStack[trapStack.length-1];if(activeTrap!==trap){activeTrap.pause()}}var trapIndex=trapStack.indexOf(trap);if(trapIndex===-1){trapStack.push(trap)}else{trapStack.splice(trapIndex,1);trapStack.push(trap)}},deactivateTrap:function deactivateTrap(trapStack,trap){var trapIndex=trapStack.indexOf(trap);if(trapIndex!==-1){trapStack.splice(trapIndex,1)}if(trapStack.length>0){trapStack[trapStack.length-1].unpause()}}};var isSelectableInput=function isSelectableInput(node){return node.tagName&&node.tagName.toLowerCase()==="input"&&typeof node.select==="function"};var isEscapeEvent=function isEscapeEvent(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27};var isTabEvent=function isTabEvent(e){return e.key==="Tab"||e.keyCode===9};var isKeyForward=function isKeyForward(e){return isTabEvent(e)&&!e.shiftKey};var isKeyBackward=function isKeyBackward(e){return isTabEvent(e)&&e.shiftKey};var delay=function delay(fn){return setTimeout(fn,0)};var findIndex=function findIndex(arr,fn){var idx=-1;arr.every((function(value,i){if(fn(value)){idx=i;return false}return true}));return idx};var valueOrHandler=function valueOrHandler(value){for(var _len=arguments.length,params=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){params[_key-1]=arguments[_key]}return typeof value==="function"?value.apply(void 0,params):value};var getActualTarget=function getActualTarget(event){return event.target.shadowRoot&&typeof event.composedPath==="function"?event.composedPath()[0]:event.target};var internalTrapStack=[];var createFocusTrap=function createFocusTrap(elements,userOptions){var doc=(userOptions===null||userOptions===void 0?void 0:userOptions.document)||document;var trapStack=(userOptions===null||userOptions===void 0?void 0:userOptions.trapStack)||internalTrapStack;var config=_objectSpread2({returnFocusOnDeactivate:true,escapeDeactivates:true,delayInitialFocus:true,isKeyForward:isKeyForward,isKeyBackward:isKeyBackward},userOptions);var state={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:false,paused:false,delayInitialFocusTimer:undefined};var trap;var getOption=function getOption(configOverrideOptions,optionName,configOptionName){return configOverrideOptions&&configOverrideOptions[optionName]!==undefined?configOverrideOptions[optionName]:config[configOptionName||optionName]};var findContainerIndex=function findContainerIndex(element){return state.containerGroups.findIndex((function(_ref){var container=_ref.container,tabbableNodes=_ref.tabbableNodes;return container.contains(element)||tabbableNodes.find((function(node){return node===element}))}))};var getNodeForOption=function getNodeForOption(optionName){var optionValue=config[optionName];if(typeof optionValue==="function"){for(var _len2=arguments.length,params=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){params[_key2-1]=arguments[_key2]}optionValue=optionValue.apply(void 0,params)}if(optionValue===true){optionValue=undefined}if(!optionValue){if(optionValue===undefined||optionValue===false){return optionValue}throw new Error("`".concat(optionName,"` was specified but was not a node, or did not return a node"))}var node=optionValue;if(typeof optionValue==="string"){node=doc.querySelector(optionValue);if(!node){throw new Error("`".concat(optionName,"` as selector refers to no known node"))}}return node};var getInitialFocusNode=function getInitialFocusNode(){var node=getNodeForOption("initialFocus");if(node===false){return false}if(node===undefined){if(findContainerIndex(doc.activeElement)>=0){node=doc.activeElement}else{var firstTabbableGroup=state.tabbableGroups[0];var firstTabbableNode=firstTabbableGroup&&firstTabbableGroup.firstTabbableNode;node=firstTabbableNode||getNodeForOption("fallbackFocus")}}if(!node){throw new Error("Your focus-trap needs to have at least one focusable element")}return node};var updateTabbableNodes=function updateTabbableNodes(){state.containerGroups=state.containers.map((function(container){var tabbableNodes=tabbable.tabbable(container,config.tabbableOptions);var focusableNodes=tabbable.focusable(container,config.tabbableOptions);return{container:container,tabbableNodes:tabbableNodes,focusableNodes:focusableNodes,firstTabbableNode:tabbableNodes.length>0?tabbableNodes[0]:null,lastTabbableNode:tabbableNodes.length>0?tabbableNodes[tabbableNodes.length-1]:null,nextTabbableNode:function nextTabbableNode(node){var forward=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var nodeIdx=focusableNodes.findIndex((function(n){return n===node}));if(nodeIdx<0){return undefined}if(forward){return focusableNodes.slice(nodeIdx+1).find((function(n){return tabbable.isTabbable(n,config.tabbableOptions)}))}return focusableNodes.slice(0,nodeIdx).reverse().find((function(n){return tabbable.isTabbable(n,config.tabbableOptions)}))}}}));state.tabbableGroups=state.containerGroups.filter((function(group){return group.tabbableNodes.length>0}));if(state.tabbableGroups.length<=0&&!getNodeForOption("fallbackFocus")){throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")}};var tryFocus=function tryFocus(node){if(node===false){return}if(node===doc.activeElement){return}if(!node||!node.focus){tryFocus(getInitialFocusNode());return}node.focus({preventScroll:!!config.preventScroll});state.mostRecentlyFocusedNode=node;if(isSelectableInput(node)){node.select()}};var getReturnFocusNode=function getReturnFocusNode(previousActiveElement){var node=getNodeForOption("setReturnFocus",previousActiveElement);return node?node:node===false?false:previousActiveElement};var checkPointerDown=function checkPointerDown(e){var target=getActualTarget(e);if(findContainerIndex(target)>=0){return}if(valueOrHandler(config.clickOutsideDeactivates,e)){trap.deactivate({returnFocus:config.returnFocusOnDeactivate&&!tabbable.isFocusable(target,config.tabbableOptions)});return}if(valueOrHandler(config.allowOutsideClick,e)){return}e.preventDefault()};var checkFocusIn=function checkFocusIn(e){var target=getActualTarget(e);var targetContained=findContainerIndex(target)>=0;if(targetContained||target instanceof Document){if(targetContained){state.mostRecentlyFocusedNode=target}}else{if(state.containers[0].nextSibling){return}e.stopImmediatePropagation();tryFocus(state.mostRecentlyFocusedNode||getInitialFocusNode())}};var checkKeyNav=function checkKeyNav(event){var isBackward=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var target=getActualTarget(event);updateTabbableNodes();var destinationNode=null;if(state.tabbableGroups.length>0){var containerIndex=findContainerIndex(target);var containerGroup=containerIndex>=0?state.containerGroups[containerIndex]:undefined;if(containerIndex<0){if(isBackward){destinationNode=state.tabbableGroups[state.tabbableGroups.length-1].lastTabbableNode}else{destinationNode=state.tabbableGroups[0].firstTabbableNode}}else if(isBackward){var startOfGroupIndex=findIndex(state.tabbableGroups,(function(_ref2){var firstTabbableNode=_ref2.firstTabbableNode;return target===firstTabbableNode}));if(startOfGroupIndex<0&&(containerGroup.container===target||tabbable.isFocusable(target,config.tabbableOptions)&&!tabbable.isTabbable(target,config.tabbableOptions)&&!containerGroup.nextTabbableNode(target,false))){startOfGroupIndex=containerIndex}if(startOfGroupIndex>=0){var destinationGroupIndex=startOfGroupIndex===0?state.tabbableGroups.length-1:startOfGroupIndex-1;var destinationGroup=state.tabbableGroups[destinationGroupIndex];destinationNode=destinationGroup.lastTabbableNode}else if(!isTabEvent(event)){destinationNode=containerGroup.nextTabbableNode(target,false)}}else{var lastOfGroupIndex=findIndex(state.tabbableGroups,(function(_ref3){var lastTabbableNode=_ref3.lastTabbableNode;return target===lastTabbableNode}));if(lastOfGroupIndex<0&&(containerGroup.container===target||tabbable.isFocusable(target,config.tabbableOptions)&&!tabbable.isTabbable(target,config.tabbableOptions)&&!containerGroup.nextTabbableNode(target))){lastOfGroupIndex=containerIndex}if(lastOfGroupIndex>=0){var _destinationGroupIndex=lastOfGroupIndex===state.tabbableGroups.length-1?0:lastOfGroupIndex+1;var _destinationGroup=state.tabbableGroups[_destinationGroupIndex];destinationNode=_destinationGroup.firstTabbableNode}else if(!isTabEvent(event)){destinationNode=containerGroup.nextTabbableNode(target)}}}else{destinationNode=getNodeForOption("fallbackFocus")}if(destinationNode){if(isTabEvent(event)){event.preventDefault()}tryFocus(destinationNode)}};var checkKey=function checkKey(event){if(isEscapeEvent(event)&&valueOrHandler(config.escapeDeactivates,event)!==false){event.preventDefault();trap.deactivate();return}if(config.isKeyForward(event)||config.isKeyBackward(event)){checkKeyNav(event,config.isKeyBackward(event))}};var checkClick=function checkClick(e){var target=getActualTarget(e);if(findContainerIndex(target)>=0){return}if(valueOrHandler(config.clickOutsideDeactivates,e)){return}if(valueOrHandler(config.allowOutsideClick,e)){return}e.preventDefault();e.stopImmediatePropagation()};var addListeners=function addListeners(){if(!state.active){return}activeFocusTraps.activateTrap(trapStack,trap);state.delayInitialFocusTimer=config.delayInitialFocus?delay((function(){tryFocus(getInitialFocusNode())})):tryFocus(getInitialFocusNode());doc.addEventListener("focusin",checkFocusIn,true);doc.addEventListener("mousedown",checkPointerDown,{capture:true,passive:false});doc.addEventListener("touchstart",checkPointerDown,{capture:true,passive:false});doc.addEventListener("click",checkClick,{capture:true,passive:false});doc.addEventListener("keydown",checkKey,{capture:true,passive:false});return trap};var removeListeners=function removeListeners(){if(!state.active){return}doc.removeEventListener("focusin",checkFocusIn,true);doc.removeEventListener("mousedown",checkPointerDown,true);doc.removeEventListener("touchstart",checkPointerDown,true);doc.removeEventListener("click",checkClick,true);doc.removeEventListener("keydown",checkKey,true);return trap};trap={get active(){return state.active},get paused(){return state.paused},activate:function activate(activateOptions){if(state.active){return this}var onActivate=getOption(activateOptions,"onActivate");var onPostActivate=getOption(activateOptions,"onPostActivate");var checkCanFocusTrap=getOption(activateOptions,"checkCanFocusTrap");if(!checkCanFocusTrap){updateTabbableNodes()}state.active=true;state.paused=false;state.nodeFocusedBeforeActivation=doc.activeElement;if(onActivate){onActivate()}var finishActivation=function finishActivation(){if(checkCanFocusTrap){updateTabbableNodes()}addListeners();if(onPostActivate){onPostActivate()}};if(checkCanFocusTrap){checkCanFocusTrap(state.containers.concat()).then(finishActivation,finishActivation);return this}finishActivation();return this},deactivate:function deactivate(deactivateOptions){if(!state.active){return this}var options=_objectSpread2({onDeactivate:config.onDeactivate,onPostDeactivate:config.onPostDeactivate,checkCanReturnFocus:config.checkCanReturnFocus},deactivateOptions);clearTimeout(state.delayInitialFocusTimer);state.delayInitialFocusTimer=undefined;removeListeners();state.active=false;state.paused=false;activeFocusTraps.deactivateTrap(trapStack,trap);var onDeactivate=getOption(options,"onDeactivate");var onPostDeactivate=getOption(options,"onPostDeactivate");var checkCanReturnFocus=getOption(options,"checkCanReturnFocus");var returnFocus=getOption(options,"returnFocus","returnFocusOnDeactivate");if(onDeactivate){onDeactivate()}var finishDeactivation=function finishDeactivation(){delay((function(){if(returnFocus){tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation))}if(onPostDeactivate){onPostDeactivate()}}))};if(returnFocus&&checkCanReturnFocus){checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation,finishDeactivation);return this}finishDeactivation();return this},pause:function pause(){if(state.paused||!state.active){return this}state.paused=true;removeListeners();return this},unpause:function unpause(){if(!state.paused||!state.active){return this}state.paused=false;updateTabbableNodes();addListeners();return this},updateContainerElements:function updateContainerElements(containerElements){var elementsAsArray=[].concat(containerElements).filter(Boolean);state.containers=elementsAsArray.map((function(element){return typeof element==="string"?doc.querySelector(element):element}));if(state.active){updateTabbableNodes()}return this}};trap.updateContainerElements(elements);return trap};exports.createFocusTrap=createFocusTrap;Object.defineProperty(exports,"__esModule",{value:true})}));(function($){var settings={},roots={},caches={},_consts={className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch",NAME:"node_name"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_setting={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:true,dblClickExpand:true,expandSpeed:"fast",fontCss:{},nodeClasses:{},nameIsHTML:false,selectedMulti:true,showIcon:true,showLine:true,showTitle:true,txtSelectedEnable:false},data:{key:{isParent:"isParent",children:"children",name:"name",title:"",url:"url",icon:"icon"},render:{name:null,title:null},simpleData:{enable:false,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:false,leaf:false}},async:{enable:false,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",headers:{},xhrFields:{},url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},_initRoot=function(setting){var r=data.getRoot(setting);if(!r){r={};data.setRoot(setting,r)}data.nodeChildren(setting,r,[]);r.expandTriggerFlag=false;r.curSelectedList=[];r.noSelection=true;r.createdNodes=[];r.zId=0;r._ver=(new Date).getTime()},_initCache=function(setting){var c=data.getCache(setting);if(!c){c={};data.setCache(setting,c)}c.nodes=[];c.doms=[]},_bindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.bind(c.NODECREATED,(function(event,treeId,node){tools.apply(setting.callback.onNodeCreated,[event,treeId,node])}));o.bind(c.CLICK,(function(event,srcEvent,treeId,node,clickFlag){tools.apply(setting.callback.onClick,[srcEvent,treeId,node,clickFlag])}));o.bind(c.EXPAND,(function(event,treeId,node){tools.apply(setting.callback.onExpand,[event,treeId,node])}));o.bind(c.COLLAPSE,(function(event,treeId,node){tools.apply(setting.callback.onCollapse,[event,treeId,node])}));o.bind(c.ASYNC_SUCCESS,(function(event,treeId,node,msg){tools.apply(setting.callback.onAsyncSuccess,[event,treeId,node,msg])}));o.bind(c.ASYNC_ERROR,(function(event,treeId,node,XMLHttpRequest,textStatus,errorThrown){tools.apply(setting.callback.onAsyncError,[event,treeId,node,XMLHttpRequest,textStatus,errorThrown])}));o.bind(c.REMOVE,(function(event,treeId,treeNode){tools.apply(setting.callback.onRemove,[event,treeId,treeNode])}));o.bind(c.SELECTED,(function(event,treeId,node){tools.apply(setting.callback.onSelected,[treeId,node])}));o.bind(c.UNSELECTED,(function(event,treeId,node){tools.apply(setting.callback.onUnSelected,[treeId,node])}))},_unbindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.unbind(c.NODECREATED).unbind(c.CLICK).unbind(c.EXPAND).unbind(c.COLLAPSE).unbind(c.ASYNC_SUCCESS).unbind(c.ASYNC_ERROR).unbind(c.REMOVE).unbind(c.SELECTED).unbind(c.UNSELECTED)},_eventProxy=function(event){var target=event.target,setting=data.getSetting(event.data.treeId),tId="",node=null,nodeEventType="",treeEventType="",nodeEventCallback=null,treeEventCallback=null,tmp=null;if(tools.eqs(event.type,"mousedown")){treeEventType="mousedown"}else if(tools.eqs(event.type,"mouseup")){treeEventType="mouseup"}else if(tools.eqs(event.type,"contextmenu")){treeEventType="contextmenu"}else if(tools.eqs(event.type,"click")){if(tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.SWITCH)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="switchNode"}else{tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="clickNode"}}}else if(tools.eqs(event.type,"dblclick")){treeEventType="dblclick";tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="switchNode"}}if(treeEventType.length>0&&tId.length==0){tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id}}if(tId.length>0){node=data.getNodeCache(setting,tId);switch(nodeEventType){case"switchNode":var isParent=data.nodeIsParent(setting,node);if(!isParent){nodeEventType=""}else if(tools.eqs(event.type,"click")||tools.eqs(event.type,"dblclick")&&tools.apply(setting.view.dblClickExpand,[setting.treeId,node],setting.view.dblClickExpand)){nodeEventCallback=handler.onSwitchNode}else{nodeEventType=""}break;case"clickNode":nodeEventCallback=handler.onClickNode;break}}switch(treeEventType){case"mousedown":treeEventCallback=handler.onZTreeMousedown;break;case"mouseup":treeEventCallback=handler.onZTreeMouseup;break;case"dblclick":treeEventCallback=handler.onZTreeDblclick;break;case"contextmenu":treeEventCallback=handler.onZTreeContextmenu;break}var proxyResult={stop:false,node:node,nodeEventType:nodeEventType,nodeEventCallback:nodeEventCallback,treeEventType:treeEventType,treeEventCallback:treeEventCallback};return proxyResult},_initNode=function(setting,level,n,parentNode,isFirstNode,isLastNode,openFlag){if(!n)return;var r=data.getRoot(setting),children=data.nodeChildren(setting,n);n.level=level;n.tId=setting.treeId+"_"+ ++r.zId;n.parentTId=parentNode?parentNode.tId:null;n.open=typeof n.open=="string"?tools.eqs(n.open,"true"):!!n.open;var isParent=data.nodeIsParent(setting,n);if(tools.isArray(children)){data.nodeIsParent(setting,n,true);n.zAsync=true}else{isParent=data.nodeIsParent(setting,n,isParent);n.open=isParent&&!setting.async.enable?n.open:false;n.zAsync=!isParent}n.isFirstNode=isFirstNode;n.isLastNode=isLastNode;n.getParentNode=function(){return data.getNodeCache(setting,n.parentTId)};n.getPreNode=function(){return data.getPreNode(setting,n)};n.getNextNode=function(){return data.getNextNode(setting,n)};n.getIndex=function(){return data.getNodeIndex(setting,n)};n.getPath=function(){return data.getNodePath(setting,n)};n.isAjaxing=false;data.fixPIdKeyValue(setting,n)},_init={bind:[_bindEvent],unbind:[_unbindEvent],caches:[_initCache],nodes:[_initNode],proxys:[_eventProxy],roots:[_initRoot],beforeA:[],afterA:[],innerBeforeA:[],innerAfterA:[],zTreeTools:[]},data={addNodeCache:function(setting,node){data.getCache(setting).nodes[data.getNodeCacheId(node.tId)]=node},getNodeCacheId:function(tId){return tId.substring(tId.lastIndexOf("_")+1)},addAfterA:function(afterA){_init.afterA.push(afterA)},addBeforeA:function(beforeA){_init.beforeA.push(beforeA)},addInnerAfterA:function(innerAfterA){_init.innerAfterA.push(innerAfterA)},addInnerBeforeA:function(innerBeforeA){_init.innerBeforeA.push(innerBeforeA)},addInitBind:function(bindEvent){_init.bind.push(bindEvent)},addInitUnBind:function(unbindEvent){_init.unbind.push(unbindEvent)},addInitCache:function(initCache){_init.caches.push(initCache)},addInitNode:function(initNode){_init.nodes.push(initNode)},addInitProxy:function(initProxy,isFirst){if(!!isFirst){_init.proxys.splice(0,0,initProxy)}else{_init.proxys.push(initProxy)}},addInitRoot:function(initRoot){_init.roots.push(initRoot)},addNodesData:function(setting,parentNode,index,nodes){var children=data.nodeChildren(setting,parentNode),params;if(!children){children=data.nodeChildren(setting,parentNode,[]);index=-1}else if(index>=children.length){index=-1}if(children.length>0&&index===0){children[0].isFirstNode=false;view.setNodeLineIcos(setting,children[0])}else if(children.length>0&&index<0){children[children.length-1].isLastNode=false;view.setNodeLineIcos(setting,children[children.length-1])}data.nodeIsParent(setting,parentNode,true);if(index<0){data.nodeChildren(setting,parentNode,children.concat(nodes))}else{params=[index,0].concat(nodes);children.splice.apply(children,params)}},addSelectedNode:function(setting,node){var root=data.getRoot(setting);if(!data.isSelectedNode(setting,node)){root.curSelectedList.push(node)}},addCreatedNode:function(setting,node){if(!!setting.callback.onNodeCreated||!!setting.view.addDiyDom){var root=data.getRoot(setting);root.createdNodes.push(node)}},addZTreeTools:function(zTreeTools){_init.zTreeTools.push(zTreeTools)},exSetting:function(s){$.extend(true,_setting,s)},fixPIdKeyValue:function(setting,node){if(setting.data.simpleData.enable){node[setting.data.simpleData.pIdKey]=node.parentTId?node.getParentNode()[setting.data.simpleData.idKey]:setting.data.simpleData.rootPId}},getAfterA:function(setting,node,array){for(var i=0,j=_init.afterA.length;i<j;i++){_init.afterA[i].apply(this,arguments)}},getBeforeA:function(setting,node,array){for(var i=0,j=_init.beforeA.length;i<j;i++){_init.beforeA[i].apply(this,arguments)}},getInnerAfterA:function(setting,node,array){for(var i=0,j=_init.innerAfterA.length;i<j;i++){_init.innerAfterA[i].apply(this,arguments)}},getInnerBeforeA:function(setting,node,array){for(var i=0,j=_init.innerBeforeA.length;i<j;i++){_init.innerBeforeA[i].apply(this,arguments)}},getCache:function(setting){return caches[setting.treeId]},getNodeIndex:function(setting,node){if(!node)return null;var p=node.parentTId?node.getParentNode():data.getRoot(setting),children=data.nodeChildren(setting,p);for(var i=0,l=children.length-1;i<=l;i++){if(children[i]===node){return i}}return-1},getNextNode:function(setting,node){if(!node)return null;var p=node.parentTId?node.getParentNode():data.getRoot(setting),children=data.nodeChildren(setting,p);for(var i=0,l=children.length-1;i<=l;i++){if(children[i]===node){return i==l?null:children[i+1]}}return null},getNodeByParam:function(setting,nodes,key,value){if(!nodes||!key)return null;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(node[key]==value){return nodes[i]}var children=data.nodeChildren(setting,node);var tmp=data.getNodeByParam(setting,children,key,value);if(tmp)return tmp}return null},getNodeCache:function(setting,tId){if(!tId)return null;var n=caches[setting.treeId].nodes[data.getNodeCacheId(tId)];return n?n:null},getNodePath:function(setting,node){if(!node)return null;var path;if(node.parentTId){path=node.getParentNode().getPath()}else{path=[]}if(path){path.push(node)}return path},getNodes:function(setting){return data.nodeChildren(setting,data.getRoot(setting))},getNodesByParam:function(setting,nodes,key,value){if(!nodes||!key)return[];var result=[];for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(node[key]==value){result.push(node)}var children=data.nodeChildren(setting,node);result=result.concat(data.getNodesByParam(setting,children,key,value))}return result},getNodesByParamFuzzy:function(setting,nodes,key,value){if(!nodes||!key)return[];var result=[];value=value.toLowerCase();for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(typeof node[key]=="string"&&nodes[i][key].toLowerCase().indexOf(value)>-1){result.push(node)}var children=data.nodeChildren(setting,node);result=result.concat(data.getNodesByParamFuzzy(setting,children,key,value))}return result},getNodesByFilter:function(setting,nodes,filter,isSingle,invokeParam){if(!nodes)return isSingle?null:[];var result=isSingle?null:[];for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(tools.apply(filter,[node,invokeParam],false)){if(isSingle){return node}result.push(node)}var children=data.nodeChildren(setting,node);var tmpResult=data.getNodesByFilter(setting,children,filter,isSingle,invokeParam);if(isSingle&&!!tmpResult){return tmpResult}result=isSingle?tmpResult:result.concat(tmpResult)}return result},getPreNode:function(setting,node){if(!node)return null;var p=node.parentTId?node.getParentNode():data.getRoot(setting),children=data.nodeChildren(setting,p);for(var i=0,l=children.length;i<l;i++){if(children[i]===node){return i==0?null:children[i-1]}}return null},getRoot:function(setting){return setting?roots[setting.treeId]:null},getRoots:function(){return roots},getSetting:function(treeId){return settings[treeId]},getSettings:function(){return settings},getZTreeTools:function(treeId){var r=this.getRoot(this.getSetting(treeId));return r?r.treeTools:null},initCache:function(setting){for(var i=0,j=_init.caches.length;i<j;i++){_init.caches[i].apply(this,arguments)}},initNode:function(setting,level,node,parentNode,preNode,nextNode){for(var i=0,j=_init.nodes.length;i<j;i++){_init.nodes[i].apply(this,arguments)}},initRoot:function(setting){for(var i=0,j=_init.roots.length;i<j;i++){_init.roots[i].apply(this,arguments)}},isSelectedNode:function(setting,node){var root=data.getRoot(setting);for(var i=0,j=root.curSelectedList.length;i<j;i++){if(node===root.curSelectedList[i])return true}return false},nodeChildren:function(setting,node,newChildren){if(!node){return null}var key=setting.data.key.children;if(typeof newChildren!=="undefined"){node[key]=newChildren}return node[key]},nodeIsParent:function(setting,node,newIsParent){if(!node){return false}var key=setting.data.key.isParent;if(typeof newIsParent!=="undefined"){if(typeof newIsParent==="string"){newIsParent=tools.eqs(newIsParent,"true")}newIsParent=!!newIsParent;node[key]=newIsParent}else if(typeof node[key]=="string"){node[key]=tools.eqs(node[key],"true")}else{node[key]=!!node[key]}return node[key]},nodeName:function(setting,node,newName){var key=setting.data.key.name;if(typeof newName!=="undefined"){node[key]=newName}var rawName=""+node[key];if(typeof setting.data.render.name==="function"){return setting.data.render.name.call(this,rawName,node)}return rawName},nodeTitle:function(setting,node){var t=setting.data.key.title===""?setting.data.key.name:setting.data.key.title;var rawTitle=""+node[t];if(typeof setting.data.render.title==="function"){return setting.data.render.title.call(this,rawTitle,node)}return rawTitle},removeNodeCache:function(setting,node){var children=data.nodeChildren(setting,node);if(children){for(var i=0,l=children.length;i<l;i++){data.removeNodeCache(setting,children[i])}}data.getCache(setting).nodes[data.getNodeCacheId(node.tId)]=null},removeSelectedNode:function(setting,node){var root=data.getRoot(setting);for(var i=0,j=root.curSelectedList.length;i<j;i++){if(node===root.curSelectedList[i]||!data.getNodeCache(setting,root.curSelectedList[i].tId)){root.curSelectedList.splice(i,1);setting.treeObj.trigger(consts.event.UNSELECTED,[setting.treeId,node]);i--;j--}}},setCache:function(setting,cache){caches[setting.treeId]=cache},setRoot:function(setting,root){roots[setting.treeId]=root},setZTreeTools:function(setting,zTreeTools){for(var i=0,j=_init.zTreeTools.length;i<j;i++){_init.zTreeTools[i].apply(this,arguments)}},transformToArrayFormat:function(setting,nodes){if(!nodes)return[];var r=[];if(tools.isArray(nodes)){for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];_do(node)}}else{_do(nodes)}return r;function _do(_node){r.push(_node);var children=data.nodeChildren(setting,_node);if(children){r=r.concat(data.transformToArrayFormat(setting,children))}}},transformTozTreeFormat:function(setting,sNodes){var i,l,key=setting.data.simpleData.idKey,parentKey=setting.data.simpleData.pIdKey;if(!key||key==""||!sNodes)return[];if(tools.isArray(sNodes)){var r=[];var tmpMap={};for(i=0,l=sNodes.length;i<l;i++){tmpMap[sNodes[i][key]]=sNodes[i]}for(i=0,l=sNodes.length;i<l;i++){var p=tmpMap[sNodes[i][parentKey]];if(p&&sNodes[i][key]!=sNodes[i][parentKey]){var children=data.nodeChildren(setting,p);if(!children){children=data.nodeChildren(setting,p,[])}children.push(sNodes[i])}else{r.push(sNodes[i])}}return r}else{return[sNodes]}}},event={bindEvent:function(setting){for(var i=0,j=_init.bind.length;i<j;i++){_init.bind[i].apply(this,arguments)}},unbindEvent:function(setting){for(var i=0,j=_init.unbind.length;i<j;i++){_init.unbind[i].apply(this,arguments)}},bindTree:function(setting){var eventParam={treeId:setting.treeId},o=setting.treeObj;if(!setting.view.txtSelectedEnable){o.bind("selectstart",handler.onSelectStart).css({"-moz-user-select":"-moz-none"})}o.bind("click",eventParam,event.proxy);o.bind("dblclick",eventParam,event.proxy);o.bind("mouseover",eventParam,event.proxy);o.bind("mouseout",eventParam,event.proxy);o.bind("mousedown",eventParam,event.proxy);o.bind("mouseup",eventParam,event.proxy);o.bind("contextmenu",eventParam,event.proxy)},unbindTree:function(setting){var o=setting.treeObj;o.unbind("selectstart",handler.onSelectStart).unbind("click",event.proxy).unbind("dblclick",event.proxy).unbind("mouseover",event.proxy).unbind("mouseout",event.proxy).unbind("mousedown",event.proxy).unbind("mouseup",event.proxy).unbind("contextmenu",event.proxy)},doProxy:function(e){var results=[];for(var i=0,j=_init.proxys.length;i<j;i++){var proxyResult=_init.proxys[i].apply(this,arguments);results.push(proxyResult);if(proxyResult.stop){break}}return results},proxy:function(e){var setting=data.getSetting(e.data.treeId);if(!tools.uCanDo(setting,e))return true;var results=event.doProxy(e),r=true,x=false;for(var i=0,l=results.length;i<l;i++){var proxyResult=results[i];if(proxyResult.nodeEventCallback){x=true;r=proxyResult.nodeEventCallback.apply(proxyResult,[e,proxyResult.node])&&r}if(proxyResult.treeEventCallback){x=true;r=proxyResult.treeEventCallback.apply(proxyResult,[e,proxyResult.node])&&r}}return r}},handler={onSwitchNode:function(event,node){var setting=data.getSetting(event.data.treeId);if(node.open){if(tools.apply(setting.callback.beforeCollapse,[setting.treeId,node],true)==false)return true;data.getRoot(setting).expandTriggerFlag=true;view.switchNode(setting,node)}else{if(tools.apply(setting.callback.beforeExpand,[setting.treeId,node],true)==false)return true;data.getRoot(setting).expandTriggerFlag=true;view.switchNode(setting,node)}return true},onClickNode:function(event,node){var setting=data.getSetting(event.data.treeId),clickFlag=setting.view.autoCancelSelected&&(event.ctrlKey||event.metaKey)&&data.isSelectedNode(setting,node)?0:setting.view.autoCancelSelected&&(event.ctrlKey||event.metaKey)&&setting.view.selectedMulti?2:1;if(tools.apply(setting.callback.beforeClick,[setting.treeId,node,clickFlag],true)==false)return true;if(clickFlag===0){view.cancelPreSelectedNode(setting,node)}else{view.selectNode(setting,node,clickFlag===2)}setting.treeObj.trigger(consts.event.CLICK,[event,setting.treeId,node,clickFlag]);return true},onZTreeMousedown:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeMouseDown,[setting.treeId,node],true)){tools.apply(setting.callback.onMouseDown,[event,setting.treeId,node])}return true},onZTreeMouseup:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeMouseUp,[setting.treeId,node],true)){tools.apply(setting.callback.onMouseUp,[event,setting.treeId,node])}return true},onZTreeDblclick:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeDblClick,[setting.treeId,node],true)){tools.apply(setting.callback.onDblClick,[event,setting.treeId,node])}return true},onZTreeContextmenu:function(event,node){var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeRightClick,[setting.treeId,node],true)){tools.apply(setting.callback.onRightClick,[event,setting.treeId,node])}return typeof setting.callback.onRightClick!="function"},onSelectStart:function(e){var n=e.originalEvent.srcElement.nodeName.toLowerCase();return n==="input"||n==="textarea"}},tools={apply:function(fun,param,defaultValue){if(typeof fun=="function"){return fun.apply(zt,param?param:[])}return defaultValue},canAsync:function(setting,node){var children=data.nodeChildren(setting,node);var isParent=data.nodeIsParent(setting,node);return setting.async.enable&&node&&isParent&&!(node.zAsync||children&&children.length>0)},clone:function(obj){if(obj===null)return null;var o=tools.isArray(obj)?[]:{};for(var i in obj){o[i]=obj[i]instanceof Date?new Date(obj[i].getTime()):typeof obj[i]==="object"?tools.clone(obj[i]):obj[i]}return o},eqs:function(str1,str2){return str1.toLowerCase()===str2.toLowerCase()},isArray:function(arr){return Object.prototype.toString.apply(arr)==="[object Array]"},isElement:function(o){return typeof HTMLElement==="object"?o instanceof HTMLElement:o&&typeof o==="object"&&o!==null&&o.nodeType===1&&typeof o.nodeName==="string"},$:function(node,exp,setting){if(!!exp&&typeof exp!="string"){setting=exp;exp=""}if(typeof node=="string"){return $(node,setting?setting.treeObj.get(0).ownerDocument:null)}else{return $("#"+node.tId+exp,setting?setting.treeObj:null)}},getMDom:function(setting,curDom,targetExpr){if(!curDom)return null;while(curDom&&curDom.id!==setting.treeId){for(var i=0,l=targetExpr.length;curDom.tagName&&i<l;i++){if(tools.eqs(curDom.tagName,targetExpr[i].tagName)&&curDom.getAttribute(targetExpr[i].attrName)!==null){return curDom}}curDom=curDom.parentNode}return null},getNodeMainDom:function(target){return $(target).parent("li").get(0)||$(target).parentsUntil("li").parent().get(0)},isChildOrSelf:function(dom,parentId){return $(dom).closest("#"+parentId).length>0},uCanDo:function(setting,e){return true}},view={addNodes:function(setting,parentNode,index,newNodes,isSilent){var isParent=data.nodeIsParent(setting,parentNode);if(setting.data.keep.leaf&&parentNode&&!isParent){return}if(!tools.isArray(newNodes)){newNodes=[newNodes]}if(setting.data.simpleData.enable){newNodes=data.transformTozTreeFormat(setting,newNodes)}if(parentNode){var target_switchObj=$$(parentNode,consts.id.SWITCH,setting),target_icoObj=$$(parentNode,consts.id.ICON,setting),target_ulObj=$$(parentNode,consts.id.UL,setting);if(!parentNode.open){view.replaceSwitchClass(parentNode,target_switchObj,consts.folder.CLOSE);view.replaceIcoClass(parentNode,target_icoObj,consts.folder.CLOSE);parentNode.open=false;target_ulObj.css({display:"none"})}data.addNodesData(setting,parentNode,index,newNodes);view.createNodes(setting,parentNode.level+1,newNodes,parentNode,index);if(!isSilent){view.expandCollapseParentNode(setting,parentNode,true)}}else{data.addNodesData(setting,data.getRoot(setting),index,newNodes);view.createNodes(setting,0,newNodes,null,index)}},appendNodes:function(setting,level,nodes,parentNode,index,initFlag,openFlag){if(!nodes)return[];var html=[];var tmpPNode=parentNode?parentNode:data.getRoot(setting),tmpPChild=data.nodeChildren(setting,tmpPNode),isFirstNode,isLastNode;if(!tmpPChild||index>=tmpPChild.length-nodes.length){index=-1}for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];if(initFlag){isFirstNode=(index===0||tmpPChild.length==nodes.length)&&i==0;isLastNode=index<0&&i==nodes.length-1;data.initNode(setting,level,node,parentNode,isFirstNode,isLastNode,openFlag);data.addNodeCache(setting,node)}var isParent=data.nodeIsParent(setting,node);var childHtml=[];var children=data.nodeChildren(setting,node);if(children&&children.length>0){childHtml=view.appendNodes(setting,level+1,children,node,-1,initFlag,openFlag&&node.open)}if(openFlag){view.makeDOMNodeMainBefore(html,setting,node);view.makeDOMNodeLine(html,setting,node);data.getBeforeA(setting,node,html);view.makeDOMNodeNameBefore(html,setting,node);data.getInnerBeforeA(setting,node,html);view.makeDOMNodeIcon(html,setting,node);data.getInnerAfterA(setting,node,html);view.makeDOMNodeNameAfter(html,setting,node);data.getAfterA(setting,node,html);if(isParent&&node.open){view.makeUlHtml(setting,node,html,childHtml.join(""))}view.makeDOMNodeMainAfter(html,setting,node);data.addCreatedNode(setting,node)}}return html},appendParentULDom:function(setting,node){var html=[],nObj=$$(node,setting);if(!nObj.get(0)&&!!node.parentTId){view.appendParentULDom(setting,node.getParentNode());nObj=$$(node,setting)}var ulObj=$$(node,consts.id.UL,setting);if(ulObj.get(0)){ulObj.remove()}var children=data.nodeChildren(setting,node),childHtml=view.appendNodes(setting,node.level+1,children,node,-1,false,true);view.makeUlHtml(setting,node,html,childHtml.join(""));nObj.append(html.join(""))},asyncNode:function(setting,node,isSilent,callback){var i,l;var isParent=data.nodeIsParent(setting,node);if(node&&!isParent){tools.apply(callback);return false}else if(node&&node.isAjaxing){return false}else if(tools.apply(setting.callback.beforeAsync,[setting.treeId,node],true)==false){tools.apply(callback);return false}if(node){node.isAjaxing=true;var icoObj=$$(node,consts.id.ICON,setting);icoObj.attr({style:"",class:consts.className.BUTTON+" "+consts.className.ICO_LOADING})}var tmpParam={};var autoParam=tools.apply(setting.async.autoParam,[setting.treeId,node],setting.async.autoParam);for(i=0,l=autoParam.length;node&&i<l;i++){var pKey=autoParam[i].split("="),spKey=pKey;if(pKey.length>1){spKey=pKey[1];pKey=pKey[0]}tmpParam[spKey]=node[pKey]}var otherParam=tools.apply(setting.async.otherParam,[setting.treeId,node],setting.async.otherParam);if(tools.isArray(otherParam)){for(i=0,l=otherParam.length;i<l;i+=2){tmpParam[otherParam[i]]=otherParam[i+1]}}else{for(var p in otherParam){tmpParam[p]=otherParam[p]}}var _tmpV=data.getRoot(setting)._ver;$.ajax({contentType:setting.async.contentType,cache:false,type:setting.async.type,url:tools.apply(setting.async.url,[setting.treeId,node],setting.async.url),data:setting.async.contentType.indexOf("application/json")>-1?JSON.stringify(tmpParam):tmpParam,dataType:setting.async.dataType,headers:setting.async.headers,xhrFields:setting.async.xhrFields,success:function(msg){if(_tmpV!=data.getRoot(setting)._ver){return}var newNodes=[];try{if(!msg||msg.length==0){newNodes=[]}else if(typeof msg=="string"){newNodes=eval("("+msg+")")}else{newNodes=msg}}catch(err){newNodes=msg}if(node){node.isAjaxing=null;node.zAsync=true}view.setNodeLineIcos(setting,node);if(newNodes&&newNodes!==""){newNodes=tools.apply(setting.async.dataFilter,[setting.treeId,node,newNodes],newNodes);view.addNodes(setting,node,-1,!!newNodes?tools.clone(newNodes):[],!!isSilent)}else{view.addNodes(setting,node,-1,[],!!isSilent)}setting.treeObj.trigger(consts.event.ASYNC_SUCCESS,[setting.treeId,node,msg]);tools.apply(callback)},error:function(XMLHttpRequest,textStatus,errorThrown){if(_tmpV!=data.getRoot(setting)._ver){return}if(node)node.isAjaxing=null;view.setNodeLineIcos(setting,node);setting.treeObj.trigger(consts.event.ASYNC_ERROR,[setting.treeId,node,XMLHttpRequest,textStatus,errorThrown])}});return true},cancelPreSelectedNode:function(setting,node,excludeNode){var list=data.getRoot(setting).curSelectedList,i,n;for(i=list.length-1;i>=0;i--){n=list[i];if(node===n||!node&&(!excludeNode||excludeNode!==n)){$$(n,consts.id.A,setting).removeClass(consts.node.CURSELECTED);if(node){data.removeSelectedNode(setting,node);break}else{list.splice(i,1);setting.treeObj.trigger(consts.event.UNSELECTED,[setting.treeId,n])}}}},createNodeCallback:function(setting){if(!!setting.callback.onNodeCreated||!!setting.view.addDiyDom){var root=data.getRoot(setting);while(root.createdNodes.length>0){var node=root.createdNodes.shift();tools.apply(setting.view.addDiyDom,[setting.treeId,node]);if(!!setting.callback.onNodeCreated){setting.treeObj.trigger(consts.event.NODECREATED,[setting.treeId,node])}}}},createNodes:function(setting,level,nodes,parentNode,index){if(!nodes||nodes.length==0)return;var root=data.getRoot(setting),openFlag=!parentNode||parentNode.open||!!$$(data.nodeChildren(setting,parentNode)[0],setting).get(0);root.createdNodes=[];var zTreeHtml=view.appendNodes(setting,level,nodes,parentNode,index,true,openFlag),parentObj,nextObj;if(!parentNode){parentObj=setting.treeObj}else{var ulObj=$$(parentNode,consts.id.UL,setting);if(ulObj.get(0)){parentObj=ulObj}}if(parentObj){if(index>=0){nextObj=parentObj.children()[index]}if(index>=0&&nextObj){$(nextObj).before(zTreeHtml.join(""))}else{parentObj.append(zTreeHtml.join(""))}}view.createNodeCallback(setting)},destroy:function(setting){if(!setting)return;data.initCache(setting);data.initRoot(setting);event.unbindTree(setting);event.unbindEvent(setting);setting.treeObj.empty();delete settings[setting.treeId]},expandCollapseNode:function(setting,node,expandFlag,animateFlag,callback){var root=data.getRoot(setting);var tmpCb,_callback;if(!node){tools.apply(callback,[]);return}var children=data.nodeChildren(setting,node);var isParent=data.nodeIsParent(setting,node);if(root.expandTriggerFlag){_callback=callback;tmpCb=function(){if(_callback)_callback();if(node.open){setting.treeObj.trigger(consts.event.EXPAND,[setting.treeId,node])}else{setting.treeObj.trigger(consts.event.COLLAPSE,[setting.treeId,node])}};callback=tmpCb;root.expandTriggerFlag=false}if(!node.open&&isParent&&(!$$(node,consts.id.UL,setting).get(0)||children&&children.length>0&&!$$(children[0],setting).get(0))){view.appendParentULDom(setting,node);view.createNodeCallback(setting)}if(node.open==expandFlag){tools.apply(callback,[]);return}var ulObj=$$(node,consts.id.UL,setting),switchObj=$$(node,consts.id.SWITCH,setting),icoObj=$$(node,consts.id.ICON,setting);if(isParent){node.open=!node.open;if(node.iconOpen&&node.iconClose){icoObj.attr("style",view.makeNodeIcoStyle(setting,node))}if(node.open){view.replaceSwitchClass(node,switchObj,consts.folder.OPEN);view.replaceIcoClass(node,icoObj,consts.folder.OPEN);if(animateFlag==false||setting.view.expandSpeed==""){ulObj.show();tools.apply(callback,[])}else{if(children&&children.length>0){ulObj.slideDown(setting.view.expandSpeed,callback)}else{ulObj.show();tools.apply(callback,[])}}}else{view.replaceSwitchClass(node,switchObj,consts.folder.CLOSE);view.replaceIcoClass(node,icoObj,consts.folder.CLOSE);if(animateFlag==false||setting.view.expandSpeed==""||!(children&&children.length>0)){ulObj.hide();tools.apply(callback,[])}else{ulObj.slideUp(setting.view.expandSpeed,callback)}}}else{tools.apply(callback,[])}},expandCollapseParentNode:function(setting,node,expandFlag,animateFlag,callback){if(!node)return;if(!node.parentTId){view.expandCollapseNode(setting,node,expandFlag,animateFlag,callback);return}else{view.expandCollapseNode(setting,node,expandFlag,animateFlag)}if(node.parentTId){view.expandCollapseParentNode(setting,node.getParentNode(),expandFlag,animateFlag,callback)}},expandCollapseSonNode:function(setting,node,expandFlag,animateFlag,callback){var root=data.getRoot(setting),treeNodes=node?data.nodeChildren(setting,node):data.nodeChildren(setting,root),selfAnimateSign=node?false:animateFlag,expandTriggerFlag=data.getRoot(setting).expandTriggerFlag;data.getRoot(setting).expandTriggerFlag=false;if(treeNodes){for(var i=0,l=treeNodes.length;i<l;i++){if(treeNodes[i])view.expandCollapseSonNode(setting,treeNodes[i],expandFlag,selfAnimateSign)}}data.getRoot(setting).expandTriggerFlag=expandTriggerFlag;view.expandCollapseNode(setting,node,expandFlag,animateFlag,callback)},isSelectedNode:function(setting,node){if(!node){return false}var list=data.getRoot(setting).curSelectedList,i;for(i=list.length-1;i>=0;i--){if(node===list[i]){return true}}return false},makeDOMNodeIcon:function(html,setting,node){var nameStr=data.nodeName(setting,node),name=setting.view.nameIsHTML?nameStr:nameStr.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");html.push("<span id='",node.tId,consts.id.ICON,"' title='' treeNode",consts.id.ICON," class='",view.makeNodeIcoClass(setting,node),"' style='",view.makeNodeIcoStyle(setting,node),"'></span><span id='",node.tId,consts.id.SPAN,"' class='",consts.className.NAME,"'>",name,"</span>")},makeDOMNodeLine:function(html,setting,node){html.push("<span id='",node.tId,consts.id.SWITCH,"' title='' class='",view.makeNodeLineClass(setting,node),"' treeNode",consts.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(html,setting,node){html.push("</li>")},makeDOMNodeMainBefore:function(html,setting,node){html.push("<li id='",node.tId,"' class='",consts.className.LEVEL,node.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(html,setting,node){html.push("</a>")},makeDOMNodeNameBefore:function(html,setting,node){var title=data.nodeTitle(setting,node),url=view.makeNodeUrl(setting,node),fontcss=view.makeNodeFontCss(setting,node),nodeClasses=view.makeNodeClasses(setting,node),fontStyle=[];for(var f in fontcss){fontStyle.push(f,":",fontcss[f],";")}html.push("<a id='",node.tId,consts.id.A,"' class='",consts.className.LEVEL,node.level,nodeClasses.add?" "+nodeClasses.add.join(" "):"","' treeNode",consts.id.A,node.click?' onclick="'+node.click+'"':"",url!=null&&url.length>0?" href='"+url+"'":""," target='",view.makeNodeTarget(node),"' style='",fontStyle.join(""),"'");if(tools.apply(setting.view.showTitle,[setting.treeId,node],setting.view.showTitle)&&title){html.push("title='",title.replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"'")}html.push(">")},makeNodeFontCss:function(setting,node){var fontCss=tools.apply(setting.view.fontCss,[setting.treeId,node],setting.view.fontCss);return fontCss&&typeof fontCss!="function"?fontCss:{}},makeNodeClasses:function(setting,node){var classes=tools.apply(setting.view.nodeClasses,[setting.treeId,node],setting.view.nodeClasses);return classes&&typeof classes!=="function"?classes:{add:[],remove:[]}},makeNodeIcoClass:function(setting,node){var icoCss=["ico"];if(!node.isAjaxing){var isParent=data.nodeIsParent(setting,node);icoCss[0]=(node.iconSkin?node.iconSkin+"_":"")+icoCss[0];if(isParent){icoCss.push(node.open?consts.folder.OPEN:consts.folder.CLOSE)}else{icoCss.push(consts.folder.DOCU)}}return consts.className.BUTTON+" "+icoCss.join("_")},makeNodeIcoStyle:function(setting,node){var icoStyle=[];if(!node.isAjaxing){var isParent=data.nodeIsParent(setting,node);var icon=isParent&&node.iconOpen&&node.iconClose?node.open?node.iconOpen:node.iconClose:node[setting.data.key.icon];if(icon)icoStyle.push("background:url(",icon,") 0 0 no-repeat;");if(setting.view.showIcon==false||!tools.apply(setting.view.showIcon,[setting.treeId,node],true)){icoStyle.push("display:none;")}}return icoStyle.join("")},makeNodeLineClass:function(setting,node){var lineClass=[];if(setting.view.showLine){if(node.level==0&&node.isFirstNode&&node.isLastNode){lineClass.push(consts.line.ROOT)}else if(node.level==0&&node.isFirstNode){lineClass.push(consts.line.ROOTS)}else if(node.isLastNode){lineClass.push(consts.line.BOTTOM)}else{lineClass.push(consts.line.CENTER)}}else{lineClass.push(consts.line.NOLINE)}if(data.nodeIsParent(setting,node)){lineClass.push(node.open?consts.folder.OPEN:consts.folder.CLOSE)}else{lineClass.push(consts.folder.DOCU)}return view.makeNodeLineClassEx(node)+lineClass.join("_")},makeNodeLineClassEx:function(node){return consts.className.BUTTON+" "+consts.className.LEVEL+node.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(node){return node.target||"_blank"},makeNodeUrl:function(setting,node){var urlKey=setting.data.key.url;return node[urlKey]?node[urlKey]:null},makeUlHtml:function(setting,node,html,content){html.push("<ul id='",node.tId,consts.id.UL,"' class='",consts.className.LEVEL,node.level," ",view.makeUlLineClass(setting,node),"' style='display:",node.open?"block":"none","'>");html.push(content);html.push("</ul>")},makeUlLineClass:function(setting,node){return setting.view.showLine&&!node.isLastNode?consts.line.LINE:""},removeChildNodes:function(setting,node){if(!node)return;var nodes=data.nodeChildren(setting,node);if(!nodes)return;for(var i=0,l=nodes.length;i<l;i++){data.removeNodeCache(setting,nodes[i])}data.removeSelectedNode(setting);delete node[setting.data.key.children];if(!setting.data.keep.parent){data.nodeIsParent(setting,node,false);node.open=false;var tmp_switchObj=$$(node,consts.id.SWITCH,setting),tmp_icoObj=$$(node,consts.id.ICON,setting);view.replaceSwitchClass(node,tmp_switchObj,consts.folder.DOCU);view.replaceIcoClass(node,tmp_icoObj,consts.folder.DOCU);$$(node,consts.id.UL,setting).remove()}else{$$(node,consts.id.UL,setting).empty()}},scrollIntoView:function(setting,dom){if(!dom){return}if(typeof Element==="undefined"||typeof HTMLElement==="undefined"){var contRect=setting.treeObj.get(0).getBoundingClientRect(),findMeRect=dom.getBoundingClientRect();if(findMeRect.top<contRect.top||findMeRect.bottom>contRect.bottom||findMeRect.right>contRect.right||findMeRect.left<contRect.left){dom.scrollIntoView()}return}if(!Element.prototype.scrollIntoViewIfNeeded){Element.prototype.scrollIntoViewIfNeeded=function(centerIfNeeded){"use strict";function makeRange(start,length){return{start:start,length:length,end:start+length}}function coverRange(inner,outer){if(false===centerIfNeeded||outer.start<inner.end&&inner.start<outer.end){return Math.max(inner.end-outer.length,Math.min(outer.start,inner.start))}return(inner.start+inner.end-outer.length)/2}function makePoint(x,y){return{x:x,y:y,translate:function translate(dX,dY){return makePoint(x+dX,y+dY)}}}function absolute(elem,pt){while(elem){pt=pt.translate(elem.offsetLeft,elem.offsetTop);elem=elem.offsetParent}return pt}var target=absolute(this,makePoint(0,0)),extent=makePoint(this.offsetWidth,this.offsetHeight),elem=this.parentNode,origin;while(elem instanceof HTMLElement){origin=absolute(elem,makePoint(elem.clientLeft,elem.clientTop));elem.scrollLeft=coverRange(makeRange(target.x-origin.x,extent.x),makeRange(elem.scrollLeft,elem.clientWidth));elem.scrollTop=coverRange(makeRange(target.y-origin.y,extent.y),makeRange(elem.scrollTop,elem.clientHeight));target=target.translate(-elem.scrollLeft,-elem.scrollTop);elem=elem.parentNode}}}dom.scrollIntoViewIfNeeded()},setFirstNode:function(setting,parentNode){var children=data.nodeChildren(setting,parentNode);if(children.length>0){children[0].isFirstNode=true}},setLastNode:function(setting,parentNode){var children=data.nodeChildren(setting,parentNode);if(children.length>0){children[children.length-1].isLastNode=true}},removeNode:function(setting,node){var root=data.getRoot(setting),parentNode=node.parentTId?node.getParentNode():root;node.isFirstNode=false;node.isLastNode=false;node.getPreNode=function(){return null};node.getNextNode=function(){return null};if(!data.getNodeCache(setting,node.tId)){return}$$(node,setting).remove();data.removeNodeCache(setting,node);data.removeSelectedNode(setting,node);var children=data.nodeChildren(setting,parentNode);for(var i=0,l=children.length;i<l;i++){if(children[i].tId==node.tId){children.splice(i,1);break}}view.setFirstNode(setting,parentNode);view.setLastNode(setting,parentNode);var tmp_ulObj,tmp_switchObj,tmp_icoObj,childLength=children.length;if(!setting.data.keep.parent&&childLength==0){data.nodeIsParent(setting,parentNode,false);parentNode.open=false;delete parentNode[setting.data.key.children];tmp_ulObj=$$(parentNode,consts.id.UL,setting);tmp_switchObj=$$(parentNode,consts.id.SWITCH,setting);tmp_icoObj=$$(parentNode,consts.id.ICON,setting);view.replaceSwitchClass(parentNode,tmp_switchObj,consts.folder.DOCU);view.replaceIcoClass(parentNode,tmp_icoObj,consts.folder.DOCU);tmp_ulObj.css("display","none")}else if(setting.view.showLine&&childLength>0){var newLast=children[childLength-1];tmp_ulObj=$$(newLast,consts.id.UL,setting);tmp_switchObj=$$(newLast,consts.id.SWITCH,setting);tmp_icoObj=$$(newLast,consts.id.ICON,setting);if(parentNode==root){if(children.length==1){view.replaceSwitchClass(newLast,tmp_switchObj,consts.line.ROOT)}else{var tmp_first_switchObj=$$(children[0],consts.id.SWITCH,setting);view.replaceSwitchClass(children[0],tmp_first_switchObj,consts.line.ROOTS);view.replaceSwitchClass(newLast,tmp_switchObj,consts.line.BOTTOM)}}else{view.replaceSwitchClass(newLast,tmp_switchObj,consts.line.BOTTOM)}tmp_ulObj.removeClass(consts.line.LINE)}},replaceIcoClass:function(node,obj,newName){if(!obj||node.isAjaxing)return;var tmpName=obj.attr("class");if(tmpName==undefined)return;var tmpList=tmpName.split("_");switch(newName){case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:tmpList[tmpList.length-1]=newName;break}obj.attr("class",tmpList.join("_"))},replaceSwitchClass:function(node,obj,newName){if(!obj)return;var tmpName=obj.attr("class");if(tmpName==undefined)return;var tmpList=tmpName.split("_");switch(newName){case consts.line.ROOT:case consts.line.ROOTS:case consts.line.CENTER:case consts.line.BOTTOM:case consts.line.NOLINE:tmpList[0]=view.makeNodeLineClassEx(node)+newName;break;case consts.folder.OPEN:case consts.folder.CLOSE:case consts.folder.DOCU:tmpList[1]=newName;break}obj.attr("class",tmpList.join("_"));if(newName!==consts.folder.DOCU){obj.removeAttr("disabled")}else{obj.attr("disabled","disabled")}},selectNode:function(setting,node,addFlag){if(!addFlag){view.cancelPreSelectedNode(setting,null,node)}$$(node,consts.id.A,setting).addClass(consts.node.CURSELECTED);data.addSelectedNode(setting,node);setting.treeObj.trigger(consts.event.SELECTED,[setting.treeId,node])},setNodeFontCss:function(setting,treeNode){var aObj=$$(treeNode,consts.id.A,setting),fontCss=view.makeNodeFontCss(setting,treeNode);if(fontCss){aObj.css(fontCss)}},setNodeClasses:function(setting,treeNode){var aObj=$$(treeNode,consts.id.A,setting),classes=view.makeNodeClasses(setting,treeNode);if("add"in classes&&classes.add.length){aObj.addClass(classes.add.join(" "))}if("remove"in classes&&classes.remove.length){aObj.removeClass(classes.remove.join(" "))}},setNodeLineIcos:function(setting,node){if(!node)return;var switchObj=$$(node,consts.id.SWITCH,setting),ulObj=$$(node,consts.id.UL,setting),icoObj=$$(node,consts.id.ICON,setting),ulLine=view.makeUlLineClass(setting,node);if(ulLine.length==0){ulObj.removeClass(consts.line.LINE)}else{ulObj.addClass(ulLine)}switchObj.attr("class",view.makeNodeLineClass(setting,node));if(data.nodeIsParent(setting,node)){switchObj.removeAttr("disabled")}else{switchObj.attr("disabled","disabled")}icoObj.removeAttr("style");icoObj.attr("style",view.makeNodeIcoStyle(setting,node));icoObj.attr("class",view.makeNodeIcoClass(setting,node))},setNodeName:function(setting,node){var title=data.nodeTitle(setting,node),nObj=$$(node,consts.id.SPAN,setting);nObj.empty();if(setting.view.nameIsHTML){nObj.html(data.nodeName(setting,node))}else{nObj.text(data.nodeName(setting,node))}if(tools.apply(setting.view.showTitle,[setting.treeId,node],setting.view.showTitle)){var aObj=$$(node,consts.id.A,setting);aObj.attr("title",!title?"":title)}},setNodeTarget:function(setting,node){var aObj=$$(node,consts.id.A,setting);aObj.attr("target",view.makeNodeTarget(node))},setNodeUrl:function(setting,node){var aObj=$$(node,consts.id.A,setting),url=view.makeNodeUrl(setting,node);if(url==null||url.length==0){aObj.removeAttr("href")}else{aObj.attr("href",url)}},switchNode:function(setting,node){if(node.open||!tools.canAsync(setting,node)){view.expandCollapseNode(setting,node,!node.open)}else if(setting.async.enable){if(!view.asyncNode(setting,node)){view.expandCollapseNode(setting,node,!node.open);return}}else if(node){view.expandCollapseNode(setting,node,!node.open)}}};$.fn.zTree={consts:_consts,_z:{tools:tools,view:view,event:event,data:data},getZTreeObj:function(treeId){var o=data.getZTreeTools(treeId);return o?o:null},destroy:function(treeId){if(!!treeId&&treeId.length>0){view.destroy(data.getSetting(treeId))}else{for(var s in settings){view.destroy(settings[s])}}},init:function(obj,zSetting,zNodes){var setting=tools.clone(_setting);$.extend(true,setting,zSetting);setting.treeId=obj.attr("id");setting.treeObj=obj;setting.treeObj.empty();settings[setting.treeId]=setting;if(typeof document.body.style.maxHeight==="undefined"){setting.view.expandSpeed=""}data.initRoot(setting);var root=data.getRoot(setting);zNodes=zNodes?tools.clone(tools.isArray(zNodes)?zNodes:[zNodes]):[];if(setting.data.simpleData.enable){data.nodeChildren(setting,root,data.transformTozTreeFormat(setting,zNodes))}else{data.nodeChildren(setting,root,zNodes)}data.initCache(setting);event.unbindTree(setting);event.bindTree(setting);event.unbindEvent(setting);event.bindEvent(setting);var zTreeTools={setting:setting,addNodes:function(parentNode,index,newNodes,isSilent){if(!parentNode)parentNode=null;var isParent=data.nodeIsParent(setting,parentNode);if(parentNode&&!isParent&&setting.data.keep.leaf)return null;var i=parseInt(index,10);if(isNaN(i)){isSilent=!!newNodes;newNodes=index;index=-1}else{index=i}if(!newNodes)return null;var xNewNodes=tools.clone(tools.isArray(newNodes)?newNodes:[newNodes]);function addCallback(){view.addNodes(setting,parentNode,index,xNewNodes,isSilent==true)}if(tools.canAsync(setting,parentNode)){view.asyncNode(setting,parentNode,isSilent,addCallback)}else{addCallback()}return xNewNodes},cancelSelectedNode:function(node){view.cancelPreSelectedNode(setting,node)},destroy:function(){view.destroy(setting)},expandAll:function(expandFlag){expandFlag=!!expandFlag;view.expandCollapseSonNode(setting,null,expandFlag,true);return expandFlag},expandNode:function(node,expandFlag,sonSign,focus,callbackFlag){if(!node||!data.nodeIsParent(setting,node))return null;if(expandFlag!==true&&expandFlag!==false){expandFlag=!node.open}callbackFlag=!!callbackFlag;if(callbackFlag&&expandFlag&&tools.apply(setting.callback.beforeExpand,[setting.treeId,node],true)==false){return null}else if(callbackFlag&&!expandFlag&&tools.apply(setting.callback.beforeCollapse,[setting.treeId,node],true)==false){return null}if(expandFlag&&node.parentTId){view.expandCollapseParentNode(setting,node.getParentNode(),expandFlag,false)}if(expandFlag===node.open&&!sonSign){return null}data.getRoot(setting).expandTriggerFlag=callbackFlag;if(!tools.canAsync(setting,node)&&sonSign){view.expandCollapseSonNode(setting,node,expandFlag,true,showNodeFocus)}else{node.open=!expandFlag;view.switchNode(this.setting,node);showNodeFocus()}return expandFlag;function showNodeFocus(){var a=$$(node,consts.id.A,setting).get(0);if(a&&focus!==false){view.scrollIntoView(setting,a)}}},getNodes:function(){return data.getNodes(setting)},getNodeByParam:function(key,value,parentNode){if(!key)return null;return data.getNodeByParam(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),key,value)},getNodeByTId:function(tId){return data.getNodeCache(setting,tId)},getNodesByParam:function(key,value,parentNode){if(!key)return null;return data.getNodesByParam(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),key,value)},getNodesByParamFuzzy:function(key,value,parentNode){if(!key)return null;return data.getNodesByParamFuzzy(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),key,value)},getNodesByFilter:function(filter,isSingle,parentNode,invokeParam){isSingle=!!isSingle;if(!filter||typeof filter!="function")return isSingle?null:[];return data.getNodesByFilter(setting,parentNode?data.nodeChildren(setting,parentNode):data.getNodes(setting),filter,isSingle,invokeParam)},getNodeIndex:function(node){if(!node)return null;var parentNode=node.parentTId?node.getParentNode():data.getRoot(setting);var children=data.nodeChildren(setting,parentNode);for(var i=0,l=children.length;i<l;i++){if(children[i]==node)return i}return-1},getSelectedNodes:function(){var r=[],list=data.getRoot(setting).curSelectedList;for(var i=0,l=list.length;i<l;i++){r.push(list[i])}return r},isSelectedNode:function(node){return data.isSelectedNode(setting,node)},reAsyncChildNodesPromise:function(parentNode,reloadType,isSilent){var promise=new Promise((function(resolve,reject){try{zTreeTools.reAsyncChildNodes(parentNode,reloadType,isSilent,(function(){resolve(parentNode)}))}catch(e){reject(e)}}));return promise},reAsyncChildNodes:function(parentNode,reloadType,isSilent,callback){if(!this.setting.async.enable)return;var isRoot=!parentNode;if(isRoot){parentNode=data.getRoot(setting)}if(reloadType=="refresh"){var children=data.nodeChildren(setting,parentNode);for(var i=0,l=children?children.length:0;i<l;i++){data.removeNodeCache(setting,children[i])}data.removeSelectedNode(setting);data.nodeChildren(setting,parentNode,[]);if(isRoot){this.setting.treeObj.empty()}else{var ulObj=$$(parentNode,consts.id.UL,setting);ulObj.empty()}}view.asyncNode(this.setting,isRoot?null:parentNode,!!isSilent,callback)},refresh:function(){this.setting.treeObj.empty();var root=data.getRoot(setting),nodes=data.nodeChildren(setting,root);data.initRoot(setting);data.nodeChildren(setting,root,nodes);data.initCache(setting);view.createNodes(setting,0,data.nodeChildren(setting,root),null,-1)},removeChildNodes:function(node){if(!node)return null;var nodes=data.nodeChildren(setting,node);view.removeChildNodes(setting,node);return nodes?nodes:null},removeNode:function(node,callbackFlag){if(!node)return;callbackFlag=!!callbackFlag;if(callbackFlag&&tools.apply(setting.callback.beforeRemove,[setting.treeId,node],true)==false)return;view.removeNode(setting,node);if(callbackFlag){this.setting.treeObj.trigger(consts.event.REMOVE,[setting.treeId,node])}},selectNode:function(node,addFlag,isSilent){if(!node)return;if(tools.uCanDo(setting)){addFlag=setting.view.selectedMulti&&addFlag;if(node.parentTId){view.expandCollapseParentNode(setting,node.getParentNode(),true,false,showNodeFocus)}else if(!isSilent){try{$$(node,setting).focus().blur()}catch(e){}}view.selectNode(setting,node,addFlag)}function showNodeFocus(){if(isSilent){return}var a=$$(node,setting).get(0);view.scrollIntoView(setting,a)}},transformTozTreeNodes:function(simpleNodes){return data.transformTozTreeFormat(setting,simpleNodes)},transformToArray:function(nodes){return data.transformToArrayFormat(setting,nodes)},updateNode:function(node,checkTypeFlag){if(!node)return;var nObj=$$(node,setting);if(nObj.get(0)&&tools.uCanDo(setting)){view.setNodeName(setting,node);view.setNodeTarget(setting,node);view.setNodeUrl(setting,node);view.setNodeLineIcos(setting,node);view.setNodeFontCss(setting,node);view.setNodeClasses(setting,node)}}};root.treeTools=zTreeTools;data.setZTreeTools(setting,zTreeTools);var children=data.nodeChildren(setting,root);if(children&&children.length>0){view.createNodes(setting,0,children,null,-1)}else if(setting.async.enable&&setting.async.url&&setting.async.url!==""){view.asyncNode(setting)}return zTreeTools}};var zt=$.fn.zTree,$$=tools.$,consts=zt.consts})(jQuery);(function($){var _consts={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},_setting={check:{enable:false,autoCheckTrigger:false,chkStyle:_consts.checkbox.STYLE,nocheckInherit:false,chkDisabledInherit:false,radioType:_consts.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}},_initRoot=function(setting){var r=data.getRoot(setting);r.radioCheckedList=[]},_initCache=function(treeId){},_bindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.bind(c.CHECK,(function(event,srcEvent,treeId,node){event.srcEvent=srcEvent;tools.apply(setting.callback.onCheck,[event,treeId,node])}))},_unbindEvent=function(setting){var o=setting.treeObj,c=consts.event;o.unbind(c.CHECK)},_eventProxy=function(e){var target=e.target,setting=data.getSetting(e.data.treeId),tId="",node=null,nodeEventType="",treeEventType="",nodeEventCallback=null,treeEventCallback=null;if(tools.eqs(e.type,"mouseover")){if(setting.check.enable&&tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.CHECK)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="mouseoverCheck"}}else if(tools.eqs(e.type,"mouseout")){if(setting.check.enable&&tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.CHECK)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="mouseoutCheck"}}else if(tools.eqs(e.type,"click")){if(setting.check.enable&&tools.eqs(target.tagName,"span")&&target.getAttribute("treeNode"+consts.id.CHECK)!==null){tId=tools.getNodeMainDom(target).id;nodeEventType="checkNode"}}if(tId.length>0){node=data.getNodeCache(setting,tId);switch(nodeEventType){case"checkNode":nodeEventCallback=_handler.onCheckNode;break;case"mouseoverCheck":nodeEventCallback=_handler.onMouseoverCheck;break;case"mouseoutCheck":nodeEventCallback=_handler.onMouseoutCheck;break}}var proxyResult={stop:nodeEventType==="checkNode",node:node,nodeEventType:nodeEventType,nodeEventCallback:nodeEventCallback,treeEventType:treeEventType,treeEventCallback:treeEventCallback};return proxyResult},_initNode=function(setting,level,n,parentNode,isFirstNode,isLastNode,openFlag){if(!n)return;var checked=data.nodeChecked(setting,n);n.checkedOld=checked;if(typeof n.nocheck=="string")n.nocheck=tools.eqs(n.nocheck,"true");n.nocheck=!!n.nocheck||setting.check.nocheckInherit&&parentNode&&!!parentNode.nocheck;if(typeof n.chkDisabled=="string")n.chkDisabled=tools.eqs(n.chkDisabled,"true");n.chkDisabled=!!n.chkDisabled||setting.check.chkDisabledInherit&&parentNode&&!!parentNode.chkDisabled;if(typeof n.halfCheck=="string")n.halfCheck=tools.eqs(n.halfCheck,"true");n.halfCheck=!!n.halfCheck;n.check_Child_State=-1;n.check_Focus=false;n.getCheckStatus=function(){return data.getCheckStatus(setting,n)};if(setting.check.chkStyle==consts.radio.STYLE&&setting.check.radioType==consts.radio.TYPE_ALL&&checked){var r=data.getRoot(setting);r.radioCheckedList.push(n)}},_beforeA=function(setting,node,html){if(setting.check.enable){data.makeChkFlag(setting,node);html.push("<span ID='",node.tId,consts.id.CHECK,"' class='",view.makeChkClass(setting,node),"' treeNode",consts.id.CHECK,node.nocheck===true?" style='display:none;'":"","></span>")}},_zTreeTools=function(setting,zTreeTools){zTreeTools.checkNode=function(node,checked,checkTypeFlag,callbackFlag){var nodeChecked=data.nodeChecked(setting,node);if(node.chkDisabled===true)return;if(checked!==true&&checked!==false){checked=!nodeChecked}callbackFlag=!!callbackFlag;if(nodeChecked===checked&&!checkTypeFlag){return}else if(callbackFlag&&tools.apply(this.setting.callback.beforeCheck,[this.setting.treeId,node],true)==false){return}if(tools.uCanDo(this.setting)&&this.setting.check.enable&&node.nocheck!==true){data.nodeChecked(setting,node,checked);var checkObj=$$(node,consts.id.CHECK,this.setting);if(checkTypeFlag||this.setting.check.chkStyle===consts.radio.STYLE)view.checkNodeRelation(this.setting,node);view.setChkClass(this.setting,checkObj,node);view.repairParentChkClassWithSelf(this.setting,node);if(callbackFlag){this.setting.treeObj.trigger(consts.event.CHECK,[null,this.setting.treeId,node])}}};zTreeTools.checkAllNodes=function(checked){view.repairAllChk(this.setting,!!checked)};zTreeTools.getCheckedNodes=function(checked){checked=checked!==false;var children=data.nodeChildren(setting,data.getRoot(this.setting));return data.getTreeCheckedNodes(this.setting,children,checked)};zTreeTools.getChangeCheckedNodes=function(){var children=data.nodeChildren(setting,data.getRoot(this.setting));return data.getTreeChangeCheckedNodes(this.setting,children)};zTreeTools.setChkDisabled=function(node,disabled,inheritParent,inheritChildren){disabled=!!disabled;inheritParent=!!inheritParent;inheritChildren=!!inheritChildren;view.repairSonChkDisabled(this.setting,node,disabled,inheritChildren);view.repairParentChkDisabled(this.setting,node.getParentNode(),disabled,inheritParent)};var _updateNode=zTreeTools.updateNode;zTreeTools.updateNode=function(node,checkTypeFlag){if(_updateNode)_updateNode.apply(zTreeTools,arguments);if(!node||!this.setting.check.enable)return;var nObj=$$(node,this.setting);if(nObj.get(0)&&tools.uCanDo(this.setting)){var checkObj=$$(node,consts.id.CHECK,this.setting);if(checkTypeFlag==true||this.setting.check.chkStyle===consts.radio.STYLE)view.checkNodeRelation(this.setting,node);view.setChkClass(this.setting,checkObj,node);view.repairParentChkClassWithSelf(this.setting,node)}}},_data={getRadioCheckedList:function(setting){var checkedList=data.getRoot(setting).radioCheckedList;for(var i=0,j=checkedList.length;i<j;i++){if(!data.getNodeCache(setting,checkedList[i].tId)){checkedList.splice(i,1);i--;j--}}return checkedList},getCheckStatus:function(setting,node){if(!setting.check.enable||node.nocheck||node.chkDisabled)return null;var checked=data.nodeChecked(setting,node),r={checked:checked,half:node.halfCheck?node.halfCheck:setting.check.chkStyle==consts.radio.STYLE?node.check_Child_State===2:checked?node.check_Child_State>-1&&node.check_Child_State<2:node.check_Child_State>0};return r},getTreeCheckedNodes:function(setting,nodes,checked,results){if(!nodes)return[];var onlyOne=checked&&setting.check.chkStyle==consts.radio.STYLE&&setting.check.radioType==consts.radio.TYPE_ALL;results=!results?[]:results;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];var children=data.nodeChildren(setting,node);var nodeChecked=data.nodeChecked(setting,node);if(node.nocheck!==true&&node.chkDisabled!==true&&nodeChecked==checked){results.push(node);if(onlyOne){break}}data.getTreeCheckedNodes(setting,children,checked,results);if(onlyOne&&results.length>0){break}}return results},getTreeChangeCheckedNodes:function(setting,nodes,results){if(!nodes)return[];results=!results?[]:results;for(var i=0,l=nodes.length;i<l;i++){var node=nodes[i];var children=data.nodeChildren(setting,node);var nodeChecked=data.nodeChecked(setting,node);if(node.nocheck!==true&&node.chkDisabled!==true&&nodeChecked!=node.checkedOld){results.push(node)}data.getTreeChangeCheckedNodes(setting,children,results)}return results},makeChkFlag:function(setting,node){if(!node)return;var chkFlag=-1;var children=data.nodeChildren(setting,node);if(children){for(var i=0,l=children.length;i<l;i++){var cNode=children[i];var nodeChecked=data.nodeChecked(setting,cNode);var tmp=-1;if(setting.check.chkStyle==consts.radio.STYLE){if(cNode.nocheck===true||cNode.chkDisabled===true){tmp=cNode.check_Child_State}else if(cNode.halfCheck===true){tmp=2}else if(nodeChecked){tmp=2}else{tmp=cNode.check_Child_State>0?2:0}if(tmp==2){chkFlag=2;break}else if(tmp==0){chkFlag=0}}else if(setting.check.chkStyle==consts.checkbox.STYLE){if(cNode.nocheck===true||cNode.chkDisabled===true){tmp=cNode.check_Child_State}else if(cNode.halfCheck===true){tmp=1}else if(nodeChecked){tmp=cNode.check_Child_State===-1||cNode.check_Child_State===2?2:1}else{tmp=cNode.check_Child_State>0?1:0}if(tmp===1){chkFlag=1;break}else if(tmp===2&&chkFlag>-1&&i>0&&tmp!==chkFlag){chkFlag=1;break}else if(chkFlag===2&&tmp>-1&&tmp<2){chkFlag=1;break}else if(tmp>-1){chkFlag=tmp}}}}node.check_Child_State=chkFlag}},_event={},_handler={onCheckNode:function(event,node){if(node.chkDisabled===true)return false;var setting=data.getSetting(event.data.treeId);if(tools.apply(setting.callback.beforeCheck,[setting.treeId,node],true)==false)return true;var nodeChecked=data.nodeChecked(setting,node);data.nodeChecked(setting,node,!nodeChecked);view.checkNodeRelation(setting,node);var checkObj=$$(node,consts.id.CHECK,setting);view.setChkClass(setting,checkObj,node);view.repairParentChkClassWithSelf(setting,node);setting.treeObj.trigger(consts.event.CHECK,[event,setting.treeId,node]);return true},onMouseoverCheck:function(event,node){if(node.chkDisabled===true)return false;var setting=data.getSetting(event.data.treeId),checkObj=$$(node,consts.id.CHECK,setting);node.check_Focus=true;view.setChkClass(setting,checkObj,node);return true},onMouseoutCheck:function(event,node){if(node.chkDisabled===true)return false;var setting=data.getSetting(event.data.treeId),checkObj=$$(node,consts.id.CHECK,setting);node.check_Focus=false;view.setChkClass(setting,checkObj,node);return true}},_tools={},_view={checkNodeRelation:function(setting,node){var pNode,i,l,r=consts.radio;var nodeChecked=data.nodeChecked(setting,node);if(setting.check.chkStyle==r.STYLE){var checkedList=data.getRadioCheckedList(setting);if(nodeChecked){if(setting.check.radioType==r.TYPE_ALL){for(i=checkedList.length-1;i>=0;i--){pNode=checkedList[i];var pNodeChecked=data.nodeChecked(setting,pNode);if(pNodeChecked&&pNode!=node){data.nodeChecked(setting,pNode,false);checkedList.splice(i,1);view.setChkClass(setting,$$(pNode,consts.id.CHECK,setting),pNode);if(pNode.parentTId!=node.parentTId){view.repairParentChkClassWithSelf(setting,pNode)}}}checkedList.push(node)}else{var parentNode=node.parentTId?node.getParentNode():data.getRoot(setting);var children=data.nodeChildren(setting,parentNode);for(i=0,l=children.length;i<l;i++){pNode=children[i];var pNodeChecked=data.nodeChecked(setting,pNode);if(pNodeChecked&&pNode!=node){data.nodeChecked(setting,pNode,false);view.setChkClass(setting,$$(pNode,consts.id.CHECK,setting),pNode)}}}}else if(setting.check.radioType==r.TYPE_ALL){for(i=0,l=checkedList.length;i<l;i++){if(node==checkedList[i]){checkedList.splice(i,1);break}}}}else{var children=data.nodeChildren(setting,node);if(nodeChecked&&(!children||children.length==0||setting.check.chkboxType.Y.indexOf("s")>-1)){view.setSonNodeCheckBox(setting,node,true)}if(!nodeChecked&&(!children||children.length==0||setting.check.chkboxType.N.indexOf("s")>-1)){view.setSonNodeCheckBox(setting,node,false)}if(nodeChecked&&setting.check.chkboxType.Y.indexOf("p")>-1){view.setParentNodeCheckBox(setting,node,true)}if(!nodeChecked&&setting.check.chkboxType.N.indexOf("p")>-1){view.setParentNodeCheckBox(setting,node,false)}}},makeChkClass:function(setting,node){var c=consts.checkbox,r=consts.radio,fullStyle="";var nodeChecked=data.nodeChecked(setting,node);if(node.chkDisabled===true){fullStyle=c.DISABLED}else if(node.halfCheck){fullStyle=c.PART}else if(setting.check.chkStyle==r.STYLE){fullStyle=node.check_Child_State<1?c.FULL:c.PART}else{fullStyle=nodeChecked?node.check_Child_State===2||node.check_Child_State===-1?c.FULL:c.PART:node.check_Child_State<1?c.FULL:c.PART}var chkName=setting.check.chkStyle+"_"+(nodeChecked?c.TRUE:c.FALSE)+"_"+fullStyle;chkName=node.check_Focus&&node.chkDisabled!==true?chkName+"_"+c.FOCUS:chkName;return consts.className.BUTTON+" "+c.DEFAULT+" "+chkName},repairAllChk:function(setting,checked){if(setting.check.enable&&setting.check.chkStyle===consts.checkbox.STYLE){var root=data.getRoot(setting);var children=data.nodeChildren(setting,root);for(var i=0,l=children.length;i<l;i++){var node=children[i];if(node.nocheck!==true&&node.chkDisabled!==true){data.nodeChecked(setting,node,checked)}view.setSonNodeCheckBox(setting,node,checked)}}},repairChkClass:function(setting,node){if(!node)return;data.makeChkFlag(setting,node);if(node.nocheck!==true){var checkObj=$$(node,consts.id.CHECK,setting);view.setChkClass(setting,checkObj,node)}},repairParentChkClass:function(setting,node){if(!node||!node.parentTId)return;var pNode=node.getParentNode();view.repairChkClass(setting,pNode);view.repairParentChkClass(setting,pNode)},repairParentChkClassWithSelf:function(setting,node){if(!node)return;var children=data.nodeChildren(setting,node);if(children&&children.length>0){view.repairParentChkClass(setting,children[0])}else{view.repairParentChkClass(setting,node)}},repairSonChkDisabled:function(setting,node,chkDisabled,inherit){if(!node)return;if(node.chkDisabled!=chkDisabled){node.chkDisabled=chkDisabled}view.repairChkClass(setting,node);var children=data.nodeChildren(setting,node);if(children&&inherit){for(var i=0,l=children.length;i<l;i++){var sNode=children[i];view.repairSonChkDisabled(setting,sNode,chkDisabled,inherit)}}},repairParentChkDisabled:function(setting,node,chkDisabled,inherit){if(!node)return;if(node.chkDisabled!=chkDisabled&&inherit){node.chkDisabled=chkDisabled}view.repairChkClass(setting,node);view.repairParentChkDisabled(setting,node.getParentNode(),chkDisabled,inherit)},setChkClass:function(setting,obj,node){if(!obj)return;if(node.nocheck===true){obj.hide()}else{obj.show()}obj.attr("class",view.makeChkClass(setting,node))},setParentNodeCheckBox:function(setting,node,value,srcNode){var checkObj=$$(node,consts.id.CHECK,setting);if(!srcNode)srcNode=node;data.makeChkFlag(setting,node);if(node.nocheck!==true&&node.chkDisabled!==true){data.nodeChecked(setting,node,value);view.setChkClass(setting,checkObj,node);if(setting.check.autoCheckTrigger&&node!=srcNode){setting.treeObj.trigger(consts.event.CHECK,[null,setting.treeId,node])}}if(node.parentTId){var pSign=true;if(!value){var pNodes=data.nodeChildren(setting,node.getParentNode());for(var i=0,l=pNodes.length;i<l;i++){var pNode=pNodes[i];var nodeChecked=data.nodeChecked(setting,pNode);if(pNode.nocheck!==true&&pNode.chkDisabled!==true&&nodeChecked||(pNode.nocheck===true||pNode.chkDisabled===true)&&pNode.check_Child_State>0){pSign=false;break}}}if(pSign){view.setParentNodeCheckBox(setting,node.getParentNode(),value,srcNode)}}},setSonNodeCheckBox:function(setting,node,value,srcNode){if(!node)return;var checkObj=$$(node,consts.id.CHECK,setting);if(!srcNode)srcNode=node;var hasDisable=false;var children=data.nodeChildren(setting,node);if(children){for(var i=0,l=children.length;i<l;i++){var sNode=children[i];view.setSonNodeCheckBox(setting,sNode,value,srcNode);if(sNode.chkDisabled===true)hasDisable=true}}if(node!=data.getRoot(setting)&&node.chkDisabled!==true){if(hasDisable&&node.nocheck!==true){data.makeChkFlag(setting,node)}if(node.nocheck!==true&&node.chkDisabled!==true){data.nodeChecked(setting,node,value);if(!hasDisable)node.check_Child_State=children&&children.length>0?value?2:0:-1}else{node.check_Child_State=-1}view.setChkClass(setting,checkObj,node);if(setting.check.autoCheckTrigger&&node!=srcNode&&node.nocheck!==true&&node.chkDisabled!==true){setting.treeObj.trigger(consts.event.CHECK,[null,setting.treeId,node])}}}},_z={tools:_tools,view:_view,event:_event,data:_data};$.extend(true,$.fn.zTree.consts,_consts);$.extend(true,$.fn.zTree._z,_z);var zt=$.fn.zTree,tools=zt._z.tools,consts=zt.consts,view=zt._z.view,data=zt._z.data,event=zt._z.event,$$=tools.$;data.nodeChecked=function(setting,node,newChecked){if(!node){return false}var key=setting.data.key.checked;if(typeof newChecked!=="undefined"){if(typeof newChecked==="string"){newChecked=tools.eqs(newChecked,"true")}newChecked=!!newChecked;node[key]=newChecked}else if(typeof node[key]=="string"){node[key]=tools.eqs(node[key],"true")}else{node[key]=!!node[key]}return node[key]};data.exSetting(_setting);data.addInitBind(_bindEvent);data.addInitUnBind(_unbindEvent);data.addInitCache(_initCache);data.addInitNode(_initNode);data.addInitProxy(_eventProxy,true);data.addInitRoot(_initRoot);data.addBeforeA(_beforeA);data.addZTreeTools(_zTreeTools);var _createNodes=view.createNodes;view.createNodes=function(setting,level,nodes,parentNode,index){if(_createNodes)_createNodes.apply(view,arguments);if(!nodes)return;view.repairParentChkClassWithSelf(setting,parentNode)};var _removeNode=view.removeNode;view.removeNode=function(setting,node){var parentNode=node.getParentNode();if(_removeNode)_removeNode.apply(view,arguments);if(!node||!parentNode)return;view.repairChkClass(setting,parentNode);view.repairParentChkClass(setting,parentNode)};var _appendNodes=view.appendNodes;view.appendNodes=function(setting,level,nodes,parentNode,index,initFlag,openFlag){var html="";if(_appendNodes){html=_appendNodes.apply(view,arguments)}if(parentNode){data.makeChkFlag(setting,parentNode)}return html}})(jQuery);(function($){var _consts={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},_setting={edit:{enable:false,editNameSelectAll:false,showRemoveBtn:true,showRenameBtn:true,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:false,isCopy:true,isMove:true,prev:true,next:true,inner:true,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}},_initRoot=function(setting){var r=data.getRoot(setting),rs=data.getRoots();r.curEditNode=null;r.curEditInput=null;r.curHoverNode=null;r.dragFlag=0;r.dragNodeShowBefore=[];r.dragMaskList=new Array;rs.showHoverDom=true},_initCache=function(treeId){},_bindEvent=function(setting){var o=setting.treeObj;var c=consts.event;o.bind(c.RENAME,(function(event,treeId,treeNode,isCancel){tools.apply(setting.callback.onRename,[event,treeId,treeNode,isCancel])}));o.bind(c.DRAG,(function(event,srcEvent,treeId,treeNodes){tools.apply(setting.callback.onDrag,[srcEvent,treeId,treeNodes])}));o.bind(c.DRAGMOVE,(function(event,srcEvent,treeId,treeNodes){tools.apply(setting.callback.onDragMove,[srcEvent,treeId,treeNodes])}));o.bind(c.DROP,(function(event,srcEvent,treeId,treeNodes,targetNode,moveType,isCopy){tools.apply(setting.callback.onDrop,[srcEvent,treeId,treeNodes,targetNode,moveType,isCopy])}))},_unbindEvent=function(setting){var o=setting.treeObj;var c=consts.event;o.unbind(c.RENAME);o.unbind(c.DRAG);o.unbind(c.DRAGMOVE);o.unbind(c.DROP)},_eventProxy=function(e){var target=e.target,setting=data.getSetting(e.data.treeId),relatedTarget=e.relatedTarget,tId="",node=null,nodeEventType="",treeEventType="",nodeEventCallback=null,treeEventCallback=null,tmp=null;if(tools.eqs(e.type,"mouseover")){tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="hoverOverNode"}}else if(tools.eqs(e.type,"mouseout")){tmp=tools.getMDom(setting,relatedTarget,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(!tmp){tId="remove";nodeEventType="hoverOutNode"}}else if(tools.eqs(e.type,"mousedown")){tmp=tools.getMDom(setting,target,[{tagName:"a",attrName:"treeNode"+consts.id.A}]);if(tmp){tId=tools.getNodeMainDom(tmp).id;nodeEventType="mousedownNode"}}if(tId.length>0){node=data.getNodeCache(setting,tId);switch(nodeEventType){case"mousedownNode":nodeEventCallback=_handler.onMousedownNode;break;case"hoverOverNode":nodeEventCallback=_handler.onHoverOverNode;break;case"hoverOutNode":nodeEventCallback=_handler.onHoverOutNode;break}}var proxyResult={stop:false,node:node,nodeEventType:nodeEventType,nodeEventCallback:nodeEventCallback,treeEventType:treeEventType,treeEventCallback:treeEventCallback};return proxyResult},_initNode=function(setting,level,n,parentNode,isFirstNode,isLastNode,openFlag){if(!n)return;n.isHover=false;n.editNameFlag=false},_zTreeTools=function(setting,zTreeTools){zTreeTools.cancelEditName=function(newName){var root=data.getRoot(this.setting);if(!root.curEditNode)return;view.cancelCurEditNode(this.setting,newName?newName:null,true)};zTreeTools.copyNode=function(targetNode,node,moveType,isSilent){if(!node)return null;var isParent=data.nodeIsParent(setting,targetNode);if(targetNode&&!isParent&&this.setting.data.keep.leaf&&moveType===consts.move.TYPE_INNER)return null;var _this=this,newNode=tools.clone(node);if(!targetNode){targetNode=null;moveType=consts.move.TYPE_INNER}if(moveType==consts.move.TYPE_INNER){function copyCallback(){view.addNodes(_this.setting,targetNode,-1,[newNode],isSilent)}if(tools.canAsync(this.setting,targetNode)){view.asyncNode(this.setting,targetNode,isSilent,copyCallback)}else{copyCallback()}}else{view.addNodes(this.setting,targetNode.parentNode,-1,[newNode],isSilent);view.moveNode(this.setting,targetNode,newNode,moveType,false,isSilent)}return newNode};zTreeTools.editName=function(node){if(!node||!node.tId||node!==data.getNodeCache(this.setting,node.tId))return;if(node.parentTId)view.expandCollapseParentNode(this.setting,node.getParentNode(),true);view.editNode(this.setting,node)};zTreeTools.moveNode=function(targetNode,node,moveType,isSilent){if(!node)return node;var isParent=data.nodeIsParent(setting,targetNode);if(targetNode&&!isParent&&this.setting.data.keep.leaf&&moveType===consts.move.TYPE_INNER){return null}else if(targetNode&&(node.parentTId==targetNode.tId&&moveType==consts.move.TYPE_INNER||$$(node,this.setting).find("#"+targetNode.tId).length>0)){return null}else if(!targetNode){targetNode=null}var _this=this;function moveCallback(){view.moveNode(_this.setting,targetNode,node,moveType,false,isSilent)}if(tools.canAsync(this.setting,targetNode)&&moveType===consts.move.TYPE_INNER){view.asyncNode(this.setting,targetNode,isSilent,moveCallback)}else{moveCallback()}return node};zTreeTools.setEditable=function(editable){this.setting.edit.enable=editable;return this.refresh()}},_data={setSonNodeLevel:function(setting,parentNode,node){if(!node)return;var children=data.nodeChildren(setting,node);var oldLevel=node.level;node.level=parentNode?parentNode.level+1:0;view.repairNodeLevelClass(setting,node,oldLevel);if(!children)return;for(var i=0,l=children.length;i<l;i++){if(children[i])data.setSonNodeLevel(setting,node,children[i])}}},_event={},_handler={onHoverOverNode:function(event,node){var setting=data.getSetting(event.data.treeId),root=data.getRoot(setting);if(root.curHoverNode!=node){_handler.onHoverOutNode(event)}root.curHoverNode=node;view.addHoverDom(setting,node)},onHoverOutNode:function(event,node){var setting=data.getSetting(event.data.treeId),root=data.getRoot(setting);if(root.curHoverNode&&!data.isSelectedNode(setting,root.curHoverNode)){view.removeTreeDom(setting,root.curHoverNode);root.curHoverNode=null}},onMousedownNode:function(eventMouseDown,_node){var i,l,setting=data.getSetting(eventMouseDown.data.treeId),root=data.getRoot(setting),roots=data.getRoots();if(eventMouseDown.button==2||!setting.edit.enable||!setting.edit.drag.isCopy&&!setting.edit.drag.isMove)return true;var target=eventMouseDown.target,_nodes=data.getRoot(setting).curSelectedList,nodes=[];if(!data.isSelectedNode(setting,_node)){nodes=[_node]}else{for(i=0,l=_nodes.length;i<l;i++){if(_nodes[i].editNameFlag&&tools.eqs(target.tagName,"input")&&target.getAttribute("treeNode"+consts.id.INPUT)!==null){return true}nodes.push(_nodes[i]);if(nodes[0].parentTId!==_nodes[i].parentTId){nodes=[_node];break}}}view.editNodeBlur=true;view.cancelCurEditNode(setting);var doc=$(setting.treeObj.get(0).ownerDocument),body=$(setting.treeObj.get(0).ownerDocument.body),curNode,tmpArrow,tmpTarget,isOtherTree=false,targetSetting=setting,sourceSetting=setting,preNode,nextNode,preTmpTargetNodeId=null,preTmpMoveType=null,tmpTargetNodeId=null,moveType=consts.move.TYPE_INNER,mouseDownX=eventMouseDown.clientX,mouseDownY=eventMouseDown.clientY,startTime=(new Date).getTime();if(tools.uCanDo(setting)){doc.bind("mousemove",_docMouseMove)}function _docMouseMove(event){if(root.dragFlag==0&&Math.abs(mouseDownX-event.clientX)<setting.edit.drag.minMoveSize&&Math.abs(mouseDownY-event.clientY)<setting.edit.drag.minMoveSize){return true}var i,l,tmpNode,tmpDom,tmpNodes;body.css("cursor","pointer");if(root.dragFlag==0){if(tools.apply(setting.callback.beforeDrag,[setting.treeId,nodes],true)==false){_docMouseUp(event);return true}for(i=0,l=nodes.length;i<l;i++){if(i==0){root.dragNodeShowBefore=[]}tmpNode=nodes[i];if(data.nodeIsParent(setting,tmpNode)&&tmpNode.open){view.expandCollapseNode(setting,tmpNode,!tmpNode.open);root.dragNodeShowBefore[tmpNode.tId]=true}else{root.dragNodeShowBefore[tmpNode.tId]=false}}root.dragFlag=1;roots.showHoverDom=false;tools.showIfameMask(setting,true);var isOrder=true,lastIndex=-1;if(nodes.length>1){var pNodes=nodes[0].parentTId?data.nodeChildren(setting,nodes[0].getParentNode()):data.getNodes(setting);tmpNodes=[];for(i=0,l=pNodes.length;i<l;i++){if(root.dragNodeShowBefore[pNodes[i].tId]!==undefined){if(isOrder&&lastIndex>-1&&lastIndex+1!==i){isOrder=false}tmpNodes.push(pNodes[i]);lastIndex=i}if(nodes.length===tmpNodes.length){nodes=tmpNodes;break}}}if(isOrder){preNode=nodes[0].getPreNode();nextNode=nodes[nodes.length-1].getNextNode()}curNode=$$("<ul class='zTreeDragUL'></ul>",setting);for(i=0,l=nodes.length;i<l;i++){tmpNode=nodes[i];tmpNode.editNameFlag=false;view.selectNode(setting,tmpNode,i>0);view.removeTreeDom(setting,tmpNode);if(i>setting.edit.drag.maxShowNodeNum-1){continue}tmpDom=$$("<li id='"+tmpNode.tId+"_tmp'></li>",setting);tmpDom.append($$(tmpNode,consts.id.A,setting).clone());tmpDom.css("padding","0");tmpDom.children("#"+tmpNode.tId+consts.id.A).removeClass(consts.node.CURSELECTED);curNode.append(tmpDom);if(i==setting.edit.drag.maxShowNodeNum-1){tmpDom=$$("<li id='"+tmpNode.tId+"_moretmp'><a> ... </a></li>",setting);curNode.append(tmpDom)}}curNode.attr("id",nodes[0].tId+consts.id.UL+"_tmp");curNode.addClass(setting.treeObj.attr("class"));curNode.appendTo(body);tmpArrow=$$("<span class='tmpzTreeMove_arrow'></span>",setting);tmpArrow.attr("id","zTreeMove_arrow_tmp");tmpArrow.appendTo(body);setting.treeObj.trigger(consts.event.DRAG,[event,setting.treeId,nodes])}if(root.dragFlag==1){if(tmpTarget&&tmpArrow.attr("id")==event.target.id&&tmpTargetNodeId&&event.clientX+doc.scrollLeft()+2>$("#"+tmpTargetNodeId+consts.id.A,tmpTarget).offset().left){var xT=$("#"+tmpTargetNodeId+consts.id.A,tmpTarget);event.target=xT.length>0?xT.get(0):event.target}else if(tmpTarget){tmpTarget.removeClass(consts.node.TMPTARGET_TREE);if(tmpTargetNodeId)$("#"+tmpTargetNodeId+consts.id.A,tmpTarget).removeClass(consts.node.TMPTARGET_NODE+"_"+consts.move.TYPE_PREV).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_INNER)}tmpTarget=null;tmpTargetNodeId=null;isOtherTree=false;targetSetting=setting;var settings=data.getSettings();for(var s in settings){if(settings[s].treeId&&settings[s].edit.enable&&settings[s].treeId!=setting.treeId&&(event.target.id==settings[s].treeId||$(event.target).parents("#"+settings[s].treeId).length>0)){isOtherTree=true;targetSetting=settings[s]}}var docScrollTop=doc.scrollTop(),docScrollLeft=doc.scrollLeft(),treeOffset=targetSetting.treeObj.offset(),scrollHeight=targetSetting.treeObj.get(0).scrollHeight,scrollWidth=targetSetting.treeObj.get(0).scrollWidth,dTop=event.clientY+docScrollTop-treeOffset.top,dBottom=targetSetting.treeObj.height()+treeOffset.top-event.clientY-docScrollTop,dLeft=event.clientX+docScrollLeft-treeOffset.left,dRight=targetSetting.treeObj.width()+treeOffset.left-event.clientX-docScrollLeft,isTop=dTop<setting.edit.drag.borderMax&&dTop>setting.edit.drag.borderMin,isBottom=dBottom<setting.edit.drag.borderMax&&dBottom>setting.edit.drag.borderMin,isLeft=dLeft<setting.edit.drag.borderMax&&dLeft>setting.edit.drag.borderMin,isRight=dRight<setting.edit.drag.borderMax&&dRight>setting.edit.drag.borderMin,isTreeInner=dTop>setting.edit.drag.borderMin&&dBottom>setting.edit.drag.borderMin&&dLeft>setting.edit.drag.borderMin&&dRight>setting.edit.drag.borderMin,isTreeTop=isTop&&targetSetting.treeObj.scrollTop()<=0,isTreeBottom=isBottom&&targetSetting.treeObj.scrollTop()+targetSetting.treeObj.height()+10>=scrollHeight,isTreeLeft=isLeft&&targetSetting.treeObj.scrollLeft()<=0,isTreeRight=isRight&&targetSetting.treeObj.scrollLeft()+targetSetting.treeObj.width()+10>=scrollWidth;if(event.target&&tools.isChildOrSelf(event.target,targetSetting.treeId)){var targetObj=event.target;while(targetObj&&targetObj.tagName&&!tools.eqs(targetObj.tagName,"li")&&targetObj.id!=targetSetting.treeId){targetObj=targetObj.parentNode}var canMove=true;for(i=0,l=nodes.length;i<l;i++){tmpNode=nodes[i];if(targetObj.id===tmpNode.tId){canMove=false;break}else if($$(tmpNode,setting).find("#"+targetObj.id).length>0){canMove=false;break}}if(canMove&&event.target&&tools.isChildOrSelf(event.target,targetObj.id+consts.id.A)){tmpTarget=$(targetObj);tmpTargetNodeId=targetObj.id}}tmpNode=nodes[0];if(isTreeInner&&tools.isChildOrSelf(event.target,targetSetting.treeId)){if(!tmpTarget&&(event.target.id==targetSetting.treeId||isTreeTop||isTreeBottom||isTreeLeft||isTreeRight)&&(isOtherTree||!isOtherTree&&tmpNode.parentTId)){tmpTarget=targetSetting.treeObj}if(isTop){targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()-10)}else if(isBottom){targetSetting.treeObj.scrollTop(targetSetting.treeObj.scrollTop()+10)}if(isLeft){targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()-10)}else if(isRight){targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+10)}if(tmpTarget&&tmpTarget!=targetSetting.treeObj&&tmpTarget.offset().left<targetSetting.treeObj.offset().left){targetSetting.treeObj.scrollLeft(targetSetting.treeObj.scrollLeft()+tmpTarget.offset().left-targetSetting.treeObj.offset().left)}}curNode.css({top:event.clientY+docScrollTop+3+"px",left:event.clientX+docScrollLeft+3+"px"});var dX=0;var dY=0;if(tmpTarget&&tmpTarget.attr("id")!=targetSetting.treeId){var tmpTargetNode=tmpTargetNodeId==null?null:data.getNodeCache(targetSetting,tmpTargetNodeId),isCopy=(event.ctrlKey||event.metaKey)&&setting.edit.drag.isMove&&setting.edit.drag.isCopy||!setting.edit.drag.isMove&&setting.edit.drag.isCopy,isPrev=!!(preNode&&tmpTargetNodeId===preNode.tId),isNext=!!(nextNode&&tmpTargetNodeId===nextNode.tId),isInner=tmpNode.parentTId&&tmpNode.parentTId==tmpTargetNodeId,canPrev=(isCopy||!isNext)&&tools.apply(targetSetting.edit.drag.prev,[targetSetting.treeId,nodes,tmpTargetNode],!!targetSetting.edit.drag.prev),canNext=(isCopy||!isPrev)&&tools.apply(targetSetting.edit.drag.next,[targetSetting.treeId,nodes,tmpTargetNode],!!targetSetting.edit.drag.next),canInner=(isCopy||!isInner)&&!(targetSetting.data.keep.leaf&&!data.nodeIsParent(setting,tmpTargetNode))&&tools.apply(targetSetting.edit.drag.inner,[targetSetting.treeId,nodes,tmpTargetNode],!!targetSetting.edit.drag.inner);function clearMove(){tmpTarget=null;tmpTargetNodeId="";moveType=consts.move.TYPE_INNER;tmpArrow.css({display:"none"});if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}}if(!canPrev&&!canNext&&!canInner){clearMove()}else{var tmpTargetA=$("#"+tmpTargetNodeId+consts.id.A,tmpTarget),tmpNextA=tmpTargetNode.isLastNode?null:$("#"+tmpTargetNode.getNextNode().tId+consts.id.A,tmpTarget.next()),tmpTop=tmpTargetA.offset().top,tmpLeft=tmpTargetA.offset().left,prevPercent=canPrev?canInner?.25:canNext?.5:1:-1,nextPercent=canNext?canInner?.75:canPrev?.5:0:-1,dY_percent=(event.clientY+docScrollTop-tmpTop)/tmpTargetA.height();if((prevPercent==1||dY_percent<=prevPercent&&dY_percent>=-.2)&&canPrev){dX=1-tmpArrow.width();dY=tmpTop-tmpArrow.height()/2;moveType=consts.move.TYPE_PREV}else if((nextPercent==0||dY_percent>=nextPercent&&dY_percent<=1.2)&&canNext){dX=1-tmpArrow.width();dY=tmpNextA==null||data.nodeIsParent(setting,tmpTargetNode)&&tmpTargetNode.open?tmpTop+tmpTargetA.height()-tmpArrow.height()/2:tmpNextA.offset().top-tmpArrow.height()/2;moveType=consts.move.TYPE_NEXT}else if(canInner){dX=5-tmpArrow.width();dY=tmpTop;moveType=consts.move.TYPE_INNER}else{clearMove()}if(tmpTarget){tmpArrow.css({display:"block",top:dY+"px",left:tmpLeft+dX+"px"});tmpTargetA.addClass(consts.node.TMPTARGET_NODE+"_"+moveType);if(preTmpTargetNodeId!=tmpTargetNodeId||preTmpMoveType!=moveType){startTime=(new Date).getTime()}if(tmpTargetNode&&data.nodeIsParent(setting,tmpTargetNode)&&moveType==consts.move.TYPE_INNER){var startTimer=true;if(window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId!==tmpTargetNode.tId){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}else if(window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===tmpTargetNode.tId){startTimer=false}if(startTimer){window.zTreeMoveTimer=setTimeout((function(){if(moveType!=consts.move.TYPE_INNER)return;if(tmpTargetNode&&data.nodeIsParent(setting,tmpTargetNode)&&!tmpTargetNode.open&&(new Date).getTime()-startTime>targetSetting.edit.drag.autoOpenTime&&tools.apply(targetSetting.callback.beforeDragOpen,[targetSetting.treeId,tmpTargetNode],true)){view.switchNode(targetSetting,tmpTargetNode);if(targetSetting.edit.drag.autoExpandTrigger){targetSetting.treeObj.trigger(consts.event.EXPAND,[targetSetting.treeId,tmpTargetNode])}}}),targetSetting.edit.drag.autoOpenTime+50);window.zTreeMoveTargetNodeTId=tmpTargetNode.tId}}}}}else{moveType=consts.move.TYPE_INNER;if(tmpTarget&&tools.apply(targetSetting.edit.drag.inner,[targetSetting.treeId,nodes,null],!!targetSetting.edit.drag.inner)){tmpTarget.addClass(consts.node.TMPTARGET_TREE)}else{tmpTarget=null}tmpArrow.css({display:"none"});if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}}preTmpTargetNodeId=tmpTargetNodeId;preTmpMoveType=moveType;setting.treeObj.trigger(consts.event.DRAGMOVE,[event,setting.treeId,nodes])}return false}doc.bind("mouseup",_docMouseUp);function _docMouseUp(event){if(window.zTreeMoveTimer){clearTimeout(window.zTreeMoveTimer);window.zTreeMoveTargetNodeTId=null}preTmpTargetNodeId=null;preTmpMoveType=null;doc.unbind("mousemove",_docMouseMove);doc.unbind("mouseup",_docMouseUp);doc.unbind("selectstart",_docSelect);body.css("cursor","");if(tmpTarget){tmpTarget.removeClass(consts.node.TMPTARGET_TREE);if(tmpTargetNodeId)$("#"+tmpTargetNodeId+consts.id.A,tmpTarget).removeClass(consts.node.TMPTARGET_NODE+"_"+consts.move.TYPE_PREV).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_NEXT).removeClass(consts.node.TMPTARGET_NODE+"_"+_consts.move.TYPE_INNER)}tools.showIfameMask(setting,false);roots.showHoverDom=true;if(root.dragFlag==0)return;root.dragFlag=0;var i,l,tmpNode;for(i=0,l=nodes.length;i<l;i++){tmpNode=nodes[i];if(data.nodeIsParent(setting,tmpNode)&&root.dragNodeShowBefore[tmpNode.tId]&&!tmpNode.open){view.expandCollapseNode(setting,tmpNode,!tmpNode.open);delete root.dragNodeShowBefore[tmpNode.tId]}}if(curNode)curNode.remove();if(tmpArrow)tmpArrow.remove();var isCopy=(event.ctrlKey||event.metaKey)&&setting.edit.drag.isMove&&setting.edit.drag.isCopy||!setting.edit.drag.isMove&&setting.edit.drag.isCopy;if(!isCopy&&tmpTarget&&tmpTargetNodeId&&nodes[0].parentTId&&tmpTargetNodeId==nodes[0].parentTId&&moveType==consts.move.TYPE_INNER){tmpTarget=null}if(tmpTarget){var dragTargetNode=tmpTargetNodeId==null?null:data.getNodeCache(targetSetting,tmpTargetNodeId);if(tools.apply(setting.callback.beforeDrop,[targetSetting.treeId,nodes,dragTargetNode,moveType,isCopy],true)==false){view.selectNodes(sourceSetting,nodes);return}var newNodes=isCopy?tools.clone(nodes):nodes;function dropCallback(){if(isOtherTree){if(!isCopy){for(var i=0,l=nodes.length;i<l;i++){view.removeNode(setting,nodes[i])}}if(moveType==consts.move.TYPE_INNER){view.addNodes(targetSetting,dragTargetNode,-1,newNodes)}else{view.addNodes(targetSetting,dragTargetNode.getParentNode(),moveType==consts.move.TYPE_PREV?dragTargetNode.getIndex():dragTargetNode.getIndex()+1,newNodes)}}else{if(isCopy&&moveType==consts.move.TYPE_INNER){view.addNodes(targetSetting,dragTargetNode,-1,newNodes)}else if(isCopy){view.addNodes(targetSetting,dragTargetNode.getParentNode(),moveType==consts.move.TYPE_PREV?dragTargetNode.getIndex():dragTargetNode.getIndex()+1,newNodes)}else{if(moveType!=consts.move.TYPE_NEXT){for(i=0,l=newNodes.length;i<l;i++){view.moveNode(targetSetting,dragTargetNode,newNodes[i],moveType,false)}}else{for(i=-1,l=newNodes.length-1;i<l;l--){view.moveNode(targetSetting,dragTargetNode,newNodes[l],moveType,false)}}}}view.selectNodes(targetSetting,newNodes);var a=$$(newNodes[0],setting).get(0);view.scrollIntoView(setting,a);setting.treeObj.trigger(consts.event.DROP,[event,targetSetting.treeId,newNodes,dragTargetNode,moveType,isCopy])}if(moveType==consts.move.TYPE_INNER&&tools.canAsync(targetSetting,dragTargetNode)){view.asyncNode(targetSetting,dragTargetNode,false,dropCallback)}else{dropCallback()}}else{view.selectNodes(sourceSetting,nodes);setting.treeObj.trigger(consts.event.DROP,[event,setting.treeId,nodes,null,null,null])}}doc.bind("selectstart",_docSelect);function _docSelect(){return false}return true}},_tools={getAbs:function(obj){var oRect=obj.getBoundingClientRect(),scrollTop=document.body.scrollTop+document.documentElement.scrollTop,scrollLeft=document.body.scrollLeft+document.documentElement.scrollLeft;return[oRect.left+scrollLeft,oRect.top+scrollTop]},inputFocus:function(inputObj){if(inputObj.get(0)){inputObj.focus();tools.setCursorPosition(inputObj.get(0),inputObj.val().length)}},inputSelect:function(inputObj){if(inputObj.get(0)){inputObj.focus();inputObj.select()}},setCursorPosition:function(obj,pos){if(obj.setSelectionRange){obj.focus();obj.setSelectionRange(pos,pos)}else if(obj.createTextRange){var range=obj.createTextRange();range.collapse(true);range.moveEnd("character",pos);range.moveStart("character",pos);range.select()}},showIfameMask:function(setting,showSign){var root=data.getRoot(setting);while(root.dragMaskList.length>0){root.dragMaskList[0].remove();root.dragMaskList.shift()}if(showSign){var iframeList=$$("iframe",setting);for(var i=0,l=iframeList.length;i<l;i++){var obj=iframeList.get(i),r=tools.getAbs(obj),dragMask=$$("<div id='zTreeMask_"+i+"' class='zTreeMask' style='top:"+r[1]+"px; left:"+r[0]+"px; width:"+obj.offsetWidth+"px; height:"+obj.offsetHeight+"px;'></div>",setting);dragMask.appendTo($$("body",setting));root.dragMaskList.push(dragMask)}}}},_view={addEditBtn:function(setting,node){if(node.editNameFlag||$$(node,consts.id.EDIT,setting).length>0){return}if(!tools.apply(setting.edit.showRenameBtn,[setting.treeId,node],setting.edit.showRenameBtn)){return}var aObj=$$(node,consts.id.A,setting),editStr="<span class='"+consts.className.BUTTON+" edit' id='"+node.tId+consts.id.EDIT+"' title='"+tools.apply(setting.edit.renameTitle,[setting.treeId,node],setting.edit.renameTitle)+"' treeNode"+consts.id.EDIT+" style='display:none;'></span>";aObj.append(editStr);$$(node,consts.id.EDIT,setting).bind("click",(function(){if(!tools.uCanDo(setting)||tools.apply(setting.callback.beforeEditName,[setting.treeId,node],true)==false)return false;view.editNode(setting,node);return false})).show()},addRemoveBtn:function(setting,node){if(node.editNameFlag||$$(node,consts.id.REMOVE,setting).length>0){return}if(!tools.apply(setting.edit.showRemoveBtn,[setting.treeId,node],setting.edit.showRemoveBtn)){return}var aObj=$$(node,consts.id.A,setting),removeStr="<span class='"+consts.className.BUTTON+" remove' id='"+node.tId+consts.id.REMOVE+"' title='"+tools.apply(setting.edit.removeTitle,[setting.treeId,node],setting.edit.removeTitle)+"' treeNode"+consts.id.REMOVE+" style='display:none;'></span>";aObj.append(removeStr);$$(node,consts.id.REMOVE,setting).bind("click",(function(){if(!tools.uCanDo(setting)||tools.apply(setting.callback.beforeRemove,[setting.treeId,node],true)==false)return false;view.removeNode(setting,node);setting.treeObj.trigger(consts.event.REMOVE,[setting.treeId,node]);return false})).bind("mousedown",(function(eventMouseDown){return true})).show()},addHoverDom:function(setting,node){if(data.getRoots().showHoverDom){node.isHover=true;if(setting.edit.enable){view.addEditBtn(setting,node);view.addRemoveBtn(setting,node)}tools.apply(setting.view.addHoverDom,[setting.treeId,node])}},cancelCurEditNode:function(setting,forceName,isCancel){var root=data.getRoot(setting),node=root.curEditNode;if(node){var inputObj=root.curEditInput,newName=forceName?forceName:isCancel?data.nodeName(setting,node):inputObj.val();if(tools.apply(setting.callback.beforeRename,[setting.treeId,node,newName,isCancel],true)===false){return false}data.nodeName(setting,node,newName);var aObj=$$(node,consts.id.A,setting);aObj.removeClass(consts.node.CURSELECTED_EDIT);inputObj.unbind();view.setNodeName(setting,node);node.editNameFlag=false;root.curEditNode=null;root.curEditInput=null;view.selectNode(setting,node,false);setting.treeObj.trigger(consts.event.RENAME,[setting.treeId,node,isCancel])}root.noSelection=true;return true},editNode:function(setting,node){var root=data.getRoot(setting);view.editNodeBlur=false;if(data.isSelectedNode(setting,node)&&root.curEditNode==node&&node.editNameFlag){setTimeout((function(){tools.inputFocus(root.curEditInput)}),0);return}node.editNameFlag=true;view.removeTreeDom(setting,node);view.cancelCurEditNode(setting);view.selectNode(setting,node,false);$$(node,consts.id.SPAN,setting).html("<input type=text class='rename' id='"+node.tId+consts.id.INPUT+"' treeNode"+consts.id.INPUT+" >");var inputObj=$$(node,consts.id.INPUT,setting);inputObj.attr("value",data.nodeName(setting,node));if(setting.edit.editNameSelectAll){tools.inputSelect(inputObj)}else{tools.inputFocus(inputObj)}inputObj.bind("blur",(function(event){if(!view.editNodeBlur){view.cancelCurEditNode(setting)}})).bind("keydown",(function(event){if(event.keyCode=="13"){view.editNodeBlur=true;view.cancelCurEditNode(setting)}else if(event.keyCode=="27"){view.cancelCurEditNode(setting,null,true)}})).bind("click",(function(event){return false})).bind("dblclick",(function(event){return false}));$$(node,consts.id.A,setting).addClass(consts.node.CURSELECTED_EDIT);root.curEditInput=inputObj;root.noSelection=false;root.curEditNode=node},moveNode:function(setting,targetNode,node,moveType,animateFlag,isSilent){var root=data.getRoot(setting);if(targetNode==node)return;if(setting.data.keep.leaf&&targetNode&&!data.nodeIsParent(setting,targetNode)&&moveType==consts.move.TYPE_INNER)return;var oldParentNode=node.parentTId?node.getParentNode():root,targetNodeIsRoot=targetNode===null||targetNode==root;if(targetNodeIsRoot&&targetNode===null)targetNode=root;if(targetNodeIsRoot)moveType=consts.move.TYPE_INNER;var targetParentNode=targetNode.parentTId?targetNode.getParentNode():root;if(moveType!=consts.move.TYPE_PREV&&moveType!=consts.move.TYPE_NEXT){moveType=consts.move.TYPE_INNER}if(moveType==consts.move.TYPE_INNER){if(targetNodeIsRoot){node.parentTId=null}else{if(!data.nodeIsParent(setting,targetNode)){data.nodeIsParent(setting,targetNode,true);targetNode.open=!!targetNode.open;view.setNodeLineIcos(setting,targetNode)}node.parentTId=targetNode.tId}}var targetObj,target_ulObj;if(targetNodeIsRoot){targetObj=setting.treeObj;target_ulObj=targetObj}else{if(!isSilent&&moveType==consts.move.TYPE_INNER){view.expandCollapseNode(setting,targetNode,true,false)}else if(!isSilent){view.expandCollapseNode(setting,targetNode.getParentNode(),true,false)}targetObj=$$(targetNode,setting);target_ulObj=$$(targetNode,consts.id.UL,setting);if(!!targetObj.get(0)&&!target_ulObj.get(0)){var ulstr=[];view.makeUlHtml(setting,targetNode,ulstr,"");targetObj.append(ulstr.join(""))}target_ulObj=$$(targetNode,consts.id.UL,setting)}var nodeDom=$$(node,setting);if(!nodeDom.get(0)){nodeDom=view.appendNodes(setting,node.level,[node],null,-1,false,true).join("")}else if(!targetObj.get(0)){nodeDom.remove()}if(target_ulObj.get(0)&&moveType==consts.move.TYPE_INNER){target_ulObj.append(nodeDom)}else if(targetObj.get(0)&&moveType==consts.move.TYPE_PREV){targetObj.before(nodeDom)}else if(targetObj.get(0)&&moveType==consts.move.TYPE_NEXT){targetObj.after(nodeDom)}var i,l,tmpSrcIndex=-1,tmpTargetIndex=0,oldNeighbor=null,newNeighbor=null,oldLevel=node.level;var oldChildren=data.nodeChildren(setting,oldParentNode);var targetParentChildren=data.nodeChildren(setting,targetParentNode);var targetChildren=data.nodeChildren(setting,targetNode);if(node.isFirstNode){tmpSrcIndex=0;if(oldChildren.length>1){oldNeighbor=oldChildren[1];oldNeighbor.isFirstNode=true}}else if(node.isLastNode){tmpSrcIndex=oldChildren.length-1;oldNeighbor=oldChildren[tmpSrcIndex-1];oldNeighbor.isLastNode=true}else{for(i=0,l=oldChildren.length;i<l;i++){if(oldChildren[i].tId==node.tId){tmpSrcIndex=i;break}}}if(tmpSrcIndex>=0){oldChildren.splice(tmpSrcIndex,1)}if(moveType!=consts.move.TYPE_INNER){for(i=0,l=targetParentChildren.length;i<l;i++){if(targetParentChildren[i].tId==targetNode.tId)tmpTargetIndex=i}}if(moveType==consts.move.TYPE_INNER){if(!targetChildren){targetChildren=data.nodeChildren(setting,targetNode,[])}if(targetChildren.length>0){newNeighbor=targetChildren[targetChildren.length-1];newNeighbor.isLastNode=false}targetChildren.splice(targetChildren.length,0,node);node.isLastNode=true;node.isFirstNode=targetChildren.length==1}else if(targetNode.isFirstNode&&moveType==consts.move.TYPE_PREV){targetParentChildren.splice(tmpTargetIndex,0,node);newNeighbor=targetNode;newNeighbor.isFirstNode=false;node.parentTId=targetNode.parentTId;node.isFirstNode=true;node.isLastNode=false}else if(targetNode.isLastNode&&moveType==consts.move.TYPE_NEXT){targetParentChildren.splice(tmpTargetIndex+1,0,node);newNeighbor=targetNode;newNeighbor.isLastNode=false;node.parentTId=targetNode.parentTId;node.isFirstNode=false;node.isLastNode=true}else{if(moveType==consts.move.TYPE_PREV){targetParentChildren.splice(tmpTargetIndex,0,node)}else{targetParentChildren.splice(tmpTargetIndex+1,0,node)}node.parentTId=targetNode.parentTId;node.isFirstNode=false;node.isLastNode=false}data.fixPIdKeyValue(setting,node);data.setSonNodeLevel(setting,node.getParentNode(),node);view.setNodeLineIcos(setting,node);view.repairNodeLevelClass(setting,node,oldLevel);if(!setting.data.keep.parent&&oldChildren.length<1){data.nodeIsParent(setting,oldParentNode,false);oldParentNode.open=false;var tmp_ulObj=$$(oldParentNode,consts.id.UL,setting),tmp_switchObj=$$(oldParentNode,consts.id.SWITCH,setting),tmp_icoObj=$$(oldParentNode,consts.id.ICON,setting);view.replaceSwitchClass(oldParentNode,tmp_switchObj,consts.folder.DOCU);view.replaceIcoClass(oldParentNode,tmp_icoObj,consts.folder.DOCU);tmp_ulObj.css("display","none")}else if(oldNeighbor){view.setNodeLineIcos(setting,oldNeighbor)}if(newNeighbor){view.setNodeLineIcos(setting,newNeighbor)}if(!!setting.check&&setting.check.enable&&view.repairChkClass){view.repairChkClass(setting,oldParentNode);view.repairParentChkClassWithSelf(setting,oldParentNode);if(oldParentNode!=node.parent)view.repairParentChkClassWithSelf(setting,node)}if(!isSilent){view.expandCollapseParentNode(setting,node.getParentNode(),true,animateFlag)}},removeEditBtn:function(setting,node){$$(node,consts.id.EDIT,setting).unbind().remove()},removeRemoveBtn:function(setting,node){$$(node,consts.id.REMOVE,setting).unbind().remove()},removeTreeDom:function(setting,node){node.isHover=false;view.removeEditBtn(setting,node);view.removeRemoveBtn(setting,node);tools.apply(setting.view.removeHoverDom,[setting.treeId,node])},repairNodeLevelClass:function(setting,node,oldLevel){if(oldLevel===node.level)return;var liObj=$$(node,setting),aObj=$$(node,consts.id.A,setting),ulObj=$$(node,consts.id.UL,setting),oldClass=consts.className.LEVEL+oldLevel,newClass=consts.className.LEVEL+node.level;liObj.removeClass(oldClass);liObj.addClass(newClass);aObj.removeClass(oldClass);aObj.addClass(newClass);ulObj.removeClass(oldClass);ulObj.addClass(newClass)},selectNodes:function(setting,nodes){for(var i=0,l=nodes.length;i<l;i++){view.selectNode(setting,nodes[i],i>0)}}},_z={tools:_tools,view:_view,event:_event,data:_data};$.extend(true,$.fn.zTree.consts,_consts);$.extend(true,$.fn.zTree._z,_z);var zt=$.fn.zTree,tools=zt._z.tools,consts=zt.consts,view=zt._z.view,data=zt._z.data,event=zt._z.event,$$=tools.$;data.exSetting(_setting);data.addInitBind(_bindEvent);data.addInitUnBind(_unbindEvent);data.addInitCache(_initCache);data.addInitNode(_initNode);data.addInitProxy(_eventProxy);data.addInitRoot(_initRoot);data.addZTreeTools(_zTreeTools);var _cancelPreSelectedNode=view.cancelPreSelectedNode;view.cancelPreSelectedNode=function(setting,node){var list=data.getRoot(setting).curSelectedList;for(var i=0,j=list.length;i<j;i++){if(!node||node===list[i]){view.removeTreeDom(setting,list[i]);if(node)break}}if(_cancelPreSelectedNode)_cancelPreSelectedNode.apply(view,arguments)};var _createNodes=view.createNodes;view.createNodes=function(setting,level,nodes,parentNode,index){if(_createNodes){_createNodes.apply(view,arguments)}if(!nodes)return;if(view.repairParentChkClassWithSelf){view.repairParentChkClassWithSelf(setting,parentNode)}};var _makeNodeUrl=view.makeNodeUrl;view.makeNodeUrl=function(setting,node){return setting.edit.enable?null:_makeNodeUrl.apply(view,arguments)};var _removeNode=view.removeNode;view.removeNode=function(setting,node){var root=data.getRoot(setting);if(root.curEditNode===node)root.curEditNode=null;if(_removeNode){_removeNode.apply(view,arguments)}};var _selectNode=view.selectNode;view.selectNode=function(setting,node,addFlag){var root=data.getRoot(setting);if(data.isSelectedNode(setting,node)&&root.curEditNode==node&&node.editNameFlag){return false}if(_selectNode)_selectNode.apply(view,arguments);view.addHoverDom(setting,node);return true};var _uCanDo=tools.uCanDo;tools.uCanDo=function(setting,e){var root=data.getRoot(setting);if(e&&(tools.eqs(e.type,"mouseover")||tools.eqs(e.type,"mouseout")||tools.eqs(e.type,"mousedown")||tools.eqs(e.type,"mouseup"))){return true}if(root.curEditNode){view.editNodeBlur=false;root.curEditInput.focus()}return!root.curEditNode&&(_uCanDo?_uCanDo.apply(view,arguments):true)}})(jQuery);(function($){$.fn.zTreeKeyboardNavigationDestroy=function(){};$.fn.zTreeKeyboardNavigation=function(zTree,element,selectedNodes=null,treeicon){if(typeof element==="string"||element instanceof String){element=$(element)}var rootNodes=zTree.getNodes();if(!rootNodes)return;var focusSelectedNode=function(){if((selectedNodes=zTree.getSelectedNodes())&&selectedNodes.length){$("#"+selectedNodes[0].tId).focus()}};$.fn.zTreeKeyboardNavigationDestroy();$.fn.zTreeKeyboardNavigationDestroy=function(){$(element).off("keydown")};$.fn.changeTreeIcons=function(){let eleClose=$(".app-tree li span.button.switch");$(eleClose).map(((idx,ele)=>{$(ele).addClass(treeicon);$(ele).on("click",(function(e){setTimeout((()=>{$(ele).addClass(treeicon)}),0)}))}))};$(element).on("keydown",(function(e){var selectedNodes=zTree.getSelectedNodes();var selectedNode=selectedNodes.length?selectedNodes[0]:null;var processSpace=function(){if(selectedNode&&selectedNode.isParent){zTree.expandNode(selectedNode,selectedNode.open?false:true,true,true);$.fn.changeTreeIcons()}};var processHome=function(){zTree.selectNode(rootNodes[0],false,true)};var processEnd=function(){var nodes=zTree.transformToArray(rootNodes);zTree.selectNode(nodes[nodes.length-1])};var processUp=function(){var priorNode;if(selectedNode){priorNode=selectedNode.getPreNode();if(!priorNode)return}else{processEnd()}if(!priorNode)return;zTree.selectNode(priorNode)};var processDown=function(){var nextNode;if(selectedNode){nextNode=selectedNode.getNextNode();if(!nextNode)return}else{processHome()}if(!nextNode)return;zTree.selectNode(nextNode)};var processOut=function(){if(!selectedNode)return;var parentNode=selectedNode.getParentNode();var priorNode=selectedNode.getPreNode();if(!parentNode&&!priorNode)return;if(priorNode){if(priorNode.isParent){while(priorNode){if(!priorNode.isParent||!priorNode.open||!priorNode.children)break;priorNode=priorNode.children[priorNode.children.length-1]}zTree.selectNode(priorNode);return}else{zTree.selectNode(priorNode);return}}if(parentNode){zTree.selectNode(parentNode,false,true)}};var processIn=function(){if(!selectedNode)return;if(selectedNode.isParent&&selectedNode.open&&selectedNode.children){zTree.selectNode(selectedNode.children[0]);return}var nextNode=selectedNode.getNextNode();if(nextNode){zTree.selectNode(nextNode)}else{var node=selectedNode;while(node=node.getParentNode()){var nextNode=node.getNextNode();if(nextNode){zTree.selectNode(nextNode);break}}}};var processLetter=function(keyCode){if(!Array.from({length:26},((v,i)=>i+65)).includes(keyCode&95))return false;var nodes=zTree.transformToArray(rootNodes);nodes=nodes.filter((node=>"accesskey"in node&&node.accesskey.length&&(node.accesskey.charCodeAt(0)&95)==keyCode));if(!nodes.length)return false;var selectedNodes=zTree.getSelectedNodes();if(!selectedNodes.length)return false;if(selectedNodes[0]==nodes[0])return false;zTree.selectNode(nodes[0]);return true};switch(e.keyCode){case 32:processSpace();return;case 36:processHome();break;case 35:processEnd();break;case 33:break;case 34:break;case 37:processOut();break;case 38:processUp();break;case 39:processIn();break;case 40:processDown();break;default:if(!processLetter(e.keyCode&95))return;break}focusSelectedNode()}));if(selectedNodes&&selectedNodes.length){zTree.selectNode(selectedNodes[0]);focusSelectedNode()}else{$(element).trigger({type:"keydown",which:36,keyCode:36})}}})(jQuery);