/*! v2.0.31 */
!function(){!function(o,i){function t(t){var e=i[t];i[t]=function(t){return a(e(t))}}function n(t,e,i){return(i=this).attachEvent("on"+t,function(t){(t=t||o.event).preventDefault=t.preventDefault||function(){t.returnValue=!1},t.stopPropagation=t.stopPropagation||function(){t.cancelBubble=!0},e.call(i,t)})}function a(t,e){if(e=t.length)for(;e--;)t[e].addEventListener=n;else t.addEventListener=n;return t}o.addEventListener||(a([i,o]),"Element"in o?o.Element.prototype.addEventListener=n:(i.attachEvent("onreadystatechange",function(){a(i.all)}),t("getElementsByTagName"),t("getElementById"),t("createElement"),a(i.all)))}(window,document);"undefined"!=typeof window&&window.addEventListener("load",function(){if(navigator.platform.match(/iPhone|iPod|iPad/)&&History.initCore){var 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=[],u=function(t){window.setTimeout(function(){t&&t.call(document)})},t=function(){for(r=!0;c.length;)u(c.shift())};"undefined"!=typeof document&&("complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?r=!0:(document.addEventListener("DOMContentLoaded",t),document.addEventListener("load",t)));var e=navigator.userAgent.toLowerCase(),i=e.match(/android (\d+(\.\d+)?)/),o=e.match(/firefox\/(\d+(\.\d+)?)/),n=e.match(/chrome\/(\d+(\.\d+)?)/),a=e.match(/msie (\d+(\.\d+)?)/),s=!!o,d=!!n,p=i?parseFloat(i[1]):null,h=a?parseFloat(a[1]):null;function l(){return p&&!d&&!s&&p<4.4?"お客様のご利用端末は、サポート対象外のOSバージョンのため2018年11月13日以降Paidy決済をご利用頂けません。サポート対象であるAndroid4.4以上のバージョンに更新していただくか、パソコン等（ブラウザ：IE11以上、Chrome、Firefox)をご使用いただくことで、Paidy決済をご利用いただけます。":h&&h<11?"お客様のブラウザバージョンは、サポート対象外のブラウザバージョンのため2018年11月13日以降Paidy決済をご利用頂けません。サポート対象であるIE11以上のバージョンに更新していただくか、他のブラウザ(Chrome、Firefox)をご使用いただくことで、Paidy決済をご利用いただけます。":0}var f=function(){var t=(new Date).getTime(),e=f.last||t,i=e<t?t:e+1;return f.last=i};function m(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}var _=["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"],y=function(t,e){return function(t,e){if(e&&e.key&&0<=_.indexOf(e.key))try{var i=m({},t);if(t.buyer_data){var o=m({},t.buyer_data),n=o.shops;o.shops=[];for(var a=0;a<n.length;a+=1){var s=n[a],r=m({},{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(r)}i.buyer_data=o}if(t.merchant_data){var c=m({},t.merchant_data),u=c.shops;c.shops=[];for(var d=0;d<u.length;d+=1){var p=u[d],h=m({},{age:p.age,item_id:p.item_id,shop_id:p.shop_id,category:p.category,transaction_count:p.transaction_count},p.num_photos&&{num_photos:p.num_photos},p.buyer_shop_url&&{buyer_shop_url:p.buyer_shop_url});c.shops.push(h)}i.merchant_data=c}return i}catch(t){}return t}(t,e)},g="production",v="paidy_checkout_style",k={production:"https://api.paidy.com"},w={production:"https://checkout-v2.paidy.com"},E={AUTHORIZED:"authorized",PENDING:"pending",REJECTED:"rejected",CLOSED:"closed"},b="active",D="recurring",S="initialized",q="loaded",P="closed",O="prepare",C="launch",N=function(t){return t&&"[object Function]"==={}.toString.call(t)},T=function(t){return N(t)?t:null},j=function(){},F=function(t,e,i){var o=this;void 0===e&&(e={}),this._id=i,this.options=e,this.state=O,this.iframeState=S,this.queue=[],this.iframe=document.createElement("iframe"),this.iframe.onload=function(){o.iframeState=q,o.dequeue()};var n,a=window.location.toString(),s=a.split("?")[1]&&"&"+a.split("?")[1]||"";this.iframe.src=t+"?key="+(this.options.apiKey||"")+s,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;"),l()||(n=function(){o.originalBodyPosition=window.getComputedStyle(document.body).getPropertyValue("position"),document.body.appendChild(o.iframe)},r?u(n):c.push(n))};F.prototype.enqueue=function(t){this.queue.push(t),this.dequeue()},F.prototype.dequeue=function(){if(this.iframeState===q){var t=this.queue.shift();t&&(N(t)&&t(this.iframe),this.dequeue())}},F.prototype.reload=function(){this.iframeState=S,this.iframe.src=this.iframe.src},F.prototype.launch=function(o,t){var n=this;this.state!==C&&(this.state=C,this.config=m({},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/);var e=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",i.id=v,i.appendChild(document.createTextNode("body { overflow: hidden !important; margin: 0 !important; padding: 0 !important; }")),e.appendChild(i),n._iOSDevice&&n._LIFF&&(t.style.position="absolute",t.style.top=document.documentElement.scrollTop+"px"),t.style.display="block"}))},F.prototype.close=function(t){this.state=O;var e,i,o,n=!!this.payload.merchant_data,a=!!this.config&&!!this.config.token&&this.config.token.type===D;i=v,(o=document.getElementById(i))&&o.parentNode&&o.parentNode.removeChild(o),this._iOSDevice&&(document.body.style.position=this.originalBodyPosition),e=n?-1<[E.AUTHORIZED,E.PENDING].indexOf(t.status)&&{payment_id:t.id,status:function(t){var e=t.status;switch(e){case E.AUTHORIZED:return"authorize_success";case E.PENDING:return"pending_success";default:return e}}({status:t.status}),test:t.test}:(t.test&&delete t.test,a?t.status===b&&{created_at:t.created_at,id:t.id,status:b}:-1<[E.AUTHORIZED,E.PENDING,E.REJECTED].indexOf(t.status)?t:{status:E.CLOSED}),this.iframe.style.display="none",e&&this.options.onClose(e),this.iframeState=P,this.reload()};var I=function(t){var i=this;this._id=f().toString(36).toUpperCase(),this.config={},this.configure(t),this.paidyFrame=new F(this.appHost,{apiKey:this.apiKey,onClose:this.onClose},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)};I.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.closed,u=t.callback;if(!i&&!e)throw new Error("[Paidy] Field 'key' or 'api_key' is required");var d,p=T(c)||T(u)||j;this.config.key=i||e||"",this.config.api_host=o||k[g],this.config.app_host=n||w[g],this.config.tier=a,this.config.closed=(d=p,function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];setTimeout(function(){d.apply(void 0,t)},0)}),this.config.token=s,this.config.logo_url=r,this.apiKey=this.config.key,this.apiHost=this.config.api_host,this.appHost=this.config.app_host,this.tier=this.config.tier,this.onClose=this.config.closed,this.token=this.config.token,this.logoURL=this.config.logo_url},I.prototype.launch=function(t){var e=this;if(!this.wait){var i=l();i&&alert(i);var o=y(t,this.config);this.paidyFrame.launch(o,this.config),setTimeout(function(){e.wait=!1},1e3)}},window.Paidy={},window.Paidy.configure=function(t){return new I(t)}}();
