Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smartphoto

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartphoto - npm Package Compare versions

Comparing version 1.4.3 to 1.5.0

.git

6

js/jquery-smartphoto.min.js

@@ -9,3 +9,3 @@ /**

* homepage: http://developer.a-blogcms.jp
* version: 1.3.6
* version: 1.4.3
*

@@ -56,3 +56,3 @@ * a-template:

*/
!function(){function t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var d="function"==typeof require&&require;if(!s&&d)return d(r,!0);if(n)return n(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var u=a[r]={exports:{}};e[r][0].call(u.exports,function(t){return i(e[r][1][t]||t)},u,u.exports,t,e,a,o)}return a[r].exports}for(var n="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}return t}()({1:[function(t,e,a){"use strict";function o(t){if(Array.isArray(t)){for(var e=0,a=Array(t.length);e<t.length;e++)a[e]=t[e];return a}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}();t("ie-array-find-polyfill");var r=t("morphdom"),s=function(t){return t&&t.__esModule?t:{default:t}}(r),d=t("./util"),c="input paste copy click change keydown keyup keypress contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend focus",u=c.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]",h=function(){function t(e){var a=this;i(this,t),this.atemplate=[],e&&Object.keys(e).forEach(function(t){a[t]=e[t]}),this.data||(this.data={}),this.templates||(this.templates=[]);for(var o=this.templates,n=o.length,r=0,s=n;r<s;r+=1){var c=this.templates[r],u=(0,d.selector)("#"+c).innerHTML;this.atemplate.push({id:c,html:u,binded:!1})}}return n(t,[{key:"addDataBind",value:function(t){var e=this;(0,d.on)(t,"[data-bind]","input change click",function(t){var a=t.delegateTarget,o=a.getAttribute("data-bind"),i=a.getAttribute("href"),n=a.value;i&&(n=n.replace("#","")),"checkbox"===a.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+o+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():"radio"!==a.getAttribute("type")&&e.updateDataByString(o,n)})}},{key:"addActionBind",value:function(t){var e=this;(0,d.on)(t,u,c,function(t){var a=t.delegateTarget,i=c.split(" "),n="action";i.forEach(function(e){a.getAttribute("data-action-"+e)&&t.type===e&&(n+="-"+e)});var r=a.getAttribute("data-"+n);if(r){var s=r.replace(/\(.*?\);?/,""),d=r.replace(/(.*?)\((.*?)\);?/,"$2"),u=d.split(",");if(e.e=t,e.method&&e.method[s]){var h;(h=e.method)[s].apply(h,o(u))}else e[s]&&e[s].apply(e,o(u))}})}},{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e,binded:!1}),this.templates.push(t)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){var e=this;Object.keys(t).forEach(function(a){"function"!=typeof t[a]&&(e.data[a]=t[a])})}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));e&&this.setData(e)}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i+=1)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return null;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),n=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),r=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist -->/g),s=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty -->/g);if(i)for(var d=0,c=i.length;d<c;d+=1){var u=i[d];u=u.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touch#($2)");var h=u.replace(/BEGIN/,"END"),l=new RegExp(u+"(([\\n\\r\\t]|.)*?)"+h,"g");t=t.replace(l,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))===i?n:""})}if(n)for(var f=0,p=n.length;f<p;f+=1){var m=n[f];m=m.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!==i?n:""})}if(r)for(var y=0,x=r.length;y<x;y+=1){var w=r[y];w=w.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist/,"($1):exist");var P=w.replace(/BEGIN/,"END"),E=new RegExp(w+"(([\\n\\r\\t]|.)*?)"+P,"g");t=t.replace(E,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?i:""})}if(s)for(var b=0,_=s.length;b<_;b+=1){var I=s[b];I=I.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty/,"($1):empty");var N=I.replace(/BEGIN/,"END"),S=new RegExp(I+"(([\\n\\r\\t]|.)*?)"+N,"g");t=t.replace(S,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?"":i})}return t=t.replace(/{([\w\-\.ぁ-んァ-ヶ亜-熙]+)}(\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\])*/g,function(t,i,n,r){var s=void 0;if(""+i=="i")s=a;else{if(!e[i]&&0!==e[i])return r&&o.convert&&o.convert[r]?o.convert[r].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return r&&o.convert&&o.convert[r]?o.convert[r].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){var e=/<!-- #include id="(.*?)" -->/g;return t=t.replace(e,function(t,e){return(0,d.selector)("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->/g;return t=t.replace(e,function(t,e){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g,a=this;return t=t.replace(e,function(t,e,o){var i=a.getDataByString(e),n=[];n="function"==typeof i?i.apply(a):i;var r="";if(n instanceof Array)for(var s=0,d=n.length;s<d;s+=1)r+=a.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;return Object.keys(e).forEach(function(a){for(var o=0,i=t.length;o<i;o+=1)a===t[o]&&delete e[a]}),this}},{key:"hasLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g;return!!t.match(e)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"html",a=arguments[1],o=this.templates;this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=o.length;i<n;i+=1)!function(i,n){var r=o[i],c="#"+r,u=t.getHtml(r),h=(0,d.selector)("[data-id='"+r+"']");if(h)if("text"===e)h.innerText=u;else if(a){var l=document.createElement("div");l.innerHTML=u;var f=l.querySelector(a).outerHTML;(0,s.default)(h.querySelector(a),f)}else(0,s.default)(h,"<div data-id='"+r+"'>"+u+"</div>");else(0,d.selector)(c).insertAdjacentHTML("afterend",'<div data-id="'+r+'"></div>'),"text"===e?(0,d.selector)("[data-id='"+r+"']").innerText=u:(0,d.selector)("[data-id='"+r+"']").innerHTML=u;var p=t.atemplate.find(function(t){return t.id===r});p.binded||(p.binded=!0,t.addDataBind((0,d.selector)("[data-id='"+r+"']")),t.addActionBind((0,d.selector)("[data-id='"+r+"']")))}(i);return this.updateBindingData(a),this.onUpdated&&this.onUpdated(a),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o+=1){var n=a[o],r=(0,d.selector)("[data-id='"+n+"']");t&&(r=r.querySelector(t));var s=r.querySelectorAll("[data-bind]");[].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a});var c=r.querySelectorAll("[data-bind-oneway]");[].forEach.call(c,function(t){var a=e.getDataByString(t.getAttribute("data-bind-oneway"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a})}return this}},{key:"applyMethod",value:function(t){for(var e,a=arguments.length,o=Array(a>1?a-1:0),i=1;i<a;i++)o[i-1]=arguments[i];return(e=this.method)[t].apply(e,o)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();a.default=h,e.exports=a.default},{"./util":2,"ie-array-find-polyfill":5,morphdom:6}],2:[function(t,e,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var o=a.matches=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},i=(a.selector=function(t){return document.querySelector(t)},a.findAncestor=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t&&t!==document;){if(o(t,e))return t;t=t.parentElement}return null});a.on=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,i(t.target,e));a&&(t.delegateTarget=a,o(t))})})}},{}],3:[function(t,e,a){try{var o=new window.CustomEvent("test");if(o.preventDefault(),!0!==o.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var i=function(t,e){var a,o;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},a=document.createEvent("CustomEvent"),a.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),o=a.preventDefault,a.preventDefault=function(){o.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},a};i.prototype=window.Event.prototype,window.CustomEvent=i}},{}],4:[function(t,e,a){(function(t,e){!function(t){function o(t){return"[object Array]"===Object.prototype.toString.call(t)}function i(){for(var t=0;t<I.length;t++)I[t][0](I[t][1]);I=[],y=!1}function n(t,e){I.push([t,e]),y||(y=!0,_(i,0))}function r(t,e){function a(t){c(e,t)}function o(t){h(e,t)}try{t(a,o)}catch(t){o(t)}}function s(t){var e=t.owner,a=e.state_,o=e.data_,i=t[a],n=t.then;if("function"==typeof i){a=P;try{o=i(o)}catch(t){h(n,t)}}d(n,o)||(a===P&&c(n,o),a===E&&h(n,o))}function d(t,e){var a;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&("function"==typeof e||"object"==typeof e)){var o=e.then;if("function"==typeof o)return o.call(e,function(o){a||(a=!0,e!==o?c(t,o):u(t,o))},function(e){a||(a=!0,h(t,e))}),!0}}catch(e){return a||h(t,e),!0}return!1}function c(t,e){t!==e&&d(t,e)||u(t,e)}function u(t,e){t.state_===x&&(t.state_=w,t.data_=e,n(f,t))}function h(t,e){t.state_===x&&(t.state_=w,t.data_=e,n(p,t))}function l(t){var e=t.then_;t.then_=void 0;for(var a=0;a<e.length;a++)s(e[a])}function f(t){t.state_=P,l(t)}function p(t){t.state_=E,l(t)}function m(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof m==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],r(t,this)}var v=t.Promise,g=v&&"resolve"in v&&"reject"in v&&"all"in v&&"race"in v&&function(){var t;return new v(function(e){t=e}),"function"==typeof t}();void 0!==a&&a?(a.Promise=g?v:m,a.Polyfill=m):"function"==typeof define&&define.amd?define(function(){return g?v:m}):g||(t.Promise=m);var y,x="pending",w="sealed",P="fulfilled",E="rejected",b=function(){},_=void 0!==e?e:setTimeout,I=[];m.prototype={constructor:m,state_:x,then_:null,data_:void 0,then:function(t,e){var a={owner:this,then:new this.constructor(b),fulfilled:t,rejected:e};return this.state_===P||this.state_===E?n(s,a):this.then_.push(a),a.then},catch:function(t){return this.then(null,t)}},m.all=function(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to Promise.all().");return new e(function(e,a){for(var o,i=[],n=0,r=0;r<t.length;r++)o=t[r],o&&"function"==typeof o.then?o.then(function(t){return n++,function(a){i[t]=a,--n||e(i)}}(r),a):i[r]=o;n||e(i)})},m.race=function(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to Promise.race().");return new e(function(e,a){for(var o,i=0;i<t.length;i++)o=t[i],o&&"function"==typeof o.then?o.then(e,a):e(o)})},m.resolve=function(t){var e=this;return t&&"object"==typeof t&&t.constructor===e?t:new e(function(e){e(t)})},m.reject=function(t){return new this(function(e,a){a(t)})}}("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{timers:8}],5:[function(t,e,a){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),a=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var o=arguments[1],i=0;i<a;){var n=e[i];if(t.call(o,n,i,e))return n;i++}}})},{}],6:[function(t,e,a){"use strict";function o(t){!h&&p.createRange&&(h=p.createRange(),h.selectNode(p.body));var e;return h&&h.createContextualFragment?e=h.createContextualFragment(t):(e=p.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function n(t,e){return e&&e!==f?p.createElementNS(e,t):p.createElement(t)}function r(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,n,r,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,n=o.namespaceURI,r=o.value,n?(i=o.localName||i,t.getAttributeNS(n,i)!==r&&t.setAttributeNS(n,i,r)):t.getAttribute(i)!==r&&t.setAttribute(i,r);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,n=o.namespaceURI,n?(i=o.localName||i,v(e,n,i)||t.removeAttributeNS(n,i)):v(e,null,i)||t.removeAttribute(i))}function d(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function c(){}function u(t){return t.id}var h,l,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};l=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=l,g={OPTION:function(t,e){d(t,e,"selected")},INPUT:function(t,e){d(t,e,"checked"),d(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;t.value!==a&&(t.value=a);var o=t.firstChild;if(o){var i=o.nodeValue;if(i==a||!a&&i==t.placeholder)return;o.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,w=8,P=function(t){return function(e,a,s){function d(t){E?E.push(t):E=[t]}function h(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=b(a))?d(o):(B(a),a.firstChild&&h(a,e)),a=a.nextSibling}}function l(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),B(t),h(t,a))}function f(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=b(e);a&&(T[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=b(e);if(o){var n=T[o];n&&i(e,n)&&(e.parentNode.replaceChild(n,e),v(n,e))}m(e),e=a}}function v(o,n,r){var s,c=b(n);if(c&&delete T[c],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===N(o,n))return;if(t(o,n),S(o),!1===D(o,n))return}if("TEXTAREA"!==o.nodeName){var u,h,f,P,E=n.firstChild,I=o.firstChild;t:for(;E;){for(f=E.nextSibling,u=b(E);I;){if(h=I.nextSibling,E.isSameNode&&E.isSameNode(I)){E=f,I=h;continue t}s=b(I);var k=I.nodeType,B=void 0;if(k===E.nodeType&&(k===y?(u?u!==s&&((P=T[u])?I.nextSibling===P?B=!1:(o.insertBefore(P,I),h=I.nextSibling,s?d(s):l(I,o,!0),I=P):B=!1):s&&(B=!1),(B=!1!==B&&i(I,E))&&v(I,E)):k!==x&&k!=w||(B=!0,I.nodeValue!==E.nodeValue&&(I.nodeValue=E.nodeValue))),B){E=f,I=h;continue t}s?d(s):l(I,o,!0),I=h}if(u&&(P=T[u])&&i(P,E))o.appendChild(P),v(P,E);else{var A=_(E);!1!==A&&(A&&(E=A),E.actualize&&(E=E.actualize(o.ownerDocument||p)),o.appendChild(E),m(E))}E=f,I=h}for(;I;)h=I.nextSibling,(s=b(I))?d(s):l(I,o,!0),I=h}var O=g[o.nodeName];O&&O(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var P=a;a=p.createElement("html"),a.innerHTML=P}else a=o(a);var E,b=s.getNodeKey||u,_=s.onBeforeNodeAdded||c,I=s.onNodeAdded||c,N=s.onBeforeElUpdated||c,S=s.onElUpdated||c,k=s.onBeforeNodeDiscarded||c,B=s.onNodeDiscarded||c,D=s.onBeforeElChildrenUpdated||c,A=!0===s.childrenOnly,T={};f(e);var O=e,C=O.nodeType,G=a.nodeType;if(!A)if(C===y)G===y?i(e,a)||(B(e),O=r(e,n(a.nodeName,a.namespaceURI))):O=a;else if(C===x||C===w){if(G===C)return O.nodeValue!==a.nodeValue&&(O.nodeValue=a.nodeValue),O;O=a}if(O===a)B(e);else if(v(O,a,A),E)for(var L=0,X=E.length;L<X;L++){var z=T[E[L]];z&&l(z,z.parentNode,!1)}return!A&&O!==e&&e.parentNode&&(O.actualize&&(O=O.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(O,e)),O}}(s);e.exports=P},{}],7:[function(t,e,a){function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function n(t){if(h===setTimeout)return setTimeout(t,0);if((h===o||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function r(t){if(l===clearTimeout)return clearTimeout(t);if((l===i||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function s(){v&&p&&(v=!1,p.length?m=p.concat(m):g=-1,m.length&&d())}function d(){if(!v){var t=n(s);v=!0;for(var e=m.length;e;){for(p=m,m=[];++g<e;)p&&p[g].run();g=-1,e=m.length}p=null,v=!1,r(t)}}function c(t,e){this.fun=t,this.array=e}function u(){}var h,l,f=e.exports={};!function(){try{h="function"==typeof setTimeout?setTimeout:o}catch(t){h=o}try{l="function"==typeof clearTimeout?clearTimeout:i}catch(t){l=i}}();var p,m=[],v=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)e[a-1]=arguments[a];m.push(new c(t,e)),1!==m.length||v||n(d)},c.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.prependListener=u,f.prependOnceListener=u,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],8:[function(t,e,a){(function(e,o){function i(t,e){this._id=t,this._clearFn=e}var n=t("process/browser.js").nextTick,r=Function.prototype.apply,s=Array.prototype.slice,d={},c=0;a.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},a.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},a.clearTimeout=a.clearInterval=function(t){t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},a.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},a.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},a._unrefActive=a.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},a.setImmediate="function"==typeof e?e:function(t){var e=c++,o=!(arguments.length<2)&&s.call(arguments,1);return d[e]=!0,n(function(){d[e]&&(o?t.apply(null,o):t.call(null),a.clearImmediate(e))}),e},a.clearImmediate="function"==typeof o?o:function(t){delete d[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":7,timers:8}],9:[function(t,e,a){"use strict";var o=t("../index"),i=function(t){t.fn.SmartPhoto=function(t){return"strings"==typeof t||new o(this,t),this}};if("function"==typeof define&&define.amd)define(["jquery"],i);else{var n=window.jQuery?window.jQuery:window.$;void 0!==n&&i(n)}e.exports=i},{"../index":11}],10:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(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(a,"__esModule",{value:!0});var r=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),s=t("a-template"),d=function(t){return t&&t.__esModule?t:{default:t}}(s);t("custom-event-polyfill");var c='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e aria-hidden="true"\x3c!-- END hide:exist --\x3e\x3c!-- BEGIN hide:empty --\x3e aria-hidden="false"\x3c!-- END hide:empty --\x3e role="dialog">\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}" aria-live="polite" tabindex="-1">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"><span class="smartphoto-sr-only">\\{message.closeDialog\\}</span></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e\x3c!-- BEGIN isSmartPhone:empty --\x3e data-action-click="hidePhoto()"\x3c!-- END isSmartPhone:empty --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN processed:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}[round]px,{y}[round]px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3ewidth:{width}px;" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN processed:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showPrevArrow:empty --\x3e aria-hidden="true"\x3c!-- END showPrevArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({prev})" role="button"><span class="smartphoto-sr-only">\\{message.gotoPrevImage\\}</span></a></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showNextArrow:empty --\x3e aria-hidden="true"\x3c!-- END showNextArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({next})" role="button"><span class="smartphoto-sr-only">\\{message.gotoNextImage\\}</span></a></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li><a href="#" data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({thumb});" role="button"><span class="smartphoto-sr-only">go to {caption}</span></a></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',u=t("../lib/util"),h=t("es6-promise-polyfill").Promise,l={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit"},f=function(t){function e(t,a){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));n.data=u.extend({},l,a),n.data.currentIndex=0,n.data.oldIndex=0,n.data.hide=!0,n.data.group={},n.data.scaleSize=1,n.data.scale=!1,n.pos={x:0,y:0},n.data.photoPosX=0,n.data.photoPosY=0,n.convert={increment:n.increment,virtualPos:n.virtualPos,round:n.round},n.data.groupItems=n.groupItems,n.elements="string"==typeof t?document.querySelectorAll(t):t;var r=new Date;n.tapSecond=r.getTime(),n.onListMove=!1,n.clicked=!1,n.id=n._getUniqId(),n.vx=0,n.vy=0,n.data.appearEffect=null,n.addTemplate(n.id,c),n.data.isSmartPhone=n._isSmartPhone();var s=document.querySelector("body");u.append(s,"<div data-id='"+n.id+"'></div>"),[].forEach.call(n.elements,function(t){n.addNewItem(t)}),n.update();var d=n._getCurrentItemByHash();return d&&u.triggerEvent(d.element,"click"),setInterval(function(){n._doAnim()},n.data.forceInterval),n.data.isSmartPhone?(window.addEventListener("orientationchange",function(){n.groupItems()&&(n._resetTranslate(),n._setPosByCurrentIndex(),n._setHashByCurrentIndex(),n._setSizeByScreen(),n.update())}),n.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window,a=e.orientation;t&&t.gamma&&!n.data.appearEffect&&(n.isBeingZoomed||n.photoSwipable||n.data.elastic||!n.data.scale||(0===a?n._calcGravity(t.gamma,t.beta):90===a?n._calcGravity(t.beta,t.gamma):-90===a?n._calcGravity(-t.beta,-t.gamma):180===a&&n._calcGravity(-t.gamma,-t.beta)))}),n):i(n)):(window.addEventListener("resize",function(){n.groupItems()&&(n._resetTranslate(),n._setPosByCurrentIndex(),n._setSizeByScreen(),n.update())}),window.addEventListener("keydown",function(t){var e=t.keyCode||t.which;!0!==n.data.hide&&(37===e?n.gotoSlide(n.data.prev):39===e?n.gotoSlide(n.data.next):27===e&&n.hidePhoto())}),i(n))}return n(e,t),r(e,[{key:"on",value:function(t,e){var a=this;this._getElementByClass(this.data.classNames.smartPhoto).addEventListener(t,function(t){e.call(a,t)})}},{key:"increment",value:function(t){return t+1}},{key:"round",value:function(t){return Math.round(t)}},{key:"virtualPos",value:function(t){return(t=parseInt(t,10))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_resetTranslate",value:function(){var t=this;this.groupItems().forEach(function(e,a){e.translateX=t._getWindowWidth()*a})}},{
key:"addNewItem",value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,n=document.querySelector("body"),r=t.getAttribute("href"),s=t.querySelector("img"),d=r;s&&(d=s.currentSrc?s.currentSrc:s.src);var c={src:r,thumb:d,caption:t.getAttribute("data-caption"),groupId:a,translateX:this._getWindowWidth()*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,processed:!1,element:t};o[a].push(c),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index"),10),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;if(this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()})),this.clicked){this.clicked=!1;var e=this.data.classNames;this._getElementByClass(e.smartPhotoCaption).focus()}}},{key:"execEffect",value:function(){var t=this;return new h(function(e){u.isOldIE()&&e();var a=t.data,o=a.appearEffect,i=a.classNames,n=t._getElementByClass(i.smartPhotoImgClone),r=function t(){n.removeEventListener("transitionend",t,!0),e()};n.addEventListener("transitionend",r,!0),setTimeout(function(){n.style.transform="translate("+o.afterX+"px, "+o.afterY+"px) scale("+o.scale+")"},10)})}},{key:"addAppearEffect",value:function(t,e){if(!1===this.data.showAnimation)return void(this.data.appear=!0);var a=t.querySelector("img"),o=u.getViewPos(a),i={},n=1;i.width=a.offsetWidth,i.height=a.offsetHeight,i.top=o.top,i.left=o.left,i.once=!0,i.img=e.src;var r=this._getWindowWidth(),s=this._getWindowHeight(),d=s-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(i.width>=i.height?n=e.height<d?e.width/i.width:d/i.height:i.height>i.width&&(n=e.height<d?e.height/i.height:d/i.height),i.width*n>r&&(n=r/i.width));var c=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,h=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=c,i.afterY=h,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom";this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null,this.data.hideUi=!1,this.data.scale=!1,this.data.scaleSize=1;var a=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,o=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,i=document.querySelector("body");window.location.hash&&this._setHash(""),window.scroll(a,o),this._doHideEffect(e).then(function(){t.update(),i.style.overflow="",t._fireEvent("close")})}},{key:"_doHideEffect",value:function(t){var e=this;return new h(function(a){u.isOldIE()&&a();var o=e.data.classNames,i=e._getElementByClass(o.smartPhoto),n=e._getElementByQuery(".current ."+o.smartPhotoImg),r=e._getWindowHeight(),s=function t(){i.removeEventListener("transitionend",t,!0),a()};i.style.opacity=0,"bottom"===t?n.style.transform="translateY("+r+"px)":"top"===t&&(n.style.transform="translateY(-"+r+"px)"),i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'+this.id+'"] .'+t)}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'+this.id+'"] '+t)}},{key:"_getTouchPos",value:function(){var t=0,e=0,a="undefined"==typeof event?this.e:event;return this._isTouched(a)?(t=a.touches[0].pageX,e=a.touches[0].pageY):a.pageX&&(t=a.pageX,e=a.pageY),{x:t,y:e}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",value:function(){var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,e=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,n="group="+i+"&photo="+o;this._setHash(n),window.scroll(t,e)}},{key:"_setHash",value:function(t){window.history&&window.history.pushState&&this.data.useHistoryApi&&(t?window.history.replaceState(null,null,""+location.pathname+location.search+"#"+t):window.history.replaceState(null,null,""+location.pathname+location.search))}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=u.parseQuery(e),o=null,i=function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)};return Object.keys(t).forEach(function(e){t[e].forEach(i)}),o}},{key:"_loadItem",value:function(t){return new h(function(e){var a=new Image;a.onload=function(){t.width=a.width,t.height=a.height,t.loaded=!0,e()},a.onerror=function(){e()},a.src=t.src})}},{key:"_getItemByIndex",value:function(t){var e=this.data;return e.group[e.currentGroup][t]?e.group[e.currentGroup][t]:null}},{key:"_loadNeighborItems",value:function(){for(var t=this,e=this.data.currentIndex,a=this.data.loadOffset,o=e-a,i=e+a,n=[],r=o;r<i;r++){var s=this._getItemByIndex(r);s&&!s.loaded&&n.push(this._loadItem(s))}n.length&&h.all(n).then(function(){t._initPhoto(),t.update()})}},{key:"_setSizeByScreen",value:function(){var t=this._getWindowWidth(),e=this._getWindowHeight(),a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.loaded&&(a.processed=!0,a.scale=i/a.height,a.height<i&&(a.scale=1),a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width))})}},{key:"_slideList",value:function(){var t=this;this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){var e=t._getSelectedItem();t.data.onMoveClass=!1,t.setArrow(),t.update(),t.data.oldIndex!==t.data.currentIndex&&t._fireEvent("change"),t.data.oldIndex=t.data.currentIndex,t._loadNeighborItems(),e.loaded||t._loadItem(e).then(function(){t._initPhoto(),t.update()})},200)}},{key:"gotoSlide",value:function(t){this.e&&this.e.preventDefault&&this.e.preventDefault(),this.data.currentIndex=parseInt(t,10),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.isBeingZoomed=!1,this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos();this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(){var t=this.groupItems(),e=new Date,a=e.getTime(),o=this.tapSecond-a,i=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(i=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():u.isSmartPhone()||0!==i||0!==n?Math.abs(o)<=500&&0===i&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=a,this._fireEvent("swipeend"),"horizontal"===this.moveDir&&(i>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex-=1:i<=-this.data.swipeOffset&&this.data.currentIndex!==t.length-1&&(this.data.currentIndex+=1),this._slideList()),void("vertical"===this.moveDir&&(this.data.swipeBottomToClose&&n>=this.data.swipeOffset?this.hidePhoto("bottom"):this.data.swipeTopToClose&&n<=-this.data.swipeOffset?this.hidePhoto("top"):(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this._fireEvent("swipestart"),this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.scaleSize<=1||(this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate(),t._fireEvent("zoomin")},300))}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),this._fireEvent("zoomout")}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos();this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.photoSwipable=!1,this.zoomOutPhoto();else{this.photoSwipable=!1;var t=this._getSelectedItem(),e=this._makeBound(t),a=this.data.swipeOffset*this.data.scaleSize,o=0,i=0;if(this.data.photoPosX>e.maxX?o=-1:this.data.photoPosX<e.minX&&(o=1),this.data.photoPosY>e.maxY?i=-1:this.data.photoPosY<e.minY&&(i=1),this.data.photoPosX-e.maxX>a&&0!==this.data.currentIndex)return void this.gotoSlide(this.data.prev);if(e.minX-this.data.photoPosX>a&&this.data.currentIndex+1!==this.data.total)return void this.gotoSlide(this.data.next);0===o&&0===i?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(o,i)}}},{key:"beforeGesture",value:function(){this._fireEvent("gesturestart");var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,n=this.data.photoPosY;this.isBeingZoomed=!0,this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*n),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._fireEvent("gestureend"),this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem(),e=this._getWindowWidth(),a=this._getWindowHeight();return u.isSmartPhone()?t.width>t.height?a/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e=t.width*t.scale*this.data.scaleSize,a=t.height*t.scale*this.data.scaleSize,o=void 0,i=void 0,n=void 0,r=void 0,s=this._getWindowWidth(),d=this._getWindowHeight();return s>e?(n=(s-e)/2,o=-1*n):(n=(e-s)/2,o=-1*n),d>a?(r=(d-a)/2,i=-1*r):(r=(a-d)/2,i=-1*r),{minX:this._round(o,6)*this.data.scaleSize,minY:this._round(i,6)*this.data.scaleSize,maxX:this._round(n,6)*this.data.scaleSize,maxY:this._round(r,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector("."+t.smartPhotoImg),o=this._getElementByQuery("."+t.smartPhotoNav),i=this._getElementByQuery("."+t.smartPhotoArrows),n=this.virtualPos(this.data.photoPosX),r=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,d="translate("+n+"px,"+r+"px) scale("+s+")";a.style.transform=d,this.data.scale?u.addClass(a,t.smartPhotoImgOnMove):u.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?u.addClass(a,t.smartPhotoImgElasticMove):u.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(o&&o.setAttribute("aria-hidden","true"),i&&i.setAttribute("aria-hidden","true")):(o&&o.setAttribute("aria-hidden","false"),i&&i.setAttribute("aria-hidden","false"))}},{key:"_getWindowWidth",value:function(){return document&&document.documentElement?document.documentElement.clientWidth:window&&window.innerWidth?window.innerWidth:0}},{key:"_getWindowHeight",value:function(){return document&&document.documentElement?document.documentElement.clientHeight:window&&window.innerHeight?window.innerHeight:0}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery("."+t.smartPhotoList),a="translate("+this.data.translateX+"px,"+this.data.translateY+"px)";e.style.transform=a,this.data.onMoveClass?u.addClass(e,t.smartPhotoListOnMove):u.removeClass(e,t.smartPhotoListOnMove)}},{key:"_fireEvent",value:function(t){var e=this._getElementByClass(this.data.classNames.smartPhoto);u.triggerEvent(e,t)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(d.default);a.default=f,e.exports=a.default},{"../lib/util":12,"a-template":1,"custom-event-polyfill":3,"es6-promise-polyfill":4}],11:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":10}],12:[function(t,e,a){"use strict";function o(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var n in a)a.hasOwnProperty(n)&&("object"===i(a[n])?t[n]=o(t[n],a[n]):t[n]=a[n])}return t}Object.defineProperty(a,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=(a.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},a.extend=o,a.triggerEvent=function(t,e,a){var o=void 0;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)},a.parseQuery=function(t){for(var e,a,o,i=t.split("&"),n={},r=0,s=i.length;r<s;r++)e=i[r].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,n[a]=decodeURIComponent(o));return n},a.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},a.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},a.append=function(t,e){var a=document.createElement("div");for(a.innerHTML=e;a.children.length>0;)t.appendChild(a.children[0])},a.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},a.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")},a.getBrowser=function(){var t=window.navigator.userAgent.toLowerCase(),e=window.navigator.appVersion.toLowerCase(),a="unknown";return-1!=t.indexOf("msie")?a=-1!=e.indexOf("msie 6.")?"ie6":-1!=e.indexOf("msie 7.")?"ie7":-1!=e.indexOf("msie 8.")?"ie8":-1!=e.indexOf("msie 9.")?"ie9":-1!=e.indexOf("msie 10.")?"ie10":"ie":-1!=t.indexOf("trident/7")?a="ie11":-1!=t.indexOf("chrome")?a="chrome":-1!=t.indexOf("safari")?a="safari":-1!=t.indexOf("opera")?a="opera":-1!=t.indexOf("firefox")&&(a="firefox"),a});a.isOldIE=function(){var t=n();return-1!==t.indexOf("ie")&&parseInt(t.replace(/[^0-9]/g,""))<=10}},{}]},{},[9]);
!function(){function t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var c="function"==typeof require&&require;if(!s&&c)return c(r,!0);if(n)return n(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var u=a[r]={exports:{}};e[r][0].call(u.exports,function(t){return i(e[r][1][t]||t)},u,u.exports,t,e,a,o)}return a[r].exports}for(var n="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}return t}()({1:[function(t,e,a){"use strict";function o(t){if(Array.isArray(t)){for(var e=0,a=Array(t.length);e<t.length;e++)a[e]=t[e];return a}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}();t("ie-array-find-polyfill");var r=t("morphdom"),s=function(t){return t&&t.__esModule?t:{default:t}}(r),c=t("./util"),d="input paste copy click change keydown keyup keypress contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend focus",u=d.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]",h=function(){function t(e){var a=this;i(this,t),this.atemplate=[],e&&Object.keys(e).forEach(function(t){a[t]=e[t]}),this.data||(this.data={}),this.templates||(this.templates=[]);for(var o=this.templates,n=o.length,r=0,s=n;r<s;r+=1){var d=this.templates[r],u=(0,c.selector)("#"+d).innerHTML;this.atemplate.push({id:d,html:u,binded:!1})}}return n(t,[{key:"addDataBind",value:function(t){var e=this;(0,c.on)(t,"[data-bind]","input change click",function(t){var a=t.delegateTarget,o=a.getAttribute("data-bind"),i=a.getAttribute("href"),n=a.value;i&&(n=n.replace("#","")),"checkbox"===a.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+o+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():"radio"!==a.getAttribute("type")&&e.updateDataByString(o,n)})}},{key:"addActionBind",value:function(t){var e=this;(0,c.on)(t,u,d,function(t){var a=t.delegateTarget,i=d.split(" "),n="action";i.forEach(function(e){a.getAttribute("data-action-"+e)&&t.type===e&&(n+="-"+e)});var r=a.getAttribute("data-"+n);if(r){var s=r.replace(/\(.*?\);?/,""),c=r.replace(/(.*?)\((.*?)\);?/,"$2"),u=c.split(",");if(e.e=t,e.method&&e.method[s]){var h;(h=e.method)[s].apply(h,o(u))}else e[s]&&e[s].apply(e,o(u))}})}},{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e,binded:!1}),this.templates.push(t)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){var e=this;Object.keys(t).forEach(function(a){"function"!=typeof t[a]&&(e.data[a]=t[a])})}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));e&&this.setData(e)}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i+=1)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return null;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),n=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),r=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist -->/g),s=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty -->/g);if(i)for(var c=0,d=i.length;c<d;c+=1){var u=i[c];u=u.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touch#($2)");var h=u.replace(/BEGIN/,"END"),l=new RegExp(u+"(([\\n\\r\\t]|.)*?)"+h,"g");t=t.replace(l,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))===i?n:""})}if(n)for(var f=0,p=n.length;f<p;f+=1){var m=n[f];m=m.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!==i?n:""})}if(r)for(var y=0,x=r.length;y<x;y+=1){var w=r[y];w=w.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist/,"($1):exist");var P=w.replace(/BEGIN/,"END"),b=new RegExp(w+"(([\\n\\r\\t]|.)*?)"+P,"g");t=t.replace(b,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?i:""})}if(s)for(var E=0,_=s.length;E<_;E+=1){var I=s[E];I=I.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty/,"($1):empty");var S=I.replace(/BEGIN/,"END"),N=new RegExp(I+"(([\\n\\r\\t]|.)*?)"+S,"g");t=t.replace(N,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?"":i})}return t=t.replace(/{([\w\-\.ぁ-んァ-ヶ亜-熙]+)}(\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\])*/g,function(t,i,n,r){var s=void 0;if(""+i=="i")s=a;else{if(!e[i]&&0!==e[i])return r&&o.convert&&o.convert[r]?o.convert[r].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return r&&o.convert&&o.convert[r]?o.convert[r].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){var e=/<!-- #include id="(.*?)" -->/g;return t=t.replace(e,function(t,e){return(0,c.selector)("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->/g;return t=t.replace(e,function(t,e){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g,a=this;return t=t.replace(e,function(t,e,o){var i=a.getDataByString(e),n=[];n="function"==typeof i?i.apply(a):i;var r="";if(n instanceof Array)for(var s=0,c=n.length;s<c;s+=1)r+=a.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;return Object.keys(e).forEach(function(a){for(var o=0,i=t.length;o<i;o+=1)a===t[o]&&delete e[a]}),this}},{key:"hasLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g;return!!t.match(e)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"html",a=arguments[1],o=this.templates;this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=o.length;i<n;i+=1)!function(i,n){var r=o[i],d="#"+r,u=t.getHtml(r),h=(0,c.selector)("[data-id='"+r+"']");if(h)if("text"===e)h.innerText=u;else if(a){var l=document.createElement("div");l.innerHTML=u;var f=l.querySelector(a).outerHTML;(0,s.default)(h.querySelector(a),f)}else(0,s.default)(h,"<div data-id='"+r+"'>"+u+"</div>");else(0,c.selector)(d).insertAdjacentHTML("afterend",'<div data-id="'+r+'"></div>'),"text"===e?(0,c.selector)("[data-id='"+r+"']").innerText=u:(0,c.selector)("[data-id='"+r+"']").innerHTML=u;var p=t.atemplate.find(function(t){return t.id===r});p.binded||(p.binded=!0,t.addDataBind((0,c.selector)("[data-id='"+r+"']")),t.addActionBind((0,c.selector)("[data-id='"+r+"']")))}(i);return this.updateBindingData(a),this.onUpdated&&this.onUpdated(a),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o+=1){var n=a[o],r=(0,c.selector)("[data-id='"+n+"']");t&&(r=r.querySelector(t));var s=r.querySelectorAll("[data-bind]");[].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a});var d=r.querySelectorAll("[data-bind-oneway]");[].forEach.call(d,function(t){var a=e.getDataByString(t.getAttribute("data-bind-oneway"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a})}return this}},{key:"applyMethod",value:function(t){for(var e,a=arguments.length,o=Array(a>1?a-1:0),i=1;i<a;i++)o[i-1]=arguments[i];return(e=this.method)[t].apply(e,o)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();a.default=h,e.exports=a.default},{"./util":2,"ie-array-find-polyfill":5,morphdom:6}],2:[function(t,e,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var o=a.matches=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},i=(a.selector=function(t){return document.querySelector(t)},a.findAncestor=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t&&t!==document;){if(o(t,e))return t;t=t.parentElement}return null});a.on=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,i(t.target,e));a&&(t.delegateTarget=a,o(t))})})}},{}],3:[function(t,e,a){try{var o=new window.CustomEvent("test");if(o.preventDefault(),!0!==o.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var i=function(t,e){var a,o;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},a=document.createEvent("CustomEvent"),a.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),o=a.preventDefault,a.preventDefault=function(){o.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},a};i.prototype=window.Event.prototype,window.CustomEvent=i}},{}],4:[function(t,e,a){(function(t,e){!function(t){function o(t){return"[object Array]"===Object.prototype.toString.call(t)}function i(){for(var t=0;t<I.length;t++)I[t][0](I[t][1]);I=[],y=!1}function n(t,e){I.push([t,e]),y||(y=!0,_(i,0))}function r(t,e){function a(t){d(e,t)}function o(t){h(e,t)}try{t(a,o)}catch(t){o(t)}}function s(t){var e=t.owner,a=e.state_,o=e.data_,i=t[a],n=t.then;if("function"==typeof i){a=P;try{o=i(o)}catch(t){h(n,t)}}c(n,o)||(a===P&&d(n,o),a===b&&h(n,o))}function c(t,e){var a;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&("function"==typeof e||"object"==typeof e)){var o=e.then;if("function"==typeof o)return o.call(e,function(o){a||(a=!0,e!==o?d(t,o):u(t,o))},function(e){a||(a=!0,h(t,e))}),!0}}catch(e){return a||h(t,e),!0}return!1}function d(t,e){t!==e&&c(t,e)||u(t,e)}function u(t,e){t.state_===x&&(t.state_=w,t.data_=e,n(f,t))}function h(t,e){t.state_===x&&(t.state_=w,t.data_=e,n(p,t))}function l(t){var e=t.then_;t.then_=void 0;for(var a=0;a<e.length;a++)s(e[a])}function f(t){t.state_=P,l(t)}function p(t){t.state_=b,l(t)}function m(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof m==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],r(t,this)}var v=t.Promise,g=v&&"resolve"in v&&"reject"in v&&"all"in v&&"race"in v&&function(){var t;return new v(function(e){t=e}),"function"==typeof t}();void 0!==a&&a?(a.Promise=g?v:m,a.Polyfill=m):"function"==typeof define&&define.amd?define(function(){return g?v:m}):g||(t.Promise=m);var y,x="pending",w="sealed",P="fulfilled",b="rejected",E=function(){},_=void 0!==e?e:setTimeout,I=[];m.prototype={constructor:m,state_:x,then_:null,data_:void 0,then:function(t,e){var a={owner:this,then:new this.constructor(E),fulfilled:t,rejected:e};return this.state_===P||this.state_===b?n(s,a):this.then_.push(a),a.then},catch:function(t){return this.then(null,t)}},m.all=function(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to Promise.all().");return new e(function(e,a){for(var o,i=[],n=0,r=0;r<t.length;r++)o=t[r],o&&"function"==typeof o.then?o.then(function(t){return n++,function(a){i[t]=a,--n||e(i)}}(r),a):i[r]=o;n||e(i)})},m.race=function(t){var e=this;if(!o(t))throw new TypeError("You must pass an array to Promise.race().");return new e(function(e,a){for(var o,i=0;i<t.length;i++)o=t[i],o&&"function"==typeof o.then?o.then(e,a):e(o)})},m.resolve=function(t){var e=this;return t&&"object"==typeof t&&t.constructor===e?t:new e(function(e){e(t)})},m.reject=function(t){return new this(function(e,a){a(t)})}}("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("timers").setImmediate)},{timers:8}],5:[function(t,e,a){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),a=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var o=arguments[1],i=0;i<a;){var n=e[i];if(t.call(o,n,i,e))return n;i++}}})},{}],6:[function(t,e,a){"use strict";function o(t){!h&&p.createRange&&(h=p.createRange(),h.selectNode(p.body));var e;return h&&h.createContextualFragment?e=h.createContextualFragment(t):(e=p.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function n(t,e){return e&&e!==f?p.createElementNS(e,t):p.createElement(t)}function r(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,n,r,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,n=o.namespaceURI,r=o.value,n?(i=o.localName||i,t.getAttributeNS(n,i)!==r&&t.setAttributeNS(n,i,r)):t.getAttribute(i)!==r&&t.setAttribute(i,r);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,n=o.namespaceURI,n?(i=o.localName||i,v(e,n,i)||t.removeAttributeNS(n,i)):v(e,null,i)||t.removeAttribute(i))}function c(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function u(t){return t.id}var h,l,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};l=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=l,g={OPTION:function(t,e){c(t,e,"selected")},INPUT:function(t,e){c(t,e,"checked"),c(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;t.value!==a&&(t.value=a);var o=t.firstChild;if(o){var i=o.nodeValue;if(i==a||!a&&i==t.placeholder)return;o.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,w=8,P=function(t){return function(e,a,s){function c(t){b?b.push(t):b=[t]}function h(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=E(a))?c(o):(A(a),a.firstChild&&h(a,e)),a=a.nextSibling}}function l(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),A(t),h(t,a))}function f(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=E(e);a&&(T[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=E(e);if(o){var n=T[o];n&&i(e,n)&&(e.parentNode.replaceChild(n,e),v(n,e))}m(e),e=a}}function v(o,n,r){var s,d=E(n);if(d&&delete T[d],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===S(o,n))return;if(t(o,n),N(o),!1===B(o,n))return}if("TEXTAREA"!==o.nodeName){var u,h,f,P,b=n.firstChild,I=o.firstChild;t:for(;b;){for(f=b.nextSibling,u=E(b);I;){if(h=I.nextSibling,b.isSameNode&&b.isSameNode(I)){b=f,I=h;continue t}s=E(I);var k=I.nodeType,A=void 0;if(k===b.nodeType&&(k===y?(u?u!==s&&((P=T[u])?I.nextSibling===P?A=!1:(o.insertBefore(P,I),h=I.nextSibling,s?c(s):l(I,o,!0),I=P):A=!1):s&&(A=!1),(A=!1!==A&&i(I,b))&&v(I,b)):k!==x&&k!=w||(A=!0,I.nodeValue!==b.nodeValue&&(I.nodeValue=b.nodeValue))),A){b=f,I=h;continue t}s?c(s):l(I,o,!0),I=h}if(u&&(P=T[u])&&i(P,b))o.appendChild(P),v(P,b);else{var D=_(b);!1!==D&&(D&&(b=D),b.actualize&&(b=b.actualize(o.ownerDocument||p)),o.appendChild(b),m(b))}b=f,I=h}for(;I;)h=I.nextSibling,(s=E(I))?c(s):l(I,o,!0),I=h}var O=g[o.nodeName];O&&O(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var P=a;a=p.createElement("html"),a.innerHTML=P}else a=o(a);var b,E=s.getNodeKey||u,_=s.onBeforeNodeAdded||d,I=s.onNodeAdded||d,S=s.onBeforeElUpdated||d,N=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,B=s.onBeforeElChildrenUpdated||d,D=!0===s.childrenOnly,T={};f(e);var O=e,C=O.nodeType,G=a.nodeType;if(!D)if(C===y)G===y?i(e,a)||(A(e),O=r(e,n(a.nodeName,a.namespaceURI))):O=a;else if(C===x||C===w){if(G===C)return O.nodeValue!==a.nodeValue&&(O.nodeValue=a.nodeValue),O;O=a}if(O===a)A(e);else if(v(O,a,D),b)for(var L=0,z=b.length;L<z;L++){var X=T[b[L]];X&&l(X,X.parentNode,!1)}return!D&&O!==e&&e.parentNode&&(O.actualize&&(O=O.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(O,e)),O}}(s);e.exports=P},{}],7:[function(t,e,a){function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function n(t){if(h===setTimeout)return setTimeout(t,0);if((h===o||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function r(t){if(l===clearTimeout)return clearTimeout(t);if((l===i||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function s(){v&&p&&(v=!1,p.length?m=p.concat(m):g=-1,m.length&&c())}function c(){if(!v){var t=n(s);v=!0;for(var e=m.length;e;){for(p=m,m=[];++g<e;)p&&p[g].run();g=-1,e=m.length}p=null,v=!1,r(t)}}function d(t,e){this.fun=t,this.array=e}function u(){}var h,l,f=e.exports={};!function(){try{h="function"==typeof setTimeout?setTimeout:o}catch(t){h=o}try{l="function"==typeof clearTimeout?clearTimeout:i}catch(t){l=i}}();var p,m=[],v=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)e[a-1]=arguments[a];m.push(new d(t,e)),1!==m.length||v||n(c)},d.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.prependListener=u,f.prependOnceListener=u,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],8:[function(t,e,a){(function(e,o){function i(t,e){this._id=t,this._clearFn=e}var n=t("process/browser.js").nextTick,r=Function.prototype.apply,s=Array.prototype.slice,c={},d=0;a.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},a.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},a.clearTimeout=a.clearInterval=function(t){t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},a.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},a.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},a._unrefActive=a.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},a.setImmediate="function"==typeof e?e:function(t){var e=d++,o=!(arguments.length<2)&&s.call(arguments,1);return c[e]=!0,n(function(){c[e]&&(o?t.apply(null,o):t.call(null),a.clearImmediate(e))}),e},a.clearImmediate="function"==typeof o?o:function(t){delete c[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":7,timers:8}],9:[function(t,e,a){"use strict";var o=t("../index"),i=function(t){t.fn.SmartPhoto=function(t){return"strings"==typeof t||new o(this,t),this}};if("function"==typeof define&&define.amd)define(["jquery"],i);else{var n=window.jQuery?window.jQuery:window.$;void 0!==n&&i(n)}e.exports=i},{"../index":11}],10:[function(t,e,a){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function r(t,e,a){return e&&n(t.prototype,e),a&&n(t,a),t}function s(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?c(t):e}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=function(t){return t&&t.__esModule?t:{default:t}}(t("a-template"));t("custom-event-polyfill");var f='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e aria-hidden="true"\x3c!-- END hide:exist --\x3e\x3c!-- BEGIN hide:empty --\x3e aria-hidden="false"\x3c!-- END hide:empty --\x3e role="dialog">\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}" aria-live="polite" tabindex="-1">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"><span class="smartphoto-sr-only">\\{message.closeDialog\\}</span></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e\x3c!-- BEGIN isSmartPhone:empty --\x3e data-action-click="hidePhoto()"\x3c!-- END isSmartPhone:empty --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN processed:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}[round]px,{y}[round]px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3ewidth:{width}px;" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN processed:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showPrevArrow:empty --\x3e aria-hidden="true"\x3c!-- END showPrevArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({prev})" role="button"><span class="smartphoto-sr-only">\\{message.gotoPrevImage\\}</span></a></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showNextArrow:empty --\x3e aria-hidden="true"\x3c!-- END showNextArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({next})" role="button"><span class="smartphoto-sr-only">\\{message.gotoNextImage\\}</span></a></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li><a href="#" data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({thumb});" role="button"><span class="smartphoto-sr-only">go to {caption}</span></a></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',p=t("../lib/util"),m=t("es6-promise-polyfill"),v=m.Promise,g={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-lazy"},y=function(t){function e(t,a){var o;i(this,e),o=s(this,d(e).call(this)),o.data=p.extend({},g,a),o.data.currentIndex=0,o.data.oldIndex=0,o.data.hide=!0,o.data.group={},o.data.scaleSize=1,o.data.scale=!1,o.pos={x:0,y:0},o.data.photoPosX=0,o.data.photoPosY=0,o.convert={increment:o.increment,virtualPos:o.virtualPos,round:o.round},o.data.groupItems=o.groupItems,o.elements="string"==typeof t?document.querySelectorAll(t):t;var n=new Date;o.tapSecond=n.getTime(),o.onListMove=!1,o.clicked=!1,o.id=o._getUniqId(),o.vx=0,o.vy=0,o.data.appearEffect=null,o.addTemplate(o.id,f),o.data.isSmartPhone=o._isSmartPhone();var r=document.querySelector("body");p.append(r,"<div data-id='".concat(o.id,"'></div>")),[].forEach.call(o.elements,function(t){o.addNewItem(t)}),o.update();var c=o._getCurrentItemByHash();return c&&p.triggerEvent(c.element,"click"),setInterval(function(){o._doAnim()},o.data.forceInterval),o.data.isSmartPhone?(window.addEventListener("orientationchange",function(){o.groupItems()&&(o._resetTranslate(),o._setPosByCurrentIndex(),o._setHashByCurrentIndex(),o._setSizeByScreen(),o.update())}),o.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window,a=e.orientation;t&&t.gamma&&!o.data.appearEffect&&(o.isBeingZoomed||o.photoSwipable||o.data.elastic||!o.data.scale||(0===a?o._calcGravity(t.gamma,t.beta):90===a?o._calcGravity(t.beta,t.gamma):-90===a?o._calcGravity(-t.beta,-t.gamma):180===a&&o._calcGravity(-t.gamma,-t.beta)))}),o):s(o)):(window.addEventListener("resize",function(){o.groupItems()&&(o._resetTranslate(),o._setPosByCurrentIndex(),o._setSizeByScreen(),o.update())}),window.addEventListener("keydown",function(t){var e=t.keyCode||t.which;!0!==o.data.hide&&(37===e?o.gotoSlide(o.data.prev):39===e?o.gotoSlide(o.data.next):27===e&&o.hidePhoto())}),s(o))}return u(e,t),r(e,[{key:"on",value:function(t,e){var a=this;this._getElementByClass(this.data.classNames.smartPhoto).addEventListener(t,function(t){e.call(a,t)})}},{key:"increment",value:function(t){return t+1}},{
key:"round",value:function(t){return Math.round(t)}},{key:"virtualPos",value:function(t){return(t=parseInt(t,10))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_resetTranslate",value:function(){var t=this;this.groupItems().forEach(function(e,a){e.translateX=t._getWindowWidth()*a})}},{key:"addNewItem",value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,n=document.querySelector("body"),r=t.getAttribute("href"),s=t.querySelector("img"),c=r;s&&(c=s.getAttribute(this.data.lazyAttribute)?s.getAttribute(this.data.lazyAttribute):s.currentSrc?s.currentSrc:s.src);var d={src:r,thumb:c,caption:t.getAttribute("data-caption"),groupId:a,translateX:this._getWindowWidth()*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,processed:!1,element:t};o[a].push(d),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index"),10),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;if(this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()})),this.clicked){this.clicked=!1;var e=this.data.classNames;this._getElementByClass(e.smartPhotoCaption).focus()}}},{key:"execEffect",value:function(){var t=this;return new v(function(e){p.isOldIE()&&e();var a=t.data,o=a.appearEffect,i=a.classNames,n=t._getElementByClass(i.smartPhotoImgClone),r=function t(){n.removeEventListener("transitionend",t,!0),e()};n.addEventListener("transitionend",r,!0),setTimeout(function(){n.style.transform="translate(".concat(o.afterX,"px, ").concat(o.afterY,"px) scale(").concat(o.scale,")")},10)})}},{key:"addAppearEffect",value:function(t,e){if(!1===this.data.showAnimation)return void(this.data.appear=!0);var a=t.querySelector("img"),o=p.getViewPos(a),i={},n=1;i.width=a.offsetWidth,i.height=a.offsetHeight,i.top=o.top,i.left=o.left,i.once=!0,e.getAttribute(this.data.lazyAttribute)?i.img=e.getAttribute(this.data.lazyAttribute):i.img=e.src;var r=this._getWindowWidth(),s=this._getWindowHeight(),c=s-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(i.width>=i.height?n=e.height<c?e.width/i.width:c/i.height:i.height>i.width&&(n=e.height<c?e.height/i.height:c/i.height),i.width*n>r&&(n=r/i.width));var d=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,u=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=d,i.afterY=u,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom";this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null,this.data.hideUi=!1,this.data.scale=!1,this.data.scaleSize=1;var a=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,o=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,i=document.querySelector("body");window.location.hash&&this._setHash(""),window.scroll(a,o),this._doHideEffect(e).then(function(){t.update(),i.style.overflow="",t._fireEvent("close")})}},{key:"_doHideEffect",value:function(t){var e=this;return new v(function(a){p.isOldIE()&&a();var o=e.data.classNames,i=e._getElementByClass(o.smartPhoto),n=e._getElementByQuery(".current .".concat(o.smartPhotoImg)),r=e._getWindowHeight(),s=function t(){i.removeEventListener("transitionend",t,!0),a()};i.style.opacity=0,"bottom"===t?n.style.transform="translateY(".concat(r,"px)"):"top"===t&&(n.style.transform="translateY(-".concat(r,"px)")),i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'.concat(this.id,'"] .').concat(t))}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'.concat(this.id,'"] ').concat(t))}},{key:"_getTouchPos",value:function(){var t=0,e=0,a="undefined"==typeof event?this.e:event;return this._isTouched(a)?(t=a.touches[0].pageX,e=a.touches[0].pageY):a.pageX&&(t=a.pageX,e=a.pageY),{x:t,y:e}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",value:function(){var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,e=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,n="group=".concat(i,"&photo=").concat(o);this._setHash(n),window.scroll(t,e)}},{key:"_setHash",value:function(t){window.history&&window.history.pushState&&this.data.useHistoryApi&&(t?window.history.replaceState(null,null,"".concat(location.pathname).concat(location.search,"#").concat(t)):window.history.replaceState(null,null,"".concat(location.pathname).concat(location.search)))}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=p.parseQuery(e),o=null,i=function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)};return Object.keys(t).forEach(function(e){t[e].forEach(i)}),o}},{key:"_loadItem",value:function(t){return new v(function(e){var a=new Image;a.onload=function(){t.width=a.width,t.height=a.height,t.loaded=!0,e()},a.onerror=function(){e()},a.src=t.src})}},{key:"_getItemByIndex",value:function(t){var e=this.data;return e.group[e.currentGroup][t]?e.group[e.currentGroup][t]:null}},{key:"_loadNeighborItems",value:function(){for(var t=this,e=this.data.currentIndex,a=this.data.loadOffset,o=e-a,i=e+a,n=[],r=o;r<i;r++){var s=this._getItemByIndex(r);s&&!s.loaded&&n.push(this._loadItem(s))}n.length&&v.all(n).then(function(){t._initPhoto(),t.update()})}},{key:"_setSizeByScreen",value:function(){var t=this._getWindowWidth(),e=this._getWindowHeight(),a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.loaded&&(a.processed=!0,a.scale=i/a.height,a.height<i&&(a.scale=1),a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width))})}},{key:"_slideList",value:function(){var t=this;this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){var e=t._getSelectedItem();t.data.onMoveClass=!1,t.setArrow(),t.update(),t.data.oldIndex!==t.data.currentIndex&&t._fireEvent("change"),t.data.oldIndex=t.data.currentIndex,t._loadNeighborItems(),e.loaded||t._loadItem(e).then(function(){t._initPhoto(),t.update()})},200)}},{key:"gotoSlide",value:function(t){this.e&&this.e.preventDefault&&this.e.preventDefault(),this.data.currentIndex=parseInt(t,10),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.isBeingZoomed=!1,this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos();this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(){var t=this.groupItems(),e=new Date,a=e.getTime(),o=this.tapSecond-a,i=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(i=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():p.isSmartPhone()||0!==i||0!==n?Math.abs(o)<=500&&0===i&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=a,this._fireEvent("swipeend"),"horizontal"===this.moveDir&&(i>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex-=1:i<=-this.data.swipeOffset&&this.data.currentIndex!==t.length-1&&(this.data.currentIndex+=1),this._slideList()),void("vertical"===this.moveDir&&(this.data.swipeBottomToClose&&n>=this.data.swipeOffset?this.hidePhoto("bottom"):this.data.swipeTopToClose&&n<=-this.data.swipeOffset?this.hidePhoto("top"):(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this._fireEvent("swipestart"),this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.scaleSize<=1||(this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate(),t._fireEvent("zoomin")},300))}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),this._fireEvent("zoomout")}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos();this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.photoSwipable=!1,this.zoomOutPhoto();else{this.photoSwipable=!1;var t=this._getSelectedItem(),e=this._makeBound(t),a=this.data.swipeOffset*this.data.scaleSize,o=0,i=0;if(this.data.photoPosX>e.maxX?o=-1:this.data.photoPosX<e.minX&&(o=1),this.data.photoPosY>e.maxY?i=-1:this.data.photoPosY<e.minY&&(i=1),this.data.photoPosX-e.maxX>a&&0!==this.data.currentIndex)return void this.gotoSlide(this.data.prev);if(e.minX-this.data.photoPosX>a&&this.data.currentIndex+1!==this.data.total)return void this.gotoSlide(this.data.next);0===o&&0===i?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(o,i)}}},{key:"beforeGesture",value:function(){this._fireEvent("gesturestart");var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,n=this.data.photoPosY;this.isBeingZoomed=!0,this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*n),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._fireEvent("gestureend"),this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem(),e=this._getWindowWidth(),a=this._getWindowHeight();return p.isSmartPhone()?t.width>t.height?a/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e,a,o,i,n=t.width*t.scale*this.data.scaleSize,r=t.height*t.scale*this.data.scaleSize,s=this._getWindowWidth(),c=this._getWindowHeight();return s>n?(o=(s-n)/2,e=-1*o):(o=(n-s)/2,e=-1*o),c>r?(i=(c-r)/2,a=-1*i):(i=(r-c)/2,a=-1*i),{minX:this._round(e,6)*this.data.scaleSize,minY:this._round(a,6)*this.data.scaleSize,maxX:this._round(o,6)*this.data.scaleSize,maxY:this._round(i,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector(".".concat(t.smartPhotoImg)),o=this._getElementByQuery(".".concat(t.smartPhotoNav)),i=this._getElementByQuery(".".concat(t.smartPhotoArrows)),n=this.virtualPos(this.data.photoPosX),r=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,c="translate(".concat(n,"px,").concat(r,"px) scale(").concat(s,")");a.style.transform=c,this.data.scale?p.addClass(a,t.smartPhotoImgOnMove):p.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?p.addClass(a,t.smartPhotoImgElasticMove):p.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(o&&o.setAttribute("aria-hidden","true"),i&&i.setAttribute("aria-hidden","true")):(o&&o.setAttribute("aria-hidden","false"),i&&i.setAttribute("aria-hidden","false"))}},{key:"_getWindowWidth",value:function(){return document&&document.documentElement?document.documentElement.clientWidth:window&&window.innerWidth?window.innerWidth:0}},{key:"_getWindowHeight",value:function(){return document&&document.documentElement?document.documentElement.clientHeight:window&&window.innerHeight?window.innerHeight:0}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".".concat(t.smartPhotoList)),a="translate(".concat(this.data.translateX,"px,").concat(this.data.translateY,"px)");e.style.transform=a,this.data.onMoveClass?p.addClass(e,t.smartPhotoListOnMove):p.removeClass(e,t.smartPhotoListOnMove)}},{key:"_fireEvent",value:function(t){var e=this._getElementByClass(this.data.classNames.smartPhoto);p.triggerEvent(e,t)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(l.default);a.default=y,e.exports=a.default},{"../lib/util":12,"a-template":1,"custom-event-polyfill":3,"es6-promise-polyfill":4}],11:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":10}],12:[function(t,e,a){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var n in a)a.hasOwnProperty(n)&&("object"===o(a[n])?t[n]=i(t[n],a[n]):t[n]=a[n])}return t}Object.defineProperty(a,"__esModule",{value:!0}),a.isOldIE=a.getBrowser=a.removeClass=a.addClass=a.append=a.removeElement=a.getViewPos=a.parseQuery=a.triggerEvent=a.extend=a.isSmartPhone=void 0;var n=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};a.isSmartPhone=n;var r=i;a.extend=r;var s=function(t,e,a){var o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)};a.triggerEvent=s;var c=function(t){for(var e,a,o,i=t.split("&"),n={},r=0,s=i.length;r<s;r++)e=i[r].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,n[a]=decodeURIComponent(o));return n};a.parseQuery=c;var d=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}};a.getViewPos=d;var u=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)};a.removeElement=u;var h=function(t,e){var a=document.createElement("div");for(a.innerHTML=e;a.children.length>0;)t.appendChild(a.children[0])};a.append=h;var l=function(t,e){t.classList?t.classList.add(e):t.className+=" ".concat(e)};a.addClass=l;var f=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")};a.removeClass=f;var p=function(){var t=window.navigator.userAgent.toLowerCase(),e=window.navigator.appVersion.toLowerCase(),a="unknown";return-1!=t.indexOf("msie")?a=-1!=e.indexOf("msie 6.")?"ie6":-1!=e.indexOf("msie 7.")?"ie7":-1!=e.indexOf("msie 8.")?"ie8":-1!=e.indexOf("msie 9.")?"ie9":-1!=e.indexOf("msie 10.")?"ie10":"ie":-1!=t.indexOf("trident/7")?a="ie11":-1!=t.indexOf("chrome")?a="chrome":-1!=t.indexOf("safari")?a="safari":-1!=t.indexOf("opera")?a="opera":-1!=t.indexOf("firefox")&&(a="firefox"),a};a.getBrowser=p;var m=function(){var t=p();return-1!==t.indexOf("ie")&&parseInt(t.replace(/[^0-9]/g,""))<=10};a.isOldIE=m},{}]},{},[9]);

@@ -9,3 +9,3 @@ /**

* homepage: http://developer.a-blogcms.jp
* version: 1.3.6
* version: 1.4.3
*

@@ -56,3 +56,3 @@ * a-template:

*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.SmartPhoto=t()}}(function(){var t;return function(){function t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var d="function"==typeof require&&require;if(!s&&d)return d(r,!0);if(n)return n(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var u=a[r]={exports:{}};e[r][0].call(u.exports,function(t){return i(e[r][1][t]||t)},u,u.exports,t,e,a,o)}return a[r].exports}for(var n="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}return t}()({1:[function(t,e,a){"use strict";function o(t){if(Array.isArray(t)){for(var e=0,a=Array(t.length);e<t.length;e++)a[e]=t[e];return a}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}();t("ie-array-find-polyfill");var r=t("morphdom"),s=function(t){return t&&t.__esModule?t:{default:t}}(r),d=t("./util"),c="input paste copy click change keydown keyup keypress contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend focus",u=c.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]",h=function(){function t(e){var a=this;i(this,t),this.atemplate=[],e&&Object.keys(e).forEach(function(t){a[t]=e[t]}),this.data||(this.data={}),this.templates||(this.templates=[]);for(var o=this.templates,n=o.length,r=0,s=n;r<s;r+=1){var c=this.templates[r],u=(0,d.selector)("#"+c).innerHTML;this.atemplate.push({id:c,html:u,binded:!1})}}return n(t,[{key:"addDataBind",value:function(t){var e=this;(0,d.on)(t,"[data-bind]","input change click",function(t){var a=t.delegateTarget,o=a.getAttribute("data-bind"),i=a.getAttribute("href"),n=a.value;i&&(n=n.replace("#","")),"checkbox"===a.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+o+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():"radio"!==a.getAttribute("type")&&e.updateDataByString(o,n)})}},{key:"addActionBind",value:function(t){var e=this;(0,d.on)(t,u,c,function(t){var a=t.delegateTarget,i=c.split(" "),n="action";i.forEach(function(e){a.getAttribute("data-action-"+e)&&t.type===e&&(n+="-"+e)});var r=a.getAttribute("data-"+n);if(r){var s=r.replace(/\(.*?\);?/,""),d=r.replace(/(.*?)\((.*?)\);?/,"$2"),u=d.split(",");if(e.e=t,e.method&&e.method[s]){var h;(h=e.method)[s].apply(h,o(u))}else e[s]&&e[s].apply(e,o(u))}})}},{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e,binded:!1}),this.templates.push(t)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){var e=this;Object.keys(t).forEach(function(a){"function"!=typeof t[a]&&(e.data[a]=t[a])})}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));e&&this.setData(e)}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i+=1)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return null;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),n=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),r=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist -->/g),s=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty -->/g);if(i)for(var d=0,c=i.length;d<c;d+=1){var u=i[d];u=u.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touch#($2)");var h=u.replace(/BEGIN/,"END"),l=new RegExp(u+"(([\\n\\r\\t]|.)*?)"+h,"g");t=t.replace(l,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))===i?n:""})}if(n)for(var f=0,p=n.length;f<p;f+=1){var m=n[f];m=m.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!==i?n:""})}if(r)for(var y=0,x=r.length;y<x;y+=1){var w=r[y];w=w.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist/,"($1):exist");var P=w.replace(/BEGIN/,"END"),E=new RegExp(w+"(([\\n\\r\\t]|.)*?)"+P,"g");t=t.replace(E,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?i:""})}if(s)for(var b=0,_=s.length;b<_;b+=1){var I=s[b];I=I.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty/,"($1):empty");var N=I.replace(/BEGIN/,"END"),S=new RegExp(I+"(([\\n\\r\\t]|.)*?)"+N,"g");t=t.replace(S,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?"":i})}return t=t.replace(/{([\w\-\.ぁ-んァ-ヶ亜-熙]+)}(\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\])*/g,function(t,i,n,r){var s=void 0;if(""+i=="i")s=a;else{if(!e[i]&&0!==e[i])return r&&o.convert&&o.convert[r]?o.convert[r].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return r&&o.convert&&o.convert[r]?o.convert[r].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){var e=/<!-- #include id="(.*?)" -->/g;return t=t.replace(e,function(t,e){return(0,d.selector)("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->/g;return t=t.replace(e,function(t,e){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g,a=this;return t=t.replace(e,function(t,e,o){var i=a.getDataByString(e),n=[];n="function"==typeof i?i.apply(a):i;var r="";if(n instanceof Array)for(var s=0,d=n.length;s<d;s+=1)r+=a.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;return Object.keys(e).forEach(function(a){for(var o=0,i=t.length;o<i;o+=1)a===t[o]&&delete e[a]}),this}},{key:"hasLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g;return!!t.match(e)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"html",a=arguments[1],o=this.templates;this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=o.length;i<n;i+=1)!function(i,n){var r=o[i],c="#"+r,u=t.getHtml(r),h=(0,d.selector)("[data-id='"+r+"']");if(h)if("text"===e)h.innerText=u;else if(a){var l=document.createElement("div");l.innerHTML=u;var f=l.querySelector(a).outerHTML;(0,s.default)(h.querySelector(a),f)}else(0,s.default)(h,"<div data-id='"+r+"'>"+u+"</div>");else(0,d.selector)(c).insertAdjacentHTML("afterend",'<div data-id="'+r+'"></div>'),"text"===e?(0,d.selector)("[data-id='"+r+"']").innerText=u:(0,d.selector)("[data-id='"+r+"']").innerHTML=u;var p=t.atemplate.find(function(t){return t.id===r});p.binded||(p.binded=!0,t.addDataBind((0,d.selector)("[data-id='"+r+"']")),t.addActionBind((0,d.selector)("[data-id='"+r+"']")))}(i);return this.updateBindingData(a),this.onUpdated&&this.onUpdated(a),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o+=1){var n=a[o],r=(0,d.selector)("[data-id='"+n+"']");t&&(r=r.querySelector(t));var s=r.querySelectorAll("[data-bind]");[].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a});var c=r.querySelectorAll("[data-bind-oneway]");[].forEach.call(c,function(t){var a=e.getDataByString(t.getAttribute("data-bind-oneway"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a})}return this}},{key:"applyMethod",value:function(t){for(var e,a=arguments.length,o=Array(a>1?a-1:0),i=1;i<a;i++)o[i-1]=arguments[i];return(e=this.method)[t].apply(e,o)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();a.default=h,e.exports=a.default},{"./util":2,"ie-array-find-polyfill":5,morphdom:6}],2:[function(t,e,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var o=a.matches=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},i=(a.selector=function(t){return document.querySelector(t)},a.findAncestor=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t&&t!==document;){if(o(t,e))return t;t=t.parentElement}return null});a.on=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,i(t.target,e));a&&(t.delegateTarget=a,o(t))})})}},{}],3:[function(t,e,a){try{var o=new window.CustomEvent("test");if(o.preventDefault(),!0!==o.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var i=function(t,e){var a,o;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},a=document.createEvent("CustomEvent"),a.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),o=a.preventDefault,a.preventDefault=function(){o.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},a};i.prototype=window.Event.prototype,window.CustomEvent=i}},{}],4:[function(e,a,o){(function(e,a){!function(e){function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function n(){for(var t=0;t<N.length;t++)N[t][0](N[t][1]);N=[],x=!1}function r(t,e){N.push([t,e]),x||(x=!0,I(n,0))}function s(t,e){function a(t){u(e,t)}function o(t){l(e,t)}try{t(a,o)}catch(t){o(t)}}function d(t){var e=t.owner,a=e.state_,o=e.data_,i=t[a],n=t.then;if("function"==typeof i){a=E;try{o=i(o)}catch(t){l(n,t)}}c(n,o)||(a===E&&u(n,o),a===b&&l(n,o))}function c(t,e){var a;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&("function"==typeof e||"object"==typeof e)){var o=e.then;if("function"==typeof o)return o.call(e,function(o){a||(a=!0,e!==o?u(t,o):h(t,o))},function(e){a||(a=!0,l(t,e))}),!0}}catch(e){return a||l(t,e),!0}return!1}function u(t,e){t!==e&&c(t,e)||h(t,e)}function h(t,e){t.state_===w&&(t.state_=P,t.data_=e,r(p,t))}function l(t,e){t.state_===w&&(t.state_=P,t.data_=e,r(m,t))}function f(t){var e=t.then_;t.then_=void 0;for(var a=0;a<e.length;a++)d(e[a])}function p(t){t.state_=E,f(t)}function m(t){t.state_=b,f(t)}function v(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof v==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],s(t,this)}var g=e.Promise,y=g&&"resolve"in g&&"reject"in g&&"all"in g&&"race"in g&&function(){var t;return new g(function(e){t=e}),"function"==typeof t}();void 0!==o&&o?(o.Promise=y?g:v,o.Polyfill=v):"function"==typeof t&&t.amd?t(function(){return y?g:v}):y||(e.Promise=v);var x,w="pending",P="sealed",E="fulfilled",b="rejected",_=function(){},I=void 0!==a?a:setTimeout,N=[];v.prototype={constructor:v,state_:w,then_:null,data_:void 0,then:function(t,e){var a={owner:this,then:new this.constructor(_),fulfilled:t,rejected:e};return this.state_===E||this.state_===b?r(d,a):this.then_.push(a),a.then},catch:function(t){return this.then(null,t)}},v.all=function(t){var e=this;if(!i(t))throw new TypeError("You must pass an array to Promise.all().");return new e(function(e,a){for(var o,i=[],n=0,r=0;r<t.length;r++)o=t[r],o&&"function"==typeof o.then?o.then(function(t){return n++,function(a){i[t]=a,--n||e(i)}}(r),a):i[r]=o;n||e(i)})},v.race=function(t){var e=this;if(!i(t))throw new TypeError("You must pass an array to Promise.race().");return new e(function(e,a){for(var o,i=0;i<t.length;i++)o=t[i],o&&"function"==typeof o.then?o.then(e,a):e(o)})},v.resolve=function(t){var e=this;return t&&"object"==typeof t&&t.constructor===e?t:new e(function(e){e(t)})},v.reject=function(t){return new this(function(e,a){a(t)})}}("undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{timers:8}],5:[function(t,e,a){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),a=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var o=arguments[1],i=0;i<a;){var n=e[i];if(t.call(o,n,i,e))return n;i++}}})},{}],6:[function(t,e,a){"use strict";function o(t){!h&&p.createRange&&(h=p.createRange(),h.selectNode(p.body));var e;return h&&h.createContextualFragment?e=h.createContextualFragment(t):(e=p.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function n(t,e){return e&&e!==f?p.createElementNS(e,t):p.createElement(t)}function r(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,n,r,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,n=o.namespaceURI,r=o.value,n?(i=o.localName||i,t.getAttributeNS(n,i)!==r&&t.setAttributeNS(n,i,r)):t.getAttribute(i)!==r&&t.setAttribute(i,r);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,n=o.namespaceURI,n?(i=o.localName||i,v(e,n,i)||t.removeAttributeNS(n,i)):v(e,null,i)||t.removeAttribute(i))}function d(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function c(){}function u(t){return t.id}var h,l,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};l=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=l,g={OPTION:function(t,e){d(t,e,"selected")},INPUT:function(t,e){d(t,e,"checked"),d(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;t.value!==a&&(t.value=a);var o=t.firstChild;if(o){var i=o.nodeValue;if(i==a||!a&&i==t.placeholder)return;o.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,w=8,P=function(t){return function(e,a,s){function d(t){E?E.push(t):E=[t]}function h(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=b(a))?d(o):(B(a),a.firstChild&&h(a,e)),a=a.nextSibling}}function l(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),B(t),h(t,a))}function f(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=b(e);a&&(T[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=b(e);if(o){var n=T[o];n&&i(e,n)&&(e.parentNode.replaceChild(n,e),v(n,e))}m(e),e=a}}function v(o,n,r){var s,c=b(n);if(c&&delete T[c],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===N(o,n))return;if(t(o,n),S(o),!1===D(o,n))return}if("TEXTAREA"!==o.nodeName){var u,h,f,P,E=n.firstChild,I=o.firstChild;t:for(;E;){for(f=E.nextSibling,u=b(E);I;){if(h=I.nextSibling,E.isSameNode&&E.isSameNode(I)){E=f,I=h;continue t}s=b(I);var k=I.nodeType,B=void 0;if(k===E.nodeType&&(k===y?(u?u!==s&&((P=T[u])?I.nextSibling===P?B=!1:(o.insertBefore(P,I),h=I.nextSibling,s?d(s):l(I,o,!0),I=P):B=!1):s&&(B=!1),(B=!1!==B&&i(I,E))&&v(I,E)):k!==x&&k!=w||(B=!0,I.nodeValue!==E.nodeValue&&(I.nodeValue=E.nodeValue))),B){E=f,I=h;continue t}s?d(s):l(I,o,!0),I=h}if(u&&(P=T[u])&&i(P,E))o.appendChild(P),v(P,E);else{var A=_(E);!1!==A&&(A&&(E=A),E.actualize&&(E=E.actualize(o.ownerDocument||p)),o.appendChild(E),m(E))}E=f,I=h}for(;I;)h=I.nextSibling,(s=b(I))?d(s):l(I,o,!0),I=h}var O=g[o.nodeName];O&&O(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var P=a;a=p.createElement("html"),a.innerHTML=P}else a=o(a);var E,b=s.getNodeKey||u,_=s.onBeforeNodeAdded||c,I=s.onNodeAdded||c,N=s.onBeforeElUpdated||c,S=s.onElUpdated||c,k=s.onBeforeNodeDiscarded||c,B=s.onNodeDiscarded||c,D=s.onBeforeElChildrenUpdated||c,A=!0===s.childrenOnly,T={};f(e);var O=e,C=O.nodeType,G=a.nodeType;if(!A)if(C===y)G===y?i(e,a)||(B(e),O=r(e,n(a.nodeName,a.namespaceURI))):O=a;else if(C===x||C===w){if(G===C)return O.nodeValue!==a.nodeValue&&(O.nodeValue=a.nodeValue),O;O=a}if(O===a)B(e);else if(v(O,a,A),E)for(var L=0,X=E.length;L<X;L++){var z=T[E[L]];z&&l(z,z.parentNode,!1)}return!A&&O!==e&&e.parentNode&&(O.actualize&&(O=O.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(O,e)),O}}(s);e.exports=P},{}],7:[function(t,e,a){function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function n(t){if(h===setTimeout)return setTimeout(t,0);if((h===o||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function r(t){if(l===clearTimeout)return clearTimeout(t);if((l===i||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function s(){v&&p&&(v=!1,p.length?m=p.concat(m):g=-1,m.length&&d())}function d(){if(!v){var t=n(s);v=!0;for(var e=m.length;e;){for(p=m,m=[];++g<e;)p&&p[g].run();g=-1,e=m.length}p=null,v=!1,r(t)}}function c(t,e){this.fun=t,this.array=e}function u(){}var h,l,f=e.exports={};!function(){try{h="function"==typeof setTimeout?setTimeout:o}catch(t){h=o}try{l="function"==typeof clearTimeout?clearTimeout:i}catch(t){l=i}}();var p,m=[],v=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)e[a-1]=arguments[a];m.push(new c(t,e)),1!==m.length||v||n(d)},c.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.prependListener=u,f.prependOnceListener=u,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],8:[function(t,e,a){(function(e,o){function i(t,e){this._id=t,this._clearFn=e}var n=t("process/browser.js").nextTick,r=Function.prototype.apply,s=Array.prototype.slice,d={},c=0;a.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},a.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},a.clearTimeout=a.clearInterval=function(t){t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},a.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},a.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},a._unrefActive=a.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},a.setImmediate="function"==typeof e?e:function(t){var e=c++,o=!(arguments.length<2)&&s.call(arguments,1);return d[e]=!0,n(function(){d[e]&&(o?t.apply(null,o):t.call(null),a.clearImmediate(e))}),e},a.clearImmediate="function"==typeof o?o:function(t){delete d[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":7,timers:8}],9:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function n(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(a,"__esModule",{value:!0});var r=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),s=t("a-template"),d=function(t){return t&&t.__esModule?t:{default:t}}(s);t("custom-event-polyfill");var c='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e aria-hidden="true"\x3c!-- END hide:exist --\x3e\x3c!-- BEGIN hide:empty --\x3e aria-hidden="false"\x3c!-- END hide:empty --\x3e role="dialog">\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}" aria-live="polite" tabindex="-1">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"><span class="smartphoto-sr-only">\\{message.closeDialog\\}</span></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e\x3c!-- BEGIN isSmartPhone:empty --\x3e data-action-click="hidePhoto()"\x3c!-- END isSmartPhone:empty --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN processed:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}[round]px,{y}[round]px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3ewidth:{width}px;" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN processed:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showPrevArrow:empty --\x3e aria-hidden="true"\x3c!-- END showPrevArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({prev})" role="button"><span class="smartphoto-sr-only">\\{message.gotoPrevImage\\}</span></a></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showNextArrow:empty --\x3e aria-hidden="true"\x3c!-- END showNextArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({next})" role="button"><span class="smartphoto-sr-only">\\{message.gotoNextImage\\}</span></a></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li><a href="#" data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({thumb});" role="button"><span class="smartphoto-sr-only">go to {caption}</span></a></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',u=t("../lib/util"),h=t("es6-promise-polyfill").Promise,l={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit"},f=function(t){function e(t,a){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));n.data=u.extend({},l,a),n.data.currentIndex=0,n.data.oldIndex=0,n.data.hide=!0,n.data.group={},n.data.scaleSize=1,n.data.scale=!1,n.pos={x:0,y:0},n.data.photoPosX=0,n.data.photoPosY=0,n.convert={increment:n.increment,virtualPos:n.virtualPos,round:n.round},n.data.groupItems=n.groupItems,n.elements="string"==typeof t?document.querySelectorAll(t):t;var r=new Date;n.tapSecond=r.getTime(),n.onListMove=!1,n.clicked=!1,n.id=n._getUniqId(),n.vx=0,n.vy=0,n.data.appearEffect=null,n.addTemplate(n.id,c),n.data.isSmartPhone=n._isSmartPhone();var s=document.querySelector("body");u.append(s,"<div data-id='"+n.id+"'></div>"),[].forEach.call(n.elements,function(t){n.addNewItem(t)}),n.update();var d=n._getCurrentItemByHash();return d&&u.triggerEvent(d.element,"click"),setInterval(function(){n._doAnim()},n.data.forceInterval),n.data.isSmartPhone?(window.addEventListener("orientationchange",function(){n.groupItems()&&(n._resetTranslate(),n._setPosByCurrentIndex(),n._setHashByCurrentIndex(),n._setSizeByScreen(),n.update())}),n.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window,a=e.orientation;t&&t.gamma&&!n.data.appearEffect&&(n.isBeingZoomed||n.photoSwipable||n.data.elastic||!n.data.scale||(0===a?n._calcGravity(t.gamma,t.beta):90===a?n._calcGravity(t.beta,t.gamma):-90===a?n._calcGravity(-t.beta,-t.gamma):180===a&&n._calcGravity(-t.gamma,-t.beta)))}),n):i(n)):(window.addEventListener("resize",function(){n.groupItems()&&(n._resetTranslate(),n._setPosByCurrentIndex(),n._setSizeByScreen(),n.update())}),window.addEventListener("keydown",function(t){var e=t.keyCode||t.which;!0!==n.data.hide&&(37===e?n.gotoSlide(n.data.prev):39===e?n.gotoSlide(n.data.next):27===e&&n.hidePhoto())}),i(n))}return n(e,t),r(e,[{key:"on",value:function(t,e){var a=this;this._getElementByClass(this.data.classNames.smartPhoto).addEventListener(t,function(t){e.call(a,t)})}},{key:"increment",value:function(t){return t+1}},{key:"round",value:function(t){return Math.round(t)}},{key:"virtualPos",value:function(t){return(t=parseInt(t,10))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_resetTranslate",value:function(){var t=this;this.groupItems().forEach(function(e,a){e.translateX=t._getWindowWidth()*a})}},{key:"addNewItem",
value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,n=document.querySelector("body"),r=t.getAttribute("href"),s=t.querySelector("img"),d=r;s&&(d=s.currentSrc?s.currentSrc:s.src);var c={src:r,thumb:d,caption:t.getAttribute("data-caption"),groupId:a,translateX:this._getWindowWidth()*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,processed:!1,element:t};o[a].push(c),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index"),10),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;if(this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()})),this.clicked){this.clicked=!1;var e=this.data.classNames;this._getElementByClass(e.smartPhotoCaption).focus()}}},{key:"execEffect",value:function(){var t=this;return new h(function(e){u.isOldIE()&&e();var a=t.data,o=a.appearEffect,i=a.classNames,n=t._getElementByClass(i.smartPhotoImgClone),r=function t(){n.removeEventListener("transitionend",t,!0),e()};n.addEventListener("transitionend",r,!0),setTimeout(function(){n.style.transform="translate("+o.afterX+"px, "+o.afterY+"px) scale("+o.scale+")"},10)})}},{key:"addAppearEffect",value:function(t,e){if(!1===this.data.showAnimation)return void(this.data.appear=!0);var a=t.querySelector("img"),o=u.getViewPos(a),i={},n=1;i.width=a.offsetWidth,i.height=a.offsetHeight,i.top=o.top,i.left=o.left,i.once=!0,i.img=e.src;var r=this._getWindowWidth(),s=this._getWindowHeight(),d=s-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(i.width>=i.height?n=e.height<d?e.width/i.width:d/i.height:i.height>i.width&&(n=e.height<d?e.height/i.height:d/i.height),i.width*n>r&&(n=r/i.width));var c=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,h=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=c,i.afterY=h,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom";this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null,this.data.hideUi=!1,this.data.scale=!1,this.data.scaleSize=1;var a=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,o=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,i=document.querySelector("body");window.location.hash&&this._setHash(""),window.scroll(a,o),this._doHideEffect(e).then(function(){t.update(),i.style.overflow="",t._fireEvent("close")})}},{key:"_doHideEffect",value:function(t){var e=this;return new h(function(a){u.isOldIE()&&a();var o=e.data.classNames,i=e._getElementByClass(o.smartPhoto),n=e._getElementByQuery(".current ."+o.smartPhotoImg),r=e._getWindowHeight(),s=function t(){i.removeEventListener("transitionend",t,!0),a()};i.style.opacity=0,"bottom"===t?n.style.transform="translateY("+r+"px)":"top"===t&&(n.style.transform="translateY(-"+r+"px)"),i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'+this.id+'"] .'+t)}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'+this.id+'"] '+t)}},{key:"_getTouchPos",value:function(){var t=0,e=0,a="undefined"==typeof event?this.e:event;return this._isTouched(a)?(t=a.touches[0].pageX,e=a.touches[0].pageY):a.pageX&&(t=a.pageX,e=a.pageY),{x:t,y:e}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",value:function(){var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,e=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,n="group="+i+"&photo="+o;this._setHash(n),window.scroll(t,e)}},{key:"_setHash",value:function(t){window.history&&window.history.pushState&&this.data.useHistoryApi&&(t?window.history.replaceState(null,null,""+location.pathname+location.search+"#"+t):window.history.replaceState(null,null,""+location.pathname+location.search))}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=u.parseQuery(e),o=null,i=function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)};return Object.keys(t).forEach(function(e){t[e].forEach(i)}),o}},{key:"_loadItem",value:function(t){return new h(function(e){var a=new Image;a.onload=function(){t.width=a.width,t.height=a.height,t.loaded=!0,e()},a.onerror=function(){e()},a.src=t.src})}},{key:"_getItemByIndex",value:function(t){var e=this.data;return e.group[e.currentGroup][t]?e.group[e.currentGroup][t]:null}},{key:"_loadNeighborItems",value:function(){for(var t=this,e=this.data.currentIndex,a=this.data.loadOffset,o=e-a,i=e+a,n=[],r=o;r<i;r++){var s=this._getItemByIndex(r);s&&!s.loaded&&n.push(this._loadItem(s))}n.length&&h.all(n).then(function(){t._initPhoto(),t.update()})}},{key:"_setSizeByScreen",value:function(){var t=this._getWindowWidth(),e=this._getWindowHeight(),a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.loaded&&(a.processed=!0,a.scale=i/a.height,a.height<i&&(a.scale=1),a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width))})}},{key:"_slideList",value:function(){var t=this;this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){var e=t._getSelectedItem();t.data.onMoveClass=!1,t.setArrow(),t.update(),t.data.oldIndex!==t.data.currentIndex&&t._fireEvent("change"),t.data.oldIndex=t.data.currentIndex,t._loadNeighborItems(),e.loaded||t._loadItem(e).then(function(){t._initPhoto(),t.update()})},200)}},{key:"gotoSlide",value:function(t){this.e&&this.e.preventDefault&&this.e.preventDefault(),this.data.currentIndex=parseInt(t,10),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.isBeingZoomed=!1,this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos();this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(){var t=this.groupItems(),e=new Date,a=e.getTime(),o=this.tapSecond-a,i=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(i=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():u.isSmartPhone()||0!==i||0!==n?Math.abs(o)<=500&&0===i&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=a,this._fireEvent("swipeend"),"horizontal"===this.moveDir&&(i>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex-=1:i<=-this.data.swipeOffset&&this.data.currentIndex!==t.length-1&&(this.data.currentIndex+=1),this._slideList()),void("vertical"===this.moveDir&&(this.data.swipeBottomToClose&&n>=this.data.swipeOffset?this.hidePhoto("bottom"):this.data.swipeTopToClose&&n<=-this.data.swipeOffset?this.hidePhoto("top"):(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this._fireEvent("swipestart"),this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.scaleSize<=1||(this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate(),t._fireEvent("zoomin")},300))}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),this._fireEvent("zoomout")}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos();this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.photoSwipable=!1,this.zoomOutPhoto();else{this.photoSwipable=!1;var t=this._getSelectedItem(),e=this._makeBound(t),a=this.data.swipeOffset*this.data.scaleSize,o=0,i=0;if(this.data.photoPosX>e.maxX?o=-1:this.data.photoPosX<e.minX&&(o=1),this.data.photoPosY>e.maxY?i=-1:this.data.photoPosY<e.minY&&(i=1),this.data.photoPosX-e.maxX>a&&0!==this.data.currentIndex)return void this.gotoSlide(this.data.prev);if(e.minX-this.data.photoPosX>a&&this.data.currentIndex+1!==this.data.total)return void this.gotoSlide(this.data.next);0===o&&0===i?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(o,i)}}},{key:"beforeGesture",value:function(){this._fireEvent("gesturestart");var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,n=this.data.photoPosY;this.isBeingZoomed=!0,this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*n),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._fireEvent("gestureend"),this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem(),e=this._getWindowWidth(),a=this._getWindowHeight();return u.isSmartPhone()?t.width>t.height?a/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e=t.width*t.scale*this.data.scaleSize,a=t.height*t.scale*this.data.scaleSize,o=void 0,i=void 0,n=void 0,r=void 0,s=this._getWindowWidth(),d=this._getWindowHeight();return s>e?(n=(s-e)/2,o=-1*n):(n=(e-s)/2,o=-1*n),d>a?(r=(d-a)/2,i=-1*r):(r=(a-d)/2,i=-1*r),{minX:this._round(o,6)*this.data.scaleSize,minY:this._round(i,6)*this.data.scaleSize,maxX:this._round(n,6)*this.data.scaleSize,maxY:this._round(r,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector("."+t.smartPhotoImg),o=this._getElementByQuery("."+t.smartPhotoNav),i=this._getElementByQuery("."+t.smartPhotoArrows),n=this.virtualPos(this.data.photoPosX),r=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,d="translate("+n+"px,"+r+"px) scale("+s+")";a.style.transform=d,this.data.scale?u.addClass(a,t.smartPhotoImgOnMove):u.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?u.addClass(a,t.smartPhotoImgElasticMove):u.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(o&&o.setAttribute("aria-hidden","true"),i&&i.setAttribute("aria-hidden","true")):(o&&o.setAttribute("aria-hidden","false"),i&&i.setAttribute("aria-hidden","false"))}},{key:"_getWindowWidth",value:function(){return document&&document.documentElement?document.documentElement.clientWidth:window&&window.innerWidth?window.innerWidth:0}},{key:"_getWindowHeight",value:function(){return document&&document.documentElement?document.documentElement.clientHeight:window&&window.innerHeight?window.innerHeight:0}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery("."+t.smartPhotoList),a="translate("+this.data.translateX+"px,"+this.data.translateY+"px)";e.style.transform=a,this.data.onMoveClass?u.addClass(e,t.smartPhotoListOnMove):u.removeClass(e,t.smartPhotoListOnMove)}},{key:"_fireEvent",value:function(t){var e=this._getElementByClass(this.data.classNames.smartPhoto);u.triggerEvent(e,t)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(d.default);a.default=f,e.exports=a.default},{"../lib/util":11,"a-template":1,"custom-event-polyfill":3,"es6-promise-polyfill":4}],10:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":9}],11:[function(t,e,a){"use strict";function o(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var n in a)a.hasOwnProperty(n)&&("object"===i(a[n])?t[n]=o(t[n],a[n]):t[n]=a[n])}return t}Object.defineProperty(a,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=(a.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},a.extend=o,a.triggerEvent=function(t,e,a){var o=void 0;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)},a.parseQuery=function(t){for(var e,a,o,i=t.split("&"),n={},r=0,s=i.length;r<s;r++)e=i[r].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,n[a]=decodeURIComponent(o));return n},a.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},a.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},a.append=function(t,e){var a=document.createElement("div");for(a.innerHTML=e;a.children.length>0;)t.appendChild(a.children[0])},a.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},a.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")},a.getBrowser=function(){var t=window.navigator.userAgent.toLowerCase(),e=window.navigator.appVersion.toLowerCase(),a="unknown";return-1!=t.indexOf("msie")?a=-1!=e.indexOf("msie 6.")?"ie6":-1!=e.indexOf("msie 7.")?"ie7":-1!=e.indexOf("msie 8.")?"ie8":-1!=e.indexOf("msie 9.")?"ie9":-1!=e.indexOf("msie 10.")?"ie10":"ie":-1!=t.indexOf("trident/7")?a="ie11":-1!=t.indexOf("chrome")?a="chrome":-1!=t.indexOf("safari")?a="safari":-1!=t.indexOf("opera")?a="opera":-1!=t.indexOf("firefox")&&(a="firefox"),a});a.isOldIE=function(){var t=n();return-1!==t.indexOf("ie")&&parseInt(t.replace(/[^0-9]/g,""))<=10}},{}]},{},[10])(10)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.SmartPhoto=t()}}(function(){var t;return function(){function t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var c="function"==typeof require&&require;if(!s&&c)return c(r,!0);if(n)return n(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var u=a[r]={exports:{}};e[r][0].call(u.exports,function(t){return i(e[r][1][t]||t)},u,u.exports,t,e,a,o)}return a[r].exports}for(var n="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}return t}()({1:[function(t,e,a){"use strict";function o(t){if(Array.isArray(t)){for(var e=0,a=Array(t.length);e<t.length;e++)a[e]=t[e];return a}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}();t("ie-array-find-polyfill");var r=t("morphdom"),s=function(t){return t&&t.__esModule?t:{default:t}}(r),c=t("./util"),d="input paste copy click change keydown keyup keypress contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend focus",u=d.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]",l=function(){function t(e){var a=this;i(this,t),this.atemplate=[],e&&Object.keys(e).forEach(function(t){a[t]=e[t]}),this.data||(this.data={}),this.templates||(this.templates=[]);for(var o=this.templates,n=o.length,r=0,s=n;r<s;r+=1){var d=this.templates[r],u=(0,c.selector)("#"+d).innerHTML;this.atemplate.push({id:d,html:u,binded:!1})}}return n(t,[{key:"addDataBind",value:function(t){var e=this;(0,c.on)(t,"[data-bind]","input change click",function(t){var a=t.delegateTarget,o=a.getAttribute("data-bind"),i=a.getAttribute("href"),n=a.value;i&&(n=n.replace("#","")),"checkbox"===a.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+o+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():"radio"!==a.getAttribute("type")&&e.updateDataByString(o,n)})}},{key:"addActionBind",value:function(t){var e=this;(0,c.on)(t,u,d,function(t){var a=t.delegateTarget,i=d.split(" "),n="action";i.forEach(function(e){a.getAttribute("data-action-"+e)&&t.type===e&&(n+="-"+e)});var r=a.getAttribute("data-"+n);if(r){var s=r.replace(/\(.*?\);?/,""),c=r.replace(/(.*?)\((.*?)\);?/,"$2"),u=c.split(",");if(e.e=t,e.method&&e.method[s]){var l;(l=e.method)[s].apply(l,o(u))}else e[s]&&e[s].apply(e,o(u))}})}},{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e,binded:!1}),this.templates.push(t)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){var e=this;Object.keys(t).forEach(function(a){"function"!=typeof t[a]&&(e.data[a]=t[a])})}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));e&&this.setData(e)}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i+=1)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return null;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),n=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),r=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist -->/g),s=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty -->/g);if(i)for(var c=0,d=i.length;c<d;c+=1){var u=i[c];u=u.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touch#($2)");var l=u.replace(/BEGIN/,"END"),h=new RegExp(u+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(h,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))===i?n:""})}if(n)for(var f=0,p=n.length;f<p;f+=1){var m=n[f];m=m.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,n){return""+("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!==i?n:""})}if(r)for(var y=0,x=r.length;y<x;y+=1){var w=r[y];w=w.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist/,"($1):exist");var P=w.replace(/BEGIN/,"END"),b=new RegExp(w+"(([\\n\\r\\t]|.)*?)"+P,"g");t=t.replace(b,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?i:""})}if(s)for(var E=0,_=s.length;E<_;E+=1){var I=s[E];I=I.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty/,"($1):empty");var S=I.replace(/BEGIN/,"END"),N=new RegExp(I+"(([\\n\\r\\t]|.)*?)"+S,"g");t=t.replace(N,function(t,a,i){var n="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return n||0===n?"":i})}return t=t.replace(/{([\w\-\.ぁ-んァ-ヶ亜-熙]+)}(\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\])*/g,function(t,i,n,r){var s=void 0;if(""+i=="i")s=a;else{if(!e[i]&&0!==e[i])return r&&o.convert&&o.convert[r]?o.convert[r].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return r&&o.convert&&o.convert[r]?o.convert[r].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){var e=/<!-- #include id="(.*?)" -->/g;return t=t.replace(e,function(t,e){return(0,c.selector)("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->/g;return t=t.replace(e,function(t,e){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g,a=this;return t=t.replace(e,function(t,e,o){var i=a.getDataByString(e),n=[];n="function"==typeof i?i.apply(a):i;var r="";if(n instanceof Array)for(var s=0,c=n.length;s<c;s+=1)r+=a.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;return Object.keys(e).forEach(function(a){for(var o=0,i=t.length;o<i;o+=1)a===t[o]&&delete e[a]}),this}},{key:"hasLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g;return!!t.match(e)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"html",a=arguments[1],o=this.templates;this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=o.length;i<n;i+=1)!function(i,n){var r=o[i],d="#"+r,u=t.getHtml(r),l=(0,c.selector)("[data-id='"+r+"']");if(l)if("text"===e)l.innerText=u;else if(a){var h=document.createElement("div");h.innerHTML=u;var f=h.querySelector(a).outerHTML;(0,s.default)(l.querySelector(a),f)}else(0,s.default)(l,"<div data-id='"+r+"'>"+u+"</div>");else(0,c.selector)(d).insertAdjacentHTML("afterend",'<div data-id="'+r+'"></div>'),"text"===e?(0,c.selector)("[data-id='"+r+"']").innerText=u:(0,c.selector)("[data-id='"+r+"']").innerHTML=u;var p=t.atemplate.find(function(t){return t.id===r});p.binded||(p.binded=!0,t.addDataBind((0,c.selector)("[data-id='"+r+"']")),t.addActionBind((0,c.selector)("[data-id='"+r+"']")))}(i);return this.updateBindingData(a),this.onUpdated&&this.onUpdated(a),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o+=1){var n=a[o],r=(0,c.selector)("[data-id='"+n+"']");t&&(r=r.querySelector(t));var s=r.querySelectorAll("[data-bind]");[].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a});var d=r.querySelectorAll("[data-bind-oneway]");[].forEach.call(d,function(t){var a=e.getDataByString(t.getAttribute("data-bind-oneway"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a===t.value&&(t.checked=!0):t.value=a})}return this}},{key:"applyMethod",value:function(t){for(var e,a=arguments.length,o=Array(a>1?a-1:0),i=1;i<a;i++)o[i-1]=arguments[i];return(e=this.method)[t].apply(e,o)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();a.default=l,e.exports=a.default},{"./util":2,"ie-array-find-polyfill":5,morphdom:6}],2:[function(t,e,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var o=a.matches=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},i=(a.selector=function(t){return document.querySelector(t)},a.findAncestor=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t&&t!==document;){if(o(t,e))return t;t=t.parentElement}return null});a.on=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,i(t.target,e));a&&(t.delegateTarget=a,o(t))})})}},{}],3:[function(t,e,a){try{var o=new window.CustomEvent("test");if(o.preventDefault(),!0!==o.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var i=function(t,e){var a,o;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},a=document.createEvent("CustomEvent"),a.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),o=a.preventDefault,a.preventDefault=function(){o.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},a};i.prototype=window.Event.prototype,window.CustomEvent=i}},{}],4:[function(e,a,o){(function(e,a){!function(e){function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function n(){for(var t=0;t<S.length;t++)S[t][0](S[t][1]);S=[],x=!1}function r(t,e){S.push([t,e]),x||(x=!0,I(n,0))}function s(t,e){function a(t){u(e,t)}function o(t){h(e,t)}try{t(a,o)}catch(t){o(t)}}function c(t){var e=t.owner,a=e.state_,o=e.data_,i=t[a],n=t.then;if("function"==typeof i){a=b;try{o=i(o)}catch(t){h(n,t)}}d(n,o)||(a===b&&u(n,o),a===E&&h(n,o))}function d(t,e){var a;try{if(t===e)throw new TypeError("A promises callback cannot return that same promise.");if(e&&("function"==typeof e||"object"==typeof e)){var o=e.then;if("function"==typeof o)return o.call(e,function(o){a||(a=!0,e!==o?u(t,o):l(t,o))},function(e){a||(a=!0,h(t,e))}),!0}}catch(e){return a||h(t,e),!0}return!1}function u(t,e){t!==e&&d(t,e)||l(t,e)}function l(t,e){t.state_===w&&(t.state_=P,t.data_=e,r(p,t))}function h(t,e){t.state_===w&&(t.state_=P,t.data_=e,r(m,t))}function f(t){var e=t.then_;t.then_=void 0;for(var a=0;a<e.length;a++)c(e[a])}function p(t){t.state_=b,f(t)}function m(t){t.state_=E,f(t)}function v(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof v==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],s(t,this)}var g=e.Promise,y=g&&"resolve"in g&&"reject"in g&&"all"in g&&"race"in g&&function(){var t;return new g(function(e){t=e}),"function"==typeof t}();void 0!==o&&o?(o.Promise=y?g:v,o.Polyfill=v):"function"==typeof t&&t.amd?t(function(){return y?g:v}):y||(e.Promise=v);var x,w="pending",P="sealed",b="fulfilled",E="rejected",_=function(){},I=void 0!==a?a:setTimeout,S=[];v.prototype={constructor:v,state_:w,then_:null,data_:void 0,then:function(t,e){var a={owner:this,then:new this.constructor(_),fulfilled:t,rejected:e};return this.state_===b||this.state_===E?r(c,a):this.then_.push(a),a.then},catch:function(t){return this.then(null,t)}},v.all=function(t){var e=this;if(!i(t))throw new TypeError("You must pass an array to Promise.all().");return new e(function(e,a){for(var o,i=[],n=0,r=0;r<t.length;r++)o=t[r],o&&"function"==typeof o.then?o.then(function(t){return n++,function(a){i[t]=a,--n||e(i)}}(r),a):i[r]=o;n||e(i)})},v.race=function(t){var e=this;if(!i(t))throw new TypeError("You must pass an array to Promise.race().");return new e(function(e,a){for(var o,i=0;i<t.length;i++)o=t[i],o&&"function"==typeof o.then?o.then(e,a):e(o)})},v.resolve=function(t){var e=this;return t&&"object"==typeof t&&t.constructor===e?t:new e(function(e){e(t)})},v.reject=function(t){return new this(function(e,a){a(t)})}}("undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{timers:8}],5:[function(t,e,a){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),a=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var o=arguments[1],i=0;i<a;){var n=e[i];if(t.call(o,n,i,e))return n;i++}}})},{}],6:[function(t,e,a){"use strict";function o(t){!l&&p.createRange&&(l=p.createRange(),l.selectNode(p.body));var e;return l&&l.createContextualFragment?e=l.createContextualFragment(t):(e=p.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function n(t,e){return e&&e!==f?p.createElementNS(e,t):p.createElement(t)}function r(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,n,r,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,n=o.namespaceURI,r=o.value,n?(i=o.localName||i,t.getAttributeNS(n,i)!==r&&t.setAttributeNS(n,i,r)):t.getAttribute(i)!==r&&t.setAttribute(i,r);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,n=o.namespaceURI,n?(i=o.localName||i,v(e,n,i)||t.removeAttributeNS(n,i)):v(e,null,i)||t.removeAttribute(i))}function c(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function u(t){return t.id}var l,h,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};h=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=h,g={OPTION:function(t,e){c(t,e,"selected")},INPUT:function(t,e){c(t,e,"checked"),c(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;t.value!==a&&(t.value=a);var o=t.firstChild;if(o){var i=o.nodeValue;if(i==a||!a&&i==t.placeholder)return;o.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,w=8,P=function(t){return function(e,a,s){function c(t){b?b.push(t):b=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=E(a))?c(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function h(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),A(t),l(t,a))}function f(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=E(e);a&&(T[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=E(e);if(o){var n=T[o];n&&i(e,n)&&(e.parentNode.replaceChild(n,e),v(n,e))}m(e),e=a}}function v(o,n,r){var s,d=E(n);if(d&&delete T[d],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===S(o,n))return;if(t(o,n),N(o),!1===B(o,n))return}if("TEXTAREA"!==o.nodeName){var u,l,f,P,b=n.firstChild,I=o.firstChild;t:for(;b;){for(f=b.nextSibling,u=E(b);I;){if(l=I.nextSibling,b.isSameNode&&b.isSameNode(I)){b=f,I=l;continue t}s=E(I);var k=I.nodeType,A=void 0;if(k===b.nodeType&&(k===y?(u?u!==s&&((P=T[u])?I.nextSibling===P?A=!1:(o.insertBefore(P,I),l=I.nextSibling,s?c(s):h(I,o,!0),I=P):A=!1):s&&(A=!1),(A=!1!==A&&i(I,b))&&v(I,b)):k!==x&&k!=w||(A=!0,I.nodeValue!==b.nodeValue&&(I.nodeValue=b.nodeValue))),A){b=f,I=l;continue t}s?c(s):h(I,o,!0),I=l}if(u&&(P=T[u])&&i(P,b))o.appendChild(P),v(P,b);else{var D=_(b);!1!==D&&(D&&(b=D),b.actualize&&(b=b.actualize(o.ownerDocument||p)),o.appendChild(b),m(b))}b=f,I=l}for(;I;)l=I.nextSibling,(s=E(I))?c(s):h(I,o,!0),I=l}var O=g[o.nodeName];O&&O(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var P=a;a=p.createElement("html"),a.innerHTML=P}else a=o(a);var b,E=s.getNodeKey||u,_=s.onBeforeNodeAdded||d,I=s.onNodeAdded||d,S=s.onBeforeElUpdated||d,N=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,B=s.onBeforeElChildrenUpdated||d,D=!0===s.childrenOnly,T={};f(e);var O=e,C=O.nodeType,G=a.nodeType;if(!D)if(C===y)G===y?i(e,a)||(A(e),O=r(e,n(a.nodeName,a.namespaceURI))):O=a;else if(C===x||C===w){if(G===C)return O.nodeValue!==a.nodeValue&&(O.nodeValue=a.nodeValue),O;O=a}if(O===a)A(e);else if(v(O,a,D),b)for(var L=0,z=b.length;L<z;L++){var X=T[b[L]];X&&h(X,X.parentNode,!1)}return!D&&O!==e&&e.parentNode&&(O.actualize&&(O=O.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(O,e)),O}}(s);e.exports=P},{}],7:[function(t,e,a){function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function n(t){if(l===setTimeout)return setTimeout(t,0);if((l===o||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function r(t){if(h===clearTimeout)return clearTimeout(t);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){v&&p&&(v=!1,p.length?m=p.concat(m):g=-1,m.length&&c())}function c(){if(!v){var t=n(s);v=!0;for(var e=m.length;e;){for(p=m,m=[];++g<e;)p&&p[g].run();g=-1,e=m.length}p=null,v=!1,r(t)}}function d(t,e){this.fun=t,this.array=e}function u(){}var l,h,f=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:o}catch(t){l=o}try{h="function"==typeof clearTimeout?clearTimeout:i}catch(t){h=i}}();var p,m=[],v=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var a=1;a<arguments.length;a++)e[a-1]=arguments[a];m.push(new d(t,e)),1!==m.length||v||n(c)},d.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.prependListener=u,f.prependOnceListener=u,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],8:[function(t,e,a){(function(e,o){function i(t,e){this._id=t,this._clearFn=e}var n=t("process/browser.js").nextTick,r=Function.prototype.apply,s=Array.prototype.slice,c={},d=0;a.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},a.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},a.clearTimeout=a.clearInterval=function(t){t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},a.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},a.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},a._unrefActive=a.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},a.setImmediate="function"==typeof e?e:function(t){var e=d++,o=!(arguments.length<2)&&s.call(arguments,1);return c[e]=!0,n(function(){c[e]&&(o?t.apply(null,o):t.call(null),a.clearImmediate(e))}),e},a.clearImmediate="function"==typeof o?o:function(t){delete c[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":7,timers:8}],9:[function(t,e,a){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function r(t,e,a){return e&&n(t.prototype,e),a&&n(t,a),t}function s(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?c(t):e}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var h=function(t){return t&&t.__esModule?t:{default:t}}(t("a-template"));t("custom-event-polyfill");var f='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e aria-hidden="true"\x3c!-- END hide:exist --\x3e\x3c!-- BEGIN hide:empty --\x3e aria-hidden="false"\x3c!-- END hide:empty --\x3e role="dialog">\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}" aria-live="polite" tabindex="-1">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"><span class="smartphoto-sr-only">\\{message.closeDialog\\}</span></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e\x3c!-- BEGIN isSmartPhone:empty --\x3e data-action-click="hidePhoto()"\x3c!-- END isSmartPhone:empty --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN processed:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}[round]px,{y}[round]px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3ewidth:{width}px;" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN processed:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END processed:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showPrevArrow:empty --\x3e aria-hidden="true"\x3c!-- END showPrevArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({prev})" role="button"><span class="smartphoto-sr-only">\\{message.gotoPrevImage\\}</span></a></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN isSmartPhone:exist --\x3e \\{classNames.smartPhotoArrowHideIcon\\}\x3c!-- END isSmartPhone:exist --\x3e"\x3c!-- BEGIN showNextArrow:empty --\x3e aria-hidden="true"\x3c!-- END showNextArrow:empty --\x3e><a href="#" data-action-click="gotoSlide({next})" role="button"><span class="smartphoto-sr-only">\\{message.gotoNextImage\\}</span></a></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}"\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="true"\x3c!-- END hideUi:exist --\x3e\x3c!-- BEGIN hideUi:exist --\x3e aria-hidden="false"\x3c!-- END hideUi:exist --\x3e>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li><a href="#" data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({thumb});" role="button"><span class="smartphoto-sr-only">go to {caption}</span></a></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',p=t("../lib/util"),m=t("es6-promise-polyfill"),v=m.Promise,g={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-lazy"},y=function(t){function e(t,a){var o;i(this,e),o=s(this,d(e).call(this)),o.data=p.extend({},g,a),o.data.currentIndex=0,o.data.oldIndex=0,o.data.hide=!0,o.data.group={},o.data.scaleSize=1,o.data.scale=!1,o.pos={x:0,y:0},o.data.photoPosX=0,o.data.photoPosY=0,o.convert={increment:o.increment,virtualPos:o.virtualPos,round:o.round},o.data.groupItems=o.groupItems,o.elements="string"==typeof t?document.querySelectorAll(t):t;var n=new Date;o.tapSecond=n.getTime(),o.onListMove=!1,o.clicked=!1,o.id=o._getUniqId(),o.vx=0,o.vy=0,o.data.appearEffect=null,o.addTemplate(o.id,f),o.data.isSmartPhone=o._isSmartPhone();var r=document.querySelector("body");p.append(r,"<div data-id='".concat(o.id,"'></div>")),[].forEach.call(o.elements,function(t){o.addNewItem(t)}),o.update();var c=o._getCurrentItemByHash();return c&&p.triggerEvent(c.element,"click"),setInterval(function(){o._doAnim()},o.data.forceInterval),o.data.isSmartPhone?(window.addEventListener("orientationchange",function(){o.groupItems()&&(o._resetTranslate(),o._setPosByCurrentIndex(),o._setHashByCurrentIndex(),o._setSizeByScreen(),o.update())}),o.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window,a=e.orientation;t&&t.gamma&&!o.data.appearEffect&&(o.isBeingZoomed||o.photoSwipable||o.data.elastic||!o.data.scale||(0===a?o._calcGravity(t.gamma,t.beta):90===a?o._calcGravity(t.beta,t.gamma):-90===a?o._calcGravity(-t.beta,-t.gamma):180===a&&o._calcGravity(-t.gamma,-t.beta)))}),o):s(o)):(window.addEventListener("resize",function(){o.groupItems()&&(o._resetTranslate(),o._setPosByCurrentIndex(),o._setSizeByScreen(),o.update())}),window.addEventListener("keydown",function(t){var e=t.keyCode||t.which;!0!==o.data.hide&&(37===e?o.gotoSlide(o.data.prev):39===e?o.gotoSlide(o.data.next):27===e&&o.hidePhoto())}),s(o))}return u(e,t),r(e,[{key:"on",value:function(t,e){var a=this;this._getElementByClass(this.data.classNames.smartPhoto).addEventListener(t,function(t){e.call(a,t)})}},{key:"increment",value:function(t){return t+1}},{key:"round",
value:function(t){return Math.round(t)}},{key:"virtualPos",value:function(t){return(t=parseInt(t,10))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_resetTranslate",value:function(){var t=this;this.groupItems().forEach(function(e,a){e.translateX=t._getWindowWidth()*a})}},{key:"addNewItem",value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,n=document.querySelector("body"),r=t.getAttribute("href"),s=t.querySelector("img"),c=r;s&&(c=s.getAttribute(this.data.lazyAttribute)?s.getAttribute(this.data.lazyAttribute):s.currentSrc?s.currentSrc:s.src);var d={src:r,thumb:c,caption:t.getAttribute("data-caption"),groupId:a,translateX:this._getWindowWidth()*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,processed:!1,element:t};o[a].push(d),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index"),10),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),n.style.overflow="hidden",e._fireEvent("open")})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;if(this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()})),this.clicked){this.clicked=!1;var e=this.data.classNames;this._getElementByClass(e.smartPhotoCaption).focus()}}},{key:"execEffect",value:function(){var t=this;return new v(function(e){p.isOldIE()&&e();var a=t.data,o=a.appearEffect,i=a.classNames,n=t._getElementByClass(i.smartPhotoImgClone),r=function t(){n.removeEventListener("transitionend",t,!0),e()};n.addEventListener("transitionend",r,!0),setTimeout(function(){n.style.transform="translate(".concat(o.afterX,"px, ").concat(o.afterY,"px) scale(").concat(o.scale,")")},10)})}},{key:"addAppearEffect",value:function(t,e){if(!1===this.data.showAnimation)return void(this.data.appear=!0);var a=t.querySelector("img"),o=p.getViewPos(a),i={},n=1;i.width=a.offsetWidth,i.height=a.offsetHeight,i.top=o.top,i.left=o.left,i.once=!0,e.getAttribute(this.data.lazyAttribute)?i.img=e.getAttribute(this.data.lazyAttribute):i.img=e.src;var r=this._getWindowWidth(),s=this._getWindowHeight(),c=s-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(i.width>=i.height?n=e.height<c?e.width/i.width:c/i.height:i.height>i.width&&(n=e.height<c?e.height/i.height:c/i.height),i.width*n>r&&(n=r/i.width));var d=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,u=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=d,i.afterY=u,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom";this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null,this.data.hideUi=!1,this.data.scale=!1,this.data.scaleSize=1;var a=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,o=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,i=document.querySelector("body");window.location.hash&&this._setHash(""),window.scroll(a,o),this._doHideEffect(e).then(function(){t.update(),i.style.overflow="",t._fireEvent("close")})}},{key:"_doHideEffect",value:function(t){var e=this;return new v(function(a){p.isOldIE()&&a();var o=e.data.classNames,i=e._getElementByClass(o.smartPhoto),n=e._getElementByQuery(".current .".concat(o.smartPhotoImg)),r=e._getWindowHeight(),s=function t(){i.removeEventListener("transitionend",t,!0),a()};i.style.opacity=0,"bottom"===t?n.style.transform="translateY(".concat(r,"px)"):"top"===t&&(n.style.transform="translateY(-".concat(r,"px)")),i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'.concat(this.id,'"] .').concat(t))}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'.concat(this.id,'"] ').concat(t))}},{key:"_getTouchPos",value:function(){var t=0,e=0,a="undefined"==typeof event?this.e:event;return this._isTouched(a)?(t=a.touches[0].pageX,e=a.touches[0].pageY):a.pageX&&(t=a.pageX,e=a.pageY),{x:t,y:e}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",value:function(){var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,e=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,n="group=".concat(i,"&photo=").concat(o);this._setHash(n),window.scroll(t,e)}},{key:"_setHash",value:function(t){window.history&&window.history.pushState&&this.data.useHistoryApi&&(t?window.history.replaceState(null,null,"".concat(location.pathname).concat(location.search,"#").concat(t)):window.history.replaceState(null,null,"".concat(location.pathname).concat(location.search)))}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=p.parseQuery(e),o=null,i=function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)};return Object.keys(t).forEach(function(e){t[e].forEach(i)}),o}},{key:"_loadItem",value:function(t){return new v(function(e){var a=new Image;a.onload=function(){t.width=a.width,t.height=a.height,t.loaded=!0,e()},a.onerror=function(){e()},a.src=t.src})}},{key:"_getItemByIndex",value:function(t){var e=this.data;return e.group[e.currentGroup][t]?e.group[e.currentGroup][t]:null}},{key:"_loadNeighborItems",value:function(){for(var t=this,e=this.data.currentIndex,a=this.data.loadOffset,o=e-a,i=e+a,n=[],r=o;r<i;r++){var s=this._getItemByIndex(r);s&&!s.loaded&&n.push(this._loadItem(s))}n.length&&v.all(n).then(function(){t._initPhoto(),t.update()})}},{key:"_setSizeByScreen",value:function(){var t=this._getWindowWidth(),e=this._getWindowHeight(),a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.loaded&&(a.processed=!0,a.scale=i/a.height,a.height<i&&(a.scale=1),a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width))})}},{key:"_slideList",value:function(){var t=this;this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){var e=t._getSelectedItem();t.data.onMoveClass=!1,t.setArrow(),t.update(),t.data.oldIndex!==t.data.currentIndex&&t._fireEvent("change"),t.data.oldIndex=t.data.currentIndex,t._loadNeighborItems(),e.loaded||t._loadItem(e).then(function(){t._initPhoto(),t.update()})},200)}},{key:"gotoSlide",value:function(t){this.e&&this.e.preventDefault&&this.e.preventDefault(),this.data.currentIndex=parseInt(t,10),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.isBeingZoomed=!1,this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos();this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(){var t=this.groupItems(),e=new Date,a=e.getTime(),o=this.tapSecond-a,i=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(i=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():p.isSmartPhone()||0!==i||0!==n?Math.abs(o)<=500&&0===i&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=a,this._fireEvent("swipeend"),"horizontal"===this.moveDir&&(i>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex-=1:i<=-this.data.swipeOffset&&this.data.currentIndex!==t.length-1&&(this.data.currentIndex+=1),this._slideList()),void("vertical"===this.moveDir&&(this.data.swipeBottomToClose&&n>=this.data.swipeOffset?this.hidePhoto("bottom"):this.data.swipeTopToClose&&n<=-this.data.swipeOffset?this.hidePhoto("top"):(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this._fireEvent("swipestart"),this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.scaleSize<=1||(this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate(),t._fireEvent("zoomin")},300))}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),this._fireEvent("zoomout")}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos();this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.photoSwipable=!1,this.zoomOutPhoto();else{this.photoSwipable=!1;var t=this._getSelectedItem(),e=this._makeBound(t),a=this.data.swipeOffset*this.data.scaleSize,o=0,i=0;if(this.data.photoPosX>e.maxX?o=-1:this.data.photoPosX<e.minX&&(o=1),this.data.photoPosY>e.maxY?i=-1:this.data.photoPosY<e.minY&&(i=1),this.data.photoPosX-e.maxX>a&&0!==this.data.currentIndex)return void this.gotoSlide(this.data.prev);if(e.minX-this.data.photoPosX>a&&this.data.currentIndex+1!==this.data.total)return void this.gotoSlide(this.data.next);0===o&&0===i?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(o,i)}}},{key:"beforeGesture",value:function(){this._fireEvent("gesturestart");var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,n=this.data.photoPosY;this.isBeingZoomed=!0,this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*n),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._fireEvent("gestureend"),this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem(),e=this._getWindowWidth(),a=this._getWindowHeight();return p.isSmartPhone()?t.width>t.height?a/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e,a,o,i,n=t.width*t.scale*this.data.scaleSize,r=t.height*t.scale*this.data.scaleSize,s=this._getWindowWidth(),c=this._getWindowHeight();return s>n?(o=(s-n)/2,e=-1*o):(o=(n-s)/2,e=-1*o),c>r?(i=(c-r)/2,a=-1*i):(i=(r-c)/2,a=-1*i),{minX:this._round(e,6)*this.data.scaleSize,minY:this._round(a,6)*this.data.scaleSize,maxX:this._round(o,6)*this.data.scaleSize,maxY:this._round(i,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector(".".concat(t.smartPhotoImg)),o=this._getElementByQuery(".".concat(t.smartPhotoNav)),i=this._getElementByQuery(".".concat(t.smartPhotoArrows)),n=this.virtualPos(this.data.photoPosX),r=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,c="translate(".concat(n,"px,").concat(r,"px) scale(").concat(s,")");a.style.transform=c,this.data.scale?p.addClass(a,t.smartPhotoImgOnMove):p.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?p.addClass(a,t.smartPhotoImgElasticMove):p.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(o&&o.setAttribute("aria-hidden","true"),i&&i.setAttribute("aria-hidden","true")):(o&&o.setAttribute("aria-hidden","false"),i&&i.setAttribute("aria-hidden","false"))}},{key:"_getWindowWidth",value:function(){return document&&document.documentElement?document.documentElement.clientWidth:window&&window.innerWidth?window.innerWidth:0}},{key:"_getWindowHeight",value:function(){return document&&document.documentElement?document.documentElement.clientHeight:window&&window.innerHeight?window.innerHeight:0}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".".concat(t.smartPhotoList)),a="translate(".concat(this.data.translateX,"px,").concat(this.data.translateY,"px)");e.style.transform=a,this.data.onMoveClass?p.addClass(e,t.smartPhotoListOnMove):p.removeClass(e,t.smartPhotoListOnMove)}},{key:"_fireEvent",value:function(t){var e=this._getElementByClass(this.data.classNames.smartPhoto);p.triggerEvent(e,t)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(h.default);a.default=y,e.exports=a.default},{"../lib/util":11,"a-template":1,"custom-event-polyfill":3,"es6-promise-polyfill":4}],10:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":9}],11:[function(t,e,a){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var n in a)a.hasOwnProperty(n)&&("object"===o(a[n])?t[n]=i(t[n],a[n]):t[n]=a[n])}return t}Object.defineProperty(a,"__esModule",{value:!0}),a.isOldIE=a.getBrowser=a.removeClass=a.addClass=a.append=a.removeElement=a.getViewPos=a.parseQuery=a.triggerEvent=a.extend=a.isSmartPhone=void 0;var n=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};a.isSmartPhone=n;var r=i;a.extend=r;var s=function(t,e,a){var o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)};a.triggerEvent=s;var c=function(t){for(var e,a,o,i=t.split("&"),n={},r=0,s=i.length;r<s;r++)e=i[r].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,n[a]=decodeURIComponent(o));return n};a.parseQuery=c;var d=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}};a.getViewPos=d;var u=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)};a.removeElement=u;var l=function(t,e){var a=document.createElement("div");for(a.innerHTML=e;a.children.length>0;)t.appendChild(a.children[0])};a.append=l;var h=function(t,e){t.classList?t.classList.add(e):t.className+=" ".concat(e)};a.addClass=h;var f=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")};a.removeClass=f;var p=function(){var t=window.navigator.userAgent.toLowerCase(),e=window.navigator.appVersion.toLowerCase(),a="unknown";return-1!=t.indexOf("msie")?a=-1!=e.indexOf("msie 6.")?"ie6":-1!=e.indexOf("msie 7.")?"ie7":-1!=e.indexOf("msie 8.")?"ie8":-1!=e.indexOf("msie 9.")?"ie9":-1!=e.indexOf("msie 10.")?"ie10":"ie":-1!=t.indexOf("trident/7")?a="ie11":-1!=t.indexOf("chrome")?a="chrome":-1!=t.indexOf("safari")?a="safari":-1!=t.indexOf("opera")?a="opera":-1!=t.indexOf("firefox")&&(a="firefox"),a};a.getBrowser=p;var m=function(){var t=p();return-1!==t.indexOf("ie")&&parseInt(t.replace(/[^0-9]/g,""))<=10};a.isOldIE=m},{}]},{},[10])(10)});

@@ -10,2 +10,3 @@ 'use strict';

}
return this;

@@ -19,2 +20,3 @@ };

var jq = window.jQuery ? window.jQuery : window.$;
if (typeof jq !== 'undefined') {

@@ -21,0 +23,0 @@ applyJQuery(jq);

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,25 +6,35 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _aTemplate = _interopRequireDefault(require("a-template"));
var _aTemplate = require('a-template');
require("custom-event-polyfill");
var _aTemplate2 = _interopRequireDefault(_aTemplate);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
require('custom-event-polyfill');
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var template = '<div class="\\{classNames.smartPhoto\\}"<!-- BEGIN hide:exist --> aria-hidden="true"<!-- END hide:exist --><!-- BEGIN hide:empty --> aria-hidden="false"<!-- END hide:empty --> role="dialog">\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}" aria-live="polite" tabindex="-1"><!-- BEGIN groupItems:loop --><!-- \\BEGIN currentIndex:touch#{index} -->{caption}<!-- \\END currentIndex:touch#{index} --><!-- END groupItems:loop --></span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"><span class="smartphoto-sr-only">\\{message.closeDialog\\}</span></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"<!-- BEGIN isSmartPhone:exist --> data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"<!-- END isSmartPhone:exist --><!-- BEGIN isSmartPhone:empty --> data-action-click="hidePhoto()"<!-- END isSmartPhone:empty -->>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="\\{classNames.smartPhotoList\\}<!-- BEGIN onMoveClass:exist --> \\{classNames.smartPhotoListOnMove\\}<!-- END onMoveClass:exist -->">\n\t\t\t\t\t<!-- BEGIN groupItems:loop -->\n\t\t\t\t\t<li style="transform:translate({translateX}[round]px,{translateY}[round]px);" class="<!-- \\BEGIN currentIndex:touch#{index} -->current<!-- \\END currentIndex:touch#{index} -->">\n\t\t\t\t\t\t<!-- BEGIN processed:exist -->\n\t\t\t\t\t\t<div style="transform:translate({x}[round]px,{y}[round]px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"<!-- \\BEGIN isSmartPhone:empty --> data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"<!-- \\END isSmartPhone:empty --><!-- \\BEGIN isSmartPhone:exist --> data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"<!-- \\END isSmartPhone:exist -->>\n\t\t\t\t\t\t\t<img style="<!-- \\BEGIN currentIndex:touch#{index} -->transform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});<!-- \\END currentIndex:touch#{index} -->width:{width}px;" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}<!-- \\BEGIN scale:exist --> \\\\{classNames.smartPhotoImgOnMove\\\\}<!-- \\END scale:exist --><!-- \\BEGIN elastic:exist --> \\\\{classNames.smartPhotoImgElasticMove\\\\}<!-- \\END elastic:exist --><!-- \\BEGIN appear:exist --> active<!-- \\END appear:exist -->" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<!-- END processed:exist -->\n\t\t\t\t\t\t<!-- BEGIN processed:empty -->\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<!-- END processed:empty -->\n\t\t\t\t\t</li>\n\t\t\t\t\t<!-- END groupItems:loop -->\n\t\t\t\t</ul>\n\t\t\t\t<!-- BEGIN arrows:exist -->\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}"<!-- BEGIN hideUi:exist --> aria-hidden="true"<!-- END hideUi:exist --><!-- BEGIN hideUi:exist --> aria-hidden="false"<!-- END hideUi:exist -->>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}<!-- BEGIN isSmartPhone:exist --> \\{classNames.smartPhotoArrowHideIcon\\}<!-- END isSmartPhone:exist -->"<!-- BEGIN showPrevArrow:empty --> aria-hidden="true"<!-- END showPrevArrow:empty -->><a href="#" data-action-click="gotoSlide({prev})" role="button"><span class="smartphoto-sr-only">\\{message.gotoPrevImage\\}</span></a></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}<!-- BEGIN isSmartPhone:exist --> \\{classNames.smartPhotoArrowHideIcon\\}<!-- END isSmartPhone:exist -->"<!-- BEGIN showNextArrow:empty --> aria-hidden="true"<!-- END showNextArrow:empty -->><a href="#" data-action-click="gotoSlide({next})" role="button"><span class="smartphoto-sr-only">\\{message.gotoNextImage\\}</span></a></li>\n\t\t\t\t</ul>\n\t\t\t\t<!-- END arrows:exist -->\n\t\t\t\t<!-- BEGIN nav:exist -->\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}"<!-- BEGIN hideUi:exist --> aria-hidden="true"<!-- END hideUi:exist --><!-- BEGIN hideUi:exist --> aria-hidden="false"<!-- END hideUi:exist -->>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t<!-- BEGIN groupItems:loop -->\n\t\t\t\t\t\t<li><a href="#" data-action-click="gotoSlide({index})" class="<!-- \\BEGIN currentIndex:touch#{index} -->current<!-- \\END currentIndex:touch#{index} -->" style="background-image:url({thumb});" role="button"><span class="smartphoto-sr-only">go to {caption}</span></a></li>\n\t\t\t\t\t\t<!-- END groupItems:loop -->\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t<!-- END nav:exist -->\n\t\t</div>\n\t\t<!-- BEGIN appearEffect:exist -->\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t<!-- END appearEffect:exist -->\n\t</div>\n</div>\n';
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var template = "<div class=\"\\{classNames.smartPhoto\\}\"<!-- BEGIN hide:exist --> aria-hidden=\"true\"<!-- END hide:exist --><!-- BEGIN hide:empty --> aria-hidden=\"false\"<!-- END hide:empty --> role=\"dialog\">\n\t<div class=\"\\{classNames.smartPhotoBody\\}\">\n\t\t<div class=\"\\{classNames.smartPhotoInner\\}\">\n\t\t\t <div class=\"\\{classNames.smartPhotoHeader\\}\">\n\t\t\t\t\t<span class=\"\\{classNames.smartPhotoCount\\}\">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class=\"\\{classNames.smartPhotoCaption\\}\" aria-live=\"polite\" tabindex=\"-1\"><!-- BEGIN groupItems:loop --><!-- \\BEGIN currentIndex:touch#{index} -->{caption}<!-- \\END currentIndex:touch#{index} --><!-- END groupItems:loop --></span>\n\t\t\t\t\t<button class=\"\\{classNames.smartPhotoDismiss\\}\" data-action-click=\"hidePhoto()\"><span class=\"smartphoto-sr-only\">\\{message.closeDialog\\}</span></button>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"\\{classNames.smartPhotoContent\\}\"<!-- BEGIN isSmartPhone:exist --> data-action-touchstart=\"beforeDrag\" data-action-touchmove=\"onDrag\" data-action-touchend=\"afterDrag(false)\"<!-- END isSmartPhone:exist --><!-- BEGIN isSmartPhone:empty --> data-action-click=\"hidePhoto()\"<!-- END isSmartPhone:empty -->>\n\t\t\t\t</div>\n\t\t\t\t<ul style=\"transform:translate({translateX}[round]px,{translateY}[round]px);\" class=\"\\{classNames.smartPhotoList\\}<!-- BEGIN onMoveClass:exist --> \\{classNames.smartPhotoListOnMove\\}<!-- END onMoveClass:exist -->\">\n\t\t\t\t\t<!-- BEGIN groupItems:loop -->\n\t\t\t\t\t<li style=\"transform:translate({translateX}[round]px,{translateY}[round]px);\" class=\"<!-- \\BEGIN currentIndex:touch#{index} -->current<!-- \\END currentIndex:touch#{index} -->\">\n\t\t\t\t\t\t<!-- BEGIN processed:exist -->\n\t\t\t\t\t\t<div style=\"transform:translate({x}[round]px,{y}[round]px) scale({scale});\" class=\"\\\\{classNames.smartPhotoImgWrap\\\\}\"<!-- \\BEGIN isSmartPhone:empty --> data-action-mousemove=\"onDrag\" data-action-mousedown=\"beforeDrag\" data-action-mouseup=\"afterDrag\"<!-- \\END isSmartPhone:empty --><!-- \\BEGIN isSmartPhone:exist --> data-action-touchstart=\"beforeDrag\" data-action-touchmove=\"onDrag\" data-action-touchend=\"afterDrag\"<!-- \\END isSmartPhone:exist -->>\n\t\t\t\t\t\t\t<img style=\"<!-- \\BEGIN currentIndex:touch#{index} -->transform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});<!-- \\END currentIndex:touch#{index} -->width:{width}px;\" src=\"{src}\" class=\"\\\\{classNames.smartPhotoImg\\\\}<!-- \\BEGIN scale:exist --> \\\\{classNames.smartPhotoImgOnMove\\\\}<!-- \\END scale:exist --><!-- \\BEGIN elastic:exist --> \\\\{classNames.smartPhotoImgElasticMove\\\\}<!-- \\END elastic:exist --><!-- \\BEGIN appear:exist --> active<!-- \\END appear:exist -->\" ondragstart=\"return false;\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<!-- END processed:exist -->\n\t\t\t\t\t\t<!-- BEGIN processed:empty -->\n\t\t\t\t\t\t<div class=\"\\\\{classNames.smartPhotoLoaderWrap\\\\}\">\n\t\t\t\t\t\t\t<span class=\"\\\\{classNames.smartPhotoLoader\\\\}\"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<!-- END processed:empty -->\n\t\t\t\t\t</li>\n\t\t\t\t\t<!-- END groupItems:loop -->\n\t\t\t\t</ul>\n\t\t\t\t<!-- BEGIN arrows:exist -->\n\t\t\t\t<ul class=\"\\{classNames.smartPhotoArrows\\}\"<!-- BEGIN hideUi:exist --> aria-hidden=\"true\"<!-- END hideUi:exist --><!-- BEGIN hideUi:exist --> aria-hidden=\"false\"<!-- END hideUi:exist -->>\n\t\t\t\t\t<li class=\"\\{classNames.smartPhotoArrowLeft\\}<!-- BEGIN isSmartPhone:exist --> \\{classNames.smartPhotoArrowHideIcon\\}<!-- END isSmartPhone:exist -->\"<!-- BEGIN showPrevArrow:empty --> aria-hidden=\"true\"<!-- END showPrevArrow:empty -->><a href=\"#\" data-action-click=\"gotoSlide({prev})\" role=\"button\"><span class=\"smartphoto-sr-only\">\\{message.gotoPrevImage\\}</span></a></li>\n\t\t\t\t\t<li class=\"\\{classNames.smartPhotoArrowRight\\}<!-- BEGIN isSmartPhone:exist --> \\{classNames.smartPhotoArrowHideIcon\\}<!-- END isSmartPhone:exist -->\"<!-- BEGIN showNextArrow:empty --> aria-hidden=\"true\"<!-- END showNextArrow:empty -->><a href=\"#\" data-action-click=\"gotoSlide({next})\" role=\"button\"><span class=\"smartphoto-sr-only\">\\{message.gotoNextImage\\}</span></a></li>\n\t\t\t\t</ul>\n\t\t\t\t<!-- END arrows:exist -->\n\t\t\t\t<!-- BEGIN nav:exist -->\n\t\t\t\t<nav class=\"\\{classNames.smartPhotoNav\\}\"<!-- BEGIN hideUi:exist --> aria-hidden=\"true\"<!-- END hideUi:exist --><!-- BEGIN hideUi:exist --> aria-hidden=\"false\"<!-- END hideUi:exist -->>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t<!-- BEGIN groupItems:loop -->\n\t\t\t\t\t\t<li><a href=\"#\" data-action-click=\"gotoSlide({index})\" class=\"<!-- \\BEGIN currentIndex:touch#{index} -->current<!-- \\END currentIndex:touch#{index} -->\" style=\"background-image:url({thumb});\" role=\"button\"><span class=\"smartphoto-sr-only\">go to {caption}</span></a></li>\n\t\t\t\t\t\t<!-- END groupItems:loop -->\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t<!-- END nav:exist -->\n\t\t</div>\n\t\t<!-- BEGIN appearEffect:exist -->\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass=\"\\{classNames.smartPhotoImgClone\\}\"\n\t\tstyle=\"width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)\" />\n\t\t<!-- END appearEffect:exist -->\n\t</div>\n</div>\n";
var util = require('../lib/util');
var Promise = require('es6-promise-polyfill').Promise;
var _require = require('es6-promise-polyfill'),
Promise = _require.Promise;
var defaults = {

@@ -77,13 +87,17 @@ classNames: {

loadOffset: 2,
resizeStyle: 'fit'
resizeStyle: 'fit',
lazyAttribute: 'data-lazy'
};
var SmartPhoto = function (_ATemplate) {
var SmartPhoto =
/*#__PURE__*/
function (_ATemplate) {
_inherits(SmartPhoto, _ATemplate);
function SmartPhoto(selector, settings) {
var _this;
_classCallCheck(this, SmartPhoto);
var _this = _possibleConstructorReturn(this, (SmartPhoto.__proto__ || Object.getPrototypeOf(SmartPhoto)).call(this));
_this = _possibleConstructorReturn(this, _getPrototypeOf(SmartPhoto).call(this));
_this.data = util.extend({}, defaults, settings);

@@ -96,3 +110,6 @@ _this.data.currentIndex = 0;

_this.data.scale = false;
_this.pos = { x: 0, y: 0 };
_this.pos = {
x: 0,
y: 0
};
_this.data.photoPosX = 0;

@@ -115,6 +132,8 @@ _this.data.photoPosY = 0;

_this.data.appearEffect = null;
_this.addTemplate(_this.id, template);
_this.data.isSmartPhone = _this._isSmartPhone();
var body = document.querySelector('body');
util.append(body, '<div data-id=\'' + _this.id + '\'></div>');
util.append(body, "<div data-id='".concat(_this.id, "'></div>"));
[].forEach.call(_this.elements, function (element) {

@@ -125,3 +144,5 @@ _this.addNewItem(element);

_this.update();
var currentItem = _this._getCurrentItemByHash();
if (currentItem) {

@@ -140,13 +161,18 @@ util.triggerEvent(currentItem.element, 'click');

}
_this._resetTranslate();
_this._setPosByCurrentIndex();
_this._setSizeByScreen();
_this.update();
});
window.addEventListener('keydown', function (e) {
var code = e.keyCode || e.which;
if (_this.data.hide === true) {
return;
}
if (code === 37) {

@@ -167,6 +193,11 @@ _this.gotoSlide(_this.data.prev);

}
_this._resetTranslate();
_this._setPosByCurrentIndex();
_this._setHashByCurrentIndex();
_this._setSizeByScreen();
_this.update();

@@ -186,2 +217,3 @@ });

}
if (!_this.isBeingZoomed && !_this.photoSwipable && !_this.data.elastic && _this.data.scale) {

@@ -203,3 +235,3 @@ if (orientation === 0) {

_createClass(SmartPhoto, [{
key: 'on',
key: "on",
value: function on(event, fn) {

@@ -209,2 +241,3 @@ var _this2 = this;

var photo = this._getElementByClass(this.data.classNames.smartPhoto);
photo.addEventListener(event, function (e) {

@@ -215,3 +248,3 @@ fn.call(_this2, e);

}, {
key: 'increment',
key: "increment",
value: function increment(item) {

@@ -221,3 +254,3 @@ return item + 1;

}, {
key: 'round',
key: "round",
value: function round(number) {

@@ -227,10 +260,12 @@ return Math.round(number);

}, {
key: 'virtualPos',
key: "virtualPos",
value: function virtualPos(pos) {
pos = parseInt(pos, 10);
var item = this._getSelectedItem();
return pos / item.scale / this.data.scaleSize;
}
}, {
key: 'groupItems',
key: "groupItems",
value: function groupItems() {

@@ -240,3 +275,3 @@ return this.data.group[this.data.currentGroup];

}, {
key: '_resetTranslate',
key: "_resetTranslate",
value: function _resetTranslate() {

@@ -251,3 +286,3 @@ var _this3 = this;

}, {
key: 'addNewItem',
key: "addNewItem",
value: function addNewItem(element) {

@@ -262,5 +297,7 @@ var _this4 = this;

}
if (!group[groupId]) {
group[groupId] = [];
}
var index = group[groupId].length;

@@ -271,4 +308,7 @@ var body = document.querySelector('body');

var thumb = src;
if (img) {
if (img.currentSrc) {
if (img.getAttribute(this.data.lazyAttribute)) {
thumb = img.getAttribute(this.data.lazyAttribute);
} else if (img.currentSrc) {
thumb = img.currentSrc;

@@ -279,2 +319,3 @@ } else {

}
var item = {

@@ -298,5 +339,7 @@ src: src,

var id = element.getAttribute('data-id');
if (!id) {
element.setAttribute('data-id', index);
}
element.setAttribute('data-index', index);

@@ -307,10 +350,18 @@ element.addEventListener('click', function (event) {

_this4.data.currentIndex = parseInt(element.getAttribute('data-index'), 10);
_this4._setHashByCurrentIndex();
var currentItem = _this4._getSelectedItem();
if (currentItem.loaded) {
_this4._initPhoto();
_this4.addAppearEffect(element, currentItem);
_this4.clicked = true;
_this4.update();
body.style.overflow = 'hidden';
_this4._fireEvent('open');

@@ -320,6 +371,11 @@ } else {

_this4._initPhoto();
_this4.addAppearEffect(element, currentItem);
_this4.clicked = true;
_this4.update();
body.style.overflow = 'hidden';
_this4._fireEvent('open');

@@ -331,3 +387,3 @@ });

}, {
key: '_initPhoto',
key: "_initPhoto",
value: function _initPhoto() {

@@ -338,5 +394,9 @@ this.data.total = this.groupItems().length;

this.data.photoPosY = 0;
this._setPosByCurrentIndex();
this._setSizeByScreen();
this.setArrow();
if (this.data.resizeStyle === 'fill' && this.data.isSmartPhone) {

@@ -349,3 +409,3 @@ this.data.scale = true;

}, {
key: 'onUpdated',
key: "onUpdated",
value: function onUpdated() {

@@ -359,5 +419,7 @@ var _this5 = this;

_this5.data.appear = true;
_this5.update();
});
}
if (this.clicked) {

@@ -368,2 +430,3 @@ this.clicked = false;

var caption = this._getElementByClass(classNames.smartPhotoCaption);
caption.focus();

@@ -373,3 +436,3 @@ }

}, {
key: 'execEffect',
key: "execEffect",
value: function execEffect() {

@@ -382,7 +445,9 @@ var _this6 = this;

}
var _data = _this6.data,
appearEffect = _data.appearEffect,
classNames = _data.classNames;
var _this6$data = _this6.data,
appearEffect = _this6$data.appearEffect,
classNames = _this6$data.classNames;
var effect = _this6._getElementByClass(classNames.smartPhotoImgClone);
var handler = function handler() {

@@ -392,5 +457,6 @@ effect.removeEventListener('transitionend', handler, true);

};
effect.addEventListener('transitionend', handler, true);
setTimeout(function () {
effect.style.transform = 'translate(' + appearEffect.afterX + 'px, ' + appearEffect.afterY + 'px) scale(' + appearEffect.scale + ')';
effect.style.transform = "translate(".concat(appearEffect.afterX, "px, ").concat(appearEffect.afterY, "px) scale(").concat(appearEffect.scale, ")");
}, 10);

@@ -400,3 +466,3 @@ });

}, {
key: 'addAppearEffect',
key: "addAppearEffect",
value: function addAppearEffect(element, item) {

@@ -407,2 +473,3 @@ if (this.data.showAnimation === false) {

}
var img = element.querySelector('img');

@@ -417,5 +484,13 @@ var pos = util.getViewPos(img);

appear.once = true;
appear.img = item.src;
if (item.getAttribute(this.data.lazyAttribute)) {
appear.img = item.getAttribute(this.data.lazyAttribute);
} else {
appear.img = item.src;
}
var toX = this._getWindowWidth();
var toY = this._getWindowHeight();
var screenY = toY - this.data.headerHeight - this.data.footerHeight;

@@ -443,2 +518,3 @@

}
if (appear.width * scale > toX) {

@@ -457,3 +533,3 @@ scale = toX / appear.width;

}, {
key: 'hidePhoto',
key: "hidePhoto",
value: function hidePhoto() {

@@ -463,3 +539,2 @@ var _this7 = this;

var dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottom';
this.data.hide = true;

@@ -474,9 +549,14 @@ this.data.appear = false;

var body = document.querySelector('body');
if (window.location.hash) {
this._setHash('');
}
window.scroll(scrollX, scrollY);
this._doHideEffect(dir).then(function () {
_this7.update();
body.style.overflow = '';
_this7._fireEvent('close');

@@ -486,3 +566,3 @@ });

}, {
key: '_doHideEffect',
key: "_doHideEffect",
value: function _doHideEffect(dir) {

@@ -495,7 +575,11 @@ var _this8 = this;

}
var classNames = _this8.data.classNames;
var photo = _this8._getElementByClass(classNames.smartPhoto);
var img = _this8._getElementByQuery('.current .' + classNames.smartPhotoImg);
var img = _this8._getElementByQuery(".current .".concat(classNames.smartPhotoImg));
var height = _this8._getWindowHeight();
var handler = function handler() {

@@ -505,8 +589,11 @@ photo.removeEventListener('transitionend', handler, true);

};
photo.style.opacity = 0;
if (dir === 'bottom') {
img.style.transform = 'translateY(' + height + 'px)';
img.style.transform = "translateY(".concat(height, "px)");
} else if (dir === 'top') {
img.style.transform = 'translateY(-' + height + 'px)';
img.style.transform = "translateY(-".concat(height, "px)");
}
photo.addEventListener('transitionend', handler, true);

@@ -516,13 +603,13 @@ });

}, {
key: '_getElementByClass',
key: "_getElementByClass",
value: function _getElementByClass(className) {
return document.querySelector('[data-id="' + this.id + '"] .' + className);
return document.querySelector("[data-id=\"".concat(this.id, "\"] .").concat(className));
}
}, {
key: '_getElementByQuery',
key: "_getElementByQuery",
value: function _getElementByQuery(query) {
return document.querySelector('[data-id="' + this.id + '"] ' + query);
return document.querySelector("[data-id=\"".concat(this.id, "\"] ").concat(query));
}
}, {
key: '_getTouchPos',
key: "_getTouchPos",
value: function _getTouchPos() {

@@ -532,2 +619,3 @@ var x = 0;

var e = typeof event === 'undefined' ? this.e : event;
if (this._isTouched(e)) {

@@ -540,12 +628,22 @@ x = e.touches[0].pageX;

}
return { x: x, y: y };
return {
x: x,
y: y
};
}
}, {
key: '_getGesturePos',
key: "_getGesturePos",
value: function _getGesturePos(e) {
var touches = e.touches;
return [{ x: touches[0].pageX, y: touches[0].pageY }, { x: touches[1].pageX, y: touches[1].pageY }];
return [{
x: touches[0].pageX,
y: touches[0].pageY
}, {
x: touches[1].pageX,
y: touches[1].pageY
}];
}
}, {
key: '_setPosByCurrentIndex',
key: "_setPosByCurrentIndex",
value: function _setPosByCurrentIndex() {

@@ -560,2 +658,3 @@ var _this9 = this;

_this9.data.translateY = 0;
_this9._listUpdate();

@@ -565,3 +664,3 @@ }, 1);

}, {
key: '_setHashByCurrentIndex',
key: "_setHashByCurrentIndex",
value: function _setHashByCurrentIndex() {

@@ -573,8 +672,10 @@ var scrollX = window.pageXOffset !== undefined ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;

var group = this.data.currentGroup;
var hash = 'group=' + group + '&photo=' + id;
var hash = "group=".concat(group, "&photo=").concat(id);
this._setHash(hash);
window.scroll(scrollX, scrollY);
}
}, {
key: '_setHash',
key: "_setHash",
value: function _setHash(hash) {

@@ -584,10 +685,11 @@ if (!(window.history && window.history.pushState) || !this.data.useHistoryApi) {

}
if (hash) {
window.history.replaceState(null, null, '' + location.pathname + location.search + '#' + hash);
window.history.replaceState(null, null, "".concat(location.pathname).concat(location.search, "#").concat(hash));
} else {
window.history.replaceState(null, null, '' + location.pathname + location.search);
window.history.replaceState(null, null, "".concat(location.pathname).concat(location.search));
}
}
}, {
key: '_getCurrentItemByHash',
key: "_getCurrentItemByHash",
value: function _getCurrentItemByHash() {

@@ -598,2 +700,3 @@ var group = this.data.group;

var currentItem = null;
var getCurrentItem = function getCurrentItem(item) {

@@ -604,2 +707,3 @@ if (hashObj.group === item.groupId && hashObj.photo === item.id) {

};
Object.keys(group).forEach(function (key) {

@@ -611,6 +715,7 @@ group[key].forEach(getCurrentItem);

}, {
key: '_loadItem',
key: "_loadItem",
value: function _loadItem(item) {
return new Promise(function (resolve) {
var img = new Image();
img.onload = function () {

@@ -622,5 +727,7 @@ item.width = img.width;

};
img.onerror = function () {
resolve();
};
img.src = item.src;

@@ -630,3 +737,3 @@ });

}, {
key: '_getItemByIndex',
key: "_getItemByIndex",
value: function _getItemByIndex(index) {

@@ -637,8 +744,8 @@ var data = this.data;

return data.group[data.currentGroup][index];
} else {
return null;
}
return null;
}
}, {
key: '_loadNeighborItems',
key: "_loadNeighborItems",
value: function _loadNeighborItems() {

@@ -649,8 +756,9 @@ var _this10 = this;

var loadOffset = this.data.loadOffset;
var from = index - loadOffset;
var to = index + loadOffset;
var promises = [];
for (var i = from; i < to; i++) {
var item = this._getItemByIndex(i);
if (item && !item.loaded) {

@@ -660,5 +768,7 @@ promises.push(this._loadItem(item));

}
if (promises.length) {
Promise.all(promises).then(function () {
_this10._initPhoto();
_this10.update();

@@ -669,6 +779,8 @@ });

}, {
key: '_setSizeByScreen',
key: "_setSizeByScreen",
value: function _setSizeByScreen() {
var windowX = this._getWindowWidth();
var windowY = this._getWindowHeight();
var headerHeight = this.data.headerHeight;

@@ -682,9 +794,13 @@ var footerHeight = this.data.footerHeight;

}
item.processed = true;
item.scale = screenY / item.height;
if (item.height < screenY) {
item.scale = 1;
}
item.x = (item.scale - 1) / 2 * item.width + (windowX - item.width * item.scale) / 2;
item.y = (item.scale - 1) / 2 * item.height + (windowY - item.height * item.scale) / 2;
if (item.width * item.scale > windowX) {

@@ -697,3 +813,3 @@ item.scale = windowX / item.width;

}, {
key: '_slideList',
key: "_slideList",
value: function _slideList() {

@@ -709,18 +825,30 @@ var _this11 = this;

this.data.onMoveClass = true;
this._setPosByCurrentIndex();
this._setHashByCurrentIndex();
this._setSizeByScreen();
setTimeout(function () {
var item = _this11._getSelectedItem();
_this11.data.onMoveClass = false;
_this11.setArrow();
_this11.update();
if (_this11.data.oldIndex !== _this11.data.currentIndex) {
_this11._fireEvent('change');
}
_this11.data.oldIndex = _this11.data.currentIndex;
_this11._loadNeighborItems();
if (!item.loaded) {
_this11._loadItem(item).then(function () {
_this11._initPhoto();
_this11.update();

@@ -732,3 +860,3 @@ });

}, {
key: 'gotoSlide',
key: "gotoSlide",
value: function gotoSlide(index) {

@@ -738,10 +866,13 @@ if (this.e && this.e.preventDefault) {

}
this.data.currentIndex = parseInt(index, 10);
if (!this.data.currentIndex) {
this.data.currentIndex = 0;
}
this._slideList();
}
}, {
key: 'setArrow',
key: "setArrow",
value: function setArrow() {

@@ -754,2 +885,3 @@ var items = this.groupItems();

this.data.showPrevArrow = false;
if (next !== length) {

@@ -759,2 +891,3 @@ this.data.next = next;

}
if (prev !== -1) {

@@ -766,3 +899,3 @@ this.data.prev = prev;

}, {
key: 'beforeDrag',
key: "beforeDrag",
value: function beforeDrag() {

@@ -773,3 +906,5 @@ if (this._isGestured(this.e)) {

}
this.isBeingZoomed = false;
if (this.data.scale) {

@@ -779,3 +914,5 @@ this.beforePhotoDrag();

}
var pos = this._getTouchPos();
this.isSwipable = true;

@@ -787,3 +924,3 @@ this.dragStart = true;

}, {
key: 'afterDrag',
key: "afterDrag",
value: function afterDrag() {

@@ -803,2 +940,3 @@ var items = this.groupItems();

}
if (this.isBeingZoomed) {

@@ -808,2 +946,3 @@ this.afterGesture();

}
if (this.data.scale) {

@@ -816,2 +955,3 @@ this.afterPhotoDrag();

}
if (Math.abs(offset) <= 500 && swipeWidth === 0 && swipeHeight === 0) {

@@ -822,4 +962,7 @@ this.e.preventDefault();

}
this.tapSecond = tapSecond;
this._fireEvent('swipeend');
if (this.moveDir === 'horizontal') {

@@ -831,4 +974,6 @@ if (swipeWidth >= this.data.swipeOffset && this.data.currentIndex !== 0) {

}
this._slideList();
}
if (this.moveDir === 'vertical') {

@@ -841,2 +986,3 @@ if (this.data.swipeBottomToClose && swipeHeight >= this.data.swipeOffset) {

this.data.translateY = 0;
this._slideList();

@@ -847,5 +993,6 @@ }

}, {
key: 'onDrag',
key: "onDrag",
value: function onDrag() {
this.e.preventDefault();
if (this._isGestured(this.e) && this.onListMove === false) {

@@ -855,5 +1002,7 @@ this.onGesture();

}
if (this.isBeingZoomed) {
return;
}
if (this.data.scale) {

@@ -863,2 +1012,3 @@ this.onPhotoDrag();

}
if (!this.isSwipable) {

@@ -869,2 +1019,3 @@ return;

var pos = this._getTouchPos();
var x = pos.x - this.oldPos.x;

@@ -875,3 +1026,5 @@ var y = pos.y - this.firstPos.y;

this._fireEvent('swipestart');
this.dragStart = false;
if (Math.abs(x) > Math.abs(y)) {

@@ -890,8 +1043,10 @@ this.moveDir = 'horizontal';

}
this.onListMove = true;
this.oldPos = pos;
this._listUpdate();
}
}, {
key: 'zoomPhoto',
key: "zoomPhoto",
value: function zoomPhoto() {

@@ -902,11 +1057,17 @@ var _this12 = this;

this.data.scaleSize = this._getScaleBoarder();
if (this.data.scaleSize <= 1) {
return;
}
this.data.photoPosX = 0;
this.data.photoPosY = 0;
this._photoUpdate();
setTimeout(function () {
_this12.data.scale = true;
_this12._photoUpdate();
_this12._fireEvent('zoomin');

@@ -916,3 +1077,3 @@ }, 300);

}, {
key: 'zoomOutPhoto',
key: "zoomOutPhoto",
value: function zoomOutPhoto() {

@@ -925,16 +1086,22 @@ this.data.scaleSize = 1;

this.data.photoPosY = 0;
this._photoUpdate();
this._fireEvent('zoomout');
}
}, {
key: 'beforePhotoDrag',
key: "beforePhotoDrag",
value: function beforePhotoDrag() {
var pos = this._getTouchPos();
this.photoSwipable = true;
if (!this.data.photoPosX) {
this.data.photoPosX = 0;
}
if (!this.data.photoPosY) {
this.data.photoPosY = 0;
}
this.oldPhotoPos = pos;

@@ -944,3 +1111,3 @@ this.firstPhotoPos = pos;

}, {
key: 'onPhotoDrag',
key: "onPhotoDrag",
value: function onPhotoDrag() {

@@ -950,8 +1117,14 @@ if (!this.photoSwipable) {

}
this.e.preventDefault();
var pos = this._getTouchPos();
var x = pos.x - this.oldPhotoPos.x;
var y = pos.y - this.oldPhotoPos.y;
var moveX = this._round(this.data.scaleSize * x, 6);
var moveY = this._round(this.data.scaleSize * y, 6);
if (typeof moveX === 'number') {

@@ -961,2 +1134,3 @@ this.data.photoPosX += moveX;

}
if (typeof moveY === 'number') {

@@ -966,7 +1140,9 @@ this.data.photoPosY += moveY;

}
this.oldPhotoPos = pos;
this._photoUpdate();
}
}, {
key: 'afterPhotoDrag',
key: "afterPhotoDrag",
value: function afterPhotoDrag() {

@@ -978,7 +1154,11 @@ if (this.oldPhotoPos.x === this.firstPhotoPos.x && this.photoSwipable) {

this.photoSwipable = false;
var item = this._getSelectedItem();
var bound = this._makeBound(item);
var offset = this.data.swipeOffset * this.data.scaleSize;
var flagX = 0;
var flagY = 0;
if (this.data.photoPosX > bound.maxX) {

@@ -989,2 +1169,3 @@ flagX = -1;

}
if (this.data.photoPosY > bound.maxY) {

@@ -1004,5 +1185,3 @@ flagY = -1;

return;
}
// todo
} // todo
// if(this.data.photoPosY - bound.maxY > offset) {

@@ -1013,2 +1192,3 @@ // this.hidePhoto();

if (flagX === 0 && flagY === 0) {

@@ -1023,7 +1203,10 @@ this.vx = this.photoVX / 5;

}, {
key: 'beforeGesture',
key: "beforeGesture",
value: function beforeGesture() {
this._fireEvent('gesturestart');
var pos = this._getGesturePos(this.e);
var distance = this._getDistance(pos[0], pos[1]);
this.isBeingZoomed = true;

@@ -1035,6 +1218,8 @@ this.oldDistance = distance;

}, {
key: 'onGesture',
key: "onGesture",
value: function onGesture() {
var pos = this._getGesturePos(this.e);
var distance = this._getDistance(pos[0], pos[1]);
var size = (distance - this.oldDistance) / 100;

@@ -1046,6 +1231,8 @@ var oldScaleSize = this.data.scaleSize;

this.data.scaleSize += this._round(size, 6);
if (this.data.scaleSize < 0.2) {
this.data.scaleSize = 0.2;
}
// todo
} // todo
if (this.data.scaleSize < oldScaleSize) {

@@ -1061,8 +1248,10 @@ this.data.photoPosX = (1 + this.data.scaleSize - oldScaleSize) * posX;

}
this.oldDistance = distance;
this.e.preventDefault();
this._photoUpdate();
}
}, {
key: 'afterGesture',
key: "afterGesture",
value: function afterGesture() {

@@ -1072,2 +1261,3 @@ if (this.data.scaleSize > this._getScaleBoarder()) {

}
this.data.photoPosX = 0;

@@ -1078,7 +1268,9 @@ this.data.photoPosY = 0;

this.data.hideUi = false;
this._fireEvent('gestureend');
this._photoUpdate();
}
}, {
key: '_getForceAndTheta',
key: "_getForceAndTheta",
value: function _getForceAndTheta(vx, vy) {

@@ -1091,26 +1283,34 @@ return {

}, {
key: '_getScaleBoarder',
key: "_getScaleBoarder",
value: function _getScaleBoarder() {
var item = this._getSelectedItem();
var windowWidth = this._getWindowWidth();
var windowHeight = this._getWindowHeight();
if (!util.isSmartPhone()) {
return 1 / item.scale;
}
if (item.width > item.height) {
return windowHeight / (item.height * item.scale);
}
return windowWidth / (item.width * item.scale);
}
}, {
key: '_makeBound',
key: "_makeBound",
value: function _makeBound(item) {
var width = item.width * item.scale * this.data.scaleSize;
var height = item.height * item.scale * this.data.scaleSize;
var minX = void 0;
var minY = void 0;
var maxX = void 0;
var maxY = void 0;
var minX;
var minY;
var maxX;
var maxY;
var windowWidth = this._getWindowWidth();
var windowHeight = this._getWindowHeight();
if (windowWidth > width) {

@@ -1123,2 +1323,3 @@ maxX = (windowWidth - width) / 2;

}
if (windowHeight > height) {

@@ -1131,2 +1332,3 @@ maxY = (windowHeight - height) / 2;

}
return {

@@ -1140,3 +1342,3 @@ minX: this._round(minX, 6) * this.data.scaleSize,

}, {
key: '_registerElasticForce',
key: "_registerElasticForce",
value: function _registerElasticForce(x, y) {

@@ -1146,4 +1348,7 @@ var _this13 = this;

var item = this._getSelectedItem();
var bound = this._makeBound(item);
this.data.elastic = true;
if (x === 1) {

@@ -1154,2 +1359,3 @@ this.data.photoPosX = bound.minX;

}
if (y === 1) {

@@ -1160,5 +1366,8 @@ this.data.photoPosY = bound.minY;

}
this._photoUpdate();
setTimeout(function () {
_this13.data.elastic = false;
_this13._photoUpdate();

@@ -1168,3 +1377,3 @@ }, 300);

}, {
key: '_getSelectedItem',
key: "_getSelectedItem",
value: function _getSelectedItem() {

@@ -1176,3 +1385,3 @@ var data = this.data;

}, {
key: '_getUniqId',
key: "_getUniqId",
value: function _getUniqId() {

@@ -1182,3 +1391,3 @@ return (Date.now().toString(36) + Math.random().toString(36).substr(2, 5)).toUpperCase();

}, {
key: '_getDistance',
key: "_getDistance",
value: function _getDistance(point1, point2) {

@@ -1190,3 +1399,3 @@ var x = point1.x - point2.x;

}, {
key: '_round',
key: "_round",
value: function _round(val, precision) {

@@ -1200,3 +1409,3 @@ var digit = Math.pow(10, precision);

}, {
key: '_isTouched',
key: "_isTouched",
value: function _isTouched(e) {

@@ -1206,6 +1415,7 @@ if (e && e.touches) {

}
return false;
}
}, {
key: '_isGestured',
key: "_isGestured",
value: function _isGestured(e) {

@@ -1215,15 +1425,18 @@ if (e && e.touches && e.touches.length > 1) {

}
return false;
}
}, {
key: '_isSmartPhone',
key: "_isSmartPhone",
value: function _isSmartPhone() {
var agent = navigator.userAgent;
if (agent.indexOf('iPhone') > 0 || agent.indexOf('iPad') > 0 || agent.indexOf('ipod') > 0 || agent.indexOf('Android') > 0) {
return true;
}
return false;
}
}, {
key: '_calcGravity',
key: "_calcGravity",
value: function _calcGravity(gamma, beta) {

@@ -1233,5 +1446,7 @@ if (gamma > 5 || gamma < -5) {

}
if (this.data.verticalGravity === false) {
return;
}
if (beta > 5 || beta < -5) {

@@ -1242,15 +1457,20 @@ this.vy += beta * 0.05;

}, {
key: '_photoUpdate',
key: "_photoUpdate",
value: function _photoUpdate() {
var classNames = this.data.classNames;
var current = this._getElementByQuery('.current');
var img = current.querySelector('.' + classNames.smartPhotoImg);
var nav = this._getElementByQuery('.' + classNames.smartPhotoNav);
var arrows = this._getElementByQuery('.' + classNames.smartPhotoArrows);
var img = current.querySelector(".".concat(classNames.smartPhotoImg));
var nav = this._getElementByQuery(".".concat(classNames.smartPhotoNav));
var arrows = this._getElementByQuery(".".concat(classNames.smartPhotoArrows));
var photoPosX = this.virtualPos(this.data.photoPosX);
var photoPosY = this.virtualPos(this.data.photoPosY);
var scaleSize = this.data.scaleSize;
var transform = 'translate(' + photoPosX + 'px,' + photoPosY + 'px) scale(' + scaleSize + ')';
var transform = "translate(".concat(photoPosX, "px,").concat(photoPosY, "px) scale(").concat(scaleSize, ")");
img.style.transform = transform;
img.style.transform = transform;
if (this.data.scale) {

@@ -1261,2 +1481,3 @@ util.addClass(img, classNames.smartPhotoImgOnMove);

}
if (this.data.elastic) {

@@ -1267,2 +1488,3 @@ util.addClass(img, classNames.smartPhotoImgElasticMove);

}
if (this.data.hideUi) {

@@ -1272,2 +1494,3 @@ if (nav) {

}
if (arrows) {

@@ -1280,2 +1503,3 @@ arrows.setAttribute('aria-hidden', 'true');

}
if (arrows) {

@@ -1287,3 +1511,3 @@ arrows.setAttribute('aria-hidden', 'false');

}, {
key: '_getWindowWidth',
key: "_getWindowWidth",
value: function _getWindowWidth() {

@@ -1295,6 +1519,7 @@ if (document && document.documentElement) {

}
return 0;
}
}, {
key: '_getWindowHeight',
key: "_getWindowHeight",
value: function _getWindowHeight() {

@@ -1306,12 +1531,15 @@ if (document && document.documentElement) {

}
return 0;
}
}, {
key: '_listUpdate',
key: "_listUpdate",
value: function _listUpdate() {
var classNames = this.data.classNames;
var list = this._getElementByQuery('.' + classNames.smartPhotoList);
var transform = 'translate(' + this.data.translateX + 'px,' + this.data.translateY + 'px)';
list.style.transform = transform;
// $list
var list = this._getElementByQuery(".".concat(classNames.smartPhotoList));
var transform = "translate(".concat(this.data.translateX, "px,").concat(this.data.translateY, "px)");
list.style.transform = transform; // $list
if (this.data.onMoveClass) {

@@ -1324,9 +1552,10 @@ util.addClass(list, classNames.smartPhotoListOnMove);

}, {
key: '_fireEvent',
key: "_fireEvent",
value: function _fireEvent(eventName) {
var photo = this._getElementByClass(this.data.classNames.smartPhoto);
util.triggerEvent(photo, eventName);
}
}, {
key: '_doAnim',
key: "_doAnim",
value: function _doAnim() {

@@ -1336,6 +1565,10 @@ if (this.isBeingZoomed || this.isSwipable || this.photoSwipable || this.data.elastic || !this.data.scale) {

}
this.data.photoPosX += this.vx;
this.data.photoPosY += this.vy;
var item = this._getSelectedItem();
var bound = this._makeBound(item);
if (this.data.photoPosX < bound.minX) {

@@ -1348,2 +1581,3 @@ this.data.photoPosX = bound.minX;

}
if (this.data.photoPosY < bound.minY) {

@@ -1356,11 +1590,16 @@ this.data.photoPosY = bound.minY;

}
var power = this._getForceAndTheta(this.vx, this.vy);
var force = power.force;
var theta = power.theta;
force -= this.data.registance;
if (Math.abs(force) < 0.5) {
return;
}
this.vx = Math.cos(theta) * force;
this.vy = Math.sin(theta) * force;
this._photoUpdate();

@@ -1371,5 +1610,5 @@ }

return SmartPhoto;
}(_aTemplate2.default);
}(_aTemplate["default"]);
exports.default = SmartPhoto;
module.exports = exports['default'];
exports["default"] = SmartPhoto;
module.exports = exports["default"];

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {

});
exports.isOldIE = exports.getBrowser = exports.removeClass = exports.addClass = exports.append = exports.removeElement = exports.getViewPos = exports.parseQuery = exports.triggerEvent = exports.extend = exports.isSmartPhone = void 0;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var isSmartPhone = exports.isSmartPhone = function isSmartPhone() {
var isSmartPhone = function isSmartPhone() {
var agent = navigator.userAgent;
if (agent.indexOf('iPhone') > 0 || agent.indexOf('iPad') > 0 || agent.indexOf('ipod') > 0 || agent.indexOf('Android') > 0) {

@@ -19,2 +21,4 @@ return true;

exports.isSmartPhone = isSmartPhone;
function deepExtend(out) {

@@ -25,2 +29,3 @@ out = out || {};

var obj = arguments[i];
if (!obj) {

@@ -38,10 +43,15 @@ continue;

return out;
};
}
var extend = exports.extend = deepExtend;
;
var extend = deepExtend;
exports.extend = extend;
var triggerEvent = exports.triggerEvent = function triggerEvent(el, eventName, options) {
var event = void 0;
var triggerEvent = function triggerEvent(el, eventName, options) {
var event;
if (window.CustomEvent) {
event = new CustomEvent(eventName, { cancelable: true });
event = new CustomEvent(eventName, {
cancelable: true
});
} else {

@@ -51,6 +61,9 @@ event = document.createEvent('CustomEvent');

}
el.dispatchEvent(event);
};
var parseQuery = exports.parseQuery = function parseQuery(query) {
exports.triggerEvent = triggerEvent;
var parseQuery = function parseQuery(query) {
var s = query.split('&'),

@@ -63,4 +76,6 @@ data = {},

value;
for (; i < iz; i++) {
param = s[i].split('=');
if (param[0] !== void 0) {

@@ -72,6 +87,9 @@ key = param[0];

}
return data;
};
var getViewPos = exports.getViewPos = function getViewPos(element) {
exports.parseQuery = parseQuery;
var getViewPos = function getViewPos(element) {
return {

@@ -83,3 +101,5 @@ left: element.getBoundingClientRect().left,

var removeElement = exports.removeElement = function removeElement(element) {
exports.getViewPos = getViewPos;
var removeElement = function removeElement(element) {
if (element && element.parentNode) {

@@ -90,5 +110,8 @@ element.parentNode.removeChild(element);

var append = exports.append = function append(element, string) {
exports.removeElement = removeElement;
var append = function append(element, string) {
var div = document.createElement('div');
div.innerHTML = string;
while (div.children.length > 0) {

@@ -99,11 +122,15 @@ element.appendChild(div.children[0]);

var addClass = exports.addClass = function addClass(element, className) {
exports.append = append;
var addClass = function addClass(element, className) {
if (element.classList) {
element.classList.add(className);
} else {
element.className += ' ' + className;
element.className += " ".concat(className);
}
};
var removeClass = exports.removeClass = function removeClass(element, className) {
exports.addClass = addClass;
var removeClass = function removeClass(element, className) {
if (element.classList) {

@@ -116,3 +143,5 @@ element.classList.remove(className);

var getBrowser = exports.getBrowser = function getBrowser() {
exports.removeClass = removeClass;
var getBrowser = function getBrowser() {
var ua = window.navigator.userAgent.toLowerCase();

@@ -147,7 +176,11 @@ var ver = window.navigator.appVersion.toLowerCase();

}
return name;
};
var isOldIE = exports.isOldIE = function isOldIE() {
exports.getBrowser = getBrowser;
var isOldIE = function isOldIE() {
var browser = getBrowser();
if (browser.indexOf('ie') !== -1) {

@@ -158,3 +191,6 @@ if (parseInt(browser.replace(/[^0-9]/g, '')) <= 10) {

}
return false;
};
};
exports.isOldIE = isOldIE;
{
"name": "smartphoto",
"version": "1.4.3",
"version": "1.5.0",
"description": "smartphoto",

@@ -8,3 +8,3 @@ "homepage": "http://developer.a-blogcms.jp",

"scripts": {
"test": "mocha ./test/test.js --timeout 1000000",
"test": "mocha ./test/test.js --timeout 1000000 --exit",
"lint": "eslint ./src/core/index.js --fix",

@@ -34,28 +34,29 @@ "build:js": "npm-run-all -p build:lib build:jquery build:global",

"devDependencies": {
"babel-cli": "^6.18.0",
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-html-import-to-string": "^0.0.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.18.0",
"babelify": "^7.3.0",
"browser-sync": "^2.18.6",
"browserify": "^13.1.1",
"babelify": "^10.0.0",
"browser-sync": "^2.26.7",
"browserify": "^16.5.0",
"chokidar": "^2.0.4",
"co": "^4.6.0",
"eslint": "^3.15.0",
"eslint": "^6.2.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"fs-extra": "^2.1.2",
"http-server": "^0.9.0",
"http-server": "^0.11.1",
"licensify": "^3.1.2",
"mocha": "^3.3.0",
"mocha": "^6.2.0",
"nightmare": "^2.8.1",
"node-cmd": "^2.0.0",
"node-sass": "^4.3.0",
"node-sass": "^4.12.0",
"nodemon": "^1.11.0",
"np": "^2.16.0",
"npm-run-all": "^4.0.2",
"onchange": "^3.2.1",
"onchange": "^6.0.0",
"power-assert": "^1.4.2",
"uglify-js": "^2.8.22",
"watchify": "^3.9.0"
"watchify": "^3.11.1"
},

@@ -62,0 +63,0 @@ "dependencies": {

@@ -7,3 +7,3 @@ import ATemplate from 'a-template';

const util = require('../lib/util');
const Promise = require('es6-promise-polyfill').Promise;
const { Promise } = require('es6-promise-polyfill');

@@ -58,6 +58,6 @@ const defaults = {

resizeStyle: 'fit',
lazyAttribute: 'data-lazy'
};
export default class SmartPhoto extends ATemplate {
constructor(selector, settings) {

@@ -216,3 +216,5 @@ super();

if (img) {
if (img.currentSrc) {
if (img.getAttribute(this.data.lazyAttribute)) {
thumb = img.getAttribute(this.data.lazyAttribute);
} else if (img.currentSrc) {
thumb = img.currentSrc;

@@ -335,3 +337,7 @@ } else {

appear.once = true;
appear.img = item.src;
if (item.getAttribute(this.data.lazyAttribute)) {
appear.img = item.getAttribute(this.data.lazyAttribute);
} else {
appear.img = item.src;
}
const toX = this._getWindowWidth();

@@ -517,5 +523,4 @@ const toY = this._getWindowHeight();

return data.group[data.currentGroup][index];
} else {
return null;
}
return null;
}

@@ -1141,3 +1146,2 @@

}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc