PageSourceSearch

https://www.interlaken.swiss/dist/js/background-focus-DyLH06_S.js

js interlaken.swiss collected 2026-09-25 00:14:43 UTC 2,763 bytes, 1 lines download raw bytes

1import{n as e}from"./debounce-B316v5qs.js";var t=class t{constructor(e,t,n=!1){this.container=e,this.options=t,this.isFixed=!1,this.boundingClientRect=null,this.immediately=n,this.initialize()}static observe(n,r,i=!1){if(!n||!r||getComputedStyle(n).backgroundSize!==`cover`||t.observables.has(n))return;let a=new this(n,r,i);return t.observables.set(n,a),t.observer.observe(n),t.observes||(t.observes=!0,window.addEventListener(`resize`,e.debounce(()=>{for(let e=0;e<t.observables.length;e++)t.observables.forEach(e=>{e.updateFocusAreaByMediaCondition(),e.updateContainerBackgroundPosition()})},500))),a}static createObserver(){return window.ResizeObserver?new ResizeObserver(e=>{for(let n of e){let e=t.observables.get(n.target);e.updateFocusAreaByMediaCondition(),e.updateContainerBackgroundPosition()}}):!1}initialize(){document.readyState===`interactive`||document.readyState===`complete`||document.readyState===`loaded`?(this.updateFocusAreaByMediaCondition(),this.updateContainerBackgroundPosition()):(this.immediately&&(this.updateFocusAreaByMediaCondition(),this.updateContainerBackgroundPosition()),document.addEventListener(`readystatechange`,()=>{(document.readyState===`interactive`||document.readyState===`complete`||document.readyState===`loaded`)&&(this.updateFocusAreaByMediaCondition(),this.updateContainerBackgroundPosition())}))}updateContainerBackgroundPosition(){this.isFixed=getComputedStyle(this.container).backgroundAttachment===`fixed`,this.boundingClientRect=this.container.getBoundingClientRect();let e=this.getContainerBounds(),t=this.calcBackgroundImageCoverSize(e,this.focusArea.iw,this.focusArea.ih),n=this.isFixed?Math.floor(this.boundingClientRect.left):0,r=(t.width-e.width)*-1,i=(t.height-e.height)*-1,a={x:t.width*this.focusArea.x*-1-t.width*this.focusArea.fw/2+e.width/2,y:t.height*this.focusArea.y*-1-t.height*this.focusArea.fh/2+e.height/2};a.x=this.range(a.x,r,n),a.y=this.range(a.y,i,0),this.container.style.backgroundPosition=a.x+`px `+a.y+`px`}getContainerBounds(){return this.isFixed?{width:window.innerWidth,height:window.innerHeight}:this.boundingClientRect}range(e,t,n){return e<t?t:e>n?n:e}calcBackgroundImageCoverSize(e,t,n){let r=[],i=this.isFixed?window.innerWidth:e.width,a=this.isFixed?window.innerHeight:e.height;return 100/i*(i-t)*-1<100/a*(a-n)*-1?(r.width=i,r.height=n-n/t*((i-t)*-1)):(r.height=a,r.width=t-t/n*((a-n)*-1)),r}updateFocusAreaByMediaCondition(){this.focusArea=!1;for(let e in this.options)if(Object.prototype.hasOwnProperty.call(this.options,e)){let t=window.matchMedia(e);if((t&&t.matches||e==="default")&&(this.focusArea=this.options[e],e!=="default"))break}return this.focusArea}};t.observer=t.createObserver(),t.observes=!!t.observer,t.observables=new Map,t.resizeObserver=null;export{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.