/* * Version: 2.0.20 * Build time: Tue Feb 28 2017 19:19:39 GMT+0800 (中国标准时间) * Copyright 2016, Alibaba */ !function(t){function e(o){if(i[o])return i[o].exports;var s=i[o]={exports:{},id:o,loaded:!1};return t[o].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){function o(t){return t&&t.__esModule?t:{"default":t}}var s=i(1),r=o(s);window.FocusEngine||(window.FocusEngine=r["default"])},function(t,e,i){function o(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var s=i(2),r=o(s),n=i(3),h=o(n),a=i(4),l=o(a),d=i(5),c=o(d),f=i(8),u=o(f),g=i(9),p=o(g),y={Event:r["default"],Widget:h["default"],Switch:l["default"],Scroll:c["default"],Grid:u["default"],Grille:p["default"],roles:["Widget","Switch","Scroll","Grid","Grille"],render:function(t,e){void 0===t&&(t=document.body);var i=t.getAttribute("fe-role");if(i&&-1===this.roles.indexOf(i))return console.error(t),void console.error("[FocusEngine_Error]("+i+")\u4e0d\u662f\u652f\u6301\u7684fe-role\u7c7b\u578b\uff0c\u53ea\u652f\u6301\u4ee5\u4e0b\u7c7b\u578b\uff1a"+this.roles.join("\u3001"));if(i||t.setAttribute("fe-role","Widget"),window.$FocusEngineGlobalRoot)return window.$FocusEngineGlobalRoot.reRender(),window.$FocusEngineGlobalRoot.getWidgetById(t.id);var o=document.body.getAttribute("fe-role");return o&&-1===this.roles.indexOf(o)?void console.error("[FocusEngine_Error]("+o+")\u4e0d\u662f\u652f\u6301\u7684fe-role\u7c7b\u578b\uff0c\u53ea\u652f\u6301\u4ee5\u4e0b\u7c7b\u578b\uff1a"+this.roles.join("\u3001")):(o||(document.body.setAttribute("fe-role","Widget"),o="Widget"),window.$FocusEngineGlobalRoot=new this[o](document.body),window.$FocusEngineGlobalRoot.focus(),window.$FocusEngineGlobalRoot.handleRootEvent(e),window.$FocusEngineGlobalRoot.getWidgetById(t.id))},createWidget:function(t){var e=t.getAttribute("fe-role");return e&&-1===this.roles.indexOf(e)?(console.error(t),void console.error("[FocusEngine_Error]("+e+")\u4e0d\u662f\u652f\u6301\u7684fe-role\u7c7b\u578b\uff0c\u53ea\u652f\u6301\u4ee5\u4e0b\u7c7b\u578b\uff1a"+this.roles.join("\u3001"))):(e||t.setAttribute("fe-role","Widget"),new this[e](t))},appendWidget:function(t){for(var e=this.createWidget(t);t.parentNode;)if(t=t.parentNode,t.getAttribute("fe-role")){var i=t.id;return void this.getWidgetById(i).addChildWidget(e)}},getRoot:function(){return window.$FocusEngineGlobalRoot},getWidgetById:function(t){return window.$FocusEngineGlobalRoot?window.$FocusEngineGlobalRoot.getWidgetById(t):null},getFocusedLeaf:function(){return window.$FocusEngineGlobalRoot?window.$FocusEngineGlobalRoot.getFocusedLeaf():null},freeze:function(t){window.$FocusEngineGlobalRoot&&window.$FocusEngineGlobalRoot.freeze(t)},activate:function(){window.$FocusEngineGlobalRoot&&window.$FocusEngineGlobalRoot.activate()},disableClick:function(){window.$FocusEngineGlobalRoot&&window.$FocusEngineGlobalRoot.disableClick()},enableClick:function(){window.$FocusEngineGlobalRoot&&window.$FocusEngineGlobalRoot.enableClick()}};e["default"]=y,t.exports=e["default"]},function(t,e){function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;ithis.childWidgets.length;e++){for(var r=t[e],n=!1,h=0;he;e++){s=t[e];var o=s.getAttribute("fe-role");-1!==a["default"].roles.indexOf(o)&&(r=new a["default"][o](s),this.addChildWidget(r))}},t.prototype.handleRootEvent=function(t){var e=this;document.addEventListener("keydown",function(i){if(e.active){i=i||window.event;var o=i.keyCode,s=e.getFocusedLeaf();o&&(s.fire(new n["default"]("keydown",s,{keyCode:o})),s&&o===n["default"].VK_ENTER&&s.fire(new n["default"]("okdown",s,{keyCode:o})),t||i.preventDefault())}}),document.addEventListener("keyup",function(i){if(e.active){i=i||window.event;var o=i.keyCode,s=e.getFocusedLeaf();o&&(s&&s.fire(new n["default"]("keyup",s,{keyCode:o})),s&&o===n["default"].VK_ENTER&&s.fire(new n["default"]("ok",s,{keyCode:o})),t||i.preventDefault())}}),document.addEventListener("click",function(i){if(e.active){i=i||window.event;for(var o=i.target,s=null;o&&o!==document;){if(-1!==a["default"].roles.indexOf(o.getAttribute("fe-role"))){if(s=e.getWidgetById(o.id),s&&s.isLeafWidget()){for(var r=s;r;){if(r.noClick)return;r=r.parentWidget}if(s&&s.fire(new n["default"]("click",s)),t||i.preventDefault(),!s.disabled&&"hidden"!=s.getDOMNode().style.visibility)if(s.focused)s.fire(new n["default"]("ok",s,{isClick:!0}));else{var h=s.getDOMNode().getAttribute("can-focus");"no"!=h&&s.focus()}return}return}o=o.parentNode}}})},t.prototype.getFocusedLeaf=function(){return this.isLeafWidget()?this:this.getFocusedChildWidget()?this.getFocusedChildWidget().getFocusedLeaf():null},t.prototype.addClass=function(t){this.con.classList.add(t)},t.prototype.removeClass=function(t){this.con.classList.remove(t)},t.prototype.hasClass=function(t){return this.con.classList.contains(t)},t.prototype.show=function(){this.con.style.display="block"},t.prototype.hide=function(){this.con.style.display="none"},t.prototype.focus=function(t,e){if(!t&&this.focused)return this;for(var i=this;!i.isLeafWidget();){var o=i.getCachedChildWidget();if(o&&"yes"!==i.options.cfg.disable_child_cache)i=o;else{var s=i.getDefaultFocusedChildWidget();if(s)i=s;else{var r=i.getFirstFocusableChildWidget();if(!r)break;i=r}}}var h=new n["default"]("focus",i,{force:t});return e&&h.preventListener(),i.fire(h),this},t.prototype.focusDefault=function(t){if(!this.focused||t.force){var e=this.getParentWidget();if(e){var i=e.getFocusedChildWidget();i&&i!==this&&(i.isLeafWidget()?t.blurLeaf=i:i.getFocusedLeaf()&&(t.blurLeaf=i.getFocusedLeaf()),i.blur()),e.setFocusedChildWidget(this)}this.addClass("fe-focus"),this.focused=!0,this.cache()}},t.prototype.blur=function(){if(!this.focused)return this;var t=this.getParentWidget();t&&t.setFocusedChildWidget(null),this.removeClass("fe-focus"),this.focused=!1;var e=this.getFocusedChildWidget();return e&&e.blur(),this.fire(new n["default"]("blur",this)),this},t.prototype.cache=function(){if(this.cached)return this;var t=this.getParentWidget();if(t){var e=t.getCachedChildWidget();e&&(e.removeClass("fe-cache"),e.cached=!1),t.setCachedChildWidget(this)}return this.addClass("fe-cache"),this.cached=!0,this},t.prototype.isLeafWidget=function(){return!this.getFirstFocusableChildWidget()},t.prototype.getParentWidget=function(){return this.parentWidget},t.prototype.getFocusedChildWidget=function(){if(!this.focusedChildWidget)return null;if(-1===this.childWidgets.indexOf(this.focusedChildWidget)){var t=this.getWidgetById(this.focusedChildWidget.id);return-1!==this.childWidgets.indexOf(t)?t:null}return this.focusedChildWidget},t.prototype.setFocusedChildWidget=function(t){t&&-1===this.childWidgets.indexOf(t)||(this.focusedChildWidget=t)},t.prototype.getCachedChildWidget=function(){return this.cachedChildWidget?-1===this.childWidgets.indexOf(this.cachedChildWidget)?null:this.cachedChildWidget.disabled?null:this.cachedChildWidget:null},t.prototype.setCachedChildWidget=function(t){t&&-1===this.childWidgets.indexOf(t)||(this.cachedChildWidget=t)},t.prototype.getDefaultFocusedChildWidget=function(){return this.defaultFocusedChildWidget?-1===this.childWidgets.indexOf(this.defaultFocusedChildWidget)?null:this.defaultFocusedChildWidget.disabled?null:this.defaultFocusedChildWidget:null},t.prototype.getFirstFocusableChildWidget=function(){for(var t=0;te;e++){var o=this.childWidgets[e].getWidgetById(t);if(o)return o}return null},t.prototype.addChildWidget=function(t,e){e||0===e||(e=this.childWidgets.length),this.childWidgets.splice(e,0,t),this.childMap[t.id]=t,t.parentWidget=this,"yes"===t.options.cfg.default_focus&&this.setDefaultFocusedChildWidget(t)},t.prototype.hasChildWidget=function(t){return-1!==this.childWidgets.indexOf(t)},t.prototype.removeChildWidget=function(e){var i=void 0;if(e instanceof t&&(e=this.childWidgets.indexOf(e)),!(0>e)){i=this.childWidgets.splice(e,1);var o=i.length?i[0]:null;if(o){if(delete this.childMap[o.id],o===this.getFocusedChildWidget()){var s=this.getDefaultFocusedChildWidget()===o?this.childWidgets[0]:this.getDefaultFocusedChildWidget();s.focus()}return o===this.getCachedChildWidget()&&(this.cachedChildWidget=null),o}}},t.prototype.getDOMNode=function(){return this.con},t.prototype.getWidgetRect=function(t){if(t&&this.rect)return this.rect;var e=this.getDOMNode(),i=e.getBoundingClientRect();return this.rect={top:i.top,bottom:i.bottom,right:i.right,left:i.left,width:i.width,height:i.height,centerX:i.width/2+i.left,centerY:i.height/2+i.top},this.rect},t.prototype.getWidgetRectAsync=function(t){var e=this;window.requestAnimationFrame(function(){var i=e.getDOMNode(),o=i.getBoundingClientRect(),s={top:o.top,bottom:o.bottom,right:o.right,left:o.left,width:o.width,height:o.height,centerX:o.width/2+o.left,centerY:o.height/2+o.top};e.rect||(e.rect=s),t&&t(s)})},t.prototype.on=function(t,e,i,o){return t.constructor!==String?(console.warn("[FocusEngine] \u4e8b\u4ef6type\u7c7b\u578b\u5fc5\u987b\u662fString"),-1):e.constructor!==Function?(console.warn("[FocusEngine] \u4e8b\u4ef6\u76d1\u542c\u7c7b\u578b\u5fc5\u987b\u662fFunction"),-1):(t=t.toLowerCase(),this.eventListeners.push({type:t,cb:e,ctx:i||null,after:!!o}),this.eventListeners.length-1)},t.prototype.off=function(t){0>t||(this.eventListeners[t]=null)},t.prototype.detach=function(t,e){console.warn("[FocusEngine] detach\u65b9\u6cd5\u4e0d\u518d\u63a8\u8350\u4f7f\u7528\uff0c\u8bf7\u4f7f\u7528off\u65b9\u6cd5"),t=t.toLowerCase();for(var i=0,o=this.eventListeners.length;o>i;i++){var s=this.eventListeners[i];s.type===t&&s.cb===e&&(this.eventListeners[i]=null)}},t.prototype.fire=function(t){this.exeEventListeners(t),this.exeEventDefault(t),this.exeEventListeners(t,!0);for(var e=this;e.parentWidget&&!t.isPropagationStopped();)e=e.parentWidget,e.exeEventListeners(t),e.exeEventDefault(t),e.exeEventListeners(t,!0);return this},t.prototype.exeEventListeners=function(t,e){if(!t.isListenerPrevented()){t.type=t.type.toLowerCase();for(var i=0,o=this.eventListeners.length;o>i;i++){var s=this.eventListeners[i];s&&s.type===t.type&&s.after===!!e&&s.cb.call(s.ctx,t)}}},t.prototype.exeEventDefault=function(t){var e=t.type+"Default";this[e]&&this[e](t)},t.prototype.destroy=function(t){for(var e=0;e0?1e3*this.options.cfg.interval:0,this.disableArea="yes"===this.options.cfg.disable_area,this.disableShadow="yes"===this.options.cfg.disable_shadow,this.useLeafRect="yes"===this.options.cfg.use_leaf_rect,this.cacheRect="yes"===this.options.cfg.disable_cache_rect?!1:!0}return r(e,t),e.prototype.removeChildWidget=function(e){var i=t.prototype.removeChildWidget.call(this,e);return i===this.lastFocusedChildWidget&&(this.lastFocusedChildWidget=null),i},e.prototype.keydownDefault=function(t){return this.isLeafWidget()?void this.fire(new l["default"]("switchend",this,{keyCode:t.keyCode})):void(!t.isDefaultPrevented()&&t.target&&-1!==[l["default"].VK_LEFT,l["default"].VK_RIGHT,l["default"].VK_UP,l["default"].VK_DOWN].indexOf(t.keyCode)&&this.doSwitch(t))},e.prototype.doSwitch=function(t){var e=(new Date).getTime();if(e-this.lastKeydownTimei;i++){var s=this.childWidgets[i];if(s!==t&&!s.disabled&&s.options.tab===e&&"none"!==s.getDOMNode().style.display)return this.childWidgets[i]}return null},e.prototype._queryWidgetByShadowAlgorithm=function(t,e,i){var o=t.getWidgetRect(this.cacheRect);(this.useLeafRect||"yes"===t.options.cfg.use_self_leaf_rect)&&i&&(o=i.target.getWidgetRect(this.cacheRect));for(var s=null,r=1/0,n=0;no.top&&o.right-a.righto.left&&a.right>o.right&&a.topo.top&&a.left-o.lefto.left&&o.bottom-a.bottomo.top&&a.bottom>o.bottom&&a.lefto.left&&a.top-o.topo.bottom?Math.sqrt(Math.pow(o.left-a.right,2)+Math.pow(a.top-o.bottom,2)):o.left-a.right,r>l&&(s=h,r=l)}else if("right"===e&&a.left>=o.right){var l=1/0;l=a.bottomo.bottom?Math.sqrt(Math.pow(a.left-o.right,2)+Math.pow(a.top-o.bottom,2)):a.left-o.right,r>l&&(s=h,r=l)}else if("up"===e&&a.bottom<=o.top){var l=1/0;l=a.righto.right?Math.sqrt(Math.pow(o.top-a.bottom,2)+Math.pow(a.left-o.right,2)):o.top-a.bottom,r>l&&(s=h,r=l)}else if("down"===e&&a.top>=o.bottom){var l=1/0;l=a.righto.right?Math.sqrt(Math.pow(a.top-o.bottom,2)+Math.pow(a.left-o.right,2)):a.top-o.bottom,r>l&&(s=h,r=l)}}}return s},e.prototype.getEvents=function(){return t.prototype.getEvents.call(this).concat(["switchend"])},e}(h["default"]);e["default"]=d,t.exports=e["default"]},function(t,e,i){function o(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var n=i(4),h=o(n),a=i(2),l=o(a),d=i(6),c=o(d),f=function(t){function e(i){var o=this;if(s(this,e),t.call(this,i),this.cacheRect=!1,this.dir="h"===this.options.cfg.dir?this.options.cfg.dir:"v",this.centerDOM="document"===this.options.cfg.center?this.options.cfg.center:"con",this.duration=this.options.cfg.duration?parseFloat(this.options.cfg.duration):.3,this.speedup=this.options.cfg.speedup?parseFloat(this.options.cfg.speedup):.6,this.easing=this.options.cfg.easing?this.options.cfg.easing:"ease-out",this.speedupEasing=this.options.cfg.speedup_easing?this.options.cfg.speedup_easing:"linear",this.useRAF="yes"===this.options.cfg.use_ram||"yes"===this.options.cfg.use_raf,this.lazyload="yes"!==this.options.cfg.disable_lazyload,this.lazyloadDelay=void 0!==this.options.cfg.lazyload_delay?parseFloat(this.options.cfg.lazyload_delay):.1,this.autoListWidth="yes"===this.options.cfg.auto_list_width,this.conList=this.con.querySelector(".scroll-list"),this.offset=0,this.desArr=[],!this.conList)return void console.error("[FocusEngine_Error]Scroll\u7ec4\u4ef6\u5fc5\u987b\u542b\u6709\u4e00\u4e2a\u7c7b\u540d\u4e3ascroll-list\u7684\u5b50\u5143\u7d20\u3002");var r=getComputedStyle(this.conList);"auto"!==r.left&&0!==parseInt(r.left)&&"h"===this.dir&&console.error("[FocusEngine_Error]\u6a2a\u5411Scroll\u5bb9\u5668\u7684.scroll-list\u5b50\u5143\u7d20\u4e0d\u53ef\u8bbe\u7f6eleft\u503c"),"auto"!==r.top&&0!==parseInt(r.top)&&"v"===this.dir&&console.error("[FocusEngine_Error]\u7eb5\u5411Scroll\u5bb9\u5668\u7684.scroll-list\u5b50\u5143\u7d20\u4e0d\u53ef\u8bbe\u7f6etop\u503c"),"static"===r.position&&(this.conList.style.position="relative"),this._render(),this.autoListWidth&&this._setAutoListWidth();var n=this.getDefaultFocusedChildWidget();n&&this.scrollToWidget(n,0),this.lazyload&&setTimeout(function(){o.loadVisibleImage()},10)}return r(e,t),e.prototype._computeScrollRect=function(){if(this.conRect=this.getWidgetRect(),this.conWidth=this.conRect.width,this.conHeight=this.conRect.height,this.listRect=this.conList.getBoundingClientRect(),this.listWidth=this.listRect.width,this.listHeight=this.listRect.height,"document"===this.centerDOM){var t=document.documentElement.getBoundingClientRect();"v"===this.dir?this.center=t.height/2:this.center=t.width/2}else"v"===this.dir?this.center=this.conRect.height/2:this.center=this.conRect.width/2},e.prototype._setAutoListWidth=function(){this.rightPaddingWithUnit=this.options.cfg.right_padding,this.rightPadding=0,this.rightPaddingWithUnit&&(-1!==this.rightPaddingWithUnit.indexOf("rem")?this.rightPadding=parseFloat(this.rightPaddingWithUnit)*parseFloat(document.querySelector("html").style.fontSize):this.rightPadding=parseFloat(this.rightPaddingWithUnit)),this.conList.style.width="99999px";for(var t=0,e=this.childWidgets.length;e>t;t++){var i=this.childWidgets[t].getWidgetRect().right,o=i-this.listRect.left+this.rightPadding;o>this.listWidth&&(this.listWidth=o)}this.conList.style.width=this.listWidth+"px"},e.prototype.reRender=function(){var t=this;if(document.querySelector("#"+this.id)){if(this.con=document.querySelector("#"+this.id),this.conList=this.con.querySelector(".scroll-list"),!this.conList)return void console.error("[FocusEngine_Error]Scroll\u7ec4\u4ef6\u5fc5\u987b\u542b\u6709\u4e00\u4e2a\u7c7b\u540d\u4e3ascroll-list\u7684\u5b50\u5143\u7d20\u3002");var e=getComputedStyle(this.conList);"static"===e.position&&(this.conList.style.position="relative"),this.options=this._getOptions(this.con),this.dir="h"===this.options.cfg.dir?this.options.cfg.dir:"v",this.centerDOM="ducoment"===this.options.cfg.center?this.options.cfg.center:"con",this.duration=this.options.cfg.duration?parseFloat(this.options.cfg.duration):.3,this.easing=this.options.cfg.easing?this.options.cfg.easing:"linear",this.useRAF="yes"===this.options.cfg.use_ram||"yes"===this.options.cfg.use_raf,this._render(!0),this._reRenderChildWidget(),this.autoListWidth&&this._setAutoListWidth(),this.lazyload&&setTimeout(function(){t.loadVisibleImage()},10)}},e.prototype._render=function(t){var e=this;this._computeScrollRect(),t||("v"===this.dir?this.conList.style.top="0px":this.conList.style.left="0px"),this.useRAF||("v"===this.dir?(this.conList.style.transition="top "+this.duration+"s "+this.easing,this.conList.style.webkitTransition="top "+this.duration+"s "+this.easing):(this.conList.style.transition="left "+this.duration+"s "+this.easing,this.conList.style.webkitTransition="left "+this.duration+"s "+this.easing),t||(this.rendered=!1,this.conList.addEventListener("webkitTransitionEnd",function(t){t.target===e.conList&&(e.rendered&&e.fire(new l["default"]("scrollend",e)),e.rendered=!0)}),this.conList.addEventListener("transitionend",function(t){t.target===e.conList&&(e.rendered&&e.fire(new l["default"]("scrollend",e)),e.rendered=!0)})))},e.prototype.focusDefault=function(e){if(t.prototype.focusDefault.call(this,e),this.getFirstFocusableChildWidget()&&!e.isDefaultPrevented()){if(!(this.conWidth||this.conHeight||this.listWidth||this.listHeight||this.center)){this._computeScrollRect(),this.autoListWidth&&this._setAutoListWidth();var i=this.getDefaultFocusedChildWidget();if(i)return void this.scrollToWidget(i,0)}this.doScroll(e)}},e.prototype.scrollstartDefault=function(t){this.loadImageTimeout&&clearTimeout(this.loadImageTimeout)},e.prototype.scrollendDefault=function(t){var e=this;this.lazyload&&t.target===this&&(this.loadImageTimeout=setTimeout(function(){e.loadVisibleImage()},1e3*this.lazyloadDelay))},e.prototype.doSwitch=function(e){t.prototype.doSwitch.call(this,e)},e.prototype.doScroll=function(t){var e=this.getFocusedChildWidget();this.scrollToWidget(e,this.duration,t)},e.prototype.scrollToWidget=function(t,e,i){var o=this.computeOffsetByWidget(t);return void 0===e&&(e=this.duration),this.scrollListTo(o,e,i),this},e.prototype.computeOffsetByWidget=function(t){if("yes"===t.options.cfg.to_start)return 0;if("yes"===t.options.cfg.to_end)return"v"===this.dir?this.conHeight-this.listHeight:this.conWidth-this.listWidth;this._computeScrollRect();var e=this.center-this._getExpectCenter(t);if("v"===this.dir){if(0>e){if(this.offset+e0))return this.offset}else{if(!(e>0))return this.offset;if(-1*this.offsete))return this.offset}return this.offset+e}if(0>e){if(this.offset+e0))return this.offset}else{if(!(e>0))return this.offset;if(-1*this.offsete))return this.offset}return this.offset+e},e.prototype.scrollListTo=function(t,e,i){var o=this;if(void 0===e&&(e=this.duration),this.fire(new l["default"]("scrollstart",this)),this.useRAF){if(this.desArr.length>0&&t===this.desArr[this.desArr.length-1])return;i&&"focus"===i.type&&(this.futureOffset=t),this.desArr.push(t),1===this.desArr.length&&this.doAnimate(e,this.easing)}else this.offset=t,"v"===this.dir?(this.conList.style.transition="top "+e+"s "+this.easing,this.conList.style.webkitTransition="top "+e+"s "+this.easing):(this.conList.style.transition="left "+e+"s "+this.easing,this.conList.style.webkitTransition="left "+e+"s "+this.easing),setTimeout(function(){"v"===o.dir?(o.conList.style.transition="top "+o.duration+"s "+o.easing,o.conList.style.webkitTransition="top "+o.duration+"s "+o.easing):(o.conList.style.transition="left "+o.duration+"s "+o.easing,o.conList.style.webkitTransition="left "+o.duration+"s "+o.easing)},1),"v"===this.dir?this.conList.style.top=this.offset+"px":this.conList.style.left=this.offset+"px",i&&"focus"===i.type&&(this.futureOffset=this.offset);return this},e.prototype.doAnimate=function(t,e,i){var o=this;if(this.desArr[0]===this.offset)return this.desArr.shift(),void this.doAnimate(t,e);if(0===this.desArr.length)return void this.fire(new l["default"]("scrollend",this));var s=function(){o.scrollEndTimeout&&clearTimeout(o.scrollEndTimeout),o.offset=o.desArr.shift(),o.desArr.length>0?o.doAnimate(t,e,!0):o.scrollEndTimeout=setTimeout(function(){o.fire(new l["default"]("scrollend",o))},50)};(0,c["default"])({dom:this.conList,style:"v"===this.dir?"top":"left",start:this.offset,end:this.desArr[0],duration:i?t*this.speedup:t,easing:e,cb:s})},e.prototype._getExpectCenter=function(t){var e=t.getWidgetRect();return"v"===this.dir?this.offset+e.centerY-this.listRect.top:this.offset+e.centerX-this.listRect.left},e.prototype.getListNode=function(){return this.conList},e.prototype.loadVisibleImage=function(){for(var t=this.getWidgetRect(),e=t.left,i=t.top,o=t.right,s=t.bottom,r=this.con.querySelectorAll(".fe-lazyload"),n=function(t){var n=r[t],h=n.getAttribute("fe-src"),a=n.getBoundingClientRect();if(n.src!==h&&!(a.left<=e&&a.right<=e||a.left>=o&&a.right>=o||a.top>=s&&a.bottom>=s||a.top<=i&&a.bottom<=i)){var l=new Image;l.src=h,l.onload=function(){ n.src=h}}},h=0;hp)e.style[i]=n+c,f&&f();else{var t=g(y/p),o=s+t*(n-s);e.style[i]=o+c,y++,window.requestAnimationFrame(w)}};window.requestAnimationFrame(v)}Object.defineProperty(e,"__esModule",{value:!0});var r=i(7),n=o(r);window.requestAnimationFrame=window.requestAnimationFrame||function(t){setTimeout(t,0)};var h={linear:function(t){return t},ease:n["default"].apply(null,[.25,.1,.25,1]),"ease-in":n["default"].apply(null,[.42,0,1,1]),"ease-out":n["default"].apply(null,[0,0,.58,1]),"ease-in-out":n["default"].apply(null,[.42,0,.58,1]),custom:function(t){return n["default"].apply(null,t)}};window.animate=s,e["default"]=s,t.exports=e["default"]},function(t,e){function i(t,e){return 1-3*e+3*t}function o(t,e){return 3*e-6*t}function s(t){return 3*t}function r(t,e,r){return((i(e,r)*t+o(e,r))*t+s(e))*t}function n(t,e,r){return 3*i(e,r)*t*t+2*o(e,r)*t+s(e)}function h(t,e,i,o,s){var n,h,a=0;do h=e+(i-e)/2,n=r(h,o,s)-t,n>0?i=h:e=h;while(Math.abs(n)>c&&++as;++s){var h=n(e,i,o);if(0===h)return e;var a=r(e,i,o)-t;e-=a/h}return e}var l=4,d=.001,c=1e-7,f=10,u=11,g=1/(u-1),p="function"==typeof Float32Array;t.exports=function(t,e,i,o){function s(e){for(var o=0,s=1,r=u-1;s!==r&&l[s]<=e;++s)o+=g;--s;var c=(e-l[s])/(l[s+1]-l[s]),f=o+c*g,p=n(f,t,i);return p>=d?a(e,f,t,i):0===p?f:h(e,o,o+g,t,i)}if(!(t>=0&&1>=t&&i>=0&&1>=i))throw new Error("bezier x values must be in [0, 1] range");var l=p?new Float32Array(u):new Array(u);if(t!==e||i!==o)for(var c=0;u>c;++c)l[c]=r(c*g,t,i);return function(n){return t===e&&i===o?n:0===n?0:1===n?1:r(s(n),e,o)}}},function(t,e,i){function o(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var n=i(3),h=o(n),a=i(2),l=o(a),d=i(6),c=o(d),f=function(t){function e(i){s(this,e),t.call(this,i),this._init(),this._writeGridInnerHTML(),t.prototype._initChildWidgets.call(this),this["_checkWidgets_"+this.dir]()}return r(e,t),e.prototype._initChildWidgets=function(){},e.prototype.reRender=function(){},e.prototype._init=function(){return this.dir="h"===this.options.cfg.dir?"h":"v",this.style="h"===this.options.cfg.dir?"left":"top",isNaN(this.options.cfg.row)||isNaN(this.options.cfg.col)?void console.error("[FocusEngine_Error]Grid\u7ec4\u4ef6\u5fc5\u987b\u8bbe\u7f6e\u884c\u548c\u5217\uff01\u884c\u5217\u6570\u4e3a\u89c6\u53e3\u5185\u53ef\u89c1\u7684\u6700\u591a\u884c\u5217\u6570\u3002"):(this.duration=void 0!==this.options.cfg.duration?parseFloat(this.options.cfg.duration):.3,this.speedupDuration=void 0!==this.options.cfg.speedup_duration?parseFloat(this.options.cfg.speedup_duration):.6*this.duration,this.easing=this.options.cfg.easing?this.options.cfg.easing:"ease-out",this.speedupEasing=this.options.cfg.speedup_easing?this.options.cfg.speedup_easing:"linear",this.delay=void 0!==this.options.cfg.delay?parseFloat(this.options.cfg.delay):0,this.noEmpty="yes"===this.options.cfg.no_empty,this.delay>0&&this.delay<.05&&(this.delay=.05),this.delayStyle="1"===this.options.cfg.delay_style?1:0,this.data=this.data||[],this.itemRender=this.itemRender||null,this.scrolling=!1,this.originSize=this.options.cfg.origin_size?parseInt(this.options.cfg.origin_size):1,this.origin=0,this.dataIndex=0,void this["_init_more_"+this.dir]())},e.prototype._init_more_v=function(){this.row=parseInt(this.options.cfg.row)+2,this.col=parseInt(this.options.cfg.col),this.originSize>1?this.row=this.originSize+2:this.row%2===0&&this.row++,this.upRow=0,this.downRow=this.row-1},e.prototype._init_more_h=function(){this.row=parseInt(this.options.cfg.row),this.col=parseInt(this.options.cfg.col)+2,this.originSize>1?this.col=this.originSize+2:this.col%2===0&&this.col++,this.lefCol=0,this.rightCol=this.col-1},e.prototype._writeGridInnerHTML=function(){var t=this.con.children[0];t.id="",this.templateHTML=t.outerHTML,this.con.innerHTML="",this["_writeGridInnerHTML_"+this.dir]()},e.prototype._writeGridInnerHTML_v=function(){for(var t="",e=0;e';for(var e=0;e';var i=document.createElement("div");i.style.width="99999px",i.style.height="100%";for(var e=0;e')[0]),this.con.appendChild(i)},e.prototype._checkWidgets_v=function(){this.widgetArr=[];for(var t=0,e=0,i=this.childWidgets.length;i>e;e+=this.col){var o=this.childWidgets.slice(e,e+this.col);o=o.map(function(e,i){return e.row=t,e.col=i,e}),this.widgetArr.push(o),t++}var s=this.getWidgetRect();if(this.conHeight=s.height,this.rowHeight=this.childWidgets[0].con.parentNode.getBoundingClientRect().height,this.originArr=[],1===this.originSize)this.originArr.push(this.conHeight/2);else for(var e=0,r=this.rowHeight/2;ee;e+=this.row){var o=this.childWidgets.slice(e,e+this.row);o=o.map(function(e,i){return e.col=t,e.row=i,e}),this.widgetArr.push(o),t++}var s=this.getWidgetRect();if(this.conWidth=s.width,this.colWidth=this.childWidgets[0].con.parentNode.getBoundingClientRect().width,this.originArr=[],1===this.originSize)this.originArr.push(this.conWidth/2);else for(var e=0,r=this.colWidth/2;e=this.col?e-=this.col:-1:t===l["default"].VK_DOWN?e+this.col=this.data.length&&Math.floor(e/this.col)=this.row?e-=this.row:-1:t===l["default"].VK_RIGHT?e+this.row=this.data.length&&Math.floor(e/this.row)0?this.origin--:!this.isUp&&this.origins&&(this.focsedCY=this.conHeight-s,this.downRow=i-e,this.upRow=this.row-1-this.downRow);var r=e*this.rowHeight+this.rowHeight/2,n=(i+1)*this.rowHeight;if(o>r||n0?this.origin--:!this.isLeft&&this.origins&&(this.focsedCX=this.conWidth-s,this.rightCol=i-e,this.leftCol=this.col-1-this.rightCol);var r=e*this.colWidth+this.colWidth/2,n=(i+1)*this.colWidth;if(o>r||n=-this.upRow;o--)this._computeRowWidgetStatus_v(e,i,o);for(var o=1;o<=this.downRow;o++)this._computeRowWidgetStatus_v(e,i,o)},e.prototype._computeAllWidgetStatus_h=function(t){var e=t.col,i=Math.floor(this.dataIndex/this.row);this._computeColWidgetStatus_h(e,i,0);for(var o=-1;o>=-this.leftCol;o--)this._computeColWidgetStatus_h(e,i,o);for(var o=1;o<=this.rightCol;o++)this._computeColWidgetStatus_h(e,i,o)},e.prototype._computeRowWidgetStatus_v=function(t,e,i){for(var o=(t+i+this.row)%this.row,s=e+i,r=0;r=this.data.length||0>h)&&(a=0),n.whichData=h,n.whichDataRow=s,this.isSetData)n.offset=this.focsedCY+i*this.rowHeight-n.oriCenteY,n.con.parentNode.style.top=n.offset+"px",n.con.style.opacity=a,n.offsetRow=i;else{var l=this.focsedCY+i*this.rowHeight-n.oriCenteY;n.futureOffset=l,n.animationArr.push({offset:l,jump:n.offsetRow*i<0,opacity:a}),n.offsetRow=i}}},e.prototype._computeColWidgetStatus_h=function(t,e,i){for(var o=(t+i+this.col)%this.col,s=e+i,r=0;r=this.data.length||0>h)&&(a=0),n.whichData=h,n.whichDataCol=s,this.isSetData)n.offset=this.focsedCX+i*this.colWidth-n.oriCenteX,n.con.parentNode.style.left=n.offset+"px",n.con.style.opacity=a,n.offsetCol=i;else{var l=this.focsedCX+i*this.colWidth-n.oriCenteX;n.futureOffset=l,n.animationArr.push({offset:l,jump:n.offsetCol*i<0,opacity:a}),n.offsetCol=i}}},e.prototype._triggerWidgetsAnimation_v=function(){for(var t=0;ts;s++){var n=o[s],h=n.animationArr[0];if(h.jump)if(this.noEmpty){var a=this.data[n.whichData];a&&(this.itemRender(n.getDOMNode(),a),n.isEmpty=!1)}else n.isEmpty||(this.itemRender(n.getDOMNode()),n.isEmpty=!0)}var d=function(){for(var e=0,s=o.length;s>e;e++){var r=o[e],n=r.animationArr.shift();r.offset=n.offset,r.con.style.opacity=n.opacity}t.animationArr.length>0?i._startScroll_v(t,!0):i.scrolling&&0===t.row&&(i.scrolling=!1,i.fire(new l["default"]("scrollend",i)))};this.stopSwitch=t.animationArr.length>=2;var f=t.animationArr[0];f.offset===t.offset||f.jump||this.scrolling||(this.scrolling=!0,this.fire(new l["default"]("scrollstart",this,{distance:f.offset-t.offset}))),(0,c["default"])({dom:t.con.parentNode,style:this.style,start:f.jump?f.offset:t.offset,end:f.offset,duration:e?this.speedupDuration:this.duration,easing:e?this.speedupEasing:this.easing,cb:d})},e.prototype._startScroll_h=function(t,e){for(var i=this,o=this.widgetArr[t.col],s=0,r=o.length;r>s;s++){var n=o[s],h=n.animationArr[0];if(h.jump)if(this.noEmpty){var a=this.data[n.whichData];a&&(this.itemRender(n.getDOMNode(),a),n.isEmpty=!1)}else n.isEmpty||(this.itemRender(n.getDOMNode()),n.isEmpty=!0)}var d=function(){for(var e=0,s=o.length;s>e;e++){var r=o[e],n=r.animationArr.shift();r.offset=n.offset,r.con.style.opacity=n.opacity}t.animationArr.length>0?i._startScroll_h(t,!0):i.scrolling&&0===t.col&&(i.scrolling=!1,i.fire(new l["default"]("scrollend",i)))};this.stopSwitch=t.animationArr.length>=2;var f=t.animationArr[0];f.offset===t.offset||f.jump||this.scrolling||(this.scrolling=!0,this.fire(new l["default"]("scrollstart",this,{distance:f.offset-t.offset}))),(0,c["default"])({dom:t.con.parentNode,style:this.style,start:f.jump?f.offset:t.offset,end:f.offset,duration:e?this.speedupDuration:this.duration,easing:e?this.speedupEasing:this.easing,cb:d})},e.prototype.scrollendDefault=function(t){t.isDefaultPrevented()||this.scrolling||this["_toggleDelay_"+this.dir](0)},e.prototype.scrollstartDefault=function(t){t.isDefaultPrevented()||(this["_toggleDelay_"+this.dir](t.distance),this.loadContentTimeout&&clearTimeout(this.loadContentTimeout),window.stopImgLoading&&window.stopImgLoading())},e.prototype._toggleDelay_v=function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],i=this.getFocusedChildWidget()||this.getCachedChildWidget();if(i)for(var o=i.col,s=0;sthis.originSize)&&(i=0);var o=Math.floor(this.dataIndex/this.col),s=Math.floor((this.data.length-1)/this.col);if(s-o=0&&r>i&&(i=r)}if(on&&(i=n)}return i},e.prototype._getSetDataOrigin_h=function(t,e,i){(void 0===i||i>this.originSize)&&(i=0);var o=Math.floor(this.dataIndex/this.row),s=Math.floor((this.data.length-1)/this.row);if(s-o=0&&r>i&&(i=r)}if(on&&(i=n)}return i},e.prototype.loadContent=function(){if(!this.scrolling){for(var t=0,e=this.childWidgets.length;e>t;t++){var i=this.childWidgets[t];if(i.isEmpty||this.isSetData){var o=this.data[i.whichData];this.itemRender&&this.itemRender(i.getDOMNode(),o),i.isEmpty=!1}}window.resumeImgLoading&&window.resumeImgLoading(),this.fire(new l["default"]("contentloaded",this))}},e.prototype.splice=function(){Array.prototype.splice.apply(this.data,arguments),this.isSetData=!0,this.loadContent(),this.isSetData=!1},e.prototype.getEvents=function(){return t.prototype.getEvents.call(this).concat(["reachend","contentloaded"])},e}(h["default"]);e["default"]=f,t.exports=e["default"]},function(t,e,i){function o(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var n=i(1),h=o(n),a=i(3),l=o(a),d=i(2),c=o(d),f=i(6),u=(o(f),function(t){function e(i){s(this,e),t.call(this,i),this._init()}return r(e,t),e.prototype._init=function(){var t=this;this.listDom=document.createElement("div"),this.listDom.style.position="relative",this.listDom.style.width="100%",this.con.innerHTML="",this.con.appendChild(this.listDom),this.duration=void 0!==this.options.cfg.duration?parseFloat(this.options.cfg.duration):.3,this.delay=void 0!==this.options.cfg.delay?parseFloat(this.options.cfg.delay):.1,this.easing=this.options.cfg.easing?this.options.cfg.easing:"ease-out",this.bottomPadding=void 0!==this.options.cfg.bottom_padding?parseFloat(this.options.cfg.bottom_padding):0,this.visibleRow=void 0!==this.options.cfg.visible_row?parseInt(this.options.cfg.visible_row):5,this.listDom.style.transition="transform "+this.duration+"s "+this.easing,this.listDom.addEventListener("transitionend",function(e){e.target===t.listDom&&t.fire(new c["default"]("scrollend",t))}),this.getWidgetRect(),this.align=this.rect.height/2,this.offset=0,this._reset()},e.prototype._reset=function(){this.lastWidgetRow=0,this.lastWidgetCol=0,this.lastWidgetCenter=0,this.listHeight=0,this.childrenArr=[],this.childWidgets=[],this.childItems=[],this.focusPos={row:0,col:0}},e.prototype.setData=function(t,e){var i=this;if(this.isSetData=!0,0==this.childItems.length)return this.listDom.innerHTML="",this._reset(),this.dataIndex=void 0!==e?e:0,this.data=[].concat(t),void this._renderChildren();for(var o=!1,s=0;s1)return console.error("[FocusEngine_Error]Grille\u7ec4\u4ef6\u7684itemRender\u8fd4\u56de\u7684\u5b57\u7b26\u4e32\u5fc5\u987b\u662f\u53ef\u89e3\u6790\u6210\u4e00\u4e2adom\u5bf9\u8c61\u3002"),"continue";o=s[0]}var r=o.querySelector(".grille-lazyload");if(r&&o.removeChild(r),t.listDom.appendChild(o),!o.getAttribute("fe-role"))return t.childItems.push(o),"continue";var n=h["default"].createWidget(o);t.addChildWidget(n),t.childItems.push(n),n.data=i,n.index=e,n.lazyDom=r,n.getWidgetRectAsync(function(i){if(n.oriOffset=i.centerY-t.rect.top-t.offset,t.listHeightt.lastWidgetCenter&&(t.lastWidgetRow++,n.row=t.lastWidgetRow,t.lastWidgetCol=0,n.col=t.lastWidgetCol,t.lastWidgetCenter=i.centerY-t.offset,t.childrenArr[t.lastWidgetRow]=[n]):(n.row=t.lastWidgetRow,n.col=t.lastWidgetCol,t.lastWidgetCenter=i.centerY,t.childrenArr[t.lastWidgetRow]=[n]),n.row<=t.visibleRow&&(n.visible=!0,n.con.style.transition="transform "+.8*t.duration+"s "+t.easing),e===t.data.length-1&&(t.focused&&t.childItems[t.dataIndex].focus(),t.isSetData)){t.listDom.style.visibility="visible";var o=t.childItems[t.dataIndex];t.loadContent(),t._doScroll(o),t.setCachedChildWidget(o)}})},i=this.childItems.length;i0&&(i=0),this.listHeight-t.oriOffset0&&(e--,i>=this.childrenArr[e].length&&(i=this.childrenArr[e].length-1),t.preventDefault()),t.keyCode===c["default"].VK_DOWN&&e==this.lastWidgetRow-1&&this.fire(new c["default"]("reachend",this)),t.keyCode===c["default"].VK_DOWN&&e=this.childrenArr[e].length&&(i=this.childrenArr[e].length-1),t.preventDefault()),t.keyCode===c["default"].VK_LEFT&&i>0&&(i--,t.preventDefault()),t.keyCode===c["default"].VK_RIGHT&&i