1(()=>{"use strict";var e={156:e=>{var t=function(e){var t;return!!e&&"object"==typeof e&&"[object RegExp]"!==(t=Object.prototype.toString.call(e))&&"[object Date]"!==t&&e.$$typeof!==i},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a(Array.isArray(e)?[]:{},e,t):e}function n(e,t,i){return e.concat(t).map(function(e){return r(e,i)})}function s(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[])}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,i,l){(l=l||{}).arrayMerge=l.arrayMerge||n,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=r;var c,u,h=Array.isArray(i);return h!==Array.isArray(e)?r(i,l):h?l.arrayMerge(e,i,l):(u={},(c=l).isMergeableObject(e)&&s(e).forEach(function(t){u[t]=r(e[t],c)}),s(i).forEach(function(t){(!o(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(o(e,t)&&c.isMergeableObject(i[t])?u[t]=(function(e,t){if(!t.customMerge)return a;var i=t.customMerge(e);return"function"==typeof i?i:a})(t,c)(e[t],i[t],c):u[t]=r(i[t],c))}),u)}a.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,i){return a(e,i,t)},{})},e.exports=a}},t={};function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r=i(156),n=i.n(r);class s{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,t){let i=s.toUpperCamelCase(e,t);return s.lcFirst(i)}static toUpperCamelCase(e,t){return t?e.split(t).map(e=>s.ucFirst(e.toLowerCase())).join(""):s.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}class o{constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}publish(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=new CustomEvent(e,{detail:t,cancelable:i});return this.el.dispatchEvent(r),r}subscribe(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this,n=e.split("."),s=i.scope?t.bind(i.scope):t;if(i.once&&!0===i.once){let t=s;s=function(i){r.unsubscribe(e),t(i)}}return this.el.addEventListener(n[0],s),this.listeners.push({splitEventName:n,opts:i,cb:s}),!0}unsubscribe(e){let t=e.split(".");return this.listeners=this.listeners.reduce((e,i)=>([...i.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(i.splitEventName[0],i.cb):e.push(i),e),[]),!0}reset(){return this.listeners.forEach(e=>{this.el.removeEventListener(e.splitEventName[0],e.cb)}),this.listeners=[],!0}get el(){return this._el}set el(e){this._el=e}get listeners(){return this._listeners}set listeners(e){this._listeners=e}}class a{constructor(e,t={},i=!1){if(!(e instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${i}".`);return}this.el=e,this.$emitter=new o(this.el),this._pluginName=this._getPluginName(i),this.options=this._mergeOptions(t),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(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){let t=[this.constructor.options,this.options,e];return t.push(this._getConfigFromDataAttribute()),t.push(this._getOptionsFromDataAttribute()),n().all(t.filter(e=>e instanceof Object&&!(e instanceof Array)).map(e=>e||{}))}_getConfigFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=s.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${t}-config`);return i?window.PluginConfigManager.get(this._pluginName,i):e}_getOptionsFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=s.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${t}-options`);if(i)try{return JSON.parse(i)}catch(e){console.error(`The data attribute "data-${t}-options" could not be parsed to json: ${e.message}`)}return e}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(e){return e||(e=this.constructor.name),e}}class l extends a{static #e=this.options={liveShoppingUrl:null,type:null,validFrom:null,validTill:null,startPrice
1:null,endPrice:null,timeUnitValue:null,currentPriceSelector:null,currentPercentageSelector:null,timerContainerSelector:null,stepTimerContainerSelector:null,progressBarContainerSelector:null,stockContainerSelector:null};init(){if(!this.options.validFrom||!this.options.validTill)return;let e=this.getLiveShopping();this.updateStock(e),this.registerTimer(),("countdown"===this.options.type||"impact"===this.options.type)&&(this.currentPriceContainer=this.el.querySelector(this.options.currentPriceSelector),this.currentPercentageSelector=this.el.querySelector(this.options.currentPercentageSelector),this.nextPriceTimerContainer=this.el.querySelector(this.options.stepTimerContainerSelector),this.registerNextPriceChangeTimer(),this.updatePrice())}registerTimer(){let e=this.el.querySelector(this.options.timerContainerSelector),t=new Date(this.options.validTill);this._createTimer(t,e,e=>{clearInterval(e),window.location.reload()})}registerNextPriceChangeTimer(){if(!this.nextPriceTimerContainer)return;let e=this._getUnixTimestamp(),t=this._getTimeUntilNextStep(),i=this._getDateFromUnixTimestamp(e+t),r=this.el.querySelector(this.options.progressBarContainerSelector),n=1e3*this.options.timeUnitValue;this._createTimer(i,this.nextPriceTimerContainer,e=>{clearInterval(e),this.updatePrice(),this.registerNextPriceChangeTimer()},r?e=>{r.style.width=e/n*100+"%"}:()=>{})}updatePrice(){let e,t;if(!this.currentPriceContainer&&!this.currentPercentageSelector)return;let i=this._getNumOfSteps(),r=this._getPriceStep(),n=this._getNumOfStepsPassed();"countdown"===this.options.type?(e=n,t=this.options.startPrice-r*e):"impact"===this.options.type?(e=i-n,t=this.options.startPrice-r*e):t=this.options.endPrice;let s=(1-t/this.options.startPrice)*100;this.currentPriceContainer&&(this.currentPriceContainer.innerHTML=parseFloat(t).toFixed(2)),this.currentPercentageSelector&&(this.currentPercentageSelector.innerHTML="−"+Math.round(parseFloat(s))+"%")}updateStock(e){let t=this.el.querySelector(this.options.stockContainerSelector);t&&e&&(e.available_stock>0?t.innerHTML=e.available_stock:t.innerHTML=0)}_createTimer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>{};if(!t)return;let n=e.getTime(),s=setInterval(()=>{let e=n-new Date().getTime();r(e),e<0&&i(s);let o=Math.floor(e/864e5),a=Math.floor(e%864e5/36e5),l=Math.floor(e%36e5/6e4),c=Math.floor(e%6e4/1e3);t.innerHTML=(o>0?o+"d ":"")+(o>0||a>0?a+"h ":"")+(a>0||l>0?l+"m ":"")+(c>0?c:0)+"s "},1e3)}getLiveShopping(){if(!this.options.liveShoppingUrl)return null;let e=new XMLHttpRequest;try{e.open("GET",this.options.liveShoppingUrl,!1),e.setRequestHeader("X-Robots-Tag","noindex, nofollow"),e.send()}catch(e){return console.error(e),null}if(200!==e.status)return null;try{return JSON.parse(e.responseText)}catch(e){return console.error(e),null}}_getTimePassedSinceStart(){let e=this._getUnixTimestamp(this.options.validFrom);return this._getUnixTimestamp()-e}_getNumOfSteps(){return(this._getUnixTimestamp(this.options.validTill)-this._getUnixTimestamp(this.options.validFrom))/this.options.timeUnitValue}_getTimeBetweenSteps(){let e=this._getUnixTimestamp(this.options.validFrom);return(this._getUnixTimestamp(this.options.validTill)-e)/this._getNumOfSteps()}_getNumOfStepsPassed(){return Math.floor(this._getTimePassedSinceStart()/this._getTimeBetweenSteps())}_getTimeUntilNextStep(){let e=this._getTimePassedSinceStart(),t=this._getTimeBetweenSteps();return t-(e-this._getNumOfStepsPassed()*t)}_getPriceStep(){let e=this._getNumOfSteps();return(this.options.startPrice-this.options.endPrice)/e}_getUnixTimestamp(e){return Math.floor((e=e?new Date(e):new Date).getTime()/1e3)}_getDateFromUnixTimestamp(e){return new Date(1e3*e)}}window.PluginManager.register("DiztechLiveShoppingPlugin",l,"[data-diztech-live-shopping-plugin]")})();
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.