PageSourceSearch

https://www.schmedt.fr/theme/a8823d846a14671cc3f820d1bc772444/js/schmedt-cms/schmedt-cms.js?1790238202

js schmedt.fr collected 2026-10-07 10:29:18 UTC 35,299 bytes, 1 lines download raw bytes

1(()=>{"use strict";var t={156(t){var e=function(t){var e;return!!t&&"object"==typeof t&&"[object RegExp]"!==(e=Object.prototype.toString.call(t))&&"[object Date]"!==e&&t.$$typeof!==s},s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?a(Array.isArray(t)?[]:{},t,e):t}function i(t,e,s){return t.concat(e).map(function(t){return r(t,s)})}function o(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function n(t,e){try{return e in t}catch(t){return!1}}function a(t,s,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=r;var d,c,u=Array.isArray(s);return u!==Array.isArray(t)?r(s,l):u?l.arrayMerge(t,s,l):(c={},(d=l).isMergeableObject(t)&&o(t).forEach(function(e){c[e]=r(t[e],d)}),o(s).forEach(function(e){(!n(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(n(t,e)&&d.isMergeableObject(s[e])?c[e]=(function(t,e){if(!e.customMerge)return a;var s=e.customMerge(t);return"function"==typeof s?s:a})(e,d)(t[e],s[e],d):c[e]=r(s[e],d))}),c)}a.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,s){return a(t,s,e)},{})},t.exports=a}},e={};function s(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var r in e)s.o(e,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r=s(156),i=s.n(r);class o{static ucFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}static lcFirst(t){return t.charAt(0).toLowerCase()+t.slice(1)}static toDashCase(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,e){let s=o.toUpperCamelCase(t,e);return o.lcFirst(s)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>o.ucFirst(t.toLowerCase())).join(""):o.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}class n{constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new CustomEvent(t,{detail:e,cancelable:s});return this.el.dispatchEvent(r),r}subscribe(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this,i=t.split("."),o=s.scope?e.bind(s.scope):e;if(s.once&&!0===s.once){let e=o;o=function(s){r.unsubscribe(t),e(s)}}return this.el.addEventListener(i[0],o),this.listeners.push({splitEventName:i,opts:s,cb:o}),!0}unsubscribe(t){arguments.length>1&&"function"==typeof arguments[1]&&console.warn(`[NativeEventEmitter] Unsubscribing by passing the subscriber function as a second argument is not supported. By default, all listeners for the event will be removed. Use a suffix (separated by a dot) on the event name when subscribing/unsubscribing to identify/target your specific listener only, e.g. "${t}.MyCustomPlugin"`);let e=t.split(".");return this.listeners=this.listeners.reduce((t,s)=>([...s.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(s.splitEventName[0],s.cb):t.push(s),t),[]),!0}reset(){return this.listeners.forEach(t=>{this.el.removeEventListener(t.splitEventName[0],t.cb)}),this.listeners=[],!0}get el(){return this._el}set el(t){this._el=t}get listeners(){return this._listeners}set listeners(t){this._listeners=t}}class a{constructor(t,e={},s=!1){if(!(t instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${s}".`);return}this.el=t,this.$emitter=new n(this.el),this._pluginName=this._getPluginName(s),this.options=this._mergeOptions(e),this._initialized=!1,this._registerInstance(),this._init()}init(){console.warn(`The "init" method for the plugin "${this._pluginName}" is not defined. The plugin will not be initialized.`)}update(){}destroy(){}
1_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(t){let e=[this.constructor.options,this.options,t];return e.push(this._getConfigFromDataAttribute()),e.push(this._getOptionsFromDataAttribute()),i().all(e.filter(t=>t instanceof Object&&!(t instanceof Array)).map(t=>t||{}))}_getConfigFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=o.toDashCase(this._pluginName),s=this.el.getAttribute(`data-${e}-config`);return s?window.PluginConfigManager.get(this._pluginName,s):t}_getOptionsFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=o.toDashCase(this._pluginName),s=this.el.getAttribute(`data-${e}-options`);if(s)try{return JSON.parse(s)}catch(t){console.error(`The data attribute "data-${e}-options" could not be parsed to json: ${t.message}`)}return t}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(t){return t||(t=this.constructor.name),t}}class l extends a{static #t=this.options={triggerAttr:"[data-smhs-trigger]",popupAttr:"[data-smhs-popup]",popupMobileAttr:"[data-smhs-popup-mobile]",closeAttr:"[data-smhs-close]",spotSelector:".smhs-spot",mobileBreakpoint:768};init(){this._openIndex=null,this._pinned=!1,this._bindEvents()}_bindEvents(){this.el.querySelectorAll(this.options.triggerAttr).forEach(t=>{let e=t.dataset.smhsTrigger;t.addEventListener("mouseenter",()=>{this._pinned||this._open(e)}),t.addEventListener("mouseleave",()=>{this._pinned||this._close(e)}),t.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this._toggle(e)}),t.addEventListener("keydown",t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),this._toggle(e))})}),this.el.querySelectorAll(this.options.closeAttr).forEach(t=>{t.addEventListener("click",t=>{t.stopPropagation(),this._closeAll()})}),document.addEventListener("click",t=>{t.target.closest(".smhs-popup")||t.target.closest(".smhs-marker")||this._closeAll()})}_isTouchLayout(){return window.innerWidth<this.options.mobileBreakpoint}_raise(t){this.el.querySelectorAll(this.options.spotSelector).forEach(t=>{t.style.zIndex="1"});let e=this.el.querySelector(`[data-smhs-index="${t}"]`);e&&(e.style.zIndex="100")}_open(t){if(this._isTouchLayout())return;this._closeAll(),this._raise(t);let e=this.el.querySelector(`[data-smhs-popup="${t}"]`);e&&(e.classList.add("is-visible"),this._openIndex=t);let s=this.el.querySelector(`[data-smhs-trigger="${t}"]`);s&&s.setAttribute("aria-expanded","true")}_close(t){if(this._isTouchLayout())return;let e=this.el.querySelector(`[data-smhs-popup="${t}"]`);e&&e.classList.remove("is-visible");let s=this.el.querySelector(`[data-smhs-trigger="${t}"]`);s&&s.setAttribute("aria-expanded","false"),this._openIndex===t&&(this._openIndex=null)}_toggle(t){if(this._openIndex===t&&this._pinned){this._closeAll();return}if(this._closeAll(),this._raise(t),this._pinned=!0,this._isTouchLayout()){let e=this.el.querySelector(`[data-smhs-popup-mobile="${t}"]`);e&&e.classList.add("is-visible")}else{let e=this.el.querySelector(`[data-smhs-popup="${t}"]`);e&&e.classList.add("is-visible")}let e=this.el.querySelector(`[data-smhs-trigger="${t}"]`);e&&e.setAttribute("aria-expanded","true"),this._openIndex=t}_closeAll(){this.el.querySelectorAll(".smhs-popup").forEach(t=>t.classList.remove("is-visible")),this.el.querySelectorAll(this.options.triggerAttr).forEach(t=>t.setAttribute("aria-expanded","false")),this._openIndex=null,this._pinned=!1}
1}class d{constructor(){this._request=null,this._errorHandlingInternal=!1}get(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",r=this._createPreparedRequest("GET",t,s);return this._sendRequest(r,null,e)}post(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let i=this._createPreparedRequest("POST",t,r);return this._sendRequest(i,e,s)}delete(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let i=this._createPreparedRequest("DELETE",t,r);return this._sendRequest(i,e,s)}patch(t,e,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";r=this._getContentType(e,r);let i=this._createPreparedRequest("PATCH",t,r);return this._sendRequest(i,e,s)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(t){this._errorHandlingInternal=t}_registerOnLoaded(t,e){e&&(!0===this._errorHandlingInternal?(t.addEventListener("load",()=>{e(t.responseText,t)}),t.addEventListener("abort",()=>{console.warn(`the request to ${t.responseURL} was aborted`)}),t.addEventListener("error",()=>{console.warn(`the request to ${t.responseURL} failed with status ${t.status}`)}),t.addEventListener("timeout",()=>{console.warn(`the request to ${t.responseURL} timed out`)})):t.addEventListener("loadend",()=>{e(t.responseText,t)}))}_sendRequest(t,e,s){return this._registerOnLoaded(t,s),t.send(e),t}_getContentType(t,e){return t instanceof FormData&&(e=!1),e}_createPreparedRequest(t,e,s){return this._request=new XMLHttpRequest,this._request.open(t,e),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),s&&this._request.setRequestHeader("Content-type",s),this._request}}let c="js-offcanvas-singleton",u=new WeakMap;class h{constructor(){this.$emitter=new n}open(t,e,s,r,i,o,n){this._removeExistingOffCanvas();let a=this._createOffCanvas(s,o,n,r);this.setContent(t,i),this._openOffcanvas(a,e)}setContent(t,e){let s=this.getOffCanvas();s[0]&&(s[0].innerHTML=t,this._registerEvents(e),this._setAriaAttrs())}setAdditionalClassName(t){this.getOffCanvas()[0].classList.add(t)}getOffCanvas(){return document.querySelectorAll(`.${c}`)}close(t){let e=this.getOffCanvas();e.forEach(t=>{bootstrap.Offcanvas.getInstance(t).hide()}),setTimeout(()=>{this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:e})},t)}goBackInHistory(){window.history.back()}exists(){return this.getOffCanvas().length>0}_openOffcanvas(t,e){window.focusHandler.saveFocusState("offcanvas"),this._disableBackgroundAccessibility(t),window.focusHandler._addFocusTrapGuard(t),h.bsOffcanvas.show(),window.history.pushState("offcanvas-open",""),"function"==typeof e&&e()}_registerEvents(t){let e=this.getOffCanvas();e.forEach(s=>{let r=()=>{setTimeout(()=>
1{this._restoreBackgroundState(),s.remove(),window.focusHandler._removeFocusTrapGuard(),window.focusHandler.resumeFocusState("offcanvas"),this.$emitter.publish("onCloseOffcanvas",{offCanvasContent:e})},t),s.removeEventListener("hide.bs.offcanvas",r)};s.addEventListener("hide.bs.offcanvas",r)}),window.addEventListener("popstate",this.close.bind(this,t),{once:!0}),document.querySelectorAll(".js-offcanvas-close").forEach(e=>{e.addEventListener("click",this.close.bind(this,t))})}_setAriaAttrs(){let t=this.getOffCanvas()[0],e="off-canvas-headline",s=t.querySelector(`[data-id="${e}"]`);s&&!t.hasAttribute("aria-labelledby")&&(s.setAttribute("id",e),t.setAttribute("aria-labelledby",e))}_disableBackgroundAccessibility(t){let e=[...document.body.children].filter(e=>e!==t).map(t=>({element:t,inert:t.inert,ariaHidden:t.getAttribute("aria-hidden")}));u.set(this,e),e.forEach(t=>{let{element:e}=t;e.inert=!0,e.setAttribute("aria-hidden","true")})}_restoreBackgroundState(){let t=u.get(this);t?.forEach(t=>{let{element:e,inert:s,ariaHidden:r}=t;if(e.inert=s,null===r){e.removeAttribute("aria-hidden");return}e.setAttribute("aria-hidden",r)}),u.delete(this)}_removeExistingOffCanvas(){this.getOffCanvas().forEach(t=>{let e=bootstrap.Offcanvas.getInstance(t);e&&"function"==typeof e.dispose&&e.dispose(),t.remove(),window.focusHandler._removeFocusTrapGuard()}
1),this._restoreBackgroundState(),h.bsOffcanvas=null}_getPositionClass(t){return"left"===t?"offcanvas-start":"right"===t?"offcanvas-end":`offcanvas-${t}`}_createOffCanvas(t,e,s,r){let i=document.createElement("div");if(i.classList.add("offcanvas",c),i.classList.add(this._getPositionClass(t)),i.setAttribute("tabindex","-1"),!0===e&&i.classList.add("is-fullwidth"),s){let t=typeof s;if("string"===t)i.classList.add(s);else if(Array.isArray(s))s.forEach(t=>{i.classList.add(t)});else throw Error(`The type "${t}" is not supported. Please pass an array or a string.`)}return document.body.appendChild(i),h.bsOffcanvas=new bootstrap.Offcanvas(i,{backdrop:!1!==r||"static"}),i}}let p=Object.freeze(new h);class m{static open(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left",r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:350,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";p.open(t,e,s,r,i,o,n)}static setContent(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:350;p.setContent(t,e,s)}static setAdditionalClassName(t){p.setAdditionalClassName(t)}static close(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;p.close(t)}static exists(){return p.exists()}static getOffCanvas(){return p.getOffCanvas()}static REMOVE_OFF_CANVAS_DELAY(){return 350}}let _=/^[A-Za-z0-9\-_.]+$/;function g(t){if("string"!=typeof t||""===t)return null;try{let e=new URL(t,window.location.origin);if("https:"===e.protocol||"http:"===e.protocol)return e.href}catch(t){}return null}function f(t,e,s){let r=Math.max(1,e||1),i=Math.max(1,s||1),o=Math.max(1,parseInt(t,10)||1);if(o<r)return r;let n=(o-r)%i;return 0===n?o:o+(i-n)}class v extends a{static #t=this.options={defaultRows:5,urls:{suggest:"/schmedt/quick-order/suggest",lookup:"/schmedt/quick-order/lookup",csvParse:"/schmedt/quick-order/csv/parse",csvExport:"/schmedt/quick-order/csv/export",addToCart:"/schmedt/quick-order/add-to-cart"},snippets:{}};init(){this._rowsContainer=this.el.querySelector("[data-sqo-rows]"),this._rowTemplate=this.el.querySelector("[data-sqo-row-template]"),this._addRowBtn=this.el.querySelector("[data-sqo-add-row]"),this._addToCartBtn=this.el.querySelector("[data-sqo-submit]"),this._csvImportInput=this.el.querySelector("[data-sqo-csv-import]"),this._csvExportBtn=this.el.querySelector("[data-sqo-csv-export]"),this._statusEl=this.el.querySelector("[data-sqo-form-status]"),this._csvModalEl=this.el.querySelector("[data-sqo-csv-modal]"),this._csvModalBody=this._csvModalEl?this._csvModalEl.querySelector("[data-sqo-csv-modal-body]"):null,this._csvModalApply=this._csvModalEl?this._csvModalEl.querySelector("[data-sqo-csv-modal-apply]"):null,this._csvModalCancel=this._csvModalEl?this._csvModalEl.querySelector("[data-sqo-csv-modal-cancel]"):null,this._csvParseResult=null,this._rowsContainer&&this._rowTemplate&&(this._httpClient=new d,this._bindEvents(),this._populateInitialRows())}_bindEvents(){this._addRowBtn&&this._addRowBtn.addEventListener("click",t=>{t.preventDefault(),this._addRow()}),this._addToCartBtn&&this._addToCartBtn.addEventListener("click",t=>{t.preventDefault(),this._submitToCart()}),this._csvImportInput&&this._csvImportInput.addEventListener("change",t=>{let e=t.target.files&&t.target.files[0];e&&this._handleCsvUpload(e),t.target.value=""}),this._csvExportBtn&&this._csvExportBtn.addEventListener("click",t=>{t.preventDefault(),this._exportCsv()}),this._csvModalApply&&this._csvModalApply.addEventListener("click",t=>{t.preventDefault(),this._applyCsvImport()}),this._csvModalCancel&&this._csvModalCancel.addEventListener("click",t=>{t.preventDefault(),this._closeCsvModal()})}_populateInitialRows(){let t=parseInt(this.options.defaultRows,10)||5;for(let e=0;e<t;e++)this._addRow()}_addRow(t){let e=this._rowTemplate.content.cloneNode(!0).querySelector("[data-sqo-row]");if(!e)return null;let s=e.querySelector("[data-sqo-product-number]"),r=e.querySelector("[data-sqo-qty]"),i=e.querySelector("[data-sqo-remove]"),o=e.querySelector("[data-sqo-suggest]");
1t&&t.productNumber&&(s.value=t.productNumber),t&&t.qty&&(r.value=String(t.qty));let n=null,a=-1,l=!1,d=()=>{n&&(clearTimeout(n),n=null),l=!0},c=()=>{r.focus(),r.select()};return s.addEventListener("input",()=>{let t=s.value.trim();this._clearResolved(e),this._closeSuggest(o),n&&clearTimeout(n),l=!1,!(t.length<4)&&_.test(t)&&(n=setTimeout(()=>{l||this._fetchSuggest(t).then(r=>{l||s.value.trim()!==t||this._renderSuggest(o,r,t=>{s.value=t.productNumber,d(),this._closeSuggest(o),this._resolveRow(e,t.productNumber),c()})})},250))}),s.addEventListener("keydown",t=>{let r=o.querySelectorAll("[data-sqo-suggest-item]");"ArrowDown"===t.key&&r.length>0?(t.preventDefault(),a=(a+1)%r.length,this._highlightSuggest(r,a)):"ArrowUp"===t.key&&r.length>0?(t.preventDefault(),a=(a-1+r.length)%r.length,this._highlightSuggest(r,a)):"Enter"===t.key?(t.preventDefault(),a>=0&&r[a]?r[a].click():(d(),this._closeSuggest(o),this._resolveRow(e,s.value.trim()),c()),a=-1):"Escape"===t.key&&(d(),this._closeSuggest(o),a=-1)}),s.addEventListener("blur",()=>{d(),setTimeout(()=>this._closeSuggest(o),200);let t=s.value.trim();t&&_.test(t)&&!e.dataset.sqoProductId&&this._resolveRow(e,t)}),r.addEventListener("change",()=>{let t=parseInt(e.dataset.sqoMinPurchase||"1",10),s=parseInt(e.dataset.sqoPurchaseSteps||"1",10),i=parseInt(r.value,10);if(!Number.isFinite(i)||i<1){r.value=String(t);return}r.value=String(f(i,t,s))}),i.addEventListener("click",t=>{t.preventDefault(),e.parentNode.removeChild(e)}),t&&t.resolved&&this._renderResolved(e,t.resolved),this._rowsContainer.appendChild(e),t&&t.productNumber&&!t.resolved&&this._resolveRow(e,t.productNumber),e}_setRowStatus(t,e,s){t.dataset.sqoStatus=e;let r=t.querySelector("[data-sqo-error]");r&&(r.textContent=s||"",r.classList.toggle("d-none",!s))}_renderResolved(t,e){let s=t.querySelector("[data-sqo-preview]"),r=t.querySelector("[data-sqo-preview-img]"),i=t.querySelector("[data-sqo-preview-name]"),o=t.querySelector("[data-sqo-preview-spec]"),n=t.querySelector("[data-sqo-purchase-hint]"),a=t.querySelector("[data-sqo-qty]");if(t.dataset.sqoProductId=String(e.id||""),t.dataset.sqoMinPurchase=String(e.minPurchase||1),t.dataset.sqoPurchaseSteps=String(e.purchaseSteps||1),i&&(i.textContent=e.name||""),o){let t=e.spezifikation||"";o.textContent=t,o.classList.toggle("d-none",""===t)}if(r){let t=g(e.coverThumbUrl);t?(r.src=t,r.alt=e.name||"",r.classList.remove("d-none")):(r.removeAttribute("src"),r.classList.add("d-none"))}s&&s.classList.remove("d-none");let l=e.minPurchase||1,d=e.purchaseSteps||1;if(n){if(l>1||d>1){let t=this.options.snippets.purchaseHint||"Min %min%, in %step% steps";n.textContent=t.replace("%min%",l).replace("%step%",d),n.classList.remove("d-none")}else n.textContent="",n.classList.add("d-none")}if(a){let t=parseInt(a.value,10)||1;a.value=String(f(t,l,d)),a.min=String(l),a.step=String(d)}this._setRowStatus(t,"ok",null)}_renderUnresolved(t,e){let s=t.querySelector("[data-sqo-preview]");s&&s.classList.add("d-none"),delete t.dataset.sqoProductId,this._setRowStatus(t,"error",e)}_clearResolved(t){let e=t.querySelector("[data-sqo-preview]"),s=t.querySelector("[data-sqo-preview-img]"),r=t.querySelector("[data-sqo-preview-name]"),i=t.querySelector("[data-sqo-preview-spec]"),o=t.querySelector("[data-sqo-purchase-hint]");e&&e.classList.add("d-none"),s&&(s.removeAttribute("src"),s.classList.add("d-none")),r&&(r.textContent=""),i&&(i.textContent="",i.classList.add("d-none")),o&&(o.textContent="",o.classList.add("d-none")),delete t.dataset.sqoProductId,delete t.dataset.sqoMinPurchase,delete t.dataset.sqoPurchaseSteps,this._setRowStatus(t,"idle",null)}async _resolveRow(t,e){if(!e||!_.test(e)){this._renderUnresolved(t,this.options.snippets.invalidNumber||"Invalid product number");return}try{let s=this.options.urls.lookup+"?productNumber="+encodeURIComponent(e),r=await fetch(s,{credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!r.ok){this._renderUnresolved(t,this.options.snippets.notFound||"Not found");return}let i=await r.json();i&&i.found&&i.product?this._renderResolved(t,i.product):this._renderUnresolved(t,this.options.snippets.notFound||"Not found")}catch(e){this._renderUnresolved(t,this.options.snippets.networkError||"Network error")}}async _fetchSuggest(t){try{let e=this.options.urls.suggest+"?q="+encodeURIComponent(t)+"&limit=8",s=await fetch(e,{credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!s.ok)return[];let r=await s.json();return Array.isArray(r.items)?r.items:[]}catch(t){return[]}}_renderSuggest(t,e,s){if(t.textContent="",0===e.length){t.classList.add("d-none");return}
1e.forEach(e=>{let r=document.createElement("button");r.type="button",r.className="list-group-item list-group-item-action sqo-suggest__item",r.dataset.sqoSuggestItem="1";let i=document.createElement("span");i.className="sqo-suggest__img";let o=g(e.coverThumbUrl);if(o){let t=document.createElement("img");t.src=o,t.alt="",t.loading="lazy",i.appendChild(t)}let n=document.createElement("span");n.className="sqo-suggest__text";let a=document.createElement("span");a.className="sqo-suggest__top";let l=document.createElement("span");if(l.className="sqo-suggest__nr",l.textContent=e.productNumber||"",a.appendChild(l),e.name){let t=document.createElement("span");t.className="sqo-suggest__name",t.textContent=e.name,a.appendChild(document.createTextNode(" ")),a.appendChild(t)}if(n.appendChild(a),e.spezifikation){let t=document.createElement("span");t.className="sqo-suggest__spec",t.textContent=e.spezifikation,n.appendChild(t)}r.appendChild(i),r.appendChild(n),r.addEventListener("mousedown",t=>{t.preventDefault()}),r.addEventListener("click",t=>{t.preventDefault(),s(e)}),t.appendChild(r)}),t.classList.remove("d-none")}_highlightSuggest(t,e){t.forEach((t,s)=>{t.classList.toggle("active",s===e),s===e&&t.scrollIntoView({block:"nearest"})})}_closeSuggest(t){t&&(t.textContent="",t.classList.add("d-none"))}_collectRows(){let t=[];return this._rowsContainer.querySelectorAll("[data-sqo-row]").forEach(e=>{let s=e.querySelector("[data-sqo-product-number]"),r=e.querySelector("[data-sqo-qty]"),i=s?s.value.trim():"",o=r&&parseInt(r.value,10)||1;if(!i)return;let n=e.querySelector("[data-sqo-preview-name]"),a=e.querySelector("[data-sqo-preview-spec]"),l=n&&n.textContent||"",d=a&&a.textContent||"";t.push({productNumber:i,qty:o,name:l,spezifikation:d,resolved:!!e.dataset.sqoProductId})}),t}_openOffcanvasCart(){try{this._httpClient.get("/checkout/offcanvas",t=>{try{m.open(t,null,"right")}catch(t){window.location.href="/checkout/cart"}})}catch(t){window.location.href="/checkout/cart"}}async _submitToCart(){let t=this._collectRows();if(0===t.length){this._setStatus(this.options.snippets.emptyForm||"Please add at least one product.","warning");return}let e=t.map(t=>({productNumber:t.productNumber,qty:t.qty}));this._setStatus(this.options.snippets.submitting||"Sending...","info"),this._addToCartBtn&&(this._addToCartBtn.disabled=!0);try{let t=new FormData;t.append("rows",JSON.stringify(e));let s=await fetch(this.options.urls.addToCart,{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"},body:t});if(!s.ok){this._setStatus(this.options.snippets.serverError||"Server error","danger");return}let r=await s.json(),i=r.added||0,o=Array.isArray(r.skipped)?r.skipped:[],n=new Set(o.map(t=>t.productNumber));if(this._rowsContainer.querySelectorAll("[data-sqo-row]").forEach(t=>{let e=t.querySelector("[data-sqo-product-number]"),s=e?e.value.trim():"";s&&n.has(s)&&this._setRowStatus(t,"error",this.options.snippets.notFound||"Not found")}),i>0&&this._openOffcanvasCart(),0===o.length&&i>0)this._setStatus("","info");else{let t=this.options.snippets.partialResult||"%added% added, %skipped% skipped";this._setStatus(t.replace("%added%",String(i)).replace("%skipped%",String(o.length)),i>0?"warning":"danger")}}catch(t){this._setStatus(this.options.snippets.networkError||"Network error","danger")}finally{this._addToCartBtn&&(this._addToCartBtn.disabled=!1)}}async _handleCsvUpload(t){if(t.size>204800){this._setStatus(this.options.snippets.fileTooLarge||"File too large (max 200 KB).","danger");return}if("csv"!==(t.name||"").toLowerCase().split(".").pop()){this._setStatus(this.options.snippets.fileType||"Only .csv files are allowed.","danger");return}let e=new FormData;e.append("file",t),this._setStatus(this.options.snippets.parsing||"Parsing...","info");try{let t=await fetch(this.options.urls.csvParse,{method:"POST",credentials:"same-origin",body:e,headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"}});if(!t.ok){let e="PARSE_ERROR";try{let s=await t.json();s&&s.error&&(e=s.error)}catch(t){}this._setStatus(this._csvErrorMessage(e),"danger");return}let s=await t.json();if(!Array.isArray(s.rows)||0===s.rows.length){this._setStatus(this.options.snippets.csvEmpty||"CSV is empty.","warning");return}this._csvParseResult=s.rows,this._renderCsvModal(s.rows),this._setStatus("","info")}catch(t){this._setStatus(this.options.snippets.networkError||"Network error","danger")}}_csvErrorMessage(t){return({FILE_TOO_LARGE:this.options.snippets.fileTooLarge||"File too large.",INVALID_FILE_TYPE:this.options.snippets.fileType||"Invalid file type.",TOO_MANY_ROWS:this.options.snippets.tooManyRows||"Too many rows (max 200).",MISSING_HEADER_PRODUCTNR:this.options.snippets.headerMissing||"CSV header missing ProductNr.",NO_FILE:this.options.snippets.noFile||"No file uploaded.",INVA
1LID_PAYLOAD:this.options.snippets.invalidPayload||"Invalid payload."})[t]||this.options.snippets.parseError||"Could not parse CSV."}_renderCsvModal(t){if(!this._csvModalEl||!this._csvModalBody)return;this._csvModalBody.textContent="";let e=document.createElement("table");e.className="table table-sm sqo-csv-modal__table";let s=document.createElement("thead"),r=document.createElement("tr");["","ProductNr",this.options.snippets.modalColName||"Name",this.options.snippets.modalColSpec||"Spec",this.options.snippets.modalColQty||"Qty"].forEach(t=>{let e=document.createElement("th");e.textContent=t,r.appendChild(e)}),s.appendChild(r),e.appendChild(s);let i=document.createElement("tbody");t.forEach(t=>{let e=document.createElement("tr"),s=document.createElement("td"),r=document.createElement("span");r.className="badge",t.error?(r.classList.add("badge-danger"),r.textContent="!",e.classList.add("sqo-csv-row--error")):(r.classList.add("badge-success"),r.textContent="✓"),s.appendChild(r),e.appendChild(s);let o=document.createElement("td");o.textContent=t.productNumber||"",e.appendChild(o);let n=document.createElement("td");n.textContent=t.resolved&&t.resolved.name?t.resolved.name:"",e.appendChild(n);let a=document.createElement("td");a.className="sqo-csv-modal__spec",a.textContent=t.resolved&&t.resolved.spezifikation?t.resolved.spezifikation:"",e.appendChild(a);let l=document.createElement("td");l.textContent=String(t.qty||1),e.appendChild(l),i.appendChild(e)}),e.appendChild(i),this._csvModalBody.appendChild(e),this._openCsvModal()}_openCsvModal(){this._csvModalEl&&(this._csvModalEl.classList.add("is-open"),this._csvModalEl.setAttribute("aria-hidden","false"),document.body.classList.add("sqo-modal-open"))}_closeCsvModal(){this._csvModalEl&&(this._csvModalEl.classList.remove("is-open"),this._csvModalEl.setAttribute("aria-hidden","true"),document.body.classList.remove("sqo-modal-open"),this._csvParseResult=null)}_applyCsvImport(){if(!Array.isArray(this._csvParseResult)){this._closeCsvModal();return}let t=new Map;this._rowsContainer.querySelectorAll("[data-sqo-row]").forEach(e=>{let s=e.querySelector("[data-sqo-product-number]"),r=s?s.value.trim():"";r&&!t.has(r)&&t.set(r,e)});let e=[];this._csvParseResult.forEach(s=>{let r=t.get(s.productNumber);if(r)this._mergeQtyIntoRow(r,s.qty||1);else{let r=this._addRow({productNumber:s.productNumber,qty:s.qty,resolved:s.resolved});r&&(e.push(r),t.set(s.productNumber,r))}}),this._reorderRowsAfterImport(e),this._closeCsvModal(),this._setStatus(this.options.snippets.csvApplied||"List imported.","success")}_reorderRowsAfterImport(t){let e=Array.from(this._rowsContainer.querySelectorAll("[data-sqo-row]")),s=new Set(t),r=[],i=[];e.forEach(t=>{if(s.has(t))return;let e=t.querySelector("[data-sqo-product-number]");e&&""!==e.value.trim()?r.push(t):i.push(t)}),[...r,...t,...i].forEach(t=>this._rowsContainer.appendChild(t))}_mergeQtyIntoRow(t,e){let s=t.querySelector("[data-sqo-qty]");if(!s)return;let r=(parseInt(s.value,10)||0)+(parseInt(e,10)||1),i=parseInt(t.dataset.sqoMinPurchase||"1",10),o=parseInt(t.dataset.sqoPurchaseSteps||"1",10);s.value=String(f(r,i,o))}async _exportCsv(){let t=this._collectRows();if(0===t.length){this._setStatus(this.options.snippets.emptyForm||"Nothing to export.","warning");return}let e=t.map(t=>({productNumber:t.productNumber,name:t.name,spezifikation:t.spezifikation,qty:t.qty}));try{let t=new FormData;t.append("rows",JSON.stringify(e));let s=await fetch(this.options.urls.csvExport,{method:"POST",credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"},body:t});if(!s.ok){this._setStatus(this.options.snippets.serverError||"Server error","danger");return}let r=await s.blob(),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=this._exportFilename(),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i),this._setStatus(this.options.snippets.csvExported||"CSV downloaded.","success")}catch(t){this._setStatus(this.options.snippets.networkError||"Network error","danger")}}_exportFilename(){let t=new Date,e=t=>String(t).padStart(2,"0");return"schmedt_quick-order_"+t.getFullYear()+e(t.getMonth()+1)+e(t.getDate())+"_"+e(t.getHours())+e(t.getMinutes())+e(t.getSeconds())+".csv"}_setStatus(t,e){if(!this._statusEl)return;if(this._statusEl.textContent="",!t){this._statusEl.classList.add("d-none");return}let s=["info","success","warning","danger"].includes(e)?e:"info",r=this.el.querySelector('template[data-sqo-alert-template="'+s+'"]');if(r&&r.content){let e=r.content.cloneNode(!0),s=e.querySelector(".alert-content");s?s.textContent=t:this._replacePlaceholder(e,t),this._statusEl.appendChild(e)}else{let e=document.createElement("div");e.className="alert alert-"+s,e.setAttribute("role","danger"===s?"alert":"status"),e.textContent=t,this._statusEl.appendChild(e)}this._statusEl.classList.remove("d-none")}_replacePlaceholder(t,e){let s;let r="__SQO_PLACEHOLDER__",i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;s=i.nextNode();)if(s.nodeValue&&s.nodeValue.includes(r)){s.nodeValue=s.nodeValue.replace(r,e);return}}}
1let y="schmedt-cms.productQuestion.error.generic",b=["name","company","email","phone","question","privacy"];class q extends a{static #t=this.options={submitUrl:"/schmedt/product-question/submit",modalId:""};init(){this._modal=this.options.modalId?document.getElementById(this.options.modalId):null,this._modal||(this._modal=this.el.querySelector(".schmedt-product-question-modal")),this._modal&&(this._form=this._modal.querySelector("[data-pq-form]"),this._form&&(this._submitBtn=this._form.querySelector("[data-pq-submit]"),this._globalError=this._modal.querySelector("[data-pq-global-error]"),this._success=this._modal.querySelector("[data-pq-success]"),this._snippets=this._readSnippets(),this._sending=!1,this._sent=!1,this._trigger=null,this._registerEvents()))}_readSnippets(){let t=this._modal.getAttribute("data-schmedt-product-question-snippets");if(!t)return{submit:"",submitting:"",errors:{}};try{let e=JSON.parse(t);return{submit:e.submit||"",submitting:e.submitting||"",errors:e.errors||{}}}catch(t){return{submit:"",submitting:"",errors:{}}}}_registerEvents(){this._collectTriggers().forEach(t=>{t.addEventListener("click",e=>{e.preventDefault(),this._open(t)})}),this._modal.addEventListener("show.bs.modal",t=>{t.relatedTarget&&(this._trigger=t.relatedTarget)}),this._modal.addEventListener("shown.bs.modal",()=>this._focusFirstField()),this._modal.addEventListener("hidden.bs.modal",()=>{this._trigger&&document.body.contains(this._trigger)&&this._trigger.focus()}),this._form.addEventListener("submit",t=>this._onSubmit(t))}_collectTriggers(){return this.el.matches("button, a")?[this.el]:Array.from(this.el.querySelectorAll("[data-schmedt-product-question-trigger]"))}_open(t){let e=window.bootstrap&&window.bootstrap.Modal?window.bootstrap.Modal:null;e&&(this._trigger=t,e.getOrCreateInstance(this._modal).show(t))}_focusFirstField(){let t=this._form.querySelector('input:not([type="hidden"]):not([tabindex="-1"]), textarea');t&&t.focus()}_onSubmit(t){t.preventDefault(),this._sending||this._sent||this._captchaPending()||this._send()}_captchaPending(){let t=this._form.querySelector('[data-validation="grecaptcha"]');return null!==t&&""===t.value.trim()}async _send(){this._sending=!0,this._clearErrors(),this._setSubmitting(!0);try{let t=await fetch(this._form.getAttribute("action")||this.options.submitUrl,{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"},body:new FormData(this._form)}),e=null;try{e=await t.json()}catch(t){e=null}if(t.ok&&e&&!0===e.success){this._renderSuccess();return}this._renderErrors(e&&e.errors?e.errors:{_global:y})}catch(t){this._renderErrors({_global:y})}finally{this._sending=!1,this._setSubmitting(!1)}}_setSubmitting(t){if(this._sent||!this._submitBtn)return;this._submitBtn.disabled=t;let e=t?this._snippets.submitting:this._snippets.submit;e&&(this._submitBtn.textContent=e)}_text(t){return this._snippets.errors[t]||this._snippets.errors[y]||""}_clearErrors(){this._form.querySelectorAll("[data-pq-error]").forEach(t=>{t.textContent="",t.classList.remove("is-visible")}),this._form.querySelectorAll(".is-invalid").forEach(t=>t.classList.remove("is-invalid")),this._globalError&&(this._globalError.textContent="",this._globalError.classList.add("d-none"))}_renderErrors(t){let e=null,s=[];Object.keys(t).forEach(r=>{let i=this._text(t[r]);if(-1===b.indexOf(r)){s.push(i);return}let o=this._form.querySelector('[data-pq-error="'+r+'"]');o&&(o.textContent=i,o.classList.add("is-visible"));let n=this._form.querySelector('[name="'+r+'"]');n&&(n.classList.add("is-invalid"),e||(e=n))}),s.length>0&&this._globalError&&(this._globalError.textContent=s.join(" "),this._globalError.classList.remove("d-none")),e?e.focus():this._globalError&&s.length>0&&this._globalError.scrollIntoView({block:"nearest"})}_renderSuccess(){this._sent=!0,this._form.querySelectorAll("input, textarea, select, button").forEach(t=>{t.disabled=!0}),this._globalError&&this._globalError.classList.add("d-none"),this._success&&(this._success.classList.remove("d-none"),this._success.focus(),this._success.scrollIntoView({block:"nearest"}))}}window.PluginManager.register("SchmedtHotspot",l,"[data-smhs-plugin]"),window.PluginManager.register("SchmedtQuickOrder",v,"[data-schmedt-quick-order]"),window.PluginManager.register("SchmedtProductQuestion",q,"[data-schmedt-product-question]")})();

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.