//>>built
define("dojox/mobile/SpinWheelSlot","dojo/_base/kernel,dojo/_base/array,dojo/_base/declare,dojo/_base/lang,dojo/_base/window,dojo/dom-class,dojo/dom-construct,dijit/_Contained,dijit/_WidgetBase,./scrollable".split(","),function(q,h,m,r,k,l,g,n,o,p){return m("dojox.mobile.SpinWheelSlot",[o,n,p],{items:[],labels:[],labelFrom:0,labelTo:0,zeroPad:0,value:"",step:1,tabIndex:"0",_setTabIndexAttr:"",baseClass:"mblSpinWheelSlot",maxSpeed:500,minItems:15,centerPos:0,scrollBar:!1,constraint:!1,propagatable:!1,
androidWorkaroud:!1,buildRendering:function(){this.inherited(arguments);this.initLabels();if(0<this.labels.length){this.items=[];for(i=0;i<this.labels.length;i++)this.items.push([i,this.labels[i]])}this.containerNode=g.create("div",{className:"mblSpinWheelSlotContainer"});this.containerNode.style.height=2*(k.global.innerHeight||k.doc.documentElement.clientHeight)+"px";this.panelNodes=[];for(var a=0;3>a;a++){this.panelNodes[a]=g.create("div",{className:"mblSpinWheelSlotPanel"});var b=this.items.length,
c=Math.ceil(this.minItems/b);for(j=0;j<c;j++)for(i=0;i<b;i++)g.create("div",{className:"mblSpinWheelSlotLabel",name:this.items[i][0],val:this.items[i][1],innerHTML:this._cv?this._cv(this.items[i][1]):this.items[i][1]},this.panelNodes[a]);this.containerNode.appendChild(this.panelNodes[a])}this.domNode.appendChild(this.containerNode);this.touchNode=g.create("div",{className:"mblSpinWheelSlotTouch"},this.domNode);this.setSelectable(this.domNode,!1);if(""===this.value&&0<this.items.length)this.value=
this.items[0][1];this._initialValue=this.value},startup:function(){if(!this._started)this.inherited(arguments),this.noResize=!0,this.init(),this.centerPos=this.getParent().centerPos,this._itemHeight=this.panelNodes[1].childNodes[0].offsetHeight,this.adjust(),this._keydownHandle=this.connect(this.domNode,"onkeydown","_onKeyDown")},initLabels:function(){if(this.labelFrom!==this.labelTo)for(var a=this.labels=[],b=this.zeroPad&&Array(this.zeroPad).join("0"),c=this.labelFrom;c<=this.labelTo;c+=this.step)a.push(this.zeroPad?
(b+c).slice(-this.zeroPad):c+"")},adjust:function(){for(var a=this.panelNodes[1].childNodes,b,c=0,d=a.length;c<d;c++){var e=a[c];if(e.offsetTop<=this.centerPos&&this.centerPos<e.offsetTop+e.offsetHeight){b=this.centerPos-(e.offsetTop+Math.round(e.offsetHeight/2));break}}a=this.panelNodes[0].offsetHeight;this.panelNodes[0].style.top=-a+b+"px";this.panelNodes[1].style.top=b+"px";this.panelNodes[2].style.top=a+b+"px"},setInitialValue:function(){this.set("value",this._initialValue)},_onKeyDown:function(a){a&&
"keydown"===a.type&&(40===a.keyCode?this.spin(-1):38===a.keyCode&&this.spin(1))},_getCenterPanel:function(){for(var a=this.getPos(),b=0,c=this.panelNodes.length;b<c;b++){var d=a.y+this.panelNodes[b].offsetTop;if(d<=this.centerPos&&this.centerPos<d+this.panelNodes[b].offsetHeight)return this.panelNodes[b]}return null},setColor:function(a,b){h.forEach(this.panelNodes,function(c){h.forEach(c.childNodes,function(c){l.toggle(c,b||"mblSpinWheelSlotLabelBlue",c.innerHTML===a)},this)},this)},disableValues:function(){h.forEach(this.panelNodes,
function(a){for(var b=27;31>b;b++)l.toggle(a.childNodes[b],"mblSpinWheelSlotLabelGray",b>=nDays)})},getCenterItem:function(){var a=this.getPos(),b=this._getCenterPanel();if(b)for(var a=a.y+b.offsetTop,b=b.childNodes,c=0,d=b.length;c<d;c++)if(a+b[c].offsetTop<=this.centerPos&&this.centerPos<a+b[c].offsetTop+b[c].offsetHeight)return b[c];return null},_getKeyAttr:function(){var a=this.getCenterItem();return a&&a.getAttribute("name")},_getValueAttr:function(){var a=this.getCenterItem();return a&&a.getAttribute("val")},
_setValueAttr:function(a){var b,c,d=this.get("value");if(d){this._penddingValue=void 0;this._set("value",a);for(var e=this.items.length,f=0;f<e&&!(this.items[f][1]===""+d&&(b=f),this.items[f][1]===""+a&&(c=f),void 0!==b&&void 0!==c);f++);a=c-(b||0);this.spin(0<a?a<e-a?-a:e-a:-a<e+a?-a:-(e+a))}else this._penddingValue=a},stopAnimation:function(){this.inherited(arguments);this._set("value",this.get("value"))},spin:function(a){if(this._started){var b=this.getPos();b.y%this._itemHeight||(b.y+=a*this._itemHeight,
this.slideTo(b,1))}},getSpeed:function(){var a=0,b=this._time.length,c=(new Date).getTime()-this.startTime-this._time[b-1];2<=b&&200>c&&(a=this.calcSpeed(this._posY[b-1]-this._posY[0<=b-6?b-6:0],this._time[b-1]-this._time[0<=b-6?b-6:0]));return{x:0,y:a}},calcSpeed:function(a,b){var c=this.inherited(arguments);if(!c)return 0;var d=Math.abs(c),e=c;d>this.maxSpeed&&(e=this.maxSpeed*(c/d));return e},adjustDestination:function(a){var b=this._itemHeight,c=a.y+Math.round(b/2);Math.abs(c);a.y=c-(0<=c?c%b:
c%b+b);return!0},resize:function(){this._penddingValue&&this.set("value",this._penddingValue)},slideTo:function(a,b,c){var d=this.getPos(),e=d.y+this.panelNodes[1].offsetTop,f=e+this.panelNodes[1].offsetHeight,g=this.domNode.parentNode.offsetHeight;if(d.y<a.y){if(f>g)d=this.panelNodes[2],d.style.top=this.panelNodes[0].offsetTop-this.panelNodes[0].offsetHeight+"px",this.panelNodes[2]=this.panelNodes[1],this.panelNodes[1]=this.panelNodes[0],this.panelNodes[0]=d}else if(d.y>a.y&&0>e)d=this.panelNodes[0],
d.style.top=this.panelNodes[2].offsetTop+this.panelNodes[2].offsetHeight+"px",this.panelNodes[0]=this.panelNodes[1],this.panelNodes[1]=this.panelNodes[2],this.panelNodes[2]=d;this._initialized?40>Math.abs(this._speed.y)&&(b=0.2):(b=0,this._initialized=!0);this.inherited(arguments,[a,b,c])}})});