"use strict";(self.webpackChunkutsuwa=self.webpackChunkutsuwa||[]).push([[62],{718:function(t,i,e){function n(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),n=1;n<i;n++)e[n-1]=arguments[n];return e.forEach(function(i){return Object.keys(i).forEach(function(e){return t[e]=i[e]})}),t}e.r(i),e.d(i,{default:function(){return c}});var s={position:"relative",overflow:"hidden"},o={position:"absolute",top:"0",right:"0",bottom:"0",left:"0"},r={minHeight:"100%",minWidth:"100%"},a={height:"100%",width:"100%",border:"none",opacity:0,zIndex:-1,pointerEvents:"none"},h={debounceTime:17,updateOnWindowResize:!0,updateOnContainerResize:!1,containerPosition:"relative"},u=function(){function t(t,i){var e,a,u,c=this;void 0===i&&(i={}),this.imageNode=t,this.listening=!1,this.setFocus=function(t){c.focus=t,c.img.setAttribute("data-focus-x",t.x.toString()),c.img.setAttribute("data-focus-y",t.y.toString()),c.applyShift()},this.applyShift=function(){var t=c.img,i=t.naturalWidth,e=t.naturalHeight,n=c.container.getBoundingClientRect(),s=n.width,o=n.height,r="0",a="0";if(!(s>0&&o>0&&i>0&&e>0))return!1;var h=i/s,u=e/o;c.img.style.maxHeight=null,c.img.style.maxWidth=null,i>s&&e>o&&(c.img.style[h>u?"maxHeight":"maxWidth"]="100%"),h>u?r=c.calcShift(u,s,i,c.focus.x)+"%":h<u&&(a=c.calcShift(h,o,e,c.focus.y,!0)+"%"),c.img.style.top=a,c.img.style.left=r},this.options=n(h,i),this.img=t,this.container=t.parentElement,this.img.__focused_image_instance__&&(this.img.__focused_image_instance__.stopListening(),this.img.removeEventListener("load",this.applyShift)),this.img.__focused_image_instance__=this,this.img.addEventListener("load",this.applyShift),n(this.container.style,s),this.container.style.position=this.options.containerPosition,n(this.img.style,r,o),this.debounceApplyShift=(e=this.applyShift,a=this.options.debounceTime,function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];clearTimeout(u),u=setTimeout(function(){return e.apply(void 0,i)},a)}),this.focus=this.options.focus?this.options.focus:{x:parseFloat(this.img.getAttribute("data-focus-x"))||0,y:parseFloat(this.img.getAttribute("data-focus-y"))||0},this.startListening(),this.setFocus(this.focus)}var i=t.prototype;return i.startListening=function(){var t=this;if(!this.listening&&(this.listening=!0,this.options.updateOnWindowResize&&window.addEventListener("resize",this.debounceApplyShift),this.options.updateOnContainerResize)){var i=document.createElement("object");n(i.style,a,o),i.addEventListener("load",function(e){return i.contentDocument.defaultView.addEventListener("resize",function(){return t.debounceApplyShift()})}),i.type="text/html",i.setAttribute("aria-hidden","true"),i.tabIndex=-1,this.container.appendChild(i),i.data="about:blank",this.resizeListenerObject=i}},i.stopListening=function(){this.listening&&(this.listening=!1,window.removeEventListener("resize",this.debounceApplyShift),this.resizeListenerObject&&this.resizeListenerObject.contentDocument&&(this.resizeListenerObject.contentDocument.defaultView.removeEventListener("resize",this.debounceApplyShift),this.container.removeChild(this.resizeListenerObject),this.resizeListenerObject=null))},i.calcShift=function(t,i,e,n,s){var o=Math.floor(i/2),r=(n+1)/2,a=Math.floor(e/t),h=Math.floor(r*a);s&&(h=a-h);var u=h-o,c=a-h,l=i-o;return c<l&&(u-=l-c),u<0&&(u=0),-100*u/i},t}(),c=function(t){t.style.visibility="visible",new u(t)}}}]);