/** * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches. * * @version v3.3.3 * @homepage https://bttstrp.github.io/bootstrap-switch * @author Mattia Larentis (http://larentis.eu) * @license Apache-2.0 */ (function(a,b){if('function'==typeof define&&define.amd)define(['jquery'],b);else if('undefined'!=typeof exports)b(require('jquery'));else{b(a.jquery),a.bootstrapSwitch={exports:{}}.exports}})(this,function(a){'use strict';function c(h,j){if(!(h instanceof j))throw new TypeError('Cannot call a class as a function')}var d=function(h){return h&&h.__esModule?h:{default:h}}(a),e=function(){function h(j,k){for(var m,l=0;l',{class:function(){var n=[];return n.push(k.options.state?'on':'off'),k.options.size&&n.push(k.options.size),k.options.disabled&&n.push('disabled'),k.options.readonly&&n.push('readonly'),k.options.indeterminate&&n.push('indeterminate'),k.options.inverse&&n.push('inverse'),k.$element.attr('id')&&n.push('id-'+k.$element.attr('id')),n.map(k._getClass.bind(k)).concat([k.options.baseClass],k._getClasses(k.options.wrapperClass)).join(' ')}}),this.$container=f('
',{class:this._getClass('container')}),this.$on=f('',{html:this.options.onText,class:this._getClass('handle-on')+' '+this._getClass(this.options.onColor)}),this.$off=f('',{html:this.options.offText,class:this._getClass('handle-off')+' '+this._getClass(this.options.offColor)}),this.$label=f('',{html:this.options.labelText,class:this._getClass('label')}),this.$element.on('init.bootstrapSwitch',this.options.onInit.bind(this,j)),this.$element.on('switchChange.bootstrapSwitch',function(){for(var m=arguments.length,n=Array(m),o=0;o-(k._handleWidth/2);k._dragEnd=!1,k.state(k.options.inverse?!o:o)}else k.state(!k.options.state);k._dragStart=!1}},'mouseleave.bootstrapSwitch':function(){k.$label.trigger('mouseup.bootstrapSwitch')}})}},{key:'_externalLabelHandler',value:function(){var k=this,l=this.$element.closest('label');l.on('click',function(m){m.preventDefault(),m.stopImmediatePropagation(),m.target===l[0]&&k.toggleState()})}},{key:'_formHandler',value:function(){var k=this.$element.closest('form');k.data('bootstrap-switch')||k.on('reset.bootstrapSwitch',function(){window.setTimeout(function(){k.find('input').filter(function(){return f(this).data('bootstrap-switch')}).each(function(){return f(this).bootstrapSwitch('state',this.checked)})},1)}).data('bootstrap-switch',!0)}},{key:'_getClass',value:function(k){return this.options.baseClass+'-'+k}},{key:'_getClasses',value:function(k){return f.isArray(k)?k.map(this._getClass.bind(this)):[this._getClass(k)]}}]),h}();f.fn.bootstrapSwitch=function(h){for(var k=arguments.length,l=Array(1