!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.ctFrontend,n=window.ctEvents,o=e.n(n),i={},c=function(e){return i[e]?new Promise((function(t){t(i[e]),i[e]=i[e].clone()})):new Promise((function(t){return fetch(e).then((function(n){t(n),i[e]=n.clone()}))}))},r=function(e){var t=new URLSearchParams;t.append("action","blocksy_get_woo_size_guide"),t.append("table_id",e.dataset.id),t.append("product_id",e.dataset.product),window.wp&&window.wp.customize&&(t.append("size_guide_placement",wp.customize("size_guide_placement")()),t.append("size_guide_side_panel_position",wp.customize("size_guide_side_panel_position")()));var n="".concat(ct_localizations.ajax_url,"?").concat(t.toString());return{isCached:!!i[n],fetch:function(){return new Promise((function(e){c(n).then((function(e){return e.json()})).then((function(t){t.success;var n=t.data,o=document.createElement("div");o.innerHTML=n.content,e(o.firstElementChild)}))}))}}},u=function(e){var n=e.event,i=e.el,c=e.completeAction;r(i).fetch().then((function(e){c({finalState:"",onCompleted:function(){document.querySelector(".ct-drawer-canvas").appendChild(e);var i=document.querySelector("#ct-size-guide-modal");setTimeout((function(){o().trigger("blocksy:frontend:init"),o().trigger("ct:overlay:handle-click",{event:n,options:{openStrategy:"fast",container:i}}),function(e,n){o().trigger("blocksy:frontend:init"),setTimeout((function(){o().trigger("ct:overlay:handle-click",{e:n,href:"#".concat(e.id),options:{openStrategy:"skip",isModal:"modal"===e.dataset.behaviour,computeScrollContainer:function(){if(e.closest("body"))return t.getCurrentScreen&&"mobile"===(0,t.getCurrentScreen)({withTablet:!0})?e.querySelector(".ct-size-guide-content"):e.querySelector(".entry-summary")},clickOutside:!0,focus:!1}})}))}(i,n)}),10)}})}))};(0,t.registerDynamicChunk)("blocksy_ext_woo_extra_size_guide",{mount:function(e,t){var n=t.event,o=t.completeAction;n.preventDefault(),n.stopPropagation(),u({event:n,el:e,completeAction:o})},maybeGetPanelContent:function(e,t){t.event;return r(e).isCached?new Promise((function(e){e("")})):null}}),o().on("ct:modal:closed",(function(e){"ct-size-guide-modal"===e.id&&setTimeout((function(){e.remove()}))}))}();