!function(){"use strict";const t=function(t,n,e){const o=t.split("?"),i=o[0],r=o[1]||"",s={};r.split("&").forEach((function(t){const n=t.split("=");n[0]&&(s[n[0]]=n[1]||"")})),s[n]=e;return i+"?"+Object.keys(s).map((function(t){return t+"="+encodeURIComponent(s[t])})).join("&")},n=JSON.parse("{\"init_type\":\"default\",\"auto_data_load\":1,\"mode\":\"constructor\",\"disable_orders\":0,\"list_denied_templates\":\"\",\"printery_elements_only\":0,\"printery_templates_only\":0,\"disable_templates_page\":0,\"disable_templates_categories\":0,\"iframe_only\":0,\"list_allowed_performers\":\"\",\"show_many_performers\":0,\"show_copyright\":1,\"default_outer_title\":\"Конструктор печатей и штампов\",\"overlay_white_theme\":1,\"force_loading\":1,\"main_color_3\":\"#ff1e00\",\"main_color_2\":\"#ffb100\",\"main_color_1\":\"#04819e\",\"outer_title_attribute\":\"\",\"use_outer_title\":0,\"show_title\":1,\"start_section\":\"constructor\"}"),e=JSON.parse("{\"skip_performer_section\":false,\"default_printery_id\":1,\"printery\":{\"materials\":[\"rubber\"]},\"default_city\":{\"title\":\"Сургут\",\"id\":1011,\"coordinates\":[\"61.2539773\",\"73.3961726\"]}}"),o=JSON.parse("[]"),i=function(){let i,r="#printut-stamp";const s={},l="CSwK1Pe6",c=window.location.href,a=function(t,n){n=JSON.stringify({type:"printut",method:t,data:n}),i.contentWindow.postMessage(n,"*")},u={loadPublishTemplateByKey:function(t){return a("loadPublishTemplateByKey",{template_key:t}),!0},loadPublishTemplateById:function(t){return a("loadPublishTemplateById",{template_id:t}),!0},changeWidgetColors:function(t,n,e){return a("changeWidgetColors",{color1:t,color2:n,color3:e}),!0},hide:function(){null!=i&&(i.style.display="none")},show:function(){return null!=i&&(i.style.display="block"),!0},setLanguage:function(n){if("string"==typeof n){let e;e=t(i.src,"lang",n),e=t(e,"cur","auto"),i.src!==e&&(i.src=e)}},setCurrency:function(n){if("string"==typeof n){const e=t(i.src,"cur",n);i.src!==e&&(i.src=e)}},setLanguageAndCurrency:function(n,e){if("string"==typeof n){let o;"string"!=typeof e&&(e="auto"),o=t(i.src,"lang",n),o=t(o,"cur",e),i.src!==o&&(i.src=o)}},reload:function(){return null!=i&&(i.src=i.getAttribute("src")),!0},getInfo:function(){return{widgetId:l,widgetUrl:c,container:document.querySelector(r),height:i.height,width:i.width}},setTemplatesPage:function(t,n){return a("setTemplatesPage",{stamp_type:t,category_id:n}),!0},setFastPage:function(){return a("setFastPage"),!0},setFastPageAndSnaps:function(){return a("setFastPageAndSnaps"),!0},setFastPageAndTemplates:function(t,n){return a("setFastPageAndTemplates",{stamp_type:t,category_id:n}),!0},setConstructorPage:function(){return a("setConstructorPage"),!0}},d={ping:function(){a("ping")},getWidgetData:function(){a("getWidgetData",{widgetId:l,widgetUrl:c,printeryId:parseInt("204"),params:n,options:e})},changeSize:function(t){null!=t&&(null!=t.width&&(i.width=t.width),null!=t.height&&(i.height=t.height))},updateTitle:function(t){if(n.use_outer_title&&n.outer_title_attribute){const e=document.querySelector(n.outer_title_attribute);null!=e&&(e.innerHTML=t)}},ready:function(){const t=document.querySelector(r);null!=t&&(t.classList.remove("loading"),t.classList.add("loaded"),"default"===n.init_type&&null!=o&&"string"==typeof o.onload&&"function"==typeof window[o.onload]&&window[o.onload](u))},removeUrlParameter:function(t){const n=function(t){if(null!=t){const n=window.location.href.split("?");if(n.length>=2){const e=encodeURIComponent(t)+"=",o=n[1].split(/[&;]/g);for(let t=o.length;t-- >0;)-1!==o[t].lastIndexOf(e,0)&&o.splice(t,1);const i=n[0]+(o.length>0?"?"+o.join("&"):"");window.history&&window.history.replaceState&&window.history.replaceState({},document.title,i)}}},e=function(t){return t.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((t=>t.toLowerCase())).join("_")};if("object"!=typeof t){n(t);const o=e(t);o!==t&&n(o)}else for(const o in t){n(t[o]);const i=e(t[o]);i!==t[o]&&n(i)}},redirect:function(t){if(null!=t.url){if(null!=t.old_url&&window.history&&"function"==typeof history.pushState)try{const n=window.location.origin;n===new URL(t.old_url,n).origin&&history.pushState(null,null,t.old_url)}catch(t){}window.location.href=t.url}}};return s.init=function(t,e){"string"==typeof t&&(r=t),"object"!=typeof e&&(e={});const s=document.querySelector(r);if(null!=s){s.classList.contains("loading")||s.classList.add("loading"),i=document.createElement("iframe"),e.empty?i.src="https://pechati.printut.com/constructor?widget="+l+"&as=script&empty":i.src="https://pechati.printut.com/constructor?widget="+l+"&as=script","lang"in o&&(i.src+="&lang="+o.lang),"cur"in o&&(i.src+="&cur="+o.cur),i.width="100%",i.setAttribute("frameborder","0"),i.setAttribute("style","margin: 0 auto;"),s.appendChild(i),window.addEventListener("message",(function(t){if(null!=t.data){const n=function(t){try{t=JSON.parse(t)}catch(t){return null}return"object"==typeof t&&null!==t?t:null}(t.data);null!=n&&"printut"===n.type&&null!=d[n.method]&&d[n.method](n.data)}}));window.innerWidth;const t=function(t){let e=770;n.show_title||(e=710),window.innerWidth<=768?t&&(i.height=793):window.innerWidth<=992?i.height=800:window.innerHeight<=e||window.innerWidth<1110?i.height=n.show_title?630:560:i.height=n.show_title?780:720};window.innerWidth>992?(window.addEventListener("load",(function(){t(!0)})),t(!0)):t(!0),window.addEventListener("resize",(function(){t(!1)}))}else console.error("[PRINTUT] Элемент-контейнер "+r+" не найден");return u},s.getWidgetId=function(){return l},s}();var r;r=function(){"object"!=typeof window.printutStamp&&(window.printutStamp={});const t=i.getWidgetId();if("default"===n.init_type)window.printutStamp[t]=i.init();else{const n=i.init;window.printutStamp[t]=n,null!=o&&"string"==typeof o.onload&&"function"==typeof window[o.onload]&&window[o.onload](n)}},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(r,1):document.addEventListener("DOMContentLoaded",r)}();