1"use strict";(globalThis.webpackChunkbrom_web=globalThis.webpackChunkbrom_web||[]).push([[9678],{2084:(t,e,i)=>{i.r(e),i.d(e,{OrderPublications:()=>l});class s{static storageAvailable(t){let e;try{e=window[t];const i="__storage_test__";return e.setItem(i,i),e.removeItem(i),!0}catch(t){return t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&e&&0!==e.length}}}var o=i(4146),d=i(701),r=i(7885),a=i(8257);const n="orderPublicationsList";class l{constructor(){this.storageType=s.storageAvailable("sessionStorage")?"storage":"cookie",this.list=this.getList(),document.querySelectorAll(".publications-list-item").forEach((t=>{new h(t,this)})),document.querySelectorAll(".publications-cart").forEach((t=>{new u(t,this.list.length)})),new m(this),new c(this.list.length),document.addEventListener("updateOrderPublications",(t=>{this.list=t.detail,this.uppdateList()}),!1),document.addEventListener("OrderPublicationsRemoveItem",(t=>{this.removeItem(t.detail)}),!1),document.addEventListener("OrderPublicationsUpdateItemCount",(t=>{this.updateItemCount(t.detail.id,t.detail.count)}),!1);try{if(document.getElementById("order-list-app")){const t=(0,a.$V)((()=>i.e(5662).then(i.bind(i,7438))));(0,a.Ef)({components:{"order-list":t}}).mount("#order-list-app")}if(document.getElementById("order-list-checkout-app")){const t=(0,a.$V)((()=>i.e(379).then(i.bind(i,5614))));(0,a.Ef)({components:{"order-list-checkout":t}}).mount("#order-list-checkout-app")}}catch(t){console.warn("vueInitApps",t)}}addItem(t){if(this.list&&this.list.length&&this.list.find((e=>e.id===t.id))){this.uppdateList();const e=new CustomEvent("orderPublicationsEdit",{detail:t});return void document.dispatchEvent(e)}this.list.push(t);const e=new CustomEvent("orderPublicationsAdd",{detail:t});document.dispatchEvent(e),this.uppdateList()}updateItemCount(t,e){const i=this.list.find((e=>e.id===t));i&&(i.count=e,this.addItem(i))}removeItem(t){const e=this.list.findIndex((e=>e.id===t.id));if(e>-1){this.list.splice(e,1);const i=new CustomEvent("orderPublicationsRemove",{detail:t});document.dispatchEvent(i),this.uppdateList()}}uppdateList(){"storage"===this.storageType?this.list.length?sessionStorage.setItem(n,JSON.stringify(this.list)):sessionStorage.removeItem(n):this.list.length?r.H.add(n,JSON.stringify(this.list),1/24):r.H.remove(n);const t=new CustomEvent("orderPublicationsUpdate",{detail:this.list});document.dispatchEvent(t)}getList(){let t="";if(t="storage"===this.storageType?sessionStorage.getItem(n):r.H.value(n),t&&t.length){const e=JSON.parse(t);return Array.isArray(e)?e:[]}return[]}clearList(){this.list.splice(0,this.list.length),this.uppdateList()}}class h{constructor(t,e){this.base=e,this.add=t.querySelector(".btn-pub-add"),this.remove=t.querySelector(".btn-pub-remove"),this.data={id:t.dataset.id,title:t.dataset.title,image:t.dataset.image,count:1},document.addEventListener("orderPublicationsRemove",(t=>{t.detail.id===this.data.id&&(this.add.disabled=!1,this.remove.disabled=!0)}),!1),this.base.list.find((t=>t.id===this.data.id))&&(this.add.disabled=!0,this.remove.disabled=!1),this.add&&this.add.addEventListener("click",(t=>{t.preventDefault(),this.add.disabled=!0,this.remove.disabled=!1,this.base.addItem(this.data)})),this.remove&&this.remove.addEventListener("click",(t=>{t.preventDefault(),this.add.disabled=!1,this.remove.disabled=!0,this.base.removeItem(this.data)}))}}class c{constructor(t){this.el=document.querySelector("#publications-order-anchor-link"),this.el&&(d.s.add(this.el,"hidden",t<1),document.addEventListener("orderPublicationsUpdate",(t=>{d.s.add(this.el,"hidden",t.detail.length<1)}),!1))}}class u{constructor(t,e){this.el=t,this.countEl=this.el.querySelector(".publications-cart-count"),document.addEventListener("orderPublicationsUpdate",(t=>{this.update(t.detail.length)}),!1),this.update(e)}update(t){t>0?d.s.add(this.el,"hidden",!1):d.s.add(this.el,"hidden",!0),this.countEl.dataset.items=t}}class m{constructor(t){this.base=t,this.form=document.querySelector("#publications-order-form"),this.formField=document.querySelector("#publications-order-form-content"),this.noItemsInfo=document.querySelector("#publications-order-form-invalid"),this.form&&this.formField&&(this.locked=!(this.base.list&&this.base.list.length),this.formFields=this.form.querySelectorAll("input, select, button"),this.orgTypeField=this.form.querySelector("#orgType"),this.orgNameRow=this.form.querySelector("#orgName-row"),this.orgNameField=this.form.querySelector("#orgName"),this.orgTypeField.addEventListener("change",(()=>{this.orgTypeField.value.length&&"Privatperson"!==this.orgTypeField.value?(this.orgNameRow.classList.remove("form-row--hidden"),this.orgNameField.required=!0,setTimeout((()=>{this.orgNameField.focus()}),100)):(this.orgNameRow.classList.add("form-row--hidden"),this.orgNameField.required=!1)})),d.s.add(this.noItemsInfo,"hidden",!this.locked),new o.b3(this.form,{id:"OrderList
1CheckOutForm"}),document.addEventListener("orderPublicationsUpdate",(t=>{this.formField.value=JSON.stringify(t.detail),this.locked=!(this.base.list&&this.base.list.length),this.formFields.forEach((t=>{t.disabled=this.locked})),d.s.add(this.noItemsInfo,"hidden",!this.locked)}),!1),this.formFields.forEach((t=>{t.disabled=this.locked})),this.formField.value=JSON.stringify(this.base.list),this.form.addEventListener("submit",this.submit.bind(this)))}submit(t){t.preventDefault();const e={},i=new FormData(this.form);return!(!this.base.list||!this.base.list.length)&&!!this.validate()&&(i.forEach(((t,i)=>{e[i]=t})),void fetch("/api/publications/postorder",{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify(e)}).then((t=>t.ok?t.json():Promise.reject(t))).then((t=>{if(t.status){this.form.reset(),this.base.clearList();const e=this.form.parentNode;setTimeout((()=>{this.form.remove(),e.innerText=t.message;const i=window.PAGE_URL;document.location.href=`${i}?t=1`}),100)}})).catch((t=>{console.warn(t)})))}validate(){this.inputs=this.form.querySelectorAll("input");let t=!0;return this.inputs.forEach((e=>{if(!e.validity.valid)return t=!1,!1})),t}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.