smartphoto
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -9,3 +9,3 @@ /** | ||
* homepage: http://developer.a-blogcms.jp | ||
* version: 0.7.0 | ||
* version: 0.7.1 | ||
* | ||
@@ -29,3 +29,3 @@ * a-template: | ||
*/ | ||
!function t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var h="function"==typeof require&&require;if(!s&&h)return h(r,!0);if(n)return n(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var c=a[r]={exports:{}};e[r][0].call(c.exports,function(t){var a=e[r][1][t];return i(a||t)},c,c.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}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=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}}(),n=t("morphdom"),r=[],s="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",h=s.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,n=0;n<a;n++)if(i=e[n],t.call(o,i,n,e))return i});var d=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},c=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=r.length;e<a;e++)for(var o=r[e],i=o.templates,n=0,s=i.length;n<s;n++)if(i[n]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(d(t,e))return t;t=t.parentElement}return null},f=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,u(t.target,e));a&&(t.delegateTarget=a,o(t))})})};"undefined"!=typeof document&&(f(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),n=e.value;if(o&&(n=n.replace("#","")),i){var r=l(i);if(!r)return;"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():r.updateDataByString(a,n))}}),f(document,h,s,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=s.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var n=i.replace(/\(.*?\);?/,""),r=i.replace(/(.*?)\((.*?)\);?/,"$2"),h=r.split(","),d=u(e,"[data-id]").getAttribute("data-id");if(d){var c=l(d);c&&(c.e=t,c.method&&c.method[n]?c.method[n].apply(c,h):c[n]&&c[n].apply(c,h))}}}}));var p=function(){function t(e){o(this,t),this.atemplate=[],r.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,n=i.length,s=0,h=n;s<h;s++){var d=this.templates[s],l=c("#"+d).innerHTML;this.atemplate.push({id:d,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=c("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){c("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{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){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{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++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;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 ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,d=i.length;h<d;h++){var c=i[h];c=c.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=c.replace(/BEGIN/,"END"),u=new RegExp(c+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,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++){var m=n[f];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($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++){var P=r[y];P=P.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var w=P.replace(/BEGIN/,"END"),E=new RegExp(P+"(([\\n\\r\\t]|.)*?)"+w,"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 _=0,b=s.length;_<b;_++){var I=s[_];I=I.replace(/([a-zA-Z0-9._-]+):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(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/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){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return c("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),n=[];n="function"==typeof i?i.apply(e):i;var r="";if(n instanceof Array)for(var s=0,h=n.length;s<h;s++)r+=e.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{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(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,r=a.length;i<r;i++){var s=a[i],h="#"+s,d=this.getHtml(s),l=c("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=d:n(l,"<div data-id='"+s+"'>"+d+"</div>"):(c(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?c("[data-id='"+s+"']").innerText=d:c("[data-id='"+s+"']").innerHTML=d),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var n=a[o];if(!t||t==n){var r=c("[data-id='"+n+"']"),s=r.querySelectorAll("[data-bind]");if([].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}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{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}();e.exports=p},{morphdom:3}],2:[function(t,e,a){(function(t){!function(t){function e(t){return"[object Array]"===Object.prototype.toString.call(t)}function o(){for(var t=0;t<b.length;t++)b[t][0](b[t][1]);b=[],g=!1}function i(t,e){b.push([t,e]),g||(g=!0,_(o,0))}function n(t,e){function a(t){h(e,t)}function o(t){c(e,t)}try{t(a,o)}catch(t){o(t)}}function r(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){c(n,t)}}s(n,o)||(a===P&&h(n,o),a===w&&c(n,o))}function s(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?h(t,o):d(t,o))},function(e){a||(a=!0,c(t,e))}),!0}}catch(e){return a||c(t,e),!0}return!1}function h(t,e){t!==e&&s(t,e)||d(t,e)}function d(t,e){t.state_===y&&(t.state_=x,t.data_=e,i(u,t))}function c(t,e){t.state_===y&&(t.state_=x,t.data_=e,i(f,t))}function l(t){var e=t.then_;t.then_=void 0;for(var a=0;a<e.length;a++)r(e[a])}function u(t){t.state_=P,l(t)}function f(t){t.state_=w,l(t)}function p(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof p==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],n(t,this)}var m=t.Promise,v=m&&"resolve"in m&&"reject"in m&&"all"in m&&"race"in m&&function(){var t;return new m(function(e){t=e}),"function"==typeof t}();void 0!==a&&a?(a.Promise=v?m:p,a.Polyfill=p):"function"==typeof define&&define.amd?define(function(){return v?m:p}):v||(t.Promise=p);var g,y="pending",x="sealed",P="fulfilled",w="rejected",E=function(){},_="undefined"!=typeof setImmediate?setImmediate:setTimeout,b=[];p.prototype={constructor:p,state_:y,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_===w?i(r,a):this.then_.push(a),a.then},catch:function(t){return this.then(null,t)}},p.all=function(t){var a=this;if(!e(t))throw new TypeError("You must pass an array to Promise.all().");return new a(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)})},p.race=function(t){var a=this;if(!e(t))throw new TypeError("You must pass an array to Promise.race().");return new a(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)})},p.resolve=function(t){var e=this;return t&&"object"==typeof t&&t.constructor===e?t:new e(function(e){e(t)})},p.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:{})},{}],3:[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 h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function c(t){return t.id}var l,u,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};u=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=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(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;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.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,P=8,w=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=_(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(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);a&&(C[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=_(e);if(o){var n=C[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=_(n);if(d&&delete C[d],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===N(o,n))return;if(t(o,n),S(o),!1===B(o,n))return}if("TEXTAREA"!==o.nodeName){var c,l,f,w,E=n.firstChild,I=o.firstChild;t:for(;E;){for(f=E.nextSibling,c=_(E);I;){if(l=I.nextSibling,E.isSameNode&&E.isSameNode(I)){E=f,I=l;continue t}s=_(I);var k=I.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(c?c!==s&&((w=C[c])?I.nextSibling===w?A=!1:(o.insertBefore(w,I),l=I.nextSibling,s?h(s):u(I,o,!0),I=w):A=!1):s&&(A=!1),(A=!1!==A&&i(I,E))&&v(I,E)):k!==x&&k!=P||(A=!0,I.nodeValue=E.nodeValue)),A){E=f,I=l;continue t}s?h(s):u(I,o,!0),I=l}if(c&&(w=C[c])&&i(w,E))o.appendChild(w),v(w,E);else{var D=b(E);!1!==D&&(D&&(E=D),E.actualize&&(E=E.actualize(o.ownerDocument||p)),o.appendChild(E),m(E))}E=f,I=l}for(;I;)l=I.nextSibling,(s=_(I))?h(s):u(I,o,!0),I=l}var z=g[o.nodeName];z&&z(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var w=a;a=p.createElement("html"),a.innerHTML=w}else a=o(a);var E,_=s.getNodeKey||c,b=s.onBeforeNodeAdded||d,I=s.onNodeAdded||d,N=s.onBeforeElUpdated||d,S=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,B=s.onBeforeElChildrenUpdated||d,D=!0===s.childrenOnly,C={};f(e);var z=e,T=z.nodeType,G=a.nodeType;if(!D)if(T===y)G===y?i(e,a)||(A(e),z=r(e,n(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===P){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,D),E)for(var O=0,X=E.length;O<X;O++){var Y=C[E[O]];Y&&u(Y,Y.parentNode,!1)}return!D&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=w},{}],4:[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.selector,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":6}],5:[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)}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"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),d='<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>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}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}px,{translateY}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}px,{y}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} --\x3e" 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 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 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({src});" 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',c=t("../lib/util"),l=t("es6-promise-polyfill").Promise,u={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",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,animationSpeed:300,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0,useHistoryApi:!0},f=function(t){function e(t,a){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));n.data=c.extend({},u,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},n.data.groupItems=n.groupItems,n.elements=document.querySelectorAll(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,d),n.data.isSmartPhone=n._isSmartPhone();var s=document.querySelector("body");c.append(s,"<div data-id='"+n.id+"'></div>"),[].forEach.call(n.elements,function(t){n.addNewItem(t)});var h=n._getCurrentItemByHash();return h&&c.triggerEvent(h.element,"click"),n.update(),n._getEachImageSize().then(function(){n._fireEvent("loadall")}),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.orientation;t&&t.gamma&&!n.data.appearEffect&&(n.isBeingZoomed||n.photoSwipable||n.data.elastic||!n.data.scale||(0===e?n._calcGravity(t.gamma,t.beta):90===e?n._calcGravity(t.beta,t.gamma):-90===e?n._calcGravity(-t.beta,-t.gamma):180===e&&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:"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:"_getEachImageSize",value:function(){var t=[],e=this.data.group,a=function(e){var a=new l(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){a()},o.src=e.src});t.push(a)};return Object.keys(e).forEach(function(t){e[t].forEach(a)}),l.all(t)}},{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={src:t.getAttribute("href"),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(n),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(),e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),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 l(function(e){var a=t.data.appearEffect,o=t.data.classNames,i=t._getElementByClass(o.smartPhotoImgClone),n=function t(){i.removeEventListener("transitionend",t,!0),e()};i.addEventListener("transitionend",n,!0),setTimeout(function(){i.style.transform="translate("+a.afterX+"px, "+a.afterY+"px) scale("+a.scale+")"},10)})}},{key:"addAppearEffect",value:function(t,e){var a=t.querySelector("img"),o=c.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=a.getAttribute("src");var r=this._getWindowWidth(),s=this._getWindowHeight(),h=s-this.data.headerHeight-this.data.footerHeight;e.height<s?n=1:"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(n=h/a.offsetHeight)*a.offsetWidth>r&&(n=r/a.offsetWidth);var d=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,l=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=d,i.afterY=l,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this;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 e=window.scrollX,a=window.scrollY;location.hash&&this._setHash(""),window.scroll(e,a),this._doHideEffect().then(function(){t.update(),t._fireEvent("close")})}},{key:"_doHideEffect",value:function(){var t=this;return new l(function(e){var a=t.data.classNames,o=t._getElementByClass(a.smartPhoto),i=t._getElementByQuery(".current ."+a.smartPhotoImg),n=t._getWindowHeight(),r=function t(){o.removeEventListener("transitionend",t,!0),e()};o.style.opacity=0,i.style.transform="translateY("+n+"px)",o.addEventListener("transitionend",r,!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=window.scrollX,e=window.scrollY,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){ | ||
!function t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var h="function"==typeof require&&require;if(!s&&h)return h(r,!0);if(n)return n(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var c=a[r]={exports:{}};e[r][0].call(c.exports,function(t){var a=e[r][1][t];return i(a||t)},c,c.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}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=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}}(),n=t("morphdom"),r=[],s="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",h=s.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,n=0;n<a;n++)if(i=e[n],t.call(o,i,n,e))return i});var d=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},c=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=r.length;e<a;e++)for(var o=r[e],i=o.templates,n=0,s=i.length;n<s;n++)if(i[n]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(d(t,e))return t;t=t.parentElement}return null},f=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,u(t.target,e));a&&(t.delegateTarget=a,o(t))})})};"undefined"!=typeof document&&(f(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),n=e.value;if(o&&(n=n.replace("#","")),i){var r=l(i);if(!r)return;"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():r.updateDataByString(a,n))}}),f(document,h,s,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=s.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var n=i.replace(/\(.*?\);?/,""),r=i.replace(/(.*?)\((.*?)\);?/,"$2"),h=r.split(","),d=u(e,"[data-id]").getAttribute("data-id");if(d){var c=l(d);c&&(c.e=t,c.method&&c.method[n]?c.method[n].apply(c,h):c[n]&&c[n].apply(c,h))}}}}));var p=function(){function t(e){o(this,t),this.atemplate=[],r.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,n=i.length,s=0,h=n;s<h;s++){var d=this.templates[s],l=c("#"+d).innerHTML;this.atemplate.push({id:d,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=c("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){c("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{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){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{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++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;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 ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,d=i.length;h<d;h++){var c=i[h];c=c.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=c.replace(/BEGIN/,"END"),u=new RegExp(c+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,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++){var m=n[f];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($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++){var P=r[y];P=P.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var w=P.replace(/BEGIN/,"END"),E=new RegExp(P+"(([\\n\\r\\t]|.)*?)"+w,"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 _=0,b=s.length;_<b;_++){var I=s[_];I=I.replace(/([a-zA-Z0-9._-]+):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(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/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){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return c("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),n=[];n="function"==typeof i?i.apply(e):i;var r="";if(n instanceof Array)for(var s=0,h=n.length;s<h;s++)r+=e.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{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(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,r=a.length;i<r;i++){var s=a[i],h="#"+s,d=this.getHtml(s),l=c("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=d:n(l,"<div data-id='"+s+"'>"+d+"</div>"):(c(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?c("[data-id='"+s+"']").innerText=d:c("[data-id='"+s+"']").innerHTML=d),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var n=a[o];if(!t||t==n){var r=c("[data-id='"+n+"']"),s=r.querySelectorAll("[data-bind]");if([].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}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{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}();e.exports=p},{morphdom:3}],2:[function(t,e,a){(function(t){!function(t){function e(t){return"[object Array]"===Object.prototype.toString.call(t)}function o(){for(var t=0;t<b.length;t++)b[t][0](b[t][1]);b=[],g=!1}function i(t,e){b.push([t,e]),g||(g=!0,_(o,0))}function n(t,e){function a(t){h(e,t)}function o(t){c(e,t)}try{t(a,o)}catch(t){o(t)}}function r(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){c(n,t)}}s(n,o)||(a===P&&h(n,o),a===w&&c(n,o))}function s(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?h(t,o):d(t,o))},function(e){a||(a=!0,c(t,e))}),!0}}catch(e){return a||c(t,e),!0}return!1}function h(t,e){t!==e&&s(t,e)||d(t,e)}function d(t,e){t.state_===y&&(t.state_=x,t.data_=e,i(u,t))}function c(t,e){t.state_===y&&(t.state_=x,t.data_=e,i(f,t))}function l(t){var e=t.then_;t.then_=void 0;for(var a=0;a<e.length;a++)r(e[a])}function u(t){t.state_=P,l(t)}function f(t){t.state_=w,l(t)}function p(t){if("function"!=typeof t)throw new TypeError("Promise constructor takes a function argument");if(this instanceof p==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],n(t,this)}var m=t.Promise,v=m&&"resolve"in m&&"reject"in m&&"all"in m&&"race"in m&&function(){var t;return new m(function(e){t=e}),"function"==typeof t}();void 0!==a&&a?(a.Promise=v?m:p,a.Polyfill=p):"function"==typeof define&&define.amd?define(function(){return v?m:p}):v||(t.Promise=p);var g,y="pending",x="sealed",P="fulfilled",w="rejected",E=function(){},_="undefined"!=typeof setImmediate?setImmediate:setTimeout,b=[];p.prototype={constructor:p,state_:y,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_===w?i(r,a):this.then_.push(a),a.then},catch:function(t){return this.then(null,t)}},p.all=function(t){var a=this;if(!e(t))throw new TypeError("You must pass an array to Promise.all().");return new a(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)})},p.race=function(t){var a=this;if(!e(t))throw new TypeError("You must pass an array to Promise.race().");return new a(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)})},p.resolve=function(t){var e=this;return t&&"object"==typeof t&&t.constructor===e?t:new e(function(e){e(t)})},p.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:{})},{}],3:[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 h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function c(t){return t.id}var l,u,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};u=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=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(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;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.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,P=8,w=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=_(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(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);a&&(C[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=_(e);if(o){var n=C[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=_(n);if(d&&delete C[d],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===N(o,n))return;if(t(o,n),S(o),!1===B(o,n))return}if("TEXTAREA"!==o.nodeName){var c,l,f,w,E=n.firstChild,I=o.firstChild;t:for(;E;){for(f=E.nextSibling,c=_(E);I;){if(l=I.nextSibling,E.isSameNode&&E.isSameNode(I)){E=f,I=l;continue t}s=_(I);var k=I.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(c?c!==s&&((w=C[c])?I.nextSibling===w?A=!1:(o.insertBefore(w,I),l=I.nextSibling,s?h(s):u(I,o,!0),I=w):A=!1):s&&(A=!1),(A=!1!==A&&i(I,E))&&v(I,E)):k!==x&&k!=P||(A=!0,I.nodeValue=E.nodeValue)),A){E=f,I=l;continue t}s?h(s):u(I,o,!0),I=l}if(c&&(w=C[c])&&i(w,E))o.appendChild(w),v(w,E);else{var D=b(E);!1!==D&&(D&&(E=D),E.actualize&&(E=E.actualize(o.ownerDocument||p)),o.appendChild(E),m(E))}E=f,I=l}for(;I;)l=I.nextSibling,(s=_(I))?h(s):u(I,o,!0),I=l}var z=g[o.nodeName];z&&z(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var w=a;a=p.createElement("html"),a.innerHTML=w}else a=o(a);var E,_=s.getNodeKey||c,b=s.onBeforeNodeAdded||d,I=s.onNodeAdded||d,N=s.onBeforeElUpdated||d,S=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,B=s.onBeforeElChildrenUpdated||d,D=!0===s.childrenOnly,C={};f(e);var z=e,T=z.nodeType,G=a.nodeType;if(!D)if(T===y)G===y?i(e,a)||(A(e),z=r(e,n(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===P){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,D),E)for(var O=0,X=E.length;O<X;O++){var Y=C[E[O]];Y&&u(Y,Y.parentNode,!1)}return!D&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=w},{}],4:[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.selector,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":6}],5:[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)}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"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),d='<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>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}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}px,{translateY}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}px,{y}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} --\x3e" 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 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 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({src});" 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',c=t("../lib/util"),l=t("es6-promise-polyfill").Promise,u={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",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,animationSpeed:300,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0,useHistoryApi:!0},f=function(t){function e(t,a){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));n.data=c.extend({},u,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},n.data.groupItems=n.groupItems,n.elements=document.querySelectorAll(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,d),n.data.isSmartPhone=n._isSmartPhone();var s=document.querySelector("body");c.append(s,"<div data-id='"+n.id+"'></div>"),[].forEach.call(n.elements,function(t){n.addNewItem(t)});var h=n._getCurrentItemByHash();return h&&c.triggerEvent(h.element,"click"),n.update(),n._getEachImageSize().then(function(){n._fireEvent("loadall")}),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.orientation;t&&t.gamma&&!n.data.appearEffect&&(n.isBeingZoomed||n.photoSwipable||n.data.elastic||!n.data.scale||(0===e?n._calcGravity(t.gamma,t.beta):90===e?n._calcGravity(t.beta,t.gamma):-90===e?n._calcGravity(-t.beta,-t.gamma):180===e&&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:"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:"_getEachImageSize",value:function(){var t=[],e=this.data.group,a=function(e){var a=new l(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){a()},o.src=e.src});t.push(a)};return Object.keys(e).forEach(function(t){e[t].forEach(a)}),l.all(t)}},{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={src:t.getAttribute("href"),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(n),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(),e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),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 l(function(e){var a=t.data.appearEffect,o=t.data.classNames,i=t._getElementByClass(o.smartPhotoImgClone),n=function t(){i.removeEventListener("transitionend",t,!0),e()};i.addEventListener("transitionend",n,!0),setTimeout(function(){i.style.transform="translate("+a.afterX+"px, "+a.afterY+"px) scale("+a.scale+")"},10)})}},{key:"addAppearEffect",value:function(t,e){var a=t.querySelector("img"),o=c.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=a.getAttribute("src");var r=this._getWindowWidth(),s=this._getWindowHeight(),h=s-this.data.headerHeight-this.data.footerHeight;e.height<s?n=e.width/a.offsetWidth:"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(n=h/a.offsetHeight)*a.offsetWidth>r&&(n=r/a.offsetWidth);var d=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,l=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=d,i.afterY=l,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this;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 e=window.scrollX,a=window.scrollY;location.hash&&this._setHash(""),window.scroll(e,a),this._doHideEffect().then(function(){t.update(),t._fireEvent("close")})}},{key:"_doHideEffect",value:function(){var t=this;return new l(function(e){var a=t.data.classNames,o=t._getElementByClass(a.smartPhoto),i=t._getElementByQuery(".current ."+a.smartPhotoImg),n=t._getWindowHeight(),r=function t(){o.removeEventListener("transitionend",t,!0),e()};o.style.opacity=0,i.style.transform="translateY("+n+"px)",o.addEventListener("transitionend",r,!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=window.scrollX,e=window.scrollY,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+"#"+t):window.history.replaceState(null,null,""+location.pathname))}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=c.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 l(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:"_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(){t.data.onMoveClass=!1,t.setArrow(),t.update(),t.data.oldIndex!==t.data.currentIndex&&t._fireEvent("change"),t.data.oldIndex=t.data.currentIndex},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():c.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&&(n>=this.data.swipeOffset?this.hidePhoto():(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 c.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(),h=this._getWindowHeight();return s>e?(n=(s-e)/2,o=-1*n):(n=(e-s)/2,o=-1*n),h>a?(r=(h-a)/2,i=-1*r):(r=(a-h)/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,h="translate("+n+"px,"+r+"px) scale("+s+")";a.style.transform=h,this.data.scale?c.addClass(a,t.smartPhotoImgOnMove):c.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?c.addClass(a,t.smartPhotoImgElasticMove):c.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.documentElement.clientWidth}},{key:"_getWindowHeight",value:function(){return window.innerHeight}},{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?c.addClass(e,t.smartPhotoListOnMove):c.removeClass(e,t.smartPhotoListOnMove)}},{key:"_fireEvent",value:function(t){var e=this._getElementByClass(this.data.classNames.smartPhoto);c.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);e.exports=f},{"../lib/util":7,"a-template":1,"es6-promise-polyfill":2}],6:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":5}],7:[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}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};e.exports.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},e.exports.extend=o,e.exports.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)},e.exports.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},e.exports.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.append=function(t,e){var a=new DOMParser,o=a.parseFromString(e,"text/html");t.appendChild(o.querySelector("body").childNodes[0])},e.exports.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},e.exports.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}},{}]},{},[4]); |
@@ -9,3 +9,3 @@ /** | ||
* homepage: http://developer.a-blogcms.jp | ||
* version: 0.7.0 | ||
* version: 0.7.1 | ||
* | ||
@@ -29,3 +29,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 t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var h="function"==typeof require&&require;if(!s&&h)return h(r,!0);if(n)return n(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var c=a[r]={exports:{}};e[r][0].call(c.exports,function(t){var a=e[r][1][t];return i(a||t)},c,c.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}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=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}}(),n=t("morphdom"),r=[],s="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",h=s.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,n=0;n<a;n++)if(i=e[n],t.call(o,i,n,e))return i});var d=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},c=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=r.length;e<a;e++)for(var o=r[e],i=o.templates,n=0,s=i.length;n<s;n++)if(i[n]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(d(t,e))return t;t=t.parentElement}return null},f=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,u(t.target,e));a&&(t.delegateTarget=a,o(t))})})};"undefined"!=typeof document&&(f(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),n=e.value;if(o&&(n=n.replace("#","")),i){var r=l(i);if(!r)return;"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():r.updateDataByString(a,n))}}),f(document,h,s,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=s.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var n=i.replace(/\(.*?\);?/,""),r=i.replace(/(.*?)\((.*?)\);?/,"$2"),h=r.split(","),d=u(e,"[data-id]").getAttribute("data-id");if(d){var c=l(d);c&&(c.e=t,c.method&&c.method[n]?c.method[n].apply(c,h):c[n]&&c[n].apply(c,h))}}}}));var p=function(){function t(e){o(this,t),this.atemplate=[],r.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,n=i.length,s=0,h=n;s<h;s++){var d=this.templates[s],l=c("#"+d).innerHTML;this.atemplate.push({id:d,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=c("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){c("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{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){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{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++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;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 ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,d=i.length;h<d;h++){var c=i[h];c=c.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=c.replace(/BEGIN/,"END"),u=new RegExp(c+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,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++){var m=n[f];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($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++){var P=r[y];P=P.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var w=P.replace(/BEGIN/,"END"),E=new RegExp(P+"(([\\n\\r\\t]|.)*?)"+w,"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 _=0,b=s.length;_<b;_++){var I=s[_];I=I.replace(/([a-zA-Z0-9._-]+):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(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/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){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return c("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),n=[];n="function"==typeof i?i.apply(e):i;var r="";if(n instanceof Array)for(var s=0,h=n.length;s<h;s++)r+=e.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{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(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,r=a.length;i<r;i++){var s=a[i],h="#"+s,d=this.getHtml(s),l=c("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=d:n(l,"<div data-id='"+s+"'>"+d+"</div>"):(c(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?c("[data-id='"+s+"']").innerText=d:c("[data-id='"+s+"']").innerHTML=d),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var n=a[o];if(!t||t==n){var r=c("[data-id='"+n+"']"),s=r.querySelectorAll("[data-bind]");if([].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}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{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}();e.exports=p},{morphdom:3}],2:[function(e,a,o){(function(e){!function(e){function a(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,b(i,0))}function r(t,e){function a(t){d(e,t)}function o(t){l(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=w;try{o=i(o)}catch(t){l(n,t)}}h(n,o)||(a===w&&d(n,o),a===E&&l(n,o))}function h(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):c(t,o))},function(e){a||(a=!0,l(t,e))}),!0}}catch(e){return a||l(t,e),!0}return!1}function d(t,e){t!==e&&h(t,e)||c(t,e)}function c(t,e){t.state_===x&&(t.state_=P,t.data_=e,n(f,t))}function l(t,e){t.state_===x&&(t.state_=P,t.data_=e,n(p,t))}function u(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_=w,u(t)}function p(t){t.state_=E,u(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=e.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!==o&&o?(o.Promise=g?v:m,o.Polyfill=m):"function"==typeof t&&t.amd?t(function(){return g?v:m}):g||(e.Promise=m);var y,x="pending",P="sealed",w="fulfilled",E="rejected",_=function(){},b="undefined"!=typeof setImmediate?setImmediate: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(_),fulfilled:t,rejected:e};return this.state_===w||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(!a(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(!a(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!==e?e:"undefined"!=typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[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 h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function c(t){return t.id}var l,u,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};u=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=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(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;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.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,P=8,w=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=_(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(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);a&&(C[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=_(e);if(o){var n=C[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=_(n);if(d&&delete C[d],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===N(o,n))return;if(t(o,n),S(o),!1===B(o,n))return}if("TEXTAREA"!==o.nodeName){var c,l,f,w,E=n.firstChild,I=o.firstChild;t:for(;E;){for(f=E.nextSibling,c=_(E);I;){if(l=I.nextSibling,E.isSameNode&&E.isSameNode(I)){E=f,I=l;continue t}s=_(I);var k=I.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(c?c!==s&&((w=C[c])?I.nextSibling===w?A=!1:(o.insertBefore(w,I),l=I.nextSibling,s?h(s):u(I,o,!0),I=w):A=!1):s&&(A=!1),(A=!1!==A&&i(I,E))&&v(I,E)):k!==x&&k!=P||(A=!0,I.nodeValue=E.nodeValue)),A){E=f,I=l;continue t}s?h(s):u(I,o,!0),I=l}if(c&&(w=C[c])&&i(w,E))o.appendChild(w),v(w,E);else{var D=b(E);!1!==D&&(D&&(E=D),E.actualize&&(E=E.actualize(o.ownerDocument||p)),o.appendChild(E),m(E))}E=f,I=l}for(;I;)l=I.nextSibling,(s=_(I))?h(s):u(I,o,!0),I=l}var z=g[o.nodeName];z&&z(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var w=a;a=p.createElement("html"),a.innerHTML=w}else a=o(a);var E,_=s.getNodeKey||c,b=s.onBeforeNodeAdded||d,I=s.onNodeAdded||d,N=s.onBeforeElUpdated||d,S=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,B=s.onBeforeElChildrenUpdated||d,D=!0===s.childrenOnly,C={};f(e);var z=e,T=z.nodeType,G=a.nodeType;if(!D)if(T===y)G===y?i(e,a)||(A(e),z=r(e,n(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===P){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,D),E)for(var O=0,X=E.length;O<X;O++){var Y=C[E[O]];Y&&u(Y,Y.parentNode,!1)}return!D&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=w},{}],4:[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)}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"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),d='<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>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}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}px,{translateY}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}px,{y}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} --\x3e" 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 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 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({src});" 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',c=t("../lib/util"),l=t("es6-promise-polyfill").Promise,u={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",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,animationSpeed:300,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0,useHistoryApi:!0},f=function(t){function e(t,a){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));n.data=c.extend({},u,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},n.data.groupItems=n.groupItems,n.elements=document.querySelectorAll(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,d),n.data.isSmartPhone=n._isSmartPhone();var s=document.querySelector("body");c.append(s,"<div data-id='"+n.id+"'></div>"),[].forEach.call(n.elements,function(t){n.addNewItem(t)});var h=n._getCurrentItemByHash();return h&&c.triggerEvent(h.element,"click"),n.update(),n._getEachImageSize().then(function(){n._fireEvent("loadall")}),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.orientation;t&&t.gamma&&!n.data.appearEffect&&(n.isBeingZoomed||n.photoSwipable||n.data.elastic||!n.data.scale||(0===e?n._calcGravity(t.gamma,t.beta):90===e?n._calcGravity(t.beta,t.gamma):-90===e?n._calcGravity(-t.beta,-t.gamma):180===e&&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:"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:"_getEachImageSize",value:function(){var t=[],e=this.data.group,a=function(e){var a=new l(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){a()},o.src=e.src});t.push(a)};return Object.keys(e).forEach(function(t){e[t].forEach(a)}),l.all(t)}},{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={src:t.getAttribute("href"),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(n),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(),e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),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 l(function(e){var a=t.data.appearEffect,o=t.data.classNames,i=t._getElementByClass(o.smartPhotoImgClone),n=function t(){i.removeEventListener("transitionend",t,!0),e()};i.addEventListener("transitionend",n,!0),setTimeout(function(){i.style.transform="translate("+a.afterX+"px, "+a.afterY+"px) scale("+a.scale+")"},10)})}},{key:"addAppearEffect",value:function(t,e){var a=t.querySelector("img"),o=c.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=a.getAttribute("src");var r=this._getWindowWidth(),s=this._getWindowHeight(),h=s-this.data.headerHeight-this.data.footerHeight;e.height<s?n=1:"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(n=h/a.offsetHeight)*a.offsetWidth>r&&(n=r/a.offsetWidth);var d=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,l=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=d,i.afterY=l,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this;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 e=window.scrollX,a=window.scrollY;location.hash&&this._setHash(""),window.scroll(e,a),this._doHideEffect().then(function(){t.update(),t._fireEvent("close")})}},{key:"_doHideEffect",value:function(){var t=this;return new l(function(e){var a=t.data.classNames,o=t._getElementByClass(a.smartPhoto),i=t._getElementByQuery(".current ."+a.smartPhotoImg),n=t._getWindowHeight(),r=function t(){o.removeEventListener("transitionend",t,!0),e()};o.style.opacity=0,i.style.transform="translateY("+n+"px)",o.addEventListener("transitionend",r,!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=window.scrollX,e=window.scrollY,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){ | ||
!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 t(e,a,o){function i(r,s){if(!a[r]){if(!e[r]){var h="function"==typeof require&&require;if(!s&&h)return h(r,!0);if(n)return n(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var c=a[r]={exports:{}};e[r][0].call(c.exports,function(t){var a=e[r][1][t];return i(a||t)},c,c.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}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=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}}(),n=t("morphdom"),r=[],s="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",h=s.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,n=0;n<a;n++)if(i=e[n],t.call(o,i,n,e))return i});var d=function(t,e){for(var a=(t.document||t.ownerDocument).querySelectorAll(e),o=a.length;--o>=0&&a.item(o)!==t;);return o>-1},c=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=r.length;e<a;e++)for(var o=r[e],i=o.templates,n=0,s=i.length;n<s;n++)if(i[n]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(d(t,e))return t;t=t.parentElement}return null},f=function(t,e,a,o){a.split(" ").forEach(function(a){t.addEventListener(a,function(t){var a=(t.target,u(t.target,e));a&&(t.delegateTarget=a,o(t))})})};"undefined"!=typeof document&&(f(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),n=e.value;if(o&&(n=n.replace("#","")),i){var r=l(i);if(!r)return;"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():r.updateDataByString(a,n))}}),f(document,h,s,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=s.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var n=i.replace(/\(.*?\);?/,""),r=i.replace(/(.*?)\((.*?)\);?/,"$2"),h=r.split(","),d=u(e,"[data-id]").getAttribute("data-id");if(d){var c=l(d);c&&(c.e=t,c.method&&c.method[n]?c.method[n].apply(c,h):c[n]&&c[n].apply(c,h))}}}}));var p=function(){function t(e){o(this,t),this.atemplate=[],r.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,n=i.length,s=0,h=n;s<h;s++){var d=this.templates[s],l=c("#"+d).innerHTML;this.atemplate.push({id:d,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=c("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){c("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{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){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{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++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;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 ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,d=i.length;h<d;h++){var c=i[h];c=c.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=c.replace(/BEGIN/,"END"),u=new RegExp(c+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,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++){var m=n[f];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($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++){var P=r[y];P=P.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var w=P.replace(/BEGIN/,"END"),E=new RegExp(P+"(([\\n\\r\\t]|.)*?)"+w,"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 _=0,b=s.length;_<b;_++){var I=s[_];I=I.replace(/([a-zA-Z0-9._-]+):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(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/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){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return c("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),n=[];n="function"==typeof i?i.apply(e):i;var r="";if(n instanceof Array)for(var s=0,h=n.length;s<h;s++)r+=e.resolveBlock(o,n[s],s);return r=r.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{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(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,r=a.length;i<r;i++){var s=a[i],h="#"+s,d=this.getHtml(s),l=c("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=d:n(l,"<div data-id='"+s+"'>"+d+"</div>"):(c(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?c("[data-id='"+s+"']").innerText=d:c("[data-id='"+s+"']").innerHTML=d),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var n=a[o];if(!t||t==n){var r=c("[data-id='"+n+"']"),s=r.querySelectorAll("[data-bind]");if([].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}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{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}();e.exports=p},{morphdom:3}],2:[function(e,a,o){(function(e){!function(e){function a(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,b(i,0))}function r(t,e){function a(t){d(e,t)}function o(t){l(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=w;try{o=i(o)}catch(t){l(n,t)}}h(n,o)||(a===w&&d(n,o),a===E&&l(n,o))}function h(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):c(t,o))},function(e){a||(a=!0,l(t,e))}),!0}}catch(e){return a||l(t,e),!0}return!1}function d(t,e){t!==e&&h(t,e)||c(t,e)}function c(t,e){t.state_===x&&(t.state_=P,t.data_=e,n(f,t))}function l(t,e){t.state_===x&&(t.state_=P,t.data_=e,n(p,t))}function u(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_=w,u(t)}function p(t){t.state_=E,u(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=e.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!==o&&o?(o.Promise=g?v:m,o.Polyfill=m):"function"==typeof t&&t.amd?t(function(){return g?v:m}):g||(e.Promise=m);var y,x="pending",P="sealed",w="fulfilled",E="rejected",_=function(){},b="undefined"!=typeof setImmediate?setImmediate: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(_),fulfilled:t,rejected:e};return this.state_===w||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(!a(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(!a(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!==e?e:"undefined"!=typeof self?self:this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[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 h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function c(t){return t.id}var l,u,f="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,m=p?p.body||p.createElement("div"):{};u=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=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(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;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.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,P=8,w=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=_(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(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);a&&(C[a]=e),f(e),e=e.nextSibling}}function m(t){I(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=_(e);if(o){var n=C[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=_(n);if(d&&delete C[d],!a.isSameNode||!a.isSameNode(e)){if(!r){if(!1===N(o,n))return;if(t(o,n),S(o),!1===B(o,n))return}if("TEXTAREA"!==o.nodeName){var c,l,f,w,E=n.firstChild,I=o.firstChild;t:for(;E;){for(f=E.nextSibling,c=_(E);I;){if(l=I.nextSibling,E.isSameNode&&E.isSameNode(I)){E=f,I=l;continue t}s=_(I);var k=I.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(c?c!==s&&((w=C[c])?I.nextSibling===w?A=!1:(o.insertBefore(w,I),l=I.nextSibling,s?h(s):u(I,o,!0),I=w):A=!1):s&&(A=!1),(A=!1!==A&&i(I,E))&&v(I,E)):k!==x&&k!=P||(A=!0,I.nodeValue=E.nodeValue)),A){E=f,I=l;continue t}s?h(s):u(I,o,!0),I=l}if(c&&(w=C[c])&&i(w,E))o.appendChild(w),v(w,E);else{var D=b(E);!1!==D&&(D&&(E=D),E.actualize&&(E=E.actualize(o.ownerDocument||p)),o.appendChild(E),m(E))}E=f,I=l}for(;I;)l=I.nextSibling,(s=_(I))?h(s):u(I,o,!0),I=l}var z=g[o.nodeName];z&&z(o,n)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var w=a;a=p.createElement("html"),a.innerHTML=w}else a=o(a);var E,_=s.getNodeKey||c,b=s.onBeforeNodeAdded||d,I=s.onNodeAdded||d,N=s.onBeforeElUpdated||d,S=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,B=s.onBeforeElChildrenUpdated||d,D=!0===s.childrenOnly,C={};f(e);var z=e,T=z.nodeType,G=a.nodeType;if(!D)if(T===y)G===y?i(e,a)||(A(e),z=r(e,n(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===P){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,D),E)for(var O=0,X=E.length;O<X;O++){var Y=C[E[O]];Y&&u(Y,Y.parentNode,!1)}return!D&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=w},{}],4:[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)}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"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),d='<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>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}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}px,{translateY}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}px,{y}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} --\x3e" 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 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 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({src});" 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',c=t("../lib/util"),l=t("es6-promise-polyfill").Promise,u={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",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,animationSpeed:300,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0,useHistoryApi:!0},f=function(t){function e(t,a){o(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));n.data=c.extend({},u,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},n.data.groupItems=n.groupItems,n.elements=document.querySelectorAll(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,d),n.data.isSmartPhone=n._isSmartPhone();var s=document.querySelector("body");c.append(s,"<div data-id='"+n.id+"'></div>"),[].forEach.call(n.elements,function(t){n.addNewItem(t)});var h=n._getCurrentItemByHash();return h&&c.triggerEvent(h.element,"click"),n.update(),n._getEachImageSize().then(function(){n._fireEvent("loadall")}),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.orientation;t&&t.gamma&&!n.data.appearEffect&&(n.isBeingZoomed||n.photoSwipable||n.data.elastic||!n.data.scale||(0===e?n._calcGravity(t.gamma,t.beta):90===e?n._calcGravity(t.beta,t.gamma):-90===e?n._calcGravity(-t.beta,-t.gamma):180===e&&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:"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:"_getEachImageSize",value:function(){var t=[],e=this.data.group,a=function(e){var a=new l(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){a()},o.src=e.src});t.push(a)};return Object.keys(e).forEach(function(t){e[t].forEach(a)}),l.all(t)}},{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={src:t.getAttribute("href"),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(n),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(),e._fireEvent("open")):e._loadItem(o).then(function(){e._initPhoto(),e.addAppearEffect(t,o),e.clicked=!0,e.update(),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 l(function(e){var a=t.data.appearEffect,o=t.data.classNames,i=t._getElementByClass(o.smartPhotoImgClone),n=function t(){i.removeEventListener("transitionend",t,!0),e()};i.addEventListener("transitionend",n,!0),setTimeout(function(){i.style.transform="translate("+a.afterX+"px, "+a.afterY+"px) scale("+a.scale+")"},10)})}},{key:"addAppearEffect",value:function(t,e){var a=t.querySelector("img"),o=c.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=a.getAttribute("src");var r=this._getWindowWidth(),s=this._getWindowHeight(),h=s-this.data.headerHeight-this.data.footerHeight;e.height<s?n=e.width/a.offsetWidth:"fill"===this.data.resizeStyle&&this.data.isSmartPhone?n=a.offsetWidth>a.offsetHeight?s/a.offsetHeight:r/a.offsetWidth:(n=h/a.offsetHeight)*a.offsetWidth>r&&(n=r/a.offsetWidth);var d=(n-1)/2*a.offsetWidth+(r-a.offsetWidth*n)/2,l=(n-1)/2*a.offsetHeight+(s-a.offsetHeight*n)/2;i.afterX=d,i.afterY=l,i.scale=n,this.data.appearEffect=i}},{key:"hidePhoto",value:function(){var t=this;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 e=window.scrollX,a=window.scrollY;location.hash&&this._setHash(""),window.scroll(e,a),this._doHideEffect().then(function(){t.update(),t._fireEvent("close")})}},{key:"_doHideEffect",value:function(){var t=this;return new l(function(e){var a=t.data.classNames,o=t._getElementByClass(a.smartPhoto),i=t._getElementByQuery(".current ."+a.smartPhotoImg),n=t._getWindowHeight(),r=function t(){o.removeEventListener("transitionend",t,!0),e()};o.style.opacity=0,i.style.transform="translateY("+n+"px)",o.addEventListener("transitionend",r,!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=window.scrollX,e=window.scrollY,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+"#"+t):window.history.replaceState(null,null,""+location.pathname))}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=c.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 l(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:"_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(){t.data.onMoveClass=!1,t.setArrow(),t.update(),t.data.oldIndex!==t.data.currentIndex&&t._fireEvent("change"),t.data.oldIndex=t.data.currentIndex},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():c.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&&(n>=this.data.swipeOffset?this.hidePhoto():(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 c.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(),h=this._getWindowHeight();return s>e?(n=(s-e)/2,o=-1*n):(n=(e-s)/2,o=-1*n),h>a?(r=(h-a)/2,i=-1*r):(r=(a-h)/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,h="translate("+n+"px,"+r+"px) scale("+s+")";a.style.transform=h,this.data.scale?c.addClass(a,t.smartPhotoImgOnMove):c.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?c.addClass(a,t.smartPhotoImgElasticMove):c.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.documentElement.clientWidth}},{key:"_getWindowHeight",value:function(){return window.innerHeight}},{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?c.addClass(e,t.smartPhotoListOnMove):c.removeClass(e,t.smartPhotoListOnMove)}},{key:"_fireEvent",value:function(t){var e=this._getElementByClass(this.data.classNames.smartPhoto);c.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);e.exports=f},{"../lib/util":6,"a-template":1,"es6-promise-polyfill":2}],5:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":4}],6:[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}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};e.exports.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},e.exports.extend=o,e.exports.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)},e.exports.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},e.exports.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.append=function(t,e){var a=new DOMParser,o=a.parseFromString(e,"text/html");t.appendChild(o.querySelector("body").childNodes[0])},e.exports.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},e.exports.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}},{}]},{},[5])(5)}); |
@@ -378,3 +378,3 @@ 'use strict'; | ||
if (item.height < toY) { | ||
scale = 1; | ||
scale = item.width / img.offsetWidth; | ||
} else if (this.data.resizeStyle === 'fill' && this.data.isSmartPhone) { | ||
@@ -381,0 +381,0 @@ if (img.offsetWidth > img.offsetHeight) { |
{ | ||
"name": "smartphoto", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "smartphoto", | ||
@@ -5,0 +5,0 @@ "homepage": "http://developer.a-blogcms.jp", |
@@ -42,4 +42,4 @@ # SmartPhoto | ||
```js | ||
document.addEventListener('DOMContentLoaded',function(){ | ||
new smartPhoto(".js-img-viwer"); | ||
window.addEventListener('DOMContentLoaded',function(){ | ||
new smartPhoto(".js-smartphoto"); | ||
}); | ||
@@ -51,3 +51,3 @@ ``` | ||
$(function(){ | ||
$(".js-img-viwer").smartPhoto(); | ||
$(".js-smartphoto").smartPhoto(); | ||
}); | ||
@@ -59,10 +59,10 @@ ``` | ||
```html | ||
<a href="./assets/large-kuma.jpg" class="js-img-viwer" data-caption="くま" data-id="kuma" data-group="0"> | ||
<img src="./assets/kuma.jpg" width="360"/> | ||
<a href="./assets/large-bear.jpg" class="js-smartphoto" data-caption="bear" data-id="bear" data-group="0"> | ||
<img src="./assets/bear.jpg" width="360"/> | ||
</a> | ||
<a href="./assets/large-rakuda.jpg" class="js-img-viwer" data-caption="ラクダ" data-id="rakuda" data-group="0"> | ||
<img src="./assets/rakuda.jpg" width="360"/> | ||
<a href="./assets/large-camel.jpg" class="js-smartphoto" data-caption="camel" data-id="camel" data-group="0"> | ||
<img src="./assets/camel.jpg" width="360"/> | ||
</a> | ||
<a href="./assets/large-sai.jpg" class="js-img-viwer" data-caption="サイ" data-id="sai" data-group="0"> | ||
<img src="./assets/sai.jpg" width="360"/> | ||
<a href="./assets/large-rhinoceros.jpg" class="js-smartphoto" data-caption="rhinoceros" data-id="sai" data-group="0"> | ||
<img src="./assets/rhinoceros.jpg" width="360"/> | ||
</a> | ||
@@ -73,3 +73,3 @@ <link rel="stylesheet" href="./css/smartphoto.min.css"> | ||
document.addEventListener('DOMContentLoaded',function(){ | ||
new smartPhoto(".js-img-viwer"); | ||
new smartPhoto(".js-smartphoto"); | ||
}); | ||
@@ -122,3 +122,3 @@ </script> | ||
document.addEventListener('DOMContentLoaded',function(){ | ||
new smartPhoto(".js-img-viwer",{ | ||
new smartPhoto(".js-smartphoto",{ | ||
arrows: false, | ||
@@ -136,3 +136,3 @@ nav: false | ||
document.addEventListener('DOMContentLoaded',function(){ | ||
new smartPhoto(".js-img-viwer",{ | ||
new smartPhoto(".js-smartphoto",{ | ||
resizeStyle: 'fit' | ||
@@ -139,0 +139,0 @@ }); |
@@ -336,3 +336,3 @@ import aTemplate from 'a-template'; | ||
if (item.height < toY) { | ||
scale = 1; | ||
scale = item.width / img.offsetWidth; | ||
} else if (this.data.resizeStyle === 'fill' && this.data.isSmartPhone) { | ||
@@ -339,0 +339,0 @@ if (img.offsetWidth > img.offsetHeight) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7322026