PageSourceSearch

https://www.vpg.no/theme/e7e504e72abb9df9195fdd685a5b9063/js/moorl…l-foundation.filter-radius.plugin.e64655.js

js vpg.no collected 2026-09-25 19:44:19 UTC 10,441 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[62245],{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!==i},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function s(t,e){return!1!==e.clone&&e.isMergeableObject(t)?a(Array.isArray(t)?[]:{},t,e):t}function n(t,e,i){return t.concat(e).map(function(t){return s(t,i)})}function r(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function o(t,e){try{return e in t}catch(t){return!1}}function a(t,i,l){(l=l||{}).arrayMerge=l.arrayMerge||n,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=s;var u,c,h=Array.isArray(i);return h!==Array.isArray(t)?s(i,l):h?l.arrayMerge(t,i,l):(c={},(u=l).isMergeableObject(t)&&r(t).forEach(function(e){c[e]=s(t[e],u)}),r(i).forEach(function(e){(!o(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(o(t,e)&&u.isMergeableObject(i[e])?c[e]=(function(t,e){if(!e.customMerge)return a;var i=e.customMerge(t);return"function"==typeof i?i:a})(e,u)(t[e],i[e],u):c[e]=s(i[e],u))}),c)}a.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,i){return a(t,i,e)},{})},t.exports=a},245(t,e,i){i.r(e),i.d(e,{default:()=>a});var s=i(701),n=i(156),r=i.n(n),o=i(452);class a extends s.A{static #t=this.options=r()(s.A.options,{inputLocationSelector:".location",inputDistanceSelector:".distance",inputPersistSelector:".radius-persist",inputInvalidCLass:"is-invalid",inputTimeout:1e3,locationKey:"location",distanceKey:"distance",persistKey:"radius-persist",errorContainerClass:"filter-radius-error",containerSelector:".filter-radius-container",defaultValue:null,filterRadiusPersist:!1,snippets:{filterRadiusActiveLocationLabel:"",filterRadiusActiveDistanceLabel:"",filterRadiusErrorMessage:""}});init(){this._container=this.el.querySelector(this.options.containerSelector),this._inputLocation=this.el.querySelector(this.options.inputLocationSelector),this._inputDistance=this.el.querySelector(this.options.inputDistanceSelector),this.options.filterRadiusPersist&&(this._inputPersist=this.el.querySelector(this.options.inputPersistSelector)),this._timeout=null,this._hasError=!1,this.options.defaultValue&&(this._inputDistance.value=this.options.defaultValue),this._registerEvents(),this._setValuesFromCookie()}_registerEvents(){this._inputLocation.addEventListener("input",this._onChangeInput.bind(this)),this._inputDistance.addEventListener("input",this._onChangeInput.bind(this)),this.options.filterRadiusPersist&&this._inputPersist.addEventListener("change",this._onChangeInput.bind(this))}_onChangeInput(){clearTimeout(this._timeout),this._timeout=setTimeout(()=>{this._isInputInvalid()?this._setError():(this._removeError(),this.listing.changeListing())},this.options.inputTimeout)}getValues(){let t={};return t[this.options.locationKey]=this._inputLocation.value,t[this.options.distanceKey]=this._inputDistance.value,this.options.filterRadiusPersist&&(t[this.options.persistKey]=!!this._inputPersist.checked),t}_isInputInvalid(){let t=this._inputLocation.value.length<3,e=0===this._inputDistance.value.length;return t||e}_getErrorMessageTemplate(){return`<div class="${this.options.errorContainerClass}">${this.options.snippets.filterRadiusErrorMessage}</div>`}_setError(){this._hasError||(this._inputLocation.classList.add(this.options.inputInvalidCLass),this._inputDistance.classList.add(this.options.inputInvalidCLass),this._container.insertAdjacentHTML("afterend",this._getErrorMessageTemplate()),this._hasError=!0)}_removeError(){this._inputLocation.classList.remove(this.options.inputInvalidCLass),this._inputDistance.classList.remove(this.options.inputInvalidCLass);let t=this.el.querySelector(`.${this.options.errorContainerClass}`);t&&t.remove(),this._hasError=!1}_setValuesFromCookie(){try{let t=o.A.getItem(this.options.persistKey);if(this.options.filterRadiusPersist&&t){let e=JSON.parse(decodeURIComponent(t));this._inputLocation.value=e[this.options.locationKey],this._inputDistance.value=e[this.options.distanceKey],this._inputPersist.checked=!0,this._onChangeInput()}}catch(t){}}setValuesFromUrl(t){let e=!1;return Object.keys(t).forEach(i=>
1{i===this.options.locationKey&&(this._inputLocation.value=t[i],e=!0),i===this.options.distanceKey&&(this._inputDistance.value=t[i],e=!0),this.options.filterRadiusPersist&&i===this.options.persistKey&&(this._inputPersist.checked=t[i],e=!0)}),e}getLabels(){let t=[];return this._inputLocation.value.length&&this._inputDistance.value.length?this._inputLocation.value.length&&t.push({label:`${this._inputDistance.value}${this.options.snippets.filterRadiusActiveDistanceLabel} ${this.options.snippets.filterRadiusActiveLocationLabel} "${this._inputLocation.value}"`,id:this.options.locationKey}):t=[],t}reset(t){t===this.options.locationKey&&(this._inputLocation.value=""),t===this.options.distanceKey&&(this._inputDistance.value=""),this.options.filterRadiusPersist&&t===this.options.persistKey&&(this._inputPersist.checked=!1),this._removeError()}resetAll(){this._inputLocation.value="",this._inputDistance.value="",this.options.filterRadiusPersist&&(this._inputPersist.checked=!1),this._removeError()}}},308(t,e,i){i.d(e,{A:()=>s});class s{constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=new CustomEvent(t,{detail:e,cancelable:i});return this.el.dispatchEvent(s),s}subscribe(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=this,n=t.split("."),r=i.scope?e.bind(i.scope):e;if(i.once&&!0===i.once){let e=r;r=function(i){s.unsubscribe(t),e(i)}}return this.el.addEventListener(n[0],r),this.listeners.push({splitEventName:n,opts:i,cb:r}),!0}unsubscribe(t){let e=t.split(".");return this.listeners=this.listeners.reduce((t,i)=>([...i.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(i.splitEventName[0],i.cb):t.push(i),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}}},335(t,e,i){i.d(e,{A:()=>a});var s=i(156),n=i.n(s);class r{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 i=r.toUpperCamelCase(t,e);return r.lcFirst(i)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>r.ucFirst(t.toLowerCase())).join(""):r.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}var o=i(308);class a{constructor(t,e={},i=!1){if(!(t instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${i}".`);return}this.el=t,this.$emitter=new o.A(this.el),this._pluginName=this._getPluginName(i),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(){}_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()),n().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=r.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${e}-config`);return i?window.PluginConfigManager.get(this._pluginName,i):t}_getOptionsFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=r.toDashCase(this._pluginName),i=this.el.getAttribute(`data-${e}-options`);if(i)try{return JSON.parse(i)}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}}},452(t,e,i){i.d(e,{A:()=>s});class s{static isSupported(){return"undefined"!==document.cookie}static setItem(t,e,i){if(null==t)throw Error("You must specify a key to set a cookie");let s=new Date;s.setTime(s.getTime()+864e5*i);let n="";"https:"===location.protocol&&(n="secure"),document.cookie=`${t}=${e};expires=${s.toUTCString()};path=/;sameSite=lax;${n}`}static getItem(t){if(!t)return!1;let e=t+"=",i=document.cookie.split(";");for(let t=0;t<i.length;t++){let s=i[t];for(;" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(e))return s.substring(e.length,s.length)}return!1}static removeItem(t){document.cookie=`${t}= ; expires = Thu, 01 Jan 1970 00:00:00 GMT;path=/`}static key(){return""}static clear(){}}}
1,701(t,e,i){i.d(e,{A:()=>n});var s=i(335);class n extends s.A{static #t=this.options={parentFilterPanelSelector:".cms-element-product-listing-wrapper",dropdownSelector:".filter-panel-item-dropdown"};_init(){super._init(),this._validateMethods();let t=document.querySelector(this.options.parentFilterPanelSelector);this.listing=window.PluginManager.getPluginInstanceFromElement(t,"Listing"),this.listing.registerFilter(this),this._preventDropdownClose()}_preventDropdownClose(){let t=this.el.querySelector(this.options.dropdownSelector);t&&t.addEventListener("click",t=>{t.stopPropagation()})}_validateMethods(){if("function"!=typeof this.getValues)throw Error(`[${this._pluginName}] Needs the method "getValues"'`);if("function"!=typeof this.getLabels)throw Error(`[${this._pluginName}] Needs the method "getLabels"'`);if("function"!=typeof this.reset)throw Error(`[${this._pluginName}] Needs the method "reset"'`);if("function"!=typeof this.resetAll)throw Error(`[${this._pluginName}] Needs the method "resetAll"'`)}}}}]);

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.