window.storecrm_config = {"favorite":{"favoriteMode":"product","is_only_member":false,"non_member_link":"","buttonicon":"heart","button_text":"お気に入り","button_text_remove":"お気に入り済み","has_background":false,"button_width":200,"button_height":50,"button_color":"#000000","icon_color":"#f90101","button_background_color":"#ffffff","button_border_color":"#000000","button_hover_color":"#222222","icon_hover_color":"#000000","button_hover_background_color":"#dddddd","button_hover_border_color":"#222222","button_radius":5,"button_border_width":0,"button_font":"helvetica_n4","button_fontsize":15,"button_fontweight":400,"icon_size":16,"icon_margin":5,"button_speed":0.3,"align":"center","popup_text_color":"#000000","popup_background_color":"#ffffff","popup_icon_color":"#000000","popup_icon_hover_color":"#000000","popup_border_width":0,"popup_border_color":"#999"},"favoriteList":{"list_title":"お気に入り一覧","loading_text":"読込中です...","non_item_text":"現在お気に入り中の商品はありません","show_cart":true,"insert_cart_directly":true},"restock":{},"restockPopup":{},"line":{"line_login_enable":false,"line_login_onlypreview":false},"backendUrl":"https://obake.groovymedia.co","appProxyName":"obake"}; (()=>{"use strict";var e={208:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(601),i=n.n(o),r=n(314),s=n.n(r)()(i());s.push([e.id,'.storecrm_modal {\n display: none;\n}\n\n.storecrm_modal.is-open {\n display: block;\n}\n\n.storecrm_modal_line {\n margin: 1rem 0;\n}\n\n.storecrm_modal_line label {\n display: flex;\n align-items: center;\n}\n\n#storecrm_restock_accepts_marketing {\n margin: 0 5px 0 0;\n max-width: 15px;\n}\n\n@media (hover: hover) {\n .storecrm_modal_line label:hover {\n cursor: pointer;\n }\n #storecrm_restock_accepts_marketing:hover {\n cursor: pointer;\n }\n}\n\n.storecrm_modal input, .storecrm_modal select {\n width: 100%;\n padding: 10px;\n font-size: 100%;\n margin: 1rem 0;\n}\n\n.storecrm_modal__overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 10000;\n background: rgba(0,0,0,0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.storecrm_modal__container {\n background-color: #fff;\n padding: 30px;\n min-width: 320px;\n max-width: 500px;\n min-height: 200px;\n max-height: 100vh;\n border-radius: 4px;\n overflow-y: auto;\n box-sizing: border-box;\n}\n\n.storecrm_modal__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.storecrm_modal__title {\n margin-top: 0;\n margin-bottom: 0;\n font-weight: 600;\n font-size: 1.25;\n line-height: 1.25;\n box-sizing: border-box;\n}\n\n.storecrm_modal__close {\n background: transparent;\n border: 0;\n cursor: pointer;\n}\n\n.storecrm_modal_message {\n margin-top: 2rem;\n padding: 1rem;\n}\n\n.storecrm_modal__header .storecrm_modal__close:before { content: "\\2715"; }\n\n.storecrm_modal__content {\n margin-top: 2rem;\n margin-bottom: 1rem;\n line-height: 1.5;\n color: rgba(0,0,0,.8);\n}\n\n.storecrm_modal__btn {\n display: block;\n width: 100%;\n padding-top: 1rem;\n padding-bottom: 1rem;\n background-color: #e6e6e6;\n color: rgba(0,0,0,.8);\n border-radius: .25rem;\n border-style: none;\n border-width: 0;\n cursor: pointer;\n -webkit-appearance: button;\n text-transform: none;\n overflow: visible;\n line-height: 1.15;\n margin: 0;\n margin-top: 1rem;\n will-change: transform;\n -moz-osx-font-smoothing: grayscale;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: -webkit-transform .25s ease-out;\n transition: transform .25s ease-out;\n transition: transform .25s ease-out,-webkit-transform .25s ease-out;\n}\n\n.storecrm_modal__btn:hover {\n -webkit-transform: scale(1.05);\n transform: scale(1.05);\n}\n\n.storecrm_modal__btn-primary {\n background-color: #00449e;\n color: #fff;\n}\n\n.storecrm_modal__btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n@keyframes mmfadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes mmfadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n@keyframes mmslideIn {\n from { transform: translateY(15%); }\n to { transform: translateY(0); }\n}\n\n@keyframes mmslideOut {\n from { transform: translateY(0); }\n to { transform: translateY(-10%); }\n}\n\n.micromodal-slide {\n display: none;\n}\n\n.micromodal-slide.is-open {\n display: block;\n}\n\n.micromodal-slide[aria-hidden="false"] .storecrm_modal__overlay {\n animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="false"] .storecrm_modal__container {\n animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .storecrm_modal__overlay {\n animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);\n}\n\n.micromodal-slide[aria-hidden="true"] .storecrm_modal__container {\n animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);\n}\n\n.micromodal-slide .storecrm_modal__container,\n.micromodal-slide .storecrm_modal__overlay {\n will-change: transform;\n}\n\n/* フェードイン・フェードアウトアニメーション用のクラス */\n.fade-out {\n animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1) forwards;\n}\n\n.fade-in {\n animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1) forwards;\n}\n\n.storecrm-status-widget {\n width: 100%;\n border: 1px solid #e6e6e6;\n display: flex;\n align-items: center;\n justify-content: center;\n max-height: 3em;\n}\n\n.storecrm-status-widget > div {\n padding: 1rem;\n}\n\n@media (max-width: 767px) {\n .storecrm-status-widget {\n flex-direction: column;\n max-height: none; /* Remove height restriction */\n }\n}\n\n.storecrm-status-widget button {\n margin-left: 0.5rem;\n}\n\n.storecrm-on {\n /* deep green, bold */\n color: #094c00;\n font-weight: bold;;\n}\n\n.storecrm-off {\n color: #df8536c6;\n font-weight: bold;\n}\n\n.line-chat-preview {\n display: flex;\n flex-direction: column;\n width: 360px;\n height: 640px;\n border: 1px solid #ddd;\n overflow: hidden;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n background-color: #92AAD4;\n}\n\n.line-chat-header {\n display: flex;\n align-items: center;\n padding: 10px 16px;\n background-color: #44556F;\n color: white;\n height: 50px;\n}\n\n.line-chat-body {\n flex-grow: 1;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n position: relative;\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.line-chat-body::-webkit-scrollbar {\n display: none;\n}\n\n.line-chat-footer {\n padding: 0 16px 0 16px;\n background-color: #ffffff;\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 50px;\n}\n\n.line-chat-keyboard-icon {\n width: 22px;\n height: 22px;\n}\n\n.line-chat-chatbarText {\n flex-grow: 1;\n font-size: 14px;\n color: #000;\n text-align: center;\n}\n\n/* リッチメニュー表示時のスタイル */\n.line-chat-footer.menu-open .line-chat-chatbarText:after {\n content: "▼";\n}\n\n/* リッチメニュー非表示時のスタイル */\n.line-chat-footer:not(.menu-open) .line-chat-chatbarText:after {\n content: "▲";\n}\n\n.line-richmenu-preview {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: #ffffff;\n transform: translateY(100%);\n transition: transform 0.3s cubic-bezier(0.0, 0.0, 0.2, 1);\n z-index: 10;\n box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);\n}\n\n.line-richmenu-preview.menu-open {\n transform: translateY(0);\n}\n\n.line-richmenu-preview.menu-closed {\n transform: translateY(100%);\n}',""]);const a=s},314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",o=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),o&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),o&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,o,i,r){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(o)for(var a=0;a0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),i&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=i):d[4]="".concat(i)),t.push(d))}},t}},601:e=>{e.exports=function(e){return e[1]}},804:(e,t,n)=>{function o(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);nu});var r,s,a,c,l,d=(r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],s=function(){function e(t){var n=t.targetModal,i=t.triggers,r=void 0===i?[]:i,s=t.onShow,a=void 0===s?function(){}:s,c=t.onClose,l=void 0===c?function(){}:c,d=t.openTrigger,u=void 0===d?"data-micromodal-trigger":d,h=t.closeTrigger,m=void 0===h?"data-micromodal-close":h,g=t.openClass,p=void 0===g?"is-open":g,f=t.disableScroll,b=void 0!==f&&f,v=t.disableFocus,_=void 0!==v&&v,y=t.awaitCloseAnimation,w=void 0!==y&&y,k=t.awaitOpenAnimation,S=void 0!==k&&k,x=t.debugMode,E=void 0!==x&&x;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.modal=document.getElementById(n),this.config={debugMode:E,disableScroll:b,openTrigger:u,closeTrigger:m,openClass:p,onShow:a,onClose:l,awaitCloseAnimation:w,awaitOpenAnimation:S,disableFocus:_},r.length>0&&this.registerTriggers.apply(this,o(r)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var t;return(t=[{key:"registerTriggers",value:function(){for(var e=this,t=arguments.length,n=new Array(t),o=0;o0&&void 0!==arguments[0]?arguments[0]:null;this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation?this.modal.addEventListener("animationend",(function t(){e.modal.removeEventListener("animationend",t,!1),e.setFocusToFirstNode()}),!1):this.setFocusToFirstNode(),this.config.onShow(this.modal,this.activeElement,t)}},{key:"closeModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation){var n=this.config.openClass;this.modal.addEventListener("animationend",(function e(){t.classList.remove(n),t.removeEventListener("animationend",e,!1)}),!1)}else t.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(e){this.modal=document.getElementById(e),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(e){if(this.config.disableScroll){var t=document.querySelector("body");switch(e){case"enable":Object.assign(t.style,{overflow:""});break;case"disable":Object.assign(t.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){(e.target.hasAttribute(this.config.closeTrigger)||e.target.parentNode.hasAttribute(this.config.closeTrigger))&&(e.preventDefault(),e.stopPropagation(),this.closeModal(e))}},{key:"onKeydown",value:function(e){27===e.keyCode&&this.closeModal(e),9===e.keyCode&&this.retainFocus(e)}},{key:"getFocusableNodes",value:function(){var e=this.modal.querySelectorAll(r);return Array.apply(void 0,o(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var t=this.getFocusableNodes();if(0!==t.length){var n=t.filter((function(t){return!t.hasAttribute(e.config.closeTrigger)}));n.length>0&&n[0].focus(),0===n.length&&t[0].focus()}}}},{key:"retainFocus",value:function(e){var t=this.getFocusableNodes();if(0!==t.length)if(t=t.filter((function(e){return null!==e.offsetParent})),this.modal.contains(document.activeElement)){var n=t.indexOf(document.activeElement);e.shiftKey&&0===n&&(t[t.length-1].focus(),e.preventDefault()),!e.shiftKey&&t.length>0&&n===t.length-1&&(t[0].focus(),e.preventDefault())}else t[0].focus()}}])&&function(e,t){for(var n=0;n')),!1},l=function(e,t){if(function(e){e.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",''))}(e),!t)return!0;for(var n in t)c(n);return!0},{init:function(e){var t=Object.assign({},{openTrigger:"data-micromodal-trigger"},e),n=o(document.querySelectorAll("[".concat(t.openTrigger,"]"))),i=function(e,t){var n=[];return e.forEach((function(e){var o=e.attributes[t].value;void 0===n[o]&&(n[o]=[]),n[o].push(e)})),n}(n,t.openTrigger);if(!0!==t.debugMode||!1!==l(n,i))for(var r in i){var c=i[r];t.targetModal=r,t.triggers=o(c),a=new s(t)}},show:function(e,t){var n=t||{};n.targetModal=e,!0===n.debugMode&&!1===c(e)||(a&&a.removeEventListeners(),(a=new s(n)).showModal())},close:function(e){e?a.closeModalById(e):a.closeModal()}});"undefined"!=typeof window&&(window.MicroModal=d);const u=d},511:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var o=n(72),i=n.n(o),r=n(825),s=n.n(r),a=n(659),c=n.n(a),l=n(56),d=n.n(l),u=n(540),h=n.n(u),m=n(113),g=n.n(m),p=n(208),f={};f.styleTagTransform=g(),f.setAttributes=d(),f.insert=c().bind(null,"head"),f.domAPI=s(),f.insertStyleElement=h(),i()(p.A,f);const b=p.A&&p.A.locals?p.A.locals:void 0},72:e=>{var t=[];function n(e){for(var n=-1,o=0;o{var t={};e.exports=function(e,n){var o=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},540:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var o="";n.supports&&(o+="@supports (".concat(n.supports,") {")),n.media&&(o+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(o+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),o+=n.css,i&&(o+="}"),n.media&&(o+="}"),n.supports&&(o+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(o,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},989:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.schema=t.renderWidgetSelector=t.hideWidgetSelector=t.render=t.getIcon=void 0,t.getIcon=(e,t=!1)=>{let n=null;return"star"===e.buttonicon?n=t?'':'':"heart"===e.buttonicon?n=t?'':'':"tag"===e.buttonicon?n='':"clip"===e.buttonicon&&(n=''),n&&(n=n.replace("viewBox",`width="${e.icon_size}" height="${e.icon_size}" style="margin-right: ${e.icon_margin}px;" viewBox`)),n};class n{constructor(e,t,n,o,i,r=!1,s=!1,a){this.eventTriggered=!1,this.variants=n,this.buttonSettings=Object.assign({},o),this.productId=t,this.button=i,this.isFavorited=r,this.hasVariantSelector=s,this.variantId=a,this.buttonSettings.has_background||(this.buttonSettings.button_width="auto",this.buttonSettings.button_height="auto",this.buttonSettings.button_radius=0,this.buttonSettings.button_border_width=0,this.buttonSettings.button_background_color="transparent",this.buttonSettings.button_border_color="transparent",this.buttonSettings.button_hover_border_color="transparent",this.buttonSettings.button_hover_background_color="transparent")}static getInstance(e,t,o,i,r,s=!1,a=!1,c){return n.instances[e]?(n.instances[e].isFavorited=s,n.instances[e].hasVariantSelector=a):n.instances[e]=new n(e,t,o,i,r,s,a,c),n.instances[e]}checkRender(e){document.querySelectorAll(`.storecrm-wishlistbutton-${e}`).forEach((e=>{if(e instanceof HTMLElement&&e.closest('[data-type="wishlist-button"]')){const t=new URL(location.href),n=t.searchParams.get("variant")&&t.searchParams.get("variant")||"";n&&(e.dataset.variantId=n),window.storecrm&&window.storecrm.render(!0)}}))}render(e,n=!1){const o=(0,t.getIcon)(this.buttonSettings,this.isFavorited),i=new URL(location.href),r=parseInt(i.searchParams.get("variant")||this.variantId||"0",10)||"",s=this.hasVariantSelector?"data-variant-selector":"",a=void 0!==this.button.dataset.noLabel;if(!this.eventTriggered)if(window.navigation)window.navigation.addEventListener("navigate",(()=>{window.setTimeout((()=>this.checkRender(e)),100)})),window.setTimeout((()=>this.checkRender(e)),100),window.setTimeout((()=>this.checkRender(e)),1e3);else{let t=location.href;window.setInterval((()=>{t!==location.href&&(t=location.href,this.checkRender(e))}),1e3),window.setTimeout((()=>this.checkRender(e)),100),window.setTimeout((()=>this.checkRender(e)),1e3)}this.eventTriggered,this.eventTriggered=!0;const c=n?"":`onclick="event.preventDefault();window.storecrm ? window.storecrm.toggleWishlist(this, ${this.isFavorited?"true":"false"}, ${this.buttonSettings.is_only_member}, '${this.buttonSettings.non_member_link}') : alert('読込中です。しばらくたってから再度お試しください。');"`,l=``,d=document.querySelector("#storecrm-wishlistbutton-style");return n?(d&&d.remove(),document.body.insertAdjacentHTML("afterend",l)):d||document.body.insertAdjacentHTML("afterend",l),`
\n\n
`}}let o,i,r;n.instances={},t.render=({productId:e,variantId:t,id:o,variants:i,product:r,button:s,buttonSettings:a,isFavorited:c=!1,preview:l=!1,hasVariantSelector:d=!1})=>n.getInstance(o,e,i,a,s,c,d,t).render(o,l),t.hideWidgetSelector=()=>{o&&(o.remove(),o=void 0),document.querySelectorAll(".storecrm-variantselector-dropdown").forEach((e=>e.remove())),i=void 0,r=void 0},t.renderWidgetSelector=({button:e,productId:n,variants:s,wishlist:a,buttonSettings:c,preview:l=!1,rerender:d=!1})=>{const u=i===n&&r?r:s,h=o&&d&&i==n?o.style:void 0;if(!l&&d&&i!==n)return;if(!l&&o&&(o.remove(),o=void 0,!d))return;i=n,r=u;const m=u.map((e=>{const o=a.variants.indexOf(e.id.toString())>=0,i=(0,t.getIcon)(c,o),r=l?"":`onclick="event.preventDefault();event.stopPropagation();window.storecrm ? window.storecrm.toggleWishlist(this, ${o?"true":"false"}, ${c.is_only_member}, '${c.non_member_link}') : alert('読込中です。しばらくたってから再度お試しください。');"`;return`\n ${i||(o?c.button_text_remove:c.button_text)}\n ${e.title}\n `})).join("");let g="";if(l)g="position: static;";else if(h)g=`top: ${h.top}; left: ${h.left};`;else{const t=e.getBoundingClientRect(),n=250;let o=t.left+document.documentElement.scrollLeft;o+n>window.innerWidth&&(o=window.innerWidth-n),g=`top: ${t.bottom+document.documentElement.scrollTop}px; left: ${o}px;`}const p=``;l||(document.body.insertAdjacentHTML("afterend",p),o=document.querySelector(".storecrm-variantselector-dropdown"));{const e=e=>{e.target&&e.target instanceof HTMLElement&&e.target.closest("[data-variant-selector]")||o&&(o.remove(),o=void 0)};document.addEventListener("click",e),document.addEventListener("resize",e)}return p},t.schema={preview:(e,n)=>{let o=`
${"ja"===n?"お気に入りボタン(お気に入り前)":"Favorite button (before it is added)"}
`;return o+=(0,t.render)({productId:"TEMP_product",id:"TEMP_favorite",buttonSettings:e,button:document.createElement("div"),isFavorited:!1,preview:!0,variants:[],product:null}),"variant"===e.favoriteMode&&(o+=`
${"ja"===n?"バリエーションモードの際のお気に入りボタン":"Favorite button for variant mode"}
`,o+=(0,t.renderWidgetSelector)({productId:"TEMP_product",variants:"ja"===n?[{id:"1",title:"バリエーション1"},{id:"2",title:"バリエーション2"},{id:"3",title:"バリエーション3"}]:[{id:"1",title:"Variant 1"},{id:"2",title:"Variant 2"},{id:"3",title:"Variant 3"}],wishlist:{variants:[]},buttonSettings:e,button:document.createElement("div"),preview:!0,rerender:!1})),o+=`
${"ja"===n?"お気に入りボタン(お気に入り後)":"Favorite button (after it is added)"}
`,o+=(0,t.render)({productId:"TEMP_product",id:"TEMP_favorite2",buttonSettings:e,button:document.createElement("div"),isFavorited:!0,preview:!0,variants:[],product:null}),o},rows:[{type:"card",slug:"favoriteMode",nameJa:"お気に入りのモードを選んでください",nameEn:"Choose the favorite mode",default:"product",selectOptionsJa:[{value:"product",label:"商品ごとにお気に入りをする"},{value:"variant",label:"バリエーション(商品の色やサイズなど)ごとにお気に入りをする"}],selectOptionsEn:[{value:"product",label:"Favorite by product"},{value:"variant",label:"Favorite by variant (such as color or size)"}],warningOnChangeJa:"設定を変更すると、既存のお気に入りデータが無効となります。データ移管をご希望の方はこの設定を保存せずに、お問い合わせください。",warningOnChangeEn:"Changing the setting will invalidate existing favorite data. Please contact us if you wish to transfer the data.",fullsize:!0},{type:"checkbox",slug:"is_only_member",nameJa:"お気に入り機能の利用を会員限定にする",nameEn:"Enable favorite function for sign-in customers only",default:!1,fullsize:!0},{type:"text",slug:"non_member_link",nameJa:"ゲストがお気に入りを押した場合の遷移先URL ※空欄の場合ログイン画面に遷移します",nameEn:"URL to redirect to when a guest clicks the favorite button. If left blank, the login screen will be displayed.",default:"",depends:"is_only_member",fullsize:!0},{type:"select",slug:"buttonicon",nameJa:"アイコン",nameEn:"buttonIcon",selectOptionsJa:[{value:"star",label:"星マーク(☆)"},{value:"heart",label:"ハートマーク(♡)"},{value:"tag",label:"タグアイコン"},{value:"clip",label:"クリップアイコン"},{value:"none",label:"なし"}],selectOptionsEn:[{value:"star",label:"Star icon (���)"},{value:"heart",label:"Heart icon (♡)"},{value:"tag",label:"Tag icon"},{value:"clip",label:"Clip icon"},{value:"none",label:"None"}],default:"star"},{type:"text",slug:"button_text",nameJa:"ボタンのテキスト",nameEn:"buttonText",defaultJa:"お気に入り",defaultEn:"Favorite"},{type:"text",slug:"button_text_remove",nameJa:"ボタンのテキスト(お気に入り解除)",nameEn:"buttonTextRemove",defaultJa:"お気に入り済み",defaultEn:"Favorited"},{type:"checkbox",slug:"has_background",nameJa:"背景があるボタンにする",nameEn:"hasBackground",default:!1},{type:"range",slug:"button_width",nameJa:"ボタンの幅",nameEn:"buttonWidth",default:200,min:50,max:600,step:10,depends:"has_background"},{type:"range",slug:"button_height",nameJa:"ボタンの高さ",nameEn:"buttonHeight",default:50,min:30,max:100,step:10,depends:"has_background"},{type:"colorpicker",slug:"button_color",nameJa:"ボタンの文字色",nameEn:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"icon_color",nameJa:"アイコンの文字色",nameEn:"iconColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"ボタンの背景色",nameEn:"buttonBackgroundColor",default:"#ffffff",depends:"has_background"},{type:"colorpicker",slug:"button_border_color",nameJa:"ボタンの線の色",nameEn:"buttonBorderColor",default:"#000000",depends:"has_background"},{type:"colorpicker",slug:"button_hover_color",nameJa:"ボタンの文字色(ホバー時)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"icon_hover_color",nameJa:"アイコンの文字色(ホバー時)",nameEn:"iconHoverColor",default:"#000000"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"ボタンの背景色(ホバー時)",nameEn:"buttonHoverBackgroundColor",default:"#dddddd",depends:"has_background"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"ボタンの線の色(ホバー時)",nameEn:"buttonHoverBorderColor",default:"#222222",depends:"has_background"},{type:"range",slug:"button_radius",nameJa:"ボタンの丸み",nameEn:"buttonRadius",default:5,min:0,max:20,step:1,depends:"has_background"},{type:"range",slug:"button_border_width",nameJa:"ボタンの線の太さ",nameEn:"buttonBorderWidth",default:0,min:0,max:10,step:1,depends:"has_background"},{type:"fontpicker",slug:"button_font",nameJa:"ボタンのフォント",nameEn:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"ボタンのフォントサイズ",nameEn:"buttonFontSize",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"ボタンのフォントウェイト",nameEn:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"icon_size",nameJa:"アイコンのサイズ",nameEn:"iconSize",default:16,min:10,max:30,step:1},{type:"range",slug:"icon_margin",nameJa:"アイコンとテキストとの間隔",nameEn:"iconMargin",default:5,min:0,max:20,step:1},{type:"range",slug:"button_speed",nameJa:"ボタンのアニメーション速度",nameEn:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"select",slug:"align",nameJa:"ボタンの配置",nameEn:"align",default:"center",selectOptionsJa:[{value:"left",label:"左寄せ"},{value:"center",label:"中央寄せ"},{value:"right",label:"右寄せ"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]},{type:"colorpicker",slug:"popup_text_color",nameJa:"POPUPのテキスト色",nameEn:"popupTextColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_background_color",nameJa:"POPUPの背景色",nameEn:"popupBackgroundColor",default:"#ffffff",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_icon_color",nameJa:"POPUPのアイコン色",nameEn:"popupIconColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_icon_hover_color",nameJa:"POPUPのアイコン色(ホバー時)",nameEn:"popupIconHoverColor",default:"#000000",checkVisible:e=>"variant"===e.favoriteMode},{type:"range",slug:"popup_border_width",nameJa:"POPUPの線の太さ",nameEn:"popupBorderWidth",default:0,min:0,max:10,step:1,checkVisible:e=>"variant"===e.favoriteMode},{type:"colorpicker",slug:"popup_border_color",nameJa:"POPUPの線の色",nameEn:"popupBorderColor",default:"#999",checkVisible:e=>"variant"===e.favoriteMode}]}},158:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;const i=n(215),r=n(264),s={list_title:"お気に入り一覧",loading_text:"読込中です...",non_item_text:"現在お気に入り中の商品はありません",show_cart:!1,insert_cart_directly:!0};class a{static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}constructor(e){this.config=s,this.mode="product",this.inited=!1,this.parent=e}init(){return o(this,void 0,void 0,(function*(){this.inited||(this.inited=!0,yield this.loadConfig())}))}loadConfig(){return o(this,void 0,void 0,(function*(){this.config=Object.assign(Object.assign({},s),this.parent.config.favoriteList||{}),this.applyConfig(),this.mode=this.parent.favoriteMode}))}applyConfig(){const e=document.getElementById("list_title"),t=document.getElementById("loading_text"),n=document.getElementById("non_item_text");e&&(e.textContent=this.config.list_title),t&&(t.textContent=this.config.loading_text),n&&(n.textContent=this.config.non_item_text)}render(){return o(this,void 0,void 0,(function*(){var e;const t=JSON.parse(localStorage.getItem("storecrm_wishlist")||"{}");if("product"===this.mode?t.products.join(","):t.variants.join(","),!(null==t?void 0:t.products)||0===t.products.length){null===(e=document.querySelector(".storecrm_favoritelist table"))||void 0===e||e.remove();const t=document.querySelector(".storecrm_favoritelist_loading"),n=document.querySelector(".storecrm_favoritelist_non_item");return t&&(t.style.display="none"),void(n&&(n.style.display="block"))}const n=document.querySelector(".storecrm_favoritelist_loading");n&&(n.style.display="none");const o="product"===this.mode?t.products.join(","):t.variants.join(",");yield this.loadProductAndRender(o)}))}loadProductAndRender(e){return o(this,void 0,void 0,(function*(){const t=yield fetch(`/apps/${this.parent.config.appProxyName}/favorites/products?mode=${this.mode}&ids=${e}`),n=yield t.json();this.renderProducts(n)}))}renderProducts(e){const t=document.querySelector(".storecrm_favoritelist tbody"),n=document.querySelector(".storecrm_favoritelist_loading"),o=document.querySelector(".storecrm_favoritelist table");if(!(t&&n&&o&&t instanceof HTMLElement&&n instanceof HTMLElement&&o instanceof HTMLElement))return void console.log("StoreCRM: Elements not found",t,n,o);const i="variant"===this.mode?e.variants:e.products;for(;t.firstChild;)t.removeChild(t.firstChild);i.forEach((e=>t.appendChild(this.createFavoriteRow(t,e)))),n.style.display="none",o.style.display="table"}createFavoriteRow(e,t){const n=document.createElement("tr");n.classList.add(`storecrm_favoritelist_id-${t.variant_id||t.product_id}`);const o="product"===this.mode?`/products/${t.handle}`:`/products/${t.handle}?variant=${t.variant_id}`,s=document.createElement("td");s.classList.add("storecrm_favoritelist_lefttd");const a=document.createElement("a");if(a.href=o,a.textContent=t.title,t.thumbnail_url){const e=document.createElement("img");e.classList.add("storecrm_favoritelist_img"),e.src=t.thumbnail_url,s.appendChild(e)}s.appendChild(a);const c=document.createElement("td");c.classList.add("storecrm_favoritelist_righttd");const l=document.createElement("div");if(l.classList.add("storecrm_favoritelist_links"),this.config.show_cart&&t.available){const e=document.createElement("a");e.classList.add("storecrm_favoritelist_link"),e.href="javascript:void(0);",e.innerHTML=r.iconCart,e.onclick=()=>(0,i.cartFavorite)(this.mode,"product"==this.mode?t.product_id:t.variant_id||"",t.handle,this.config.insert_cart_directly),l.appendChild(e)}const d=document.createElement("a");return d.classList.add("storecrm_favoritelist_link"),d.href="javascript:void(0);",d.innerHTML=r.iconDelete,"product"==this.mode||(d.dataset.variantId=t.variant_id),d.dataset.productId=t.product_id,d.onclick=()=>this.parent.toggleWishlist(d,!0,this.parent.config.favorite.is_only_member,this.parent.config.favorite.non_member_link),l.appendChild(d),c.appendChild(l),n.appendChild(s),n.appendChild(c),n}}t.Renderer=a,a.instance=void 0},264:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.iconCart=t.iconDelete=void 0,t.iconDelete='',t.iconCart=''},215:function(e,t){var n=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};function o(e){return n(this,void 0,void 0,(function*(){try{const t=yield fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,quantity:1})});if(!t.ok)throw new Error(`Failed to add to cart: ${t.statusText}`);const n=yield t.json();console.log("StoreCRM: 商品がカートに追加されました:",n),window.location.href="/cart"}catch(e){console.error("StoreCRM: エラーが発生しました:",e),alert("カートに追加できませんでした。")}}))}Object.defineProperty(t,"__esModule",{value:!0}),t.addToCart=t.cartFavorite=void 0,t.cartFavorite=function(e,t,n,i){"product"!==e?i?o(t):window.location.href=`/products/${encodeURIComponent(n)}?variant=${t}`:window.location.href=`/products/${encodeURIComponent(n)}`},t.addToCart=o},700:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e){this.loginButtonImg="/buttons/images/line_login_btn.png",this.parent=e}static isLoginOrRegisterPage(){console.debug("StoreCRM: isLoginOrRegisterPage called");const e=window.location.pathname;console.debug(`Current path: ${e}`);const t=n.isLoginPath(e),o=n.isRegisterPath(e);if(console.debug(`isLoginPath: ${t}, isRegisterPath: ${o}`),t||o)return console.debug("Page matches login/register path pattern"),!0;const i=n.isLoginPage(),r=n.isRegisterPage();return console.debug(`isLoginForm: ${i}, isRegisterForm: ${r}`),i||r?(console.debug("Page contains login/register form"),!0):(console.debug("Page is not a login or register page"),!1)}static isLineLoginEnabled(){return window.storecrm_config.line&&window.storecrm_config.line.line_login_enable?!(window.storecrm_config.line.line_login_onlypreview&&!(window.Shopify&&window.Shopify.designMode||document.querySelector("#OnlineStorePreviewBarNextData"))&&(console.info("StoreCRM: line_login_onlypreview is set, but not in Shopify designMode. LINE login will not be initialized."),1)):(console.info("StoreCRM: line_login_enable is not set or false. LINE login will not be initialized."),!1)}init(){if(console.debug("StoreCRM: LineLogin.init called"),n.isLineLoginEnabled())try{const e=document.querySelectorAll(`.${n.CUSTOM_CONTAINER_CLASS}`);if(console.debug(`StoreCRM: Found ${e.length} custom containers`),e.length>0)return console.debug("StoreCRM: Adding LINE login buttons to custom containers"),void e.forEach((e=>{const t=this.createLineButton(!0);e.appendChild(t),console.debug("StoreCRM: LINE login button added to custom container")}));console.debug("StoreCRM: No custom containers found, falling back to auto-detection"),n.isLoginPage()&&(console.debug("Adding LINE login button to login page"),this.addLoginButton()),n.isRegisterPage()&&(console.debug("Adding LINE login button to register page"),this.addRegisterButton()),this.clearSessionStorage()}catch(e){console.error("Error in init:",e)}else console.debug("StoreCRM: LINE login is not enabled. LINE login will not be initialized.")}clearSessionStorage(){location.pathname.includes("/register")||(sessionStorage.removeItem("line_email"),sessionStorage.removeItem("line_lineId"))}static isLoginPage(){console.debug("Checking if current page is a login page");try{const e=document.querySelector('form[action*="login"], form[action*="sign_in"]');return console.debug(`Login form found: ${!!e}`),!!e}catch(e){return console.error("Error in isLoginPage:",e),!1}}static isRegisterPage(){console.debug("Checking if current page is a register page");try{const e=document.querySelector('form[action^="/account"]');return console.debug(`Register form found: ${!!e}`),!!e}catch(e){return console.error("Error in isRegisterPage:",e),!1}}addLoginButton(){var e;const t=document.querySelector('form[action*="/account/login"]');if(console.debug("StoreCRM: Login form found:",!!t),!t)return void console.debug("StoreCRM: All forms on page:",document.querySelectorAll("form"));let n=t.querySelector('button[type="submit"]');if(n||(n=t.querySelector("button"),console.debug("StoreCRM: Using generic button instead:",!!n)),console.debug("StoreCRM: Submit button found:",!!n),!n){console.debug("StoreCRM: All buttons in form:",t.querySelectorAll("button")),console.debug("StoreCRM: No button found, appending to form");const e=document.createElement("div");e.className="line-login-container",e.style.marginTop="20px",e.style.textAlign="center";const n=this.createLineButton(!0);return e.appendChild(n),t.appendChild(e),void console.debug("StoreCRM: LINE login button appended to form")}const o=document.createElement("div");o.className="line-login-container",o.style.marginTop="20px",o.style.textAlign="center";const i=this.createLineButton(!0);o.appendChild(i),console.debug("StoreCRM: Inserting LINE login button after submit button"),null===(e=n.parentNode)||void 0===e||e.insertBefore(o,n.nextSibling),console.debug("StoreCRM: LINE login button inserted")}addRegisterButton(){var e;const t=document.querySelector('form[action^="/account"]');if(console.debug("StoreCRM: Register shopify form found:",!!t),!t)return;const n=new URLSearchParams(window.location.search);let o=n.get("email"),i=n.get("line_id");if(o?sessionStorage.setItem("line_email",o):o=sessionStorage.getItem("line_email"),i?sessionStorage.setItem("line_lineId",i):i=sessionStorage.getItem("line_lineId"),o&&o.includes("@")){const e=t.querySelector('input[name="customer[email]"]');e&&(e.value=o)}if(i){let e=t.querySelector('input[name="customer[note][lineId]"]');e||(e=document.createElement("input"),e.type="hidden",e.name="customer[note][lineId]",t.appendChild(e)),e.value=i}if(i||o)try{const e=t,n=new URL(e.action,window.location.origin);i?n.searchParams.set("line_id",i):n.searchParams.delete("line_id"),o?n.searchParams.set("email",o):n.searchParams.delete("email"),e.action=n.pathname+(n.search?n.search:"")}catch(e){console.error("Failed to update form action with line_id/email:",e)}if(i){const e=document.createElement("div");return e.textContent="LINEログインを行いました。連携を行って会員登録を行うには、以下のフォームよりご登録ください",e.style.color="#d32f2f",e.style.fontWeight="bold",e.style.fontSize="13px",e.style.marginBottom="20px",e.style.textAlign="center",void t.insertBefore(e,t.firstChild)}let r=t.querySelector('button[type="submit"]');if(r||(r=t.querySelector("button"),console.debug("StoreCRM: Using generic button instead:",!!r)),console.debug("StoreCRM: Submit button found:",!!r),!r){console.debug("StoreCRM: No button found, appending to form");const e=document.createElement("div");e.className="line-login-container",e.style.marginTop="20px",e.style.textAlign="center";const n=this.createLineButton(!1);return e.appendChild(n),t.appendChild(e),void console.debug("StoreCRM: LINE register button appended to form")}const s=document.createElement("div");s.className="line-login-container",s.style.marginTop="20px",s.style.textAlign="center";const a=this.createLineButton(!1);s.appendChild(a),console.debug("StoreCRM: Inserting LINE register button after submit button"),null===(e=r.parentNode)||void 0===e||e.insertBefore(s,r.nextSibling),console.debug("StoreCRM: LINE register button inserted")}createLineButton(e=!0){if(console.debug("StoreCRM: Creating LINE button"),!document.getElementById("btn-line-login-style")){const e=document.createElement("style");e.id="btn-line-login-style",e.innerHTML=".btn-line-login::after { box-shadow: none !important; }",document.head.appendChild(e)}const t=document.createElement("button");t.type="button",t.className="btn-line-login",t.style.backgroundColor="#06C755",t.style.color="#FFFFFF",t.style.border="none",t.style.borderRadius="4px",t.style.padding="0 6px",t.style.cursor="pointer",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="auto",t.style.height="48px",t.style.marginBottom="10px",t.style.textAlign="center",t.style.fontWeight="bold",t.style.fontSize="16px",t.style.letterSpacing="0.03em",t.style.boxShadow="0 2px 4px 0 rgba(0,0,0,0.04)",t.style.transition="background 0.2s",t.style.position="relative",t.style.overflow="hidden",t.style.boxSizing="border-box",t.style.marginTop="12px",t.style.marginBottom="12px",t.style.paddingTop="0",t.style.paddingBottom="0",t.onmouseover=()=>{t.style.backgroundColor="#06C755",t.style.filter="brightness(0.95)"},t.onmouseout=()=>{t.style.backgroundColor="#06C755",t.style.filter="none"},t.onmousedown=()=>{t.style.backgroundColor="#06C755",t.style.filter="brightness(0.85)"},t.onmouseup=()=>{t.style.backgroundColor="#06C755",t.style.filter="brightness(0.95)"};const o=document.createElement("span");o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.marginRight="12px",o.style.width="32px",o.style.height="32px",o.style.flexShrink="0",o.style.background="none";const i=document.createElement("img");i.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAACpUlEQVRYhe2XTYhNURzAf8cMZSQSRT4LSRaGfISNlLJ8WUiUUMrKRoqFlUyyQNnY2tnaaEI2vmZKeoo0YUE+UhYTEoN+FveOnjvn3ufNu++N9H6re+85//P/nf875577oEOHDh3+K0IzwWo3sAXYDqwDlgMLgClplxHgNfAMeADcBO6EEH40k3c8ovPUs+p7G+d9GjuvHaLT1DPqt3GIZhlJx5rWKtledagE0SxDam/ZstvUTy2QHeWTuq0s2c3qlxbKjvJF3VzPp/Atoc4GqsD8UmZfnzdAbwjhQ16HSXUG6KN9sqS5+oo65FZYXQy8ALpKlqrHT2BpCOFlrLG7IHAfY2WHgGFgY+b5C+AtsAl4BbwjOVBGeUJyiKwC7mdie4D1Nfddae5TBW5jUe9GNsbWtC1LJX1eVfen1xdq2teoS9RqJM/MyHh387yKKryqoRmO5RiwgaTqZiQrQCW9jR0cubmLNt2MBgWzTAV2AbEd/5VkaQ0DHxvJXVThZrkM7AT2kGyk34QQ+oF+SJYEcPBvBy2qcHSXNkAFOBpCuAE8rm1QD6frvQoMRGJf5Q1aVOFBYHFO24Ga66LqnFEHQwi39Y9lPECyLABmAuczcfcKxoyj7o7s3h2RfpfSvkF9qh5Su2ti3qpz1eXq40j8nEienXleRQfHFOA5sLDh2TbHc2Bl3kd+7hoOIYwAx1tlVcCRpv6RqFciP1mruNj0dNUe46de2VxXJzctnEpPV6+1UPaW2lOKbI30JPWE+rVk2auly2bEl5ms658lyJ5T2/P5qi5ST6qPxiH6Wd3dFtEc+VnqdvW4+qyO7EN1xYTJZlHX5Yh+V0+bHEj/DuraiOwDdfVEu0VR99aIDqtHbdfGGg8mn46fTd4Asyfap0OHDh3+cX4BcUOZ2CqT2BUAAAAASUVORK5CYII=",i.width=32,i.height=32,i.alt="LINE",i.style.display="block",i.style.width="32px",i.style.height="32px",o.appendChild(i);const r=document.createElement("span");r.textContent=e?n.BUTTON_TEXT:n.REGISTER_BUTTON_TEXT,r.style.display="inline-block",r.style.whiteSpace="nowrap",r.style.fontWeight="bold",r.style.fontSize="16px",r.style.lineHeight="1",r.style.letterSpacing="0.03em",r.style.userSelect="none",r.style.padding="0 32px",t.appendChild(o),t.appendChild(r);const s=document.createElement("div");s.className="line-login-container",s.style.display="flex",s.style.justifyContent="center",s.style.alignItems="center",s.style.width="100%",s.style.marginTop="20px",s.style.marginBottom="10px",s.appendChild(t),t.onclick=()=>{console.debug("LINE login button clicked"),this.parent.doLineLogin()},console.debug("LINE login button created successfully");const a=new URLSearchParams(window.location.search).get("line_login_error"),c=document.createElement("div");if(c.style.display="flex",c.style.flexDirection="column",c.style.alignItems="center",c.style.width="100%",c.appendChild(s),a){const e=document.createElement("div");e.textContent=a,e.style.color="#d32f2f",e.style.fontWeight="bold",e.style.fontSize="13px",e.style.marginTop="0px",e.style.marginBottom="15px",e.style.textAlign="center",c.appendChild(e)}return c}static isLoginPath(e){return console.debug(`Checking if ${e} is a login path`),"/account/login"===e||/\blogin\b/i.test(e)}static isRegisterPath(e){return console.debug(`Checking if ${e} is a register path`),"/account/register"===e||/\bregister\b/i.test(e)||/\bsignup\b/i.test(e)}}n.BUTTON_CLASS="line-login-button",n.CUSTOM_CONTAINER_CLASS="line-login-custom-container",n.instance=null,n.BUTTON_TEXT="LINEでログイン",n.REGISTER_BUTTON_TEXT="LINEで登録",t.default=n},435:function(e,t,n){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.schema=t.RestockPopupManager=void 0;const i=o(n(804));class r{constructor(e,t=!1){this.content=null,this.title=null,this.secondTitle=null,this.popup=null,this.button=null,this.footer=null,this.secondFooter=null,this.preview=!1,this.showSecondPopup=!1,this.container=null,this.secondContainer=null,this.secondContent=null,this.close=null,this.product_id=null,this.inited=!1,this.preview=t,this.config=e,this.init()}static getInstance(e,t=!1){return r.instance||(r.instance=new r(e,t)),r.instance}setParent(e){this.parent=e}renderTemplate(){document&&document.body?document.body.insertAdjacentHTML("beforeend",r.template):window.setTimeout(this.renderTemplate.bind(this),100)}init(){document&&document.body?this.runInit():window.setTimeout(this.init.bind(this),100)}runInit(){this.inited=!0,this.preview||document.body.insertAdjacentHTML("beforeend",r.template),i.default.init(),this.popup=document.getElementById("storecrm-modal"),this.content=document.getElementById("storecrm-modal-content"),this.secondContent=document.getElementById("storecrm-modal-second-content"),this.title=document.getElementById("storecrm-modal-title"),this.secondTitle=document.getElementById("storecrm-modal-second-title"),this.footer=document.querySelector(".storecrm_modal__footer"),this.secondFooter=document.getElementById("storecrm-modal-second-footer"),this.container=document.querySelector(".storecrm_modal__container"),this.secondContainer=document.getElementById("storecrm-modal-second-popup-preview"),this.container&&this.container.addEventListener("click",(e=>{e.stopPropagation()})),this.close=document.querySelector(".storecrm_modal__close"),this.close&&!this.preview&&this.close.addEventListener("click",(e=>{i.default.close("storecrm-modal")}))}render(e,t){var n,o,i,r;this.showSecondPopup=e.add_accepts_marketing_checkbox&&this.preview;const s=document.createElement("button");s.className="storecrm_modal__btn storecrm_modal__btn-primary",s.innerHTML=e.button_text,this.footer&&0!==this.footer.children.length&&(this.footer.innerHTML=""),null===(n=this.footer)||void 0===n||n.appendChild(s),this.button=s,this.button&&!this.preview&&this.button.addEventListener("click",(()=>{this.checkAcceptsMarketingStatusAndClearMessages()})),this.config=e;const a=(null===(o=window.storecrm_data)||void 0===o?void 0:o.customer_email)||window.localStorage.getItem("storecrm_restock_email")||"";if(this.title&&this.content&&this.popup){this.title.innerText=e.popup_title;let n=`\n
${e.popup_description}
\n
\n
${e.emailaddress}
\n${e.add_accepts_marketing_checkbox?``:""}\n${e.add_accepts_marketing_checkbox?``:""}\n
\n`.trim(),o=null;if(location.search&&location.search.includes("variant")){const e=new URL(location.href);o=e.searchParams.get("variant")}console.log("RestockPopupManager: render: variants",t,o);const i=t.filter((e=>!e.available)).map((e=>``)).join("");t&&Array.isArray(t)&&t.length>1?(n=n.replace("\x3c!-- select_style --\x3e",""),n=n.replace("\x3c!-- options --\x3e",i)):(n=n.replace("\x3c!-- select_style --\x3e","display:none"),n=n.replace("\x3c!-- options --\x3e",i)),this.content.innerHTML=n,this.content.style.color=e.text_color,this.container&&(this.container.style.backgroundColor=e.background_color,this.container.style.borderRadius=`${e.button_radius}px`,this.container.style.width="100%"),this.button&&(this.button.style.backgroundColor=e.button_background_color,this.button.style.color=e.button_text_color),this.close&&(this.close.style.color=e.close_text_color)}if(this.resetMessage(),this.showSecondPopup&&this.secondTitle&&this.secondContent&&this.secondContainer){this.secondContainer.style.display="block",this.secondTitle.innerText=e.popup_title;let t="";t=`\n
${e.email_confirmation_text}
hogehoge@hoge.com
\n
`,this.secondContent.innerHTML=t,this.secondContent.style.color=e.text_color,this.secondContainer.style.backgroundColor=e.background_color,this.secondContainer.style.borderRadius=`${e.button_radius}px`,this.secondContainer.style.marginTop="20px",this.secondContainer.style.width="100%",this.secondFooter&&0!==this.secondFooter.children.length&&(this.secondFooter.innerHTML="");const n=document.createElement("button");n.className="storecrm_modal__btn storecrm_modal__btn-primary",n.innerHTML=e.button_text,n.style.backgroundColor=e.button_background_color,n.style.color=e.button_text_color,null===(i=this.secondFooter)||void 0===i||i.appendChild(n)}else this.secondContainer&&(this.secondContainer.style.display="none");this.preview||null===(r=document.getElementById("storecrm-modal-second-popup-preview"))||void 0===r||r.remove(),this.preview&&(this.success(this.config.success_text),this.failure(this.config.error_text),this.popup&&this.popup.querySelectorAll(".storecrm_modal__overlay,.storecrm_modal__close").forEach((e=>{e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation()}))})))}resetMessage(){var e,t;this.footer&&(null===(e=this.footer)||void 0===e||e.querySelectorAll(".storecrm_modal_message").forEach((e=>e.remove()))),this.preview&&this.secondFooter&&(null===(t=this.secondFooter)||void 0===t||t.querySelectorAll(".storecrm_modal_message").forEach((e=>e.remove())))}disableButton(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.innerText="Sending...")}enableButtion(){this.button&&(this.button.removeAttribute("disabled"),this.button.innerText=this.config.button_text||"Enable Restock Notification")}submit(e=!1){var t,n,o;if(this.preview)return;this.resetMessage(),this.disableButton();const i=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_email"),r=null===(n=this.content)||void 0===n?void 0:n.querySelector("#storecrm_restock_variant"),s=null===(o=this.content)||void 0===o?void 0:o.querySelector("#storecrm_restock_accepts_marketing"),a=i?i.value:"",c=r?r.value:"",l=this.product_id,d=s?s.checked:null;this.parent&&this.parent.storeRestock(a,c,l,d,this.config.add_accepts_marketing_checkbox,e,this.success.bind(this),this.failure.bind(this))}show(e,t,n){this.product_id=n,this.inited?this.runShow(e,t):window.setTimeout(this.show.bind(this),100)}runShow(e,t){this.render(e,t),i.default.show("storecrm-modal")}hide(){i.default.close("storecrm-modal")}success(e){this.enableButtion();const t=document.createElement("div");t.classList.add("storecrm_modal_success","storecrm_modal_message"),t.style.color=this.config.success_text_color,t.style.backgroundColor=this.config.success_background_color,t.innerText=e,this.showSecondPopup?this.secondFooter&&this.secondFooter.appendChild(t):this.footer&&this.footer.appendChild(t)}failure(e){this.enableButtion();const t=document.createElement("div");t.classList.add("storecrm_modal_error","storecrm_modal_message"),t.style.color=this.config.failure_text_color,t.style.backgroundColor=this.config.failure_background_color,t.innerText=e,this.showSecondPopup?this.secondFooter&&this.secondFooter.appendChild(t):this.footer&&this.footer.appendChild(t)}checkAcceptsMarketingStatusAndClearMessages(){var e;if(this.resetMessage(),!this.config.add_accepts_marketing_checkbox)return void this.submit(!1);const t=null===(e=this.content)||void 0===e?void 0:e.querySelector("#storecrm_restock_email");this.parent.doMailCheck(t.value,this.failure.bind(this)).then((e=>{e.email?e.accepts_marketing?this.submit(!1):this.showAcceptsMarketingCheckbox(!1):this.showAcceptsMarketingCheckbox(!0)}))}showAcceptsMarketingCheckbox(e){var t;const n=document.getElementById("storecrm-modal-content"),o=null===(t=this.content)||void 0===t?void 0:t.querySelector("#storecrm_restock_email"),i=document.getElementById("accepts_marketing_checkbox_container"),r=document.getElementById("email_confirmation_container");if(!n||!i||!r)return;r.innerHTML=this.config.email_confirmation_text+"
"+o.value;const s=Array.from(n.children);s.forEach((e=>{"none"!==e.style.display&&e.classList.add("fade-out")})),setTimeout((()=>{s.forEach((e=>{e.style.display="none"}))}),300),i.classList.add("fade-in"),setTimeout((()=>{i.style.display="block"}),300),r.classList.add("fade-in"),setTimeout((()=>{r.style.display="block"}),300),this.switchSubmitButton(e)}switchSubmitButton(e){var t;this.footer&&(this.footer.innerHTML="");const n=document.createElement("button");n.className="storecrm_modal__btn storecrm_modal__btn-primary",n.style.color=this.config.button_text_color,n.style.backgroundColor=this.config.button_background_color,n.innerHTML=this.config.button_text,this.footer&&this.footer.appendChild(n),this.button=n,null===(t=this.button)||void 0===t||t.addEventListener("click",(()=>{this.submit(e)}))}}t.RestockPopupManager=r,r.template='';let s=null;t.schema={preview:(e,t)=>{var n;return n=()=>{r.getInstance(e,!0).show(e,[],"1234567890")},300,clearTimeout(s),s=setTimeout(n,300),r.template},rows:[{type:"text",slug:"popup_title",nameJa:"ポップアップのタイトル",nameEn:"Popup title",defaultJa:"再入荷通知",defaultEn:"Restock Notification"},{type:"text",slug:"popup_description",nameJa:"POPUPの本文",nameEn:"Popup description",defaultJa:"再入荷通知をご希望の方は以下から、ご選択ください。",defaultEn:"If you would like to receive a restock notification, please select from below."},{type:"text",slug:"emailaddress",nameJa:"メールアドレスフォーム名",nameEn:"Email address form name",defaultJa:"ご連絡メールアドレス",defaultEn:"Contact Email Address"},{type:"colorpicker",slug:"background_color",nameJa:"ポップアップの背景色",nameEn:"Popup background color",default:"#ffffff"},{type:"colorpicker",slug:"text_color",nameJa:"ポップアップのテキスト色",nameEn:"Popup text color",default:"#000000"},{type:"colorpicker",slug:"close_text_color",nameJa:"閉じるボタンの色",nameEn:"Popup close button text color",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"ボタンの背景色",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_text_color",nameJa:"ボタンのテキストカラー",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"text",slug:"button_text",nameJa:"ボタンのテキスト",nameEn:"buttonText",defaultJa:"再入荷通知を有効にする",defaultEn:"Enable restock notification"},{type:"text",slug:"success_text",nameJa:"成功時のテキスト",nameEn:"Success text",defaultJa:"再入荷通知が登録されました。",defaultEn:"Restock notification has been registered."},{type:"colorpicker",slug:"success_background_color",nameJa:"成功時の背景色",nameEn:"Success background color",default:"#F0FDF4"},{type:"colorpicker",slug:"success_text_color",nameJa:"成功時の文字色",nameEn:"Success text color",default:"#166534"},{type:"text",slug:"error_text",nameJa:"失敗時のテキスト",nameEn:"Error text",defaultJa:"再入荷通知の登録に失敗しました。しばらくたってから再度お試しください。",defaultEn:"Failed to register restock notification. Please try again later."},{type:"text",slug:"error_text_email",nameJa:"失敗時のテキスト(メールアドレスの判定)",nameEn:"Error text",defaultJa:"メールアドレスが正しくありません。確認の上、再度ご記入ください。",defaultEn:"The email address is incorrect. Please check and re-enter."},{type:"colorpicker",slug:"failure_background_color",nameJa:"エラー時の背景色",nameEn:"Success background color",default:"#FEF2F2"},{type:"colorpicker",slug:"failure_text_color",nameJa:"エラー時の文字色",nameEn:"Success text color",default:"#991B1B"},{type:"range",slug:"button_radius",nameJa:"ポップアップの丸み",nameEn:"buttonRadius",default:10,min:0,max:40,step:1},{type:"checkbox",slug:"add_accepts_marketing_checkbox",nameJa:"メルマガ配信チェックボックスを有効化",nameEn:"Add accepts marketing checkbox",default:!1},{type:"text",slug:"accepts_marketing_checkbox_text",nameJa:"メルマガ配信チェックボックスのテキスト",nameEn:"Accepts marketing checkbox text",defaultJa:"メルマガ配信に同意する",defaultEn:"I agree to receive marketing emails"},{type:"text",slug:"email_confirmation_text",nameJa:"メールアドレス確認テキスト",nameEn:"Email confirmation text",defaultJa:"こちらのメールアドレスで間違いないですか?",defaultEn:"Is this the correct email address?"}]}},898:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.schema=t.render=t.RestockButton=void 0;class n{constructor(e,t,n,o,i){this.eventTriggered=!1,this.variants=n,this.buttonSettings=o,this.productId=t,this.product=i}static getInstance(e,t=null,o=null,i=null,r=null){if(!n.instances[e]){if(!(t&&o&&i&&r))throw console.log("StoreCRM Restock: productId, variants, buttonSettings, product are required",e,t,o,i,r),new Error("StoreCRM Restock: productId, variants, buttonSettings, product are required");n.instances[e]=new n(e,t,o,i,r)}return n.instances[e]}createScript(e,t){const n=e?"":"onclick=\"event.preventDefault();window.storecrm ? window.storecrm.showRestock(this) : alert('読込中です。しばらくたってから再度お試しください。');\"";return`\n\n\n
\n\n
\n `}checkRender(e){document.querySelectorAll(`.storecrm-restock-${e}`).forEach((e=>{var t;if(e instanceof HTMLElement&&e.closest('[data-type="restock-button"]')){const n=new URL(location.href),o=(null===(t=this.variants.find((e=>e.available)))||void 0===t?void 0:t.id)||this.variants[0].id||null,i=parseInt(n.searchParams.get("variant")||o,10);if(!i)return void console.error("StoreCRM Restock: variantId is not set",i);if(!this.product||!this.product.tags||this.product.tags.indexOf("storecrm-restock-hidden")>=0)return console.log("StoreCRM: Restock:product not found or hidden"),void(e.style.display="none");const r=window.Shopify&&window.Shopify.designMode||this.variants.find((e=>!e.available&&e.id===i));e.style.display=r?"inline-block":"none"}}))}render(e,t=!1){if(t)return this.createScript(!0,e);if(!this.eventTriggered){if(this.eventTriggered=!0,window.navigation)window.navigation.addEventListener("navigate",(()=>{window.setTimeout((()=>this.checkRender(e)),100)})),window.setTimeout((()=>this.checkRender(e)),100),window.setTimeout((()=>this.checkRender(e)),1e3);else{let t=location.href;window.setInterval((()=>{t!==location.href&&(t=location.href,this.checkRender(e))}),1e3),window.setTimeout((()=>this.checkRender(e)),100),window.setTimeout((()=>this.checkRender(e)),1e3)}return this.createScript(!1,e)}}}t.RestockButton=n,n.instances={},t.render=({productId:e,variantId:t,variants:o,id:i,buttonSettings:r,isOutOfStock:s,product:a,preview:c=!1})=>(console.log("StoreCRM Restock: render",i,e,o,r,a),n.getInstance(i,e,o,r,a).render(i,c)),t.schema={preview:(e,n)=>(0,t.render)({productId:"TEMP_productId",id:"TEMP_restock",buttonSettings:e,isOutOfStock:!1,preview:!0,product:{tags:[]},variants:[]}),rows:[{type:"text",slug:"button_text",nameJa:"ボタンのテキスト",nameEn:"buttonText",defaultJa:"再入荷通知をする",defaultEn:"Notify restock"},{type:"range",slug:"button_width",nameJa:"ボタンの幅",nameEn:"buttonWidth",default:200,min:50,max:600,step:10},{type:"range",slug:"button_height",nameJa:"ボタンの高さ",nameEn:"buttonHeight",default:50,min:30,max:100,step:5},{type:"colorpicker",slug:"button_color",nameJa:"ボタンの文字色",nameEn:"buttonColor",default:"#000000"},{type:"colorpicker",slug:"button_background_color",nameJa:"ボタンの背景色",nameEn:"buttonBackgroundColor",default:"#ffffff"},{type:"colorpicker",slug:"button_border_color",nameJa:"ボタンの線の色",nameEn:"buttonBorderColor",default:"#000000"},{type:"colorpicker",slug:"button_hover_color",nameJa:"ボタンの文字色(ホバー時)",nameEn:"buttonHoverColor",default:"#222222"},{type:"colorpicker",slug:"button_hover_background_color",nameJa:"ボタンの背景色(ホバー時)",nameEn:"buttonHoverBackgroundColor",default:"#dddddd"},{type:"colorpicker",slug:"button_hover_border_color",nameJa:"ボタンの線の色(ホバー時)",nameEn:"buttonHoverBorderColor",default:"#222222"},{type:"range",slug:"button_radius",nameJa:"ボタンの丸み",nameEn:"buttonRadius",default:0,min:0,max:20,step:1},{type:"range",slug:"button_border_width",nameJa:"ボタンの線の太さ",nameEn:"buttonBorderWidth",default:0,min:0,max:5,step:1},{type:"fontpicker",slug:"button_font",nameJa:"ボタンのフォント",nameEn:"buttonFont",default:"helvetica_n4"},{type:"range",slug:"button_fontsize",nameJa:"ボタンのフォントサイズ",nameEn:"buttonFontSize",default:16,min:10,max:30,step:1},{type:"range",slug:"button_fontweight",nameJa:"ボタンのフォントウェイト",nameEn:"buttonFontWeight",default:400,min:100,max:900,step:100},{type:"range",slug:"button_speed",nameJa:"ボタンのアニメーション速度",nameEn:"buttonSpeed",default:.3,min:0,max:1,step:.1},{type:"select",slug:"align",nameJa:"ボタンの配置",nameEn:"align",default:"center",defaultJa:"中央寄せ",defaultEn:"Center",selectOptionsJa:[{value:"left",label:"左寄せ"},{value:"center",label:"中央寄せ"},{value:"right",label:"右寄せ"}],selectOptionsEn:[{value:"left",label:"Align left"},{value:"center",label:"Align center"},{value:"right",label:"Align right"}]}]}},247:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatusWidget=void 0,t.StatusWidget=class{constructor(e,t,n){this.position="beforeend",this.header=e,this.config=n,this.position=t}setParent(e){this.parent=e}render(){this.parent&&this.parent.getStatus((e=>{this.renderedWidget&&(this.renderedWidget.remove(),this.renderedWidget=void 0),this.renderedWidget=this.createWidget(e),console.log("StoreCRM: StatusWidget rendered:",this.renderedWidget),this.header.insertAdjacentElement(this.position,this.renderedWidget)}),(e=>{console.error("StoreCRM: StatusWidget render failed",e)})),this.parent||console.error("StoreCRM render: no parent. Abort.")}isLineVisible(e){return e.line_show_account&&(!e.line_debug_account||document.querySelector("#OnlineStorePreviewBarNextData")||window.Shopify.designMode)}createWidget(e){var t,n,o,i;const r=document.createElement("div");function s(e){const t=document.createElement("span");return t.classList.add("storecrm-off"),t.appendChild(document.createTextNode(e)),t}function a(e){const t=document.createElement("span");return t.classList.add("storecrm-on"),t.appendChild(document.createTextNode(e)),t}function c(e){const t=document.createElement("button");return t.classList.add("storecrm-button","storecrm-button-off"),t.appendChild(document.createTextNode(e)),t}function l(e){const t=document.createElement("button");return t.classList.add("storecrm-button","storecrm-button-on"),t.appendChild(document.createTextNode(e)),t}if(r.classList.add("storecrm-status-widget"),this.isLineVisible(e)){const o=document.createElement("div");o.appendChild(document.createTextNode("LINE設定: ")),o.appendChild(e.line?a("設定済"):s("未登録")),this.lineButton=e.line?c("解除する"):l("登録する"),o.appendChild(this.lineButton),r.appendChild(o),e.line?null===(t=this.lineButton)||void 0===t||t.addEventListener("click",this.lineUnsubscribe.bind(this)):null===(n=this.lineButton)||void 0===n||n.addEventListener("click",this.lineSubscribe.bind(this))}if(e.mail_show_account){const t=document.createElement("div");t.appendChild(document.createTextNode("メールマガジン: ")),t.appendChild(e.accepts_marketing?a("購読中"):s("未購読")),this.mailButton=e.accepts_marketing?c("購読解除する"):l("購読する"),t.appendChild(this.mailButton),r.appendChild(t),e.accepts_marketing?null===(o=this.mailButton)||void 0===o||o.addEventListener("click",this.unsubscribe.bind(this)):null===(i=this.mailButton)||void 0===i||i.addEventListener("click",this.subscribe.bind(this))}return r}lineSubscribe(){console.log("StoreCRM: LINE購読処理をします"),this.parent&&this.parent.lineSubscribe((function(e){alert(e)}))}lineUnsubscribe(){console.log("StoreCRM: LINE購読解除処理をします"),this.parent&&this.parent.lineUnsubscribe((function(e){alert(e)}))}subscribe(){console.log("StoreCRM: メール購読処理をします"),this.parent&&this.parent.mailSubscribe((function(e){alert(e)}))}unsubscribe(){console.log("StoreCRM: メール購読解除処理をします"),this.parent&&this.parent.mailUnsubscribe((function(e){alert(e)}))}}},398:function(e,t,n){var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(989),s=n(898),a=n(435),c=n(247),l=n(158),d=i(n(700));n(511),t.default=class{constructor(e){this.statusWidget=void 0,this.isTokenRefreshed=!1,this.isTokenFetching=!1,this.favoriteMode="product",this.favoriteKey="products",window.storecrm_data=window.storecrm_data||{},console.log("StoreCRM initialized version 0.7.3",e),this.config=e,this.fillDefault(),this.popupManager=a.RestockPopupManager.getInstance(e.restockPopup),this.popupManager.setParent(this)}init(){(()=>{o(this,void 0,void 0,(function*(){try{yield this.checkCustomer(),window.localStorage.getItem("storecrm_wishlist")||(yield this.syncWishlist())}catch(e){console.error("StoreCRM: init: error",e)}yield this.render(),window.location.pathname.startsWith("/apps/")&&(yield this.renderFavoriteList())}))})(),window.addEventListener("pageshow",(e=>{e.persisted&&this.render(!0)})),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&this.render(!0)})),this.initLineLogin()}initLineLogin(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{this.executeLineLoginInit()})):this.executeLineLoginInit()}executeLineLoginInit(){d.default.isLoginOrRegisterPage()&&new d.default(this).init()}getCurrentShopifyCustomerId(){try{return window.storecrm_data.customer_id||window.ShopifyAnalytics.meta.page.customerId}catch(e){return null}}checkCustomer(){return o(this,void 0,void 0,(function*(){if(window.storecrm_data.is_customer_checked)return;window.storecrm_data.is_customer_checked=!0;const e=(window.localStorage.getItem("storecrm_customer_id")||"").toString(),t=(this.getCurrentShopifyCustomerId()||"").toString();if(e!==t){if(t)return!e||e.startsWith("TEMP_")&&t?(console.log("StoreCRM: checkCustomer: storageCustomerId is not found",e,t),yield this.refreshToken(!1),void(yield this.syncWishlist(null,e,!0))):e!==t?(console.log("StoreCRM: checkCustomer: storageCustomerId is not same",e,t),void(yield this.refreshToken(!0))):void 0;(null==e?void 0:e.startsWith("TEMP_"))||(console.log("StoreCRM: checkCustomer: customerId is not found",e,t),yield this.refreshToken(!0))}else console.log("StoreCRM: checkCustomer: customerId is same",e,t)}))}refreshToken(){return o(this,arguments,void 0,(function*(e=!1){return e&&(window.localStorage.removeItem("storecrm_customer_id"),window.localStorage.removeItem("storecrm_wishlist")),yield this.fetchToken()}))}fillDefault(){this.config.favorite=this.config.favorite||{},r.schema.rows.forEach((e=>{this.config.favorite[e.slug]=this.config.favorite[e.slug]||e.default||e.defaultEn})),this.favoriteMode=this.config.favorite.favoriteMode||"product",this.favoriteKey="product"===this.favoriteMode?"products":"variants",console.log("StoreCRM: Current favorite mode: ",this.favoriteMode),this.config.restock=this.config.restock||{},s.schema.rows.forEach((e=>{this.config.restock[e.slug]=this.config.restock[e.slug]||e.default||e.defaultEn})),this.config.restockPopup=this.config.restockPopup||{},a.schema.rows.forEach((e=>{this.config.restockPopup[e.slug]=this.config.restockPopup[e.slug]||e.default||e.defaultEn}))}render(e=!1){this.doRender(e),e||(window.setTimeout(this.doRender.bind(this),500),window.setTimeout(this.doRender.bind(this),2e3),window.setTimeout(this.doRender.bind(this),5e3))}doRender(e=!1){window.location.pathname.startsWith("/apps")&&window.location.pathname.endsWith("/connect")&&(this.checkConnect(),this.renderStatusWidget());const t=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");t[this.favoriteKey]||(t[this.favoriteKey]=[]),console.log("StoreCRM: Wishlist",t),document.querySelectorAll(".storecrm-button").forEach((e=>{if(e instanceof HTMLElement==0)return;const n=e.id||"storecrm-button-"+Math.random().toString(36).slice(-8);e.id||(e.id=n);const o=new URL(location.href),i=o.searchParams.get("variant")&&o.searchParams.get("variant"),a=e.dataset.productId,c=i||e.dataset.variantId,l=void 0!==e.dataset.variantSelector,d=JSON.parse(e.dataset.variants||"[]"),u={tags:JSON.parse(e.dataset.productTags||"[]"),id:e.dataset.productId};if(!u||!a||!c)return void console.error("StoreCRM: product or productId or variantId is not set",a,c);const h=t&&("product"==this.favoriteMode?t.products&&t.products.includes(a):t.variants&&t.variants.includes(c)),m=!!e.dataset.currentVariantAvailable,g="wishlist-button"===e.dataset.type?(0,r.render)({productId:a,variantId:c,id:n,button:e,variants:d,product:u,buttonSettings:this.config.favorite,isFavorited:h,hasVariantSelector:l}):(0,s.render)({productId:a,variantId:c,id:n,buttonSettings:this.config.restock,isOutOfStock:m,product:u,variants:d});g&&(e.innerHTML=g)})),document.querySelectorAll(".storecrm-favorite").forEach((n=>{if(n instanceof HTMLElement==0)return;if(!e&&"true"===n.dataset.isRendered)return;n.dataset.isRendered="true";const o=n.dataset.productId||"",i=n.dataset.variantId||"";if(!o)return;const s=void 0!==n.dataset.variantSelector,a=n.id||"storecrm-favorite-"+Math.random().toString(36).slice(-8);n.id||(n.id=a);const c=JSON.parse(n.dataset.variants||"[]"),l={tags:JSON.parse(n.dataset.productTags||"[]"),id:n.dataset.productId},d=t&&t.products&&t.products.includes(o);n.innerHTML=(0,r.render)({productId:o,variantId:i,button:n,id:a,buttonSettings:this.config.favorite,isFavorited:d,hasVariantSelector:s,variants:c,product:l})||""})),"/account"!==window.location.pathname&&"/account/"!==window.location.pathname||this.renderStatusWidget(),this.checkToken()}checkToken(){this.isTokenRefreshed||this.isTokenRefreshNeeded()&&this.fetchToken()}isTokenRefreshNeeded(){const e=window.localStorage.getItem("storecrm_customer_id"),t=parseInt(window.localStorage.getItem("storecrm_customer_id")||"0",10),n=window.localStorage.getItem("storecrm_token");let o=null;try{o=n?n.split("|")[1]:null}catch(e){}return this.isTokenRefreshed?(console.log("StoreCRM: Token refresh needed: false (already refreshed)"),!1):e&&n&&o?window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId&&window.ShopifyAnalytics.meta.page.customerId!==t?(console.log("StoreCRM: Token refresh needed: true (customerId mismatch)"),!0):window.ShopifyAnalytics&&window.ShopifyAnalytics.meta&&window.ShopifyAnalytics.meta.page&&window.ShopifyAnalytics.meta.page.customerId?1e3*parseFloat(o)<(new Date).getTime()&&(console.log("StoreCRM: Token refresh needed: true (expired)"),!0):(console.log("StoreCRM: Token refresh needed: true (no customerId)"),!0):(console.log("StoreCRM: Token refresh needed: true (no token)"),!0)}fetchToken(){return o(this,void 0,void 0,(function*(){if(this.isTokenFetching)return yield new Promise((e=>{const t=setInterval((()=>{this.isTokenFetching||(clearInterval(t),e(null))}),100)})),window.localStorage.getItem("storecrm_token");this.isTokenFetching=!0;const e=window.localStorage.getItem("storecrm_customer_id"),t=yield fetch(`/apps/${this.config.appProxyName}/token?current_customer_id=${e}`),n=(yield t.text()).match(/\[data\]([\s\S]*?)\[\/data\]/);if(!n)throw this.isTokenRefreshed=!0,new Error("No data from API");const o=JSON.parse(n[1]);if(!o||!o.customer)throw this.isTokenRefreshed=!0,new Error("No data from API2");return window.localStorage.setItem("storecrm_token",o.customer.token),window.localStorage.setItem("storecrm_customer_id",o.customer.id),this.isTokenRefreshed=!0,console.log("StoreCRM: fetchToken: customerId",e,o.customer.id),(null==e?void 0:e.startsWith("TEMP_"))&&o.customer.id!==e&&(yield this.syncWishlist(null,e)),this.isTokenFetching=!1,o.customer.token}))}getToken(){return o(this,void 0,void 0,(function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_token")}))}getCustomerId(){return o(this,void 0,void 0,(function*(){return this.isTokenFetching&&(yield this.fetchToken()),window.localStorage.getItem("storecrm_customer_id")}))}request(){return o(this,arguments,void 0,(function*(e="GET",t,n=null,o=!1){const i=yield this.getCustomerId(),r=yield this.getToken(),s=window.location.href;t.includes("?")?t+=`&customer_id=${i}&host=${window.location.host}&referrer=${encodeURIComponent(s)}`:t+=`?customer_id=${i}&host=${window.location.host}&referrer=${encodeURIComponent(s)}`;const a=yield fetch(t,{method:e,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:n?JSON.stringify(n):null,credentials:o?"include":"same-origin"});if(!a.ok)throw new Error("API request failed");return a.json()}))}toggleWishlist(e,t=!1,n=!1,o=""){n?this.fetchToken().then((()=>{var n=window.localStorage.getItem("storecrm_customer_id");n&&!/^TEMP_/.test(n)?this.doToggleWishlist(e,!t).then((()=>{console.log(t?"StoreCRM: Wishlist removed!":"StoreCRM: Wishlist added!")})).catch((e=>{console.error(e),alert("サーバエラーが発生しました! error: "+e.message+" しばらくたってから再度お試しください。")})):window.location.href=""===o?"/account/login":o})):this.doToggleWishlist(e,!t).then((()=>{console.log(t?"StoreCRM: Wishlist removed!":"StoreCRM: Wishlist added!")})).catch((e=>{console.error(e),alert("サーバエラーが発生しました! error: "+e.message+" しばらくたってから再度お試しください。")}))}syncWishlist(){return o(this,arguments,void 0,(function*(e=null,t=void 0,n=!1){if(!n){const e=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");if(e.lastUpdated&&Date.now()-e.lastUpdated<12e5)return e}let o=null;try{o=e||(yield this.getWishlist(t))}catch(e){return void console.error("StoreCRM: syncWishlist: error",e)}if(o&&this.favoriteKey in o)return window.localStorage.getItem("storecrm_wishlist"),"product"===this.favoriteMode?(window.localStorage.setItem("storecrm_wishlist",JSON.stringify({products:o.products,lastUpdated:Date.now()})),this.renderFavoriteList(),{products:o.products}):(window.localStorage.setItem("storecrm_wishlist",JSON.stringify({products:o.products,variants:o.variants,lastUpdated:Date.now()})),this.renderFavoriteList(),{products:o.products,variants:o.variants});console.error("StoreCRM: Invalid response from favorite fetch API",o)}))}renderFavoriteList(){return o(this,void 0,void 0,(function*(){const e=document.querySelector(".storecrm_favoritelist");if(!e||e instanceof HTMLElement==0)return;console.log("StoreCRM: Render Favroite List");const t=l.Renderer.getInstance(this);yield t.init(),yield t.render()}))}getWishlist(){return o(this,arguments,void 0,(function*(e=void 0){return e?this.request("GET",`${this.config.backendUrl}/frontend/favorite/?old_customer_id=${e}&mode=${this.favoriteMode}`):this.request("GET",`${this.config.backendUrl}/frontend/favorite/?mode=${this.favoriteMode}`)}))}doToggleWishlist(e){return o(this,arguments,void 0,(function*(e,t=!1){const n=e.dataset.productId;let o=e.dataset.variantId;const i=void 0!==e.dataset.variantSelector;if(!n)return void console.error("Product ID not found");const s=e.closest(".storecrm-favorite"),a=s&&JSON.parse(s.dataset.variants||"null");if("variant"==this.favoriteMode&&a&&1===a.length&&(o=a[0].id,(0,r.hideWidgetSelector)()),"variant"==this.favoriteMode&&!o){if(i){const t=JSON.parse(window.localStorage.getItem("storecrm_wishlist")||"{}");return void(0,r.renderWidgetSelector)({button:e,productId:n,variants:a,wishlist:t,buttonSettings:this.config.favorite})}return void console.error("Variant ID not found: you need to set data-variant-id (Specify variant id) or data-variant-selector(Show variant selector) attribute.")}let c={};c=t?yield this.request("POST",`${this.config.backendUrl}/frontend/favorite/`,{product_id:n,variant_id:o,mode:this.favoriteMode}):yield this.request("DELETE",`${this.config.backendUrl}/frontend/favorite/?product_id=${n}&variant_id=${o}&mode=${this.favoriteMode}`),console.log("StoreCRM response wishlist: ",c),c&&window.localStorage.setItem("storecrm_wishlist",JSON.stringify(Object.assign(Object.assign({},c),{lastUpdated:Date.now()}))),"variant"==this.favoriteMode&&i&&(0,r.renderWidgetSelector)({button:e,productId:n,variants:a,wishlist:c,buttonSettings:this.config.favorite,rerender:!0}),this.render(!0),this.renderFavoriteList()}))}showRestock(e){const t=e.dataset.id||e.id,n=s.RestockButton.getInstance(t);n?this.popupManager.show(this.config.restockPopup,n.variants,n.productId):console.error("StoreCRM Restock: restockButton not found")}storeRestock(e,t,n,o,i,r,s=void 0,a=void 0){if(!this.checkEmailFormat(e))return a&&a("メールアドレスが正しくありません。");this.doStoreRestock(t,n,e,i,o,r).then((()=>{console.log("StoreCRM: Restock saved successfully"),s&&s(this.config.restockPopup.success_text)})).catch((e=>{console.error("StoreCRM: API call failed:",e),a&&a(this.config.restockPopup.error_text)}))}doStoreRestock(e,t,n,i,r,s){return o(this,void 0,void 0,(function*(){if(i)try{yield this.doUpsertCustomerAcceptsMarketing(n,r,s),console.log("StoreCRM: Accepts marketing status saved successfully")}catch(e){console.error("API call failed:",e)}return yield this.request("POST",`${this.config.backendUrl}/frontend/restock/`,{product_id:t,variant_id:e,email:n})}))}doUpsertCustomerAcceptsMarketing(e,t,n){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/accepts-marketing/`,{email:e,accepts_marketing:t,new_customer:n})}))}renderStatusWidget(){if(this.statusWidget)return void console.log("StoreCRM: warning: statusWidget already exists");const e=document.querySelector(".storecrm-status-widget-target"),t=document.querySelector("#shopify-section-header,.section-header,.section--header,header,.header-wrapper,.header,.header_nav"),n=document.querySelector("#MainContent, #main, .main, main");if(console.log("StoreCRM: renderStatusWidget",t,n),t||n||e){if(e)this.statusWidget=new c.StatusWidget(e,"beforeend",this.config);else if(n)this.statusWidget=new c.StatusWidget(n,"afterbegin",this.config);else{if(!t)return;this.statusWidget=new c.StatusWidget(t,"beforeend",this.config)}this.statusWidget.setParent(this),this.statusWidget.render()}else console.error("Shopify header not found. Please assign following class/id/element to header: #shopify-section-header,.section-header,.section--header,header,.header_nav")}getStatus(e,t){this.doGetStatus().then((t=>{e(t)})).catch((e=>{console.error(e),t("サーバエラーが発生しました。")}))}doGetStatus(){return o(this,void 0,void 0,(function*(){return yield this.request("GET",`${this.config.backendUrl}/frontend/status`)}))}lineSubscribe(e=void 0){this.doLineSubscribe()}doLineSubscribe(){return o(this,void 0,void 0,(function*(){const e=yield this.getCustomerId(),t=yield this.getToken(),n=window.location.href;location.href=`${this.config.backendUrl}/frontend/line/connect?token=${t}&customer_id=${e}&host=${window.location.host}&referrer=${encodeURIComponent(n)}`}))}doLineLogin(){return o(this,void 0,void 0,(function*(){const e=yield this.getCustomerId(),t=yield this.getToken(),n=window.location.href;location.href=`${this.config.backendUrl}/frontend/line/connect?is_multipass=true&token=${t}&customer_id=${e}&host=${window.location.host}&referrer=${encodeURIComponent(n)}`}))}lineUnsubscribe(e=void 0){this.doLineUnsubscribe().then((e=>{location.href=location.pathname+"?line_disconnect=1"})).catch((t=>{console.error(t),e?e("LINEの通知解除に失敗しました。"):alert("LINEの通知解除に失敗しました。")}))}doLineUnsubscribe(){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/line/disconnect`)}))}mailSubscribe(){this.doMailSubscribe().then((e=>{console.log("StoreCRM: メールマガジンの購読に成功しました。",e),this.statusWidget&&this.statusWidget.render()})).catch((e=>{console.error(e),alert("メールマガジンの購読に失敗しました。")}))}doMailSubscribe(){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/subscribe`)}))}mailUnsubscribe(){this.doMailUnsubscribe().then((e=>{console.log("StoreCRM: メールマガジンの解除に成功しました。",e);const t=document.getElementById("storecrm_message");t&&(t.innerHTML="メールマガジンの解除に成功しました。"),this.statusWidget&&this.statusWidget.render()})).catch((e=>{console.error(e);const t=document.getElementById("storecrm_message");t&&(t.innerHTML="メールマガジンの解除に失敗しました。","API"in e.toString()&&(t.innerHTML+='
解除を進めるにはログインをしてください。')),alert("メールマガジンの解除に失敗しました。")}))}doMailUnsubscribe(){return o(this,void 0,void 0,(function*(){return yield this.request("POST",`${this.config.backendUrl}/frontend/email/unsubscribe`)}))}doMailCheck(e){return o(this,arguments,void 0,(function*(e,t=void 0){return this.checkEmailFormat(e)?yield this.request("GET",`${this.config.backendUrl}/frontend/accepts-marketing/?email=${encodeURIComponent(e)}`):t&&t("メールアドレスが正しくありません。")}))}birthdaySet(){}checkEmailFormat(e){return!(!e||!e.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/))}checkConnect(){const e=new URLSearchParams(window.location.search),t=e.get("storecrm"),n=window.localStorage.getItem("storecrm_customer_id");if(n&&!n.startsWith("TEMP_")){if("line_connect"===t?this.lineSubscribe((function(){console.log("StoreCRM: LINEの通知登録に失敗しました。")})):"line_disconnect"===t?this.lineUnsubscribe():"email_subscribe"===t?this.mailSubscribe():"email_unsubscribe"===t?this.mailUnsubscribe():"birthday_set"===t&&this.birthdaySet(),e.get("line_disconnect")){const e=document.querySelector("#storecrm_message");e&&(e.innerHTML="LINEの通知を解除しました。")}if(e.get("line_connect")){const e=document.querySelector("#storecrm_message");e&&(e.innerHTML="LINEを連携しました。")}}else{const e=document.getElementById("storecrm_message");e&&(e.innerHTML='設定変更に失敗しました。
進めるにはログインをしてください。')}}}},927:function(e,t,n){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=o(n(398));window.storecrm=new i.default(window.storecrm_config||{}),window.storecrm.init()}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={id:o,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0,n(927)})();