/*! v2.0.34 */
!function(){function t(t){var e=a[t];a[t]=function(t){return o(e(t))}}function i(t,e,i){return(i=this).attachEvent("on"+t,function(t){(t=t||n.event).preventDefault=t.preventDefault||function(){t.returnValue=!1},t.stopPropagation=t.stopPropagation||function(){t.cancelBubble=!0},e.call(i,t)})}function o(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=i;else t.addEventListener=i;return t}var n,a;function s(t){window.setTimeout(function(){t&&t.call(document)})}n=window,a=document,n.addEventListener||(o([a,n]),"Element"in n?n.Element.prototype.addEventListener=i:(a.attachEvent("onreadystatechange",function(){o(a.all)}),t("getElementsByTagName"),t("getElementById"),t("createElement"),o(a.all))),"undefined"!=typeof window&&window.addEventListener("load",function(){var t;navigator.platform.match(/iPhone|iPod|iPad/)&&History.initCore&&(t=function(t){var i=t.func,o=t.limit,n=!1,a=[null,"",location.href];return function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t[1]!==a[1]||t[2]!==a[2])return a=t,void i.apply(this,t);a=t,n||(i.apply(this,t),n=!0,setTimeout(function(){n=!1},o))}},History.pushState=t({func:History.pushState,limit:350}),History.replaceState=t({func:History.replaceState,limit:350}))},!1);var r=!1,c=[],e=function(){for(r=!0;c.length;)s(c.shift())};"undefined"!=typeof document&&("complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?r=!0:(document.addEventListener("DOMContentLoaded",e),document.addEventListener("load",e)));var u=(p=navigator.userAgent.toLowerCase()).match(/android (\d+(\.\d+)?)/),d=p.match(/firefox\/(\d+(\.\d+)?)/),e=p.match(/chrome\/(\d+(\.\d+)?)/),p=p.match(/msie (\d+(\.\d+)?)/),h=!!d,l=!!e,f=u?parseFloat(u[1]):null,m=p?parseFloat(p[1]):null;function _(){return f&&!l&&!h&&f<5?"お客様のご利用端末は、サポート対象外のOSバージョンのため2018年11月13日以降Paidy決済をご利用頂けません。サポート対象であるAndroid4.4以上のバージョンに更新していただくか、パソコン等（ブラウザ：IE11以上、Chrome、Firefox)をご使用いただくことで、Paidy決済をご利用いただけます。":m&&m<11?"お客様のブラウザバージョンは、サポート対象外のブラウザバージョンのため2018年11月13日以降Paidy決済をご利用頂けません。サポート対象であるIE11以上のバージョンに更新していただくか、他のブラウザ(Chrome、Firefox)をご使用いただくことで、Paidy決済をご利用いただけます。":0}var y=function(){var t=(new Date).getTime(),e=y.last||t,e=e<t?t:e+1;return y.last=e};function g(t,e){var i=arguments;if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(t),n=1;n<arguments.length;n++){var a=i[n];if(null!=a)for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(o[s]=a[s])}return o}function v(t,e){return function(t,e){if(t.metadata=g({},e.metadata,t.metadata),e&&e.key&&0<=D.indexOf(e.key))try{var i=g({},t);if(t.buyer_data){var o=g({},t.buyer_data),n=o.shops;o.shops=[];for(var a=0;a<n.length;a+=1){var s=n[a],s=g({},{age:s.age,item_id:s.item_id,shop_id:s.shop_id,category:s.category,transaction_count:s.transaction_count},s.num_photos&&{num_photos:s.num_photos},s.buyer_shop_url&&{buyer_shop_url:s.buyer_shop_url},s.shop_name&&{shop_name:s.shop_name},s.total_sales_amount&&{total_sales_amount:s.total_sales_amount},s.shop_reputation&&{shop_reputation:s.shop_reputation},s.item_likes&&{item_likes:s.item_likes},s.item_reputation&&{item_reputation:s.item_reputation},s.num_of_follower&&{num_of_follower:s.num_of_follower});o.shops.push(s)}i.buyer_data=o}if(t.merchant_data){var r=g({},t.merchant_data),c=r.shops;r.shops=[];for(var u=0;u<c.length;u+=1){var d=c[u],d=g({},{age:d.age,item_id:d.item_id,shop_id:d.shop_id,category:d.category,transaction_count:d.transaction_count},d.num_photos&&{num_photos:d.num_photos},d.buyer_shop_url&&{buyer_shop_url:d.buyer_shop_url});r.shops.push(d)}i.merchant_data=r}return i}catch(t){}return t}(t,e)}function k(t){return t&&"[object Function]"==={}.toString.call(t)}function E(t){return k(t)?t:null}function w(){}function b(t,e,i){var o=this;void 0===e&&(e={}),this._id=i,this.options=e,this.state=F,this.iframeState=T,this.queue=[],this.iframe=document.createElement("iframe"),this.iframe.onload=function(){o.iframeState=I,o.dequeue()},e=(e=window.location.toString()).split("?")[1]&&"&"+e.split("?")[1]||"",this.iframe.src=t+"?key="+(this.options.apiKey||"")+e,this.iframe.setAttribute("style","z-index: 2147483647; display: none; position: fixed; background: transparent; top: 0; left: 0; width: 100%; height: 100%; border: 0; overflow-x: hidden; overflow-y: auto; visibility: visible; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent;"),_()||(e=function(){o.originalBodyPosition=window.getComputedStyle(document.body).getPropertyValue("position"),document.body.appendChild(o.iframe)},r?s(e):c.push(e))}var D=["pk_live_fipc8koosqqnt2dlq5ldponhki","pk_test_2pj0grk8pq462vgituhi4soupb","pk_live_ivrfsfmjbcj25v68bisol24f0t","pk_test_5a71qm1flhl4ien6j329eeejgq","NTdmNzU5ZDc0ODAwMDA3ODJiZWI2NDc3","pk_live_i2u2liovnsnhd7bv3lhkbj1ndj","pk_test_uusg55npaki2frlcpi094pqdnf","pk_live_sr1uq8ks2br5hg784k66p2ikvl","pk_test_p6p5kua3ec3ottsb4lnrmf0evk","pk_live_drgtc20a9sa7g6ruc1nqnpn4pd","pk_test_jpqok22b5rj5175nbsg5tp24pa","pk_live_qqac4cdri37qv0bpvpnpki73fi","pk_test_csi9hbenr716coapj57j9c7b12","NTczYzJhMWQ0NTAwMDBjZDBmMzlkMTlk"],O="production",S="paidy_checkout_style",C={production:"https://api.paidy.com"},q={production:"https://checkout-v2.paidy.com"},P={AUTHORIZED:"authorized",PENDING:"pending",REJECTED:"rejected",CLOSED:"closed"},N="active",L="recurring",T="initialized",I="loaded",j="closed",F="prepare",x="launch";function A(t){var i=this;this._id=y().toString(36).toUpperCase(),this.config={},this.configure(t),this.paidyFrame=new b(this.appHost,{apiKey:this.apiKey,onClose:this.onClose,isOnCloseV2:this.isOnCloseV2},this._id),this.wait=!1,window.addEventListener("message",function(t){var e=t.data;if(e&&e._id===i._id)switch(e.event){case"paidy_checkout:close":case"paidy_checkout:init_failed":i.paidyFrame&&i.paidyFrame.close(e.payload)}},!1)}b.prototype.enqueue=function(t){this.queue.push(t),this.dequeue()},b.prototype.dequeue=function(){var t;this.iframeState!==I||(t=this.queue.shift())&&(k(t)&&t(this.iframe),this.dequeue())},b.prototype.reload=function(){this.iframeState=T,this.iframe.src=this.iframe.src},b.prototype.launch=function(o,t){var n=this;this.state!==x&&(this.state=x,this.config=g({},t),this.payload=o,this.enqueue(function(t){t.contentWindow.postMessage({_id:n._id,event:"paidy_checkout:init",config:JSON.stringify(n.config),payload:JSON.stringify(o)},t.src),n._iOSDevice=!!navigator.platform.match(/iPhone|iPod|iPad|iOS/),n._LIFF=!!navigator.userAgent.match(/LIFF/),n._LINE=!!navigator.userAgent.match(/Line/);var e=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",i.id=S,i.appendChild(document.createTextNode("body { overflow: hidden !important; margin: 0 !important; padding: 0 !important; }")),e.appendChild(i),n._iOSDevice&&(n._LIFF||n._LINE)&&(t.style.position="absolute",t.style.top=document.documentElement.scrollTop+"px"),t.style.display="block"}))},b.prototype.close=function(t){this.state=F;var e,i=!!this.payload.merchant_data,o=!!this.config&&!!this.config.token&&this.config.token.type===L;e=S,(e=document.getElementById(e))&&e.parentNode&&e.parentNode.removeChild(e),this._iOSDevice&&(document.body.style.position=this.originalBodyPosition),t=i?-1<[P.AUTHORIZED,P.PENDING].indexOf(t.status)&&{payment_id:t.id,status:function(t){var e=t.status;switch(e){case P.AUTHORIZED:return"authorize_success";case P.PENDING:return"pending_success";default:return e}}({status:t.status}),test:t.test}:(t.test&&delete t.test,o?t.status===N?{created_at:t.created_at,id:t.id,status:N}:this.options.isOnCloseV2&&{status:P.CLOSED}:-1<[P.AUTHORIZED,P.PENDING,P.REJECTED].indexOf(t.status)?t:{status:P.CLOSED}),this.iframe.style.display="none",t&&this.options.onClose(t),this.iframeState=j,this.reload()},A.prototype.configure=function(t){var e=t.key,i=t.api_key,o=t.api_host,n=t.app_host,a=t.tier,s=t.token,r=t.logo_url,c=t.metadata,u=t.on_close,d=t.closed,t=t.callback;if(!i&&!e)throw new Error("[Paidy] Field 'key' or 'api_key' is required");var p,t=E(u)||E(d)||E(t)||w,u=k(u);this.config.key=i||e||"",this.config.api_host=o||C[O],this.config.app_host=n||q[O],this.config.tier=a,this.config.token=s,this.config.metadata=c,this.config.logo_url=r,this.config.closed=(p=t,function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];setTimeout(function(){p.apply(void 0,t)},0)}),this.apiKey=this.config.key,this.apiHost=this.config.api_host,this.appHost=this.config.app_host,this.tier=this.config.tier,this.token=this.config.token,this.logoURL=this.config.logo_url,this.onClose=this.config.closed,this.isOnCloseV2=u},A.prototype.launch=function(t){var e,i=this;this.wait||((e=_())&&alert(e),t=v(t,this.config),this.paidyFrame.launch(t,this.config),setTimeout(function(){i.wait=!1},1e3))},window.Paidy={},window.Paidy.configure=function(t){return new A(t)}}();
