!function(){"use strict";var e={n:function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,{a:t}),t},d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}},n=window.ctFrontend,t=window.ctEvents,o=e.n(t),i={},c=function(e){return i[e]?new Promise((function(n){n(i[e]),i[e]=i[e].clone()})):new Promise((function(n){return fetch(e).then((function(t){n(t),i[e]=t.clone()}))}))},r=function(e){var n=new URLSearchParams;n.append("action","blocksy_get_woo_size_guide"),n.append("table_id",e.dataset.id),n.append("product_id",e.dataset.product),window.wp&&window.wp.customize&&(n.append("size_guide_placement",wp.customize("size_guide_placement")()),n.append("size_guide_side_panel_position",wp.customize("size_guide_side_panel_position")()));var t="".concat(ct_localizations.ajax_url,"?").concat(n.toString());return{isCached:!!i[t],fetch:function(){return new Promise((function(e){c(t).then((function(e){return e.json()})).then((function(n){n.success;var t=n.data,o=document.createElement("div");o.innerHTML=t.content,e(o.firstElementChild)}))}))}}},a=function(e){var n=e.event,t=e.el,i=e.completeAction;r(t).fetch().then((function(e){i({finalState:"",onCompleted:function(){document.querySelector(".ct-drawer-canvas").appendChild(e);var t=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:t}}),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 e.querySelector(".ct-panel-content-inner")},clickOutside:!0,focus:!1}})}))}(t,n)}),10)}})}))};(0,n.registerDynamicChunk)("blocksy_ext_woo_extra_size_guide",{mount:function(e,n){var t=n.event,o=n.completeAction;t.preventDefault(),t.stopPropagation(),a({event:t,el:e,completeAction:o})},maybeGetPanelContent:function(e,n){n.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()}))}))}();