"use strict";var _slicedToArray=function(){return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,r){var n=[],t=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(t=(i=c.next()).done)&&(n.push(i.value),!r||n.length!==r);t=!0);}catch(e){a=!0,o=e}finally{try{!t&&c.return&&c.return()}finally{if(a)throw o}}return n}(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function _asyncToGenerator(e){return function(){var r=e.apply(this,arguments);return new Promise(function(e,n){return function t(a,o){try{var i=r[a](o),c=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(c).then(function(e){t("next",e)},function(e){t("throw",e)});e(c)}("next")})}}drill.init(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(r,n){var t,a,o,i,c,u,s,d,l,f,g,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.target,a=n.data,o=50,e.next=4,r("util/viewUtil","util/cacheUtil","common/data");case 4:i=e.sent,c=_slicedToArray(i,3),u=c[0],s=c[1],d=c[2],l=function(e,r){var n={},t=r["background-image"];t&&(n["background-image"]="url("+t+")"),["background-color","background-repeat","background-size","background-position"].forEach(function(e){r[e]&&(n[e]=r[e])}),e.css(n)},f=function(e,r){Array.from(r).forEach(function(r){var n=o++;r.outerId=n;var t=$('\n            <div class="p_ele_outer" style="opacity:0;" ver="'+r.ver+'" hor="'+r.hor+'" outer-id="'+n+'">\n                <div class="p_ele"></div>\n            </div>');setTimeout(function(){t.css("opacity","")},50),t.prop("eleData",r);var a=t.find(".p_ele");switch(a.css("width",r.w),e.append(t),r.tag){case"text":a.addClass("p_text"),a.html(r.intext.replace(/\n/g,"<br>")),["fontWeight","fontStyle","color","lineHeight"].forEach(function(e){r[e]&&a.css(e,r[e])});break;case"pic":a.addClass("p_pic"),a.append('<img src="'+r.picUrl+'" />')}l(a,r)})},g=(g=$(".mainLoading")).length?g.html():'\n        <div class="loading_layer">\n            <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="rgba(200,200,200,.5)">\n                <g fill="none" fill-rule="evenodd">\n                    <g transform="translate(1 1)" stroke-width="2">\n                        <circle stroke-opacity=".5" cx="18" cy="18" r="18" />\n                        <path d="M36 18c0-9.94-8.06-18-18-18"></path>\n                    </g>\n                </g>\n            </svg>\n        </div>\n        ',Array.from(a.mainPage).forEach(function(e,r){var n=$('\n        <div class="page">\n            '+g+"\n        </div>\n        ");l(n,e),n.prop("pageData",e),e.startLoad=_asyncToGenerator(regeneratorRuntime.mark(function t(){var a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.loaded){t.next=2;break}return t.abrupt("return",e.loaded);case 2:return d.trigger("pageStartLoad",{page:n,pageId:r}),e.loaded=2,a=[],Array.from(e).forEach(function(e){"pic"==e.tag&&a.push(e.picUrl),e["background-image"]&&a.push(e["background-image"])}),t.next=8,s.cacheImg(a);case 8:return f(n,e),n.find(".loading_layer").remove(),e.loaded=1,u.refreshView(n[0]),d.trigger("pageLoaded",{page:n,pageId:r}),e.checkPrevAndNext(),t.abrupt("return",1);case 15:case"end":return t.stop()}},t,void 0)})),e.checkPrevAndNext=function(){var e=n.prev(),r=n.next();e.length&&e[0].pageData.startLoad(),r.length&&r[0].pageData.startLoad()},e.loaded=0,t.append(n),d.currentPageId==n.index()&&(n.addClass("eleFadeIn"),setTimeout(function(){n.removeClass("eleFadeIn")},300))}),t.children().each(function(e,r){u.refreshView(r)}),p=void 0,$(window).on("resize",function(e){clearTimeout(p),p=setTimeout(function(){t.children().each(function(e,r){u.refreshView(r)})},300)});case 17:case"end":return e.stop()}},e,void 0)}));return function(r,n){return e.apply(this,arguments)}}());