YUI.add("aui-datepicker-delegate",function(e,t){function b(){}var n=e.Lang,r=n.isString,i="enterKey",s=e.one(e.config.doc),o="activeInput",u="blur",a="click",f="container",l="dateSeparator",c="datepickerSelection",h="focus",p="mask",d="mousedown",v="selectionChange",m="trigger",g="valueExtractor",y="valueFormatter";b.prototype={_eventHandles:null,_userInteractionInProgress:!1,initializer:function(){var e=this;e.bindDelegateUI()},destroy:function(){var t=this;(new e.EventHandle(t._eventHandles)).detach()},bindDelegateUI:function(){var t=this,n=t.get(f),r=t.get(m);t._eventHandles=[n.delegate([h,d],e.bind("_onceUserInteraction",t),r),n.delegate(u,e.bind("_onUserInteractionRelease",t),r),n.delegate(a,e.bind("_onceUserInteractionRelease",t),r),n.delegate("key",e.bind("_handleTabKeyEvent",t),"tab",r)],t.after("activeInputChange",e.bind("_afterActiveInputChange",t)),t.publish(v,{defaultFn:t._defSelectionChangeFn})},getSelectedDates:function(e){var t=this,n=e||t.get(o),r=n.getData(c);return r?r:null},getParsedDatesFromInputValue:function(t){var n=this,r=n.get(g),i=r.call(n,t);return i?e.Array.filter(i,function(e){return e!==!1}):null},useInputNode:function(){},useInputNodeOnce:function(e){var t=this;t._userInteractionInProgress||t.useInputNode(e)},_afterActiveInputChange:function(e){var t=this;e.prevVal&&e.prevVal.detach("keydown",t._handleKeydownEvent,t),e.newVal&&e.newVal.on("keydown",t._handleKeydownEvent,t)},_defSelectionChangeFn:function(e){var t=this,n=e.newSelection,r=t.get(o),i=t.get(y);i.call(t,n),r.setData(c,n)},_formatDate:function(t){var n=this,r=n.get(p);return e.Date.format(t,{format:r})},_handleKeydownEvent:function(e){var t=this;e.isKey("enter")&&t.fire(i)},_onceUserInteraction:function(e){var t=this;t.useInputNodeOnce(e.currentTarget),t._userInteractionInProgress=!0},_onceUserInteractionRelease:function(e){var t=this;t.useInputNodeOnce(e.currentTarget),t._userInteractionInProgress=!1},_onUserInteractionRelease:function(e){var t=this;t.useInputNode(e.currentTarget),t._userInteractionInProgress=!1},_valueExtractorFn:function(){return function(t){var r=this,i=r.get(o),s=n.trim(t||i.val()),u=r.get(l),a=r.get(p),f;return s&&(f=[],e.Array.each(s.split(u),function(t){t=n.trim(t),t&&f.push(e.Date.parse(a,t))})),f}},_valueFormatterFn:function(){return function(t){var n=this,r=n.get(o),i=n.get(l),s=[];e.Array.each(t,function(e){s.push(n._formatDate(e))}),r.val(s.join(i))}}},b.ATTRS={activeInput:{},container:{setter:e.one,value:s,writeOnce:!0},dateSeparator:{value:" \u2014 ",validator:n.isString},mask:{value:"%m/%d/%Y",validator:n.isString},trigger:{validator:r,writeOnce:!0},valueExtractor:{valueFn:"_valueExtractorFn",validator:n.isFunction},valueFormatter:{valueFn:"_valueFormatterFn",validator:n.isFunction}},e.DatePickerDelegate=b},"2.0.0",{requires:["node-event-delegate","event-focus","aui-event-input","aui-datatype-date-parse"]});
