1 line
32 KiB
Plaintext
1 line
32 KiB
Plaintext
var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__assign,Multimedia,ImageDetailSwipe;(function(n){var t;(function(t){var e=n.ImageDetailUtils.setCropBoxAnimationProperty,o=n.ImageDetailUtils.isRTL,s=n.ImageDetailUtils.calculateRegionDifference,f=n.ImageDetailUtils.isHomeworkModule,i=ImageDetailReducers,u="undefined",r=null,h=function(h){function c(t){var e=this,c,a,l;return e=h.call(this,t)||this,e.px="px",e.startAnimationClassName="start",e.endAnimationClassName="end",e.readyAnimationClassName="ready",e.cropboxHintShown="mm.detail.crophint",e.cropBoxContentAnimationTime=1e3,e.cropBoxHintAnimationTime=3500,e.lastCropCoordinates=null,e.cropBoxAnimationTime=null,e.shouldShowHint=!1,e.isCropping=!1,e.multiTouchMove=!1,e.containerHeight=null,e.containerWidth=null,e.hint=null,e.cropConfig=null,e.hasTouchStartTriggered=!1,e.enableLiveView=null,e.debounceDelay=100,e.cropboxArrowMovementStep=15,e.enableMobileView=i===null||i===void 0?void 0:i.isMobileViewEnabled(),e.overlayClassName="overlayView",e.enableCropBoxWithTextMode=!!((c=i.gpc())===null||c===void 0?void 0:c.ectm),e.isHotspotClickToNewWindow=!1,e._mouseDownPosition=null,e._mouseMoved=!1,e.componentWillUnmount=function(){e.setSessionStorage();e.handleEventsSetting(!1)},e.componentDidUpdate=function(n){if(e.enableCropBoxWithTextMode){var t=e.showCropBox(e.props),i=e.showCropBox(n);t&&!i&&(e.reinitializeCropBox(),e.handleCropBoxAnimationAndUpdate())}},e.showCropBox=function(n){var t=e.cropConfig.mdlhcpbx;return n&&(!t||t.indexOf(n.selectedModule)===-1)&&!n.isTextSelected},e.isSessionStorageEnabled=function(){var n=!1;try{n="object"==typeof _w.sessionStorage}catch(t){}return n},e.setSessionStorage=function(){e.shouldShowHint&&e.isSessionStorageEnabled()&&(sessionStorage.setItem(e.cropboxHintShown,"1"),e.shouldShowHint=!1)},e.getViewRect=function(){if(!e.imageElement||!r)return null;var n=e.imageElement.clientLeft,t=e.imageElement.clientTop,i=Math.min(e.imageElement.clientWidth,e.containerWidth),u=Math.min(e.imageElement.clientHeight,e.containerHeight),f={x:n,y:t},o={x:n+i,y:t+u};return new r(f,o)},e.getCropRect=function(n){if(!e.imageElement||!r)return null;var o=e.imageElement.clientLeft,s=e.imageElement.clientTop,t=Math.min(e.imageElement.clientWidth,e.containerWidth),i=Math.min(e.imageElement.clientHeight,e.containerHeight),u=o+Math.round(t*n.left()),f=s+Math.round(i*n.top()),h=u+Math.round(t*n.width()),c=f+Math.round(i*n.height()),l={x:u,y:f},a={x:h,y:c};return new r(l,a)},e.start=function(n){e.overlayView!=null&&(e.startCropRect=e.overlayView.cropRect().clone(),e.overlayView.setStartPoint(n))},e.move=function(n){e.overlayView!=null&&e.startCropRect!=null&&(e.overlayView.setCurrPoint(n),e.overlayView.setCropRect(e.startCropRect.clone()),e.overlayView.update(),e.updateCropBoxStyle())},e.end=function(){e.throttleCropBoxChange()},e.cropBoxChange=function(){var n=e.getCropCoordinates(),t;n==null||e.isTinyChange(e.lastCropCoordinates,n)||(t={left:n.left(),top:n.top(),right:n.right(),bottom:n.bottom()},e.lastCropCoordinates=n,e.props.changeCropCoordinates(t))},e.setCropBoxState=function(n,t){r&&(e.startCropRect=new r(n,t),e.overlayView.setCropRect(e.startCropRect),e.overlayView.setStartPoint(n),e.overlayView.setCurrPoint(n),e.overlayView.update(),e.updateCropBoxStyle())},e.updateCropBoxStyle=function(){if(e.overlayView!=null){var n=e.overlayView.cropRect();e.update(n)}},e.getCropCoordinates=function(){var i,t,n,u,f;return e.overlayView==null||!r||(t=e.overlayView.cropRect(),n=e.overlayView.viewRect(),(n===null||n===void 0?void 0:n.width())>0&&(n===null||n===void 0?void 0:n.height())>0&&(u={x:t.left()/n.width(),y:t.top()/n.height()},f={x:t.right()/n.width(),y:t.bottom()/n.height()},i=new r(u,f))),i},e.isTinyChange=function(n,t){if(e.overlayView!=null&&e.overlayView.cropRect()!=null&&e.overlayView.cropRect().width()<=e.config.minDelta&&e.overlayView.cropRect().height()<=e.config.minDelta)return!0;if(n&&t){var i=s(n.transformToRegion(),t.transformToRegion());if(i<e.config.minDelta)return!0}return!1},e.throttle=function(n,t){var i,r;return function(){clearTimeout(r);var f=this,e=arguments,u=Number(new Date);i&&u<i+t?r=setTimeout(function(){i=u;n.apply(f,e)},i+t-u):(i=u,n.apply(f,e))}},e.cancelAnimation=function(n){n&&(n.classList.remove(e.startAnimationClassName),n.classList.add(e.endAnimationClassName))},e.startAnimation=function(n){n&&(n.classList.add(e.readyAnimationClassName),e.isAnimationEnabled()&&n.classList.add(e.startAnimationClassName))},e.endAnimation=function(n,t){if(n){var i=e.cancelAnimation;e.isAnimationEnabled()?setTimeout(function(){i(n)},t):e.cancelAnimation(n)}},e.setAnimations=function(){e.startAnimation(e.cropBox);e.startAnimation(e.cropBoxContent);e.startAnimation(e.cropBoxHint);e.endAnimation(e.cropBox,e.cropBoxAnimationTime);e.endAnimation(e.cropBoxContent,e.cropBoxContentAnimationTime);e.endAnimation(e.cropBoxHint,e.cropBoxHintAnimationTime)},e.update=function(n){var i,r;if(e.cropBox&&n){var s=n.top(),u=n.left(),h=n.height(),f=n.width();if(o){var t=(i=e.overlayView)===null||i===void 0?void 0:i.viewRect(),c=t?t.left():0,l=t?t.width():e.containerWidth||((r=e.cropBox.parentElement)===null||r===void 0?void 0:r.clientWidth)||0,a=u-c,v=Math.round(Math.max(0,l-(a+f)));e.cropBox.style.left="";e.cropBox.style.right=v+e.px}else e.cropBox.style.left=u+e.px;e.cropBox.style.top=s+e.px;e.cropBox.style.width=f+e.px;e.cropBox.style.height=h+e.px;e.ImageCropBoxPin&&e.ImageCropBoxPin.setStyle(s,u,h,f)}},e.getOffsetPosition=function(n,t,i){var r=n===null||n===void 0?void 0:n.getBoundingClientRect(),u=t-(r===null||r===void 0?void 0:r.left),f=i-(r===null||r===void 0?void 0:r.top);return{x:u,y:f}},e.getTouchPosition=function(n,t){return n&&n.touches?e.getOffsetPosition(e.imageElement,n.touches[t].clientX,n.touches[t].clientY):null},e.getMousePosition=function(n){return e.getOffsetPosition(e.imageElement,n.clientX,n.clientY)},e.onTouchStart=function(n){if(e.hasTouchStartTriggered=!0,n&&n.touches)e.isCropping=!0,e.start(e.getTouchPosition(n,0)),e.config.enableMinSizeForCropBox&&e.storeMouseDownPosition(e.getTouchPosition(n,0));else e.onMouseDown(n);e.props.hasSegmentation&&e.props.dispatchEventToSegmentation(n);e.enableLiveView&&e.props.changeInsightsScrollPosition()},e.onMouseDown=function(n){if(e.isPositionWithinBoundary(e.imageElement,n.clientX,n.clientY)){e.isCropping=!0;var t=e.getMousePosition(n);e.config.enableMinSizeForCropBox&&e.storeMouseDownPosition(t);e.start(t)}e.props.hasSegmentation&&e.props.dispatchEventToSegmentation(n)},e.onTouchMove=function(n){var i,r,u,t,o;if(n&&n.touches)t=e.getTouchPosition(n,0),e.config.enableMinSizeForCropBox&&e.hasMouseMoved(t)&&(e._mouseMoved=!0),e.config.enableMultiTouchRedraw&&n.touches.length>=2?(e.multiTouchMove=!0,o=e.getTouchPosition(n,1),e.setCropBoxState(t,o),e.ensureCropBoxVisible(),e.stopPropagation(n)):!e.multiTouchMove&&e.overlayView.isTransforming()?((u=(r=(i=e.hwcrop)===null||i===void 0?void 0:i.crtMinCrp)===null||r===void 0?void 0:r.call(i,e.overlayView,t,e.ensureMinimalCropBoxAt.bind(e)))!==null&&u!==void 0?u:e.move(t),e.ensureCropBoxVisible(),e.stopPropagation(n)):f(e.props)&&e.ensureMinimalCropBoxAt(t);else e.onMouseMove(n)},e.onMouseMove=function(t){var r,u,f,i;e.isCropping?(i=e.getMousePosition(t),e.config.enableMinSizeForCropBox&&e.hasMouseMoved(i)&&(e._mouseMoved=!0),e.overlayView.isTransforming()?((f=(u=(r=e.hwcrop)===null||r===void 0?void 0:r.crtMinCrp)===null||u===void 0?void 0:u.call(r,e.overlayView,i,e.ensureMinimalCropBoxAt.bind(e)))!==null&&f!==void 0?f:e.move(i),e.ensureCropBoxVisible()):e.config.enableMouseRedraw&&e.ensureMinimalCropBoxAt(i),e.props.inTextMode&&e.debouncedOCRIntersectionsChangeHandler(n.TextRecognitionUtils.getSelectedArea(e.overlayView.cropRect(),e.overlayView.viewRect())),e.stopPropagation(t)):e.props.hasSegmentation&&e.props.dispatchEventToSegmentation(t)},e.onTouchEnd=function(n){if(n&&n.touches)e.config.enableMinSizeForCropBox&&e.sizeCropboxOnClick(),e.end(),e.config.enableMinSizeForCropBox&&e.clearMouseDownPosition(),n.touches.length===0&&(e.multiTouchMove=!1),e.stopPropagation(n);else e.onMouseUp(n);e.hasTouchStartTriggered=!1},e.onDocumentTouchEnd=function(n){if(e.hasTouchStartTriggered)e.onTouchEnd(n)},e.onMouseUp=function(){if(e.isCropping=!1,typeof _w!="undefined"){var n=_w.getSelection();n&&n.type=="Range"&&n.removeAllRanges()}e.config.enableMinSizeForCropBox&&e.sizeCropboxOnClick();e.overlayView.verifyMinimumSize();e.end();e.config.enableMinSizeForCropBox&&e.clearMouseDownPosition()},e.isPositionWithinBoundary=function(n,t,i){var r=n.getBoundingClientRect();return t<r.left||t>r.right||i<r.top||i>r.bottom?!1:!0},e.isPositionInRectangle=function(n){var t=e.overlayView.cropRect();return n.x>=t.left()&&n.x<=t.left()+t.width()&&n.y>=t.top()&&n.y<=t.top()+t.height()},e.storeMouseDownPosition=function(n){e._mouseDownPosition=n;e._mouseMoved=!1},e.clearMouseDownPosition=function(){e._mouseDownPosition=null;e._mouseMoved=!1},e.hasMouseMoved=function(n){return e._mouseDownPosition&&(Math.abs(n.x-e._mouseDownPosition.x)>1||Math.abs(n.y-e._mouseDownPosition.y)>1)},e.sizeCropboxOnClick=function(){var t=e.overlayView.cropRect(),h=t.top(),c=t.left(),l=t.width(),a=t.height(),g=l<e.config.minWidth||a<e.config.minHeight,n=e.getViewRect(),s,y,p;if(e._mouseDownPosition&&!e._mouseMoved){if(!e.isPositionInRectangle(e._mouseDownPosition)){var v=e._mouseDownPosition,i=v.x,u=v.y,f=e.config.minWidth,o=e.config.minHeight;n&&(e.config.enableMinSizeForCropBoxBasedOnImageSize&&(s=Math.min(n.width(),n.height())/2,f=Math.max(e.config.minWidth,s),o=Math.max(e.config.minHeight,s)),i+f>n.right()&&(i=n.right()-f),u+o>n.bottom()&&(u=n.bottom()-o));y={x:i,y:u};p={x:i+f,y:u+o};e.setCropBoxState(y,p)}}else if(e.overlayView&&e.overlayView.cropRect()&&g){var w=Math.max(l,e.config.minWidth),b=Math.max(a,e.config.minHeight),k=n?Math.min(n.right()-w,c):c,d=n?Math.min(n.bottom()-b,h):h,nt=new r({x:k,y:d},{x:k+w,y:d+b});e.overlayView.setCropRect(nt);e.updateCropBoxStyle()}},e.handleEventsSetting=function(n){var i,r,f,o,s,h,c,l,t=n?sj_be:sj_ue,a=typeof sb_de!==u;typeof t!==u&&(a&&"ontouchstart"in sb_de?(t(e.imageElement,"touchstart",e.onTouchStart,!0),t(e.imageElement,"touchmove",e.onTouchMove,!0),t(e.imageElement,"touchend",e.onTouchEnd,!0)):window.navigator.msPointerEnabled?((r=(i=e.imageElement)===null||i===void 0?void 0:i.style)===null||r===void 0?void 0:r.msTouchAction="none",((o=(f=e.imageElement)===null||f===void 0?void 0:f.style)===null||o===void 0?void 0:o.touchAction)&&(e.imageElement.style.touchAction="none"),t(e.imageElement,"MSPointerDown",e.onTouchStart,!0),t(e.imageElement,"MSPointerMove",e.onTouchMove,!0),t(e.imageElement,"MSPointerUp",e.onTouchEnd,!0),t(_d,"MSPointerUp",e.onDocumentTouchEnd,!0)):a&&"onpointermove"in sb_de&&((h=(s=e.imageElement)===null||s===void 0?void 0:s.style)===null||h===void 0?void 0:h.msTouchAction="none",((l=(c=e.imageElement)===null||c===void 0?void 0:c.style)===null||l===void 0?void 0:l.touchAction)&&(e.imageElement.style.touchAction="none"),t(e.imageElement,"pointerdown",e.onTouchStart,!0),t(e.imageElement,"pointermove",e.onTouchMove,!0),t(e.imageElement,"pointerup",e.onTouchEnd,!0),t(_d,"pointerup",e.onDocumentTouchEnd,!0)),t(e.imageElement,"mousedown",e.onMouseDown,!0),t(e.imageElement,"mousemove",e.onMouseMove,!0),t(e.imageElement,"mouseup",e.onMouseUp,!0))},e.handleKeyPress_leftTop=function(n){var t=e.overlayView.cropRect(),i={x:t.left(),y:t.top()};e.handleKeyPress(n,i)},e.handleKeyPress_rightTop=function(n){var t=e.overlayView.cropRect(),i={x:t.right(),y:t.top()};e.handleKeyPress(n,i)},e.handleKeyPress_leftBottom=function(n){var t=e.overlayView.cropRect(),i={x:t.left(),y:t.bottom()};e.handleKeyPress(n,i)},e.handleKeyPress_rightBottom=function(n){var t=e.overlayView.cropRect(),i={x:t.right(),y:t.bottom()};e.handleKeyPress(n,i)},e.handleKeyPress=function(n,t){var i=Object.assign({},t),r=!1;switch(n.keyCode){case 37:i.x-=e.cropboxArrowMovementStep;r=!0;break;case 39:i.x+=e.cropboxArrowMovementStep;r=!0;break;case 38:i.y-=e.cropboxArrowMovementStep;r=!0;break;case 40:i.y+=e.cropboxArrowMovementStep;r=!0}r&&(e.start(t),e.move(t),e.move(i),e.end(),e.stopPropagation(n))},e.isHotspotClickToNewWindow=((l=(a=n.ImageDetailUtils).ihpctnw)===null||l===void 0?void 0:l.call(a))||!1,r=typeof MmGeometry!==u?MmGeometry.Rectangle:null,e.enableLiveView=typeof i.ilv!="undefined"?i.ilv():!1,e.cropConfig=i.getCropConfig(),e.shouldShowHint=!e.cropConfig.eft&&e.isSessionStorageEnabled()&&sessionStorage.getItem(e.cropboxHintShown)!=="1",e.hint=e.cropConfig.hnt,e.debouncedOCRIntersectionsChangeHandler=n.ImageDetailUtils.debounce(e.props.changeIntersectedOCRRegions,e.debounceDelay),e}return __extends(c,h),c.prototype.componentWillMount=function(){this.props&&(this.config=new ImageVisualSearchCropBox.CropBoxClientConfig(this.cropConfig),this.isCropping=this.props.isDirectDrawing,this.cropBoxAnimationTime=this.config.animationDuration,this.containerWidth=this.props.containerWidth,this.containerHeight=this.props.containerHeight)},c.prototype.componentDidMount=function(){var u,e,h,o,n,t,s,i;(this.throttleCropBoxChange=this.throttle(this.cropBoxChange,this.config.eventTimeThreshold),n=this.props.cropCoordinates?this.props.cropCoordinates:this.config,r)&&(s=f(this.props),this.isCropping&&this.props.dragEvent?(i=this.getMousePosition(this.props.dragEvent),t=new r({x:i.x,y:i.y},{x:i.x+this.config.minDelta,y:i.y+this.config.minDelta}),this.overlayView=new VisualSearchCropBoxUtils.OverlayView(this.getViewRect(),t,this.config)):(t=(e=(u=this.hwcrop)===null||u===void 0?void 0:u.zCrp(s))!==null&&e!==void 0?e:new r({x:n.left,y:n.top},{x:n.right,y:n.bottom}),this.overlayView=new VisualSearchCropBoxUtils.OverlayView(this.getViewRect(),this.getCropRect(t),this.config)),s?(o=(h=this.props).changeCropCoordinates)===null||o===void 0?void 0:o.call(h,{top:0,left:0,right:1,bottom:1}):this.handleCropBoxAnimationAndUpdate(),this.props.cropCoordinates?this.lastCropCoordinates=t:this.throttleCropBoxChange(),this.handleEventsSetting(!0),this.leftTopElement&&this.props.isCropBoxFocused&&(this.leftTopElement.classList.remove("nofocus"),this.leftTopElement.focus()))},c.prototype.componentWillReceiveProps=function(n){var s,e,i,u,o;n.cropCoordinates&&(this.overlayView==null||!r||(i=new r({x:n.cropCoordinates.left,y:n.cropCoordinates.top},{x:n.cropCoordinates.right,y:n.cropCoordinates.bottom}),i.equals(this.lastCropCoordinates)&&this.containerHeight==n.containerHeight&&this.containerWidth==n.containerWidth||(this.containerHeight=n.containerHeight,this.containerWidth=n.containerWidth,this.overlayView.setViewRect(this.getViewRect()),u=this.getCropRect(i),u.width()&&u.height()&&(this.overlayView.setCropRect(u),this.lastCropCoordinates=i,this.updateCropBoxStyle(),this.setState({coordinates:i,containerHeight:n.containerHeight,containerWidth:n.containerWidth}))),this.hwcrop=t.hwcrpbx,o=this.hwcrop&&this.hwcrop.ifc(n.cropCoordinates),o&&f(n)&&!f(this.props)&&((e=(s=this.props).changeCropCoordinates)===null||e===void 0?void 0:e.call(s,{top:0,left:0,right:1,bottom:1})),this.overlayClassName=o?"overlayView fullCrop":"overlayView"))},c.prototype.reinitializeCropBox=function(){this.cropBox&&(this.handleEventsSetting(!0),this.isCropping=!1,this.startCropRect=null)},c.prototype.handleCropBoxAnimationAndUpdate=function(){var n=this.overlayView.cropRect();n&&e(n.width(),n.height(),n.left(),n.top());this.isAnimationEnabled()?setTimeout(this.updateCropBoxStyle,this.cropBoxAnimationTime):this.updateCropBoxStyle();this.setAnimations()},c.prototype.isAnimationEnabled=function(){return this.config.enableAnimations&&!this.props.isFromOverlayElement&&!this.props.isDirectDrawing&&!this.isHotspotClickToNewWindow},c.prototype.isCloseButtonEnabled=function(){return this.config.enableCloseButton},c.prototype.ensureCropBoxVisible=function(){var n,t;(n=this.hwcrop)===null||n===void 0?void 0:n.enCls(this.cropBox,this.readyAnimationClassName,this.endAnimationClassName);(t=this.hwcrop)===null||t===void 0?void 0:t.enCls(this.cropBoxContent,this.endAnimationClassName)},c.prototype.ensureMinimalCropBoxAt=function(n){var t=n.x,i=n.y,r={x:t,y:i},u={x:t+1,y:i+1};this.setCropBoxState(r,u)},c.prototype.stopPropagation=function(n){n.preventDefault();n.stopPropagation()},c.prototype.render=function(){var i=this,o="cropRect ".concat(this.isHotspotClickToNewWindow?"sbiinw":""," ").concat(this.isCloseButtonEnabled()?"rb":""),r=!0,e=this.cropConfig.mdlhcpbx;return(e&&e.indexOf(this.props.selectedModule)>-1&&(r=!1),this.props&&r&&(this.enableCropBoxWithTextMode?!this.props.isTextSelected:!0))?React.createElement("div",{id:"overlay_view",className:this.overlayClassName,ref:function(n){i.imageElement=n}},this.enableLiveView&&React.createElement(n.ImageDetail.ImageCropBoxPin,{setMainImageVerticalScroll:this.props.setMainImageVerticalScroll,ref:function(n){i.ImageCropBoxPin=n}}),React.createElement("div",{id:"crop_rect",className:o,ref:function(n){i.cropBox=n}},React.createElement("div",{className:"content",ref:function(n){i.cropBoxContent=n}},React.createElement("div",{className:"left"}),React.createElement("div",{className:"right"}),React.createElement("div",{className:"top"}),React.createElement("div",{className:"bottom"}),React.createElement(SharedComponent.AccessibleComponent,{className:"leftTop",ariaLabel:this.cropConfig.tln,role:"button",onKeyDown:this.handleKeyPress_leftTop,reference:function(n){i.leftTopElement=n}}),React.createElement(SharedComponent.AccessibleComponent,{className:"rightTop",ariaLabel:this.cropConfig.trn,role:"button",onKeyDown:this.handleKeyPress_rightTop}),React.createElement(SharedComponent.AccessibleComponent,{className:"leftBottom",ariaLabel:this.cropConfig.bln,role:"button",onKeyDown:this.handleKeyPress_leftBottom}),React.createElement(SharedComponent.AccessibleComponent,{className:"rightBottom",ariaLabel:this.cropConfig.brn,role:"button",onKeyDown:this.handleKeyPress_rightBottom}),this.isCloseButtonEnabled()&&typeof t.RemoveCropAction!="undefined"&&React.createElement(t.RemoveCropAction,{hideText:!0})),!this.enableMobileView&&f(this.props)&&typeof t.GetAnswerButton!==u&&React.createElement(t.GetAnswerButton,null)),this.shouldShowHint&&React.createElement("span",{className:"cropBoxHint",ref:function(n){i.cropBoxHint=n}},this.hint),this.config.enableDotAnimation&&n.ImageDetail.ImageCropBoxDotAnimation!=undefined?React.createElement(n.ImageDetail.ImageCropBoxDotAnimation,null):null):null},c}(React.Component),c=function(n){return{changeCropCoordinates:function(t){t&&n(ImageDetailActions.changeCropCoordinates(t))},changeInsightsScrollPosition:function(){n(ImageDetailActions.changeInsightsScrollPosition(ImageDetailActions.InsightsScrollPosition.Peek))},changeIntersectedOCRRegions:function(t){typeof ImageDetailActions.changeIntersectedTextRegions!=u&&n(ImageDetailActions.changeIntersectedTextRegions(t))},dispatchEventToSegmentation:function(t){t&&ImageDetailActions.dispatchEventToSegmentation&&n(ImageDetailActions.dispatchEventToSegmentation(t))}}},l=function(n){var t,r=i.getInsightsViewState(n),o=r===null||r===void 0?void 0:r.selectedModule,s=i.getIsHotspotClick(n)||i.getClickedEntity(n),f=i.getStartIndex(n),e=i.getEndIndex(n);return{cropCoordinates:i.getCropCoordinates(n),isFromOverlayElement:!!s,inTextMode:typeof i.itm!==u&&i.itm(n),isCropBoxFocused:typeof i.isCropElementFocused=="function"?i.isCropElementFocused(n):!1,selectedModule:o,startIndex:f,endIndex:e,isTextSelected:!!(f!=null||e!=null),hasSegmentation:!!((t=i.gcmd)===null||t===void 0?void 0:t.call(i,n))}},a=ReactRedux.connect(l,c);t.ImageCropBox=a(h)})(t=n.ImageDetail||(n.ImageDetail={}))})(Multimedia||(Multimedia={}));__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},__assign.apply(this,arguments)},function(n){var t;(function(){var u=ImageDetailActions.IImageDetailOverlayElement,f=ImageDetailActions.EventActionType,i=n.ImageDetailUtils.InsightsModuleType,e=ImageDetailActions.IImageDetailViewType,o=n.ImageDetailUtils,r="undefined",t=ImageDetailReducers;n.ImageDetail.withHotspotData=function(n,s){function h(n){return React.createElement(v,__assign({},n))}var c=function(n){return{changeCropCoordinates:function(t){n(ImageDetailActions.changeCropCoordinates(t,!0))},changeHiddenCropCoordinates:function(t){typeof ImageDetailActions.changeHiddenCropCoordinates!==r&&n(ImageDetailActions.changeHiddenCropCoordinates(t))},addToDetailStateHistory:function(){n(ImageDetailActions.addToDetailStateHistory())},changePageView:function(){n(ImageDetailActions.changePageView(e.VisualSearch))},changeSelectedModule:function(t){var r=t?i[i.all]:i[i.productandads];n(ImageDetailActions.changeInsightsSelectedModule(r))},changeInsightsStatus:function(t){n(ImageDetailActions.changeInsightStatus(!0,t,"ObjectDetection"))},changeEnableSyntheticHotspotClick:function(t){n(ImageDetailActions.ChangeEnableSyntheticHotspotClick(t))},changeSelectedObjectIndex:function(t){typeof ImageDetailActions.changeSelectedObjectIndex!==r&&n(ImageDetailActions.changeSelectedObjectIndex(t))}}},l=function(n){var e,o,h,i=t.getCurrentResult(n),v=t.gpc().disAdltVs,y=(e=v&&i&&i.isAdult?null:t.getDetectedObjects(n))!==null&&e!==void 0?e:[],l=t.getVisibleOverlayElements(n),p=l&&l.some(function(n){return n.type===u.Hotspot&&n.id==null}),a=t.getObjectDetectionConfig(n),w=t.gmio?(o=t.gmio(n))===null||o===void 0?void 0:o.imageInfo:null,b=t.getImageStateById(n,n.displayInsightsId),c=t.getImageStates(n),k=(h=c===null||c===void 0?void 0:c[i===null||i===void 0?void 0:i.id])===null||h===void 0?void 0:h.externalImageState;return{externalImageState:k,detectedObjects:y,config:a,hotspotModuleConfig:s,enableAllTabOnClick:a.EnableAllTabOnClick,detailScenario:t.getDetailScenario(n),showHotspotWithoutHover:p,imageData:i,imageState:b,viewType:t.getViewType(n),ig:t.getCurrentImpressionId(n),syntheticClick:typeof t.geshsc!=r?t.geshsc(n):f.None,selectedObjectIndex:typeof t.gsoi!=r?t.gsoi(n):-1,isMultiImageActive:!!w}},a=ReactRedux.connect(l,c),v=a(n);return h.displayName="ModuleWithHotSpotData(".concat(o.gdnm(n),")"),h}})(t=n.ImageDetail||(n.ImageDetail={}))}(Multimedia||(Multimedia={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||function(){return __assign=Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},__assign.apply(this,arguments)},function(n){var t;(function(t){var e=n.InstrumentationUtils.lac,o=n.InstrumentationUtils.la,s=ImageDetailReducers.getResourceString,f=ImageDetailActions.IClickTarget,i=ImageDetailActions.EventActionType,h=n.ImageDetail.withHotspotData,c=ImageDetailReducers,u=n.ImageDetailUtils,r="undefined",l=function(h){function l(s){var l=h.call(this,s)||this;return l.hotSpots=[],l.defaultHoverShown=!1,l.hotSpotTooltip=null,l.handleSyntheticClick=function(n){if(n.detectedObjects&&n.detectedObjects.length>0){var t=0;typeof u.ghtptla=="function"&&n.detectedObjects.length>1&&(t=u.ghtptla(n.detectedObjects));o("CI.Info","NoResults.Fallback",n.ig);l.handleClickOnHotSpotElement(n.detectedObjects[t],t)}typeof i!==r&&n.changeEnableSyntheticHotspotClick(i.Completed)},l.changeCropCoordinatesAndLoadVisualSearch=function(t,i){var r,u,f;if(((r=l.props.config)===null||r===void 0?void 0:r.EnableClickToNewWindowWithSBIView)&&typeof((u=n.ImageDetailUtils)===null||u===void 0?void 0:u.onwsbi)=="function"&&l.props.imageData){n.ImageDetailUtils.onwsbi(l.props.imageData,l.props.externalImageState,t);return}t&&(l.props.changeCropCoordinates(t),l.enableClickChangeHiddenCrop&&l.props.changeHiddenCropCoordinates(t),l.props.changeSelectedModule(l.props.enableAllTabOnClick),l.props.changeSelectedObjectIndex(i),f=ImageDetailActions.IImageDetailViewType.VisualSearch,l.enableClickChangeHiddenCrop||l.props.viewType===f||(l.props.addToDetailStateHistory(),l.props.changeInsightsStatus(l.props.ig),l.props.changePageView()))},l.stopPropagation=function(n){n.stopPropagation&&n.stopPropagation();n.preventDefault&&n.preventDefault()},l.handleUserAction=function(n,t){l.stopPropagation(n);l.handleClickOnHotSpot(t)},l.handleClickOnHotSpot=function(n){var t=l.props.detectedObjects[n];l.handleClickOnHotSpotElement(t,n)},l.handleClickOnHotSpotElement=function(i,o){var s=i&&i.boundingBox,h,c,a,v;if(s){h=i.hotspot;c=h?"left:"+h.left+", top:"+h.top:"";l.props.imageData&&l.props.imageData.instInfo&&e("ObjectDetectionHotSpot",l.props.ig,{Info:c},l.props.imageData.instInfo);switch(l.clickTarget){case f.Requery:typeof t.ObjectDetectionRequery.getRequeryUrl!==r&&typeof t.ObjectDetectionRequery.getHotspotQuery!==r&&(a=t.ObjectDetectionRequery.getHotspotQuery(i.displayName),u.gecc(t.ObjectDetectionRequery.getRequeryUrl(a))());break;case f.External:v={result:l.props.imageData,insightsViewState:{viewType:ImageDetailActions.IImageDetailViewType.VisualSearch},cropcoordinates:{top:s.top,bottom:s.bottom,left:s.left,right:s.right}};u.gecc(n.ImageDetailLocationUtils.getSearchByImageUploadUrl(v,!0))();break;default:l.changeCropCoordinatesAndLoadVisualSearch(s,o)}}},l.enableClickChangeHiddenCrop=c.gpc().echcr,l.clickTarget=s.config?s.config.ClickTarget:f.DetailPage,l}return __extends(l,h),l.prototype.componentDidMount=function(){typeof i!==r&&this.props.syntheticClick===i.Requested&&this.handleSyntheticClick(this.props)},l.prototype.componentWillUpdate=function(){this.hotSpots=[]},l.prototype.componentWillReceiveProps=function(n){typeof i!==r&&n.syntheticClick===i.Requested&&this.props.syntheticClick===i.None&&this.handleSyntheticClick(n)},l.prototype.componentDidUpdate=function(){if(this.props.setMainImageVerticalScroll&&typeof u.getOverlap!=r&&this.hotSpots&&this.hotSpots.length>0&&this.props.selectedObjectIndex>=0){var n=u.getOverlap(this.hotSpots[this.props.selectedObjectIndex],_d.querySelector(".img_bop"));console.log("selectedObjectIndex: "+this.props.selectedObjectIndex);console.log("overlap with selectedOgject: "+n);n>0&&this.props.setMainImageVerticalScroll(-n)}},l.prototype.render=function(){var n=this;if(this.props&&this.props.config&&this.props.config.Enabled&&this.props.detectedObjects&&this.props.detectedObjects.length>0&&!this.props.isMultiImageActive){this.hotSpotTooltip=this.hotSpotTooltip?this.hotSpotTooltip:s("HSTooltip");var i=this.props.config.EnableTooltip?this.hotSpotTooltip:"",u=i?{"data-tooltip":i}:{},e=this.props.showHotspotWithoutHover?"obj_det_container show":"obj_det_container";return React.createElement("div",{className:e,id:"obj_det_container"},this.props.detectedObjects.map(function(i,e){var o,c,s,h;if(i.hotspot)return o=e==0&&n.props.config.EnableNotification&&!n.defaultHoverShown?"obj_det hover":"obj_det",o+=e===n.props.selectedObjectIndex?" selected":"",c={left:i.hotspot.left*100+"%",top:i.hotspot.top*100+"%"},s=void 0,n.clickTarget==f.Requery&&typeof t.ObjectDetectionRequery.getHotspotQuery!==r&&(s=t.ObjectDetectionRequery.getHotspotQuery(i.displayName)),i.hotspot.left<.2&&(o+=" left-tooltip"),i.hotspot.left>.8&&(o+=" right-tooltip"),h="core",n.props.config.EnableHotSpotIcon&&(h+=" icon-hotspot"),React.createElement(SharedComponent.AccessibleComponent,__assign({elementName:"span"},u,{className:o,key:e,style:c,onMouseDown:function(t){return n.handleUserAction(t,e)},onTouchEnd:function(t){return n.handleUserAction(t,e)},reference:function(t){t&&n.hotSpots.push(t)}}),React.createElement("span",{className:h},s))}))}return null},l}(React.Component);n.ImageDetail.ObjectDetection=h(l);n.ImageDetail.ObjectDetection.displayName="ObjectDetection"})(t=n.ImageDetail||(n.ImageDetail={}))}(Multimedia||(Multimedia={})),function(n){var t=function(){function n(n,t,i,r,u,f,e,o,s){e===void 0&&(e=!0);o===void 0&&(o=5);s===void 0&&(s=!1);var h=this;if(this.utils=pMMUtils,this.moved=!1,this.doubletap=!1,this.touchStartPoint=null,this.touchStartElementLeft=0,this.nowtouchpid=0,this.swipeDelta=null,this.touchStartTime=0,this.timeDelta=0,this.captureEvent=!0,this.enableEndHandlerWithoutMove=!1,this.moveSensitivity=5,this.cleanUp=function(){h.handleEventsSetting(!1)},this.isMoved=function(){return h.moved},this.resetMoved=function(){h.moved=!1},this.handleEventsSetting=function(n){var t=n?sj_be:sj_ue;typeof sb_de!="undefined"&&("ontouchstart"in sb_de?(t(h.touchElement,"touchstart",h.touchStart,h.captureEvent),t(h.touchElement,"touchmove",h.touchMove,h.captureEvent),t(h.touchElement,"touchend",h.touchEnd,h.captureEvent)):window.navigator.msPointerEnabled?(h.touchElement.style.msTouchAction="none",h.touchElement.style.touchAction="none",t(h.touchElement,"MSPointerDown",h.touchStart,h.captureEvent),t(h.touchElement,"MSPointerMove",h.touchMove,h.captureEvent),t(h.touchElement,"MSPointerUp",h.touchEnd,h.captureEvent),t(_d,"MSPointerUp",h.touchEnd,h.captureEvent)):"onpointermove"in sb_de&&(h.touchElement.style.msTouchAction="none",h.touchElement.style.touchAction="none",t(h.touchElement,"pointerdown",h.touchStart,h.captureEvent),t(h.touchElement,"pointermove",h.touchMove,h.captureEvent),t(h.touchElement,"pointerup",h.touchEnd,h.captureEvent),t(_d,"pointerup",h.touchEnd,h.captureEvent)),t(_d,"mousedown",h.resetMoved,!0))},this.getHandlerOrEmpty=function(n){return n!=null?n:h.Empty},this.Empty=function(){},this.setMoved=function(n){n===void 0&&(n=!1);h.moved=n},this.checkIfDoubleTap=function(){return sb_gt()-h.touchStartTime<250&&!!h.doubleTapHandler&&!h.isMoved()},this.touchStart=function(n){if(h.isTouchEvent(n)&&(h.doubletap=h.checkIfDoubleTap(),!h.doubletap)){h.setMoved(!1);h.touchStartPoint=h.getTouchPointFromEvent(n);var t=h.utils.gcs(h.touchElement);h.touchStartElementLeft=parseInt(typeof _G!="undefined"&&_G.RTL?t.marginRight:t.marginLeft);h.touchStartTime=sb_gt();!n.pointerId||(h.nowtouchpid=n.pointerId);h.touchStartHandler(n)}},this.touchMove=function(n){if(h.isTouchEvent(n)&&h.isValidTouch(n)){var t=h.getTouchPointFromEvent(n);if(!h.touchStartPoint||!t)return;h.swipeDelta=h.getDistanceBetweenPoints(h.touchStartPoint,t);h.setMoved(Math.abs(h.swipeDelta.X)>h.moveSensitivity||Math.abs(h.swipeDelta.Y)>h.moveSensitivity);h.isMoved()&&!h.doubletap&&h.touchMoveHandler(h.touchStartElementLeft,h.swipeDelta)&&h.preventDefault(n)}},this.touchEnd=function(n){var t=h.isMoved(),i;h.isTouchEvent(n)&&(h.doubletap&&!h.isMoved()?(h.doubleTapHandler(n),h.preventDefault(n),h.doubletap=!1):(t||h.enableEndHandlerWithoutMove)&&h.isValidTouch(n)&&(h.timeDelta=sb_gt()-h.touchStartTime,i=t?h.swipeDelta:h.getNewPoint(),h.touchEndHandler(h.touchStartElementLeft,i,h.timeDelta)&&h.preventDefault(n)),sj_ue(_d,"mousedown",h.resetMoved,!0),sb_st(function(){sj_be(_d,"mousedown",this.resetMoved,!0)},150))},this.preventDefault=function(n){n.stopPropagation();n.preventDefault()},this.getTouchPointFromEvent=function(n){var t=h.getNewPoint();return t.X=n.touches?n.touches[0].pageX:n.pageX!=undefined&&n.pageX!=0?n.pageX:0,t.Y=n.touches?n.touches[0].pageY:n.pageY!=undefined&&n.pageY!=0?n.pageY:0,t},this.getDistanceBetweenPoints=function(n,t){var i=h.getNewPoint();return i.X=t.X-n.X,i.Y=t.Y-n.Y,i},this.getNewPoint=function(){return{X:0,Y:0}},this.isTouchEvent=function(n){return typeof n.pointerType=="undefined"||n.pointerType==2||n.pointerType=="touch"||n.pointerType=="pen"},this.isValidTouch=function(n){return!n.pointerId||n.pointerId==h.nowtouchpid},!n)throw"container cannot be null!";this.container=n;this.touchElement=!t?this.container:t;this.touchStartHandler=this.getHandlerOrEmpty(i);this.touchMoveHandler=this.getHandlerOrEmpty(r);this.touchEndHandler=this.getHandlerOrEmpty(u);this.doubleTapHandler=this.getHandlerOrEmpty(f);this.enableEndHandlerWithoutMove=s;this.captureEvent=e;this.moveSensitivity=o;this.handleEventsSetting(!0)}return n}();n.MmReactSwipe=t}(ImageDetailSwipe||(ImageDetailSwipe={})) |