function touchHandler(n){var r,t,i;switch(t=n.originalEvent.changedTouches[0],i="",n.type){case"touchstart":i="mousedown";break;case"touchmove":i="mousemove";break;case"touchend":i="mouseup";break;default:return}(r=document.createEvent("MouseEvent")).initMouseEvent(i,!0,!0,window,1,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,null);t.target.dispatchEvent(r);n.preventDefault()}function initTouch(n){n.on("touchstart touchmove touchend touchcancel",touchHandler)}!function(){var n=function(n,t,i,r,u,f){this.WP$Controllers$Controller();this.$row=n;this.accordionButtons=t;this.$requiredLegend=i.$requiredLegend;this.$questionsContainerRoot=i.$questionsRoot;this.isMultiResponse=r;this.callbackParams=u;this.afterAccordionShownCallback=f;this.initialize()};n.prototype={$row:null,accordionButtons:[],$accordionBody:null,preventCollapseIfInvalid:!0,isDestroyed:!1,$requiredLegend:null,$questionsContainerRoot:null,afterAccordionShownCallback:null,isMultiResponse:!1,callbackParams:null,initialize:function(){if(!this.isDestroyed){var n,i,r,t;if(this.accordionButtons)for(n=0;n<this.accordionButtons.length;n++)(r=(i=$afe.jq(this.accordionButtons[n])).safeAttr("data-collapsible-target"))&&(t=$afe.jq(this.$row.find(r)),this.__initAccordionBody(t),this.$accordionBody=t),this.__initAccordionButton(i);this.updateStyling()}},updateStyling:function(){var t,i,n;this.isDestroyed||(n=this.$row.closest(".flatradiogrouper"),t=this.$row.is(n.find(".questiongroupitem:visible").first()),i=this.$row.is(n.find(".questiongroupitem:visible").last()),t?this.$row.addClass("firstRow"):this.$row.is(":visible")&&this.$row.removeClass("firstRow"),i?this.$row.addClass("lastRow"):this.$row.is(":visible")&&this.$row.removeClass("lastRow"),this.$row.hasClass("preload")&&setTimeout($.proxy(function(){this.$row.removeClass("preload")},this),0))},destroy:function(){this.$row=null;this.accordionButtons=null;this.$accordionBody=null;this.isDestroyed=!0},__initAccordionButton:function(n){n.click($.proxy(function(t){this.__handleAccordionToggle(n,t,!0)},this));WP.DOM.Browser.isIE||WP.DOM.Browser.isFirefox||WP.DOM.Browser.isLegacyEdge||n.on("keyup",$.proxy(function(t){32===t.which&&$afe.jq(n).is(":checked")&&(this.__handleAccordionToggle(n,t,!1),t.isDefaultPrevented()||$$WP.Utilities.UI.ToggleButtonClick(n,t,0,!0),t.preventDefault())},this))},__handleAccordionToggle:function(n,t,i){var f,u,r;u=n.is(":checked");f=n.safeAttr("data-collapsible-target");r=!1;i||(u=!u);u&&f?$$WP.Questions.Utilities.Collapsible.collapse(this.$accordionBody,"show")&&(r=!0):this.isMultiResponse&&!f?r=!0:(this.preventCollapseIfInvalid=!1,$$WP.Questions.Utilities.Collapsible.collapse(this.$accordionBody,"collapse")&&(r=!0),this.preventCollapseIfInvalid=!0);r||(t.preventDefault(),setTimeout(function(){n.trigger("change",!0)},100));t.stopPropagation()},__initAccordionBody:function(n){n.on("collapsibleShow",$.proxy(function(n){this.__accordionShowEventHandler(n);n.stopPropagation()},this));n.on("collapsibleShown",$.proxy(function(n){this.__accordionShownEventHandler(n);n.stopPropagation()},this));n.on("collapsibleCollapse",$.proxy(function(n){this.__accordionCollapseEventHandler(n);n.stopPropagation()},this));n.on("collapsibleCollapsed",$.proxy(function(n){this.__accordionCollapsedEventHandler(n);n.stopPropagation()},this))},__accordionShowEventHandler:function(){this.isDestroyed||this.__setTransitioningStyle(!0)},__accordionCollapseEventHandler:function(n){this.isDestroyed||(this.preventCollapseIfInvalid&&this.$row.is("[data-invalid]")?n.preventDefault():this.__setTransitioningStyle(!0,!0))},__accordionShownEventHandler:function(){this.isDestroyed||(this.__setShowingStyle(!0),this.__setTransitioningStyle(!1),$$WPQuestionUtil.updateRequiredLegend(this.$questionsContainerRoot,this.$requiredLegend,250),$$WP.FormValidation.initializeDOMSubtree(this.$row),this.$row.find(".matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights),$afe.jq(window).trigger("resetSliderOffset"),this.afterAccordionShownCallback&&this.afterAccordionShownCallback(this.callbackParams))},__accordionCollapsedEventHandler:function(){this.isDestroyed||(this.__setShowingStyle(!1),this.__setTransitioningStyle(!1),$$WPQuestionUtil.updateRequiredLegend(this.$questionsContainerRoot,this.$requiredLegend,250),$$WP.FormValidation.initializeDOMSubtree(this.$row))},__setTransitioningStyle:function(n,t){n?t?this.$row.addClass("accordion-hiding"):this.$row.addClass("accordion-expanding"):(this.$row.removeClass("accordion-expanding"),this.$row.removeClass("accordion-hiding"))},__setShowingStyle:function(n){n?this.$row.addClass("accordion-show"):this.$row.removeClass("accordion-show")}};$$WP.Questions=$$WP.Questions||{};$$WP.Questions.AccordionController=n;n.extend($$WP.Controllers.Controller,"WP$Questions$AccordionController")}();Math.log10=Math.log10||function(n){return Math.log(n)*Math.LOG10E},function(){var n=function(n,t,i,r){this.WP$Controllers$Controller();this.__setBasicProperties(n,t);this.__setSliderOptions(i,r);r&&this.__customListSpecificSetup();this.initialize()};n.prototype={questionId:null,$question:null,$noResponse:null,$noResponseClickableArea:null,$noResponseLabel:null,$slider:null,$sliderClickableArea:null,$sliderResponseContainer:null,valueOnDrop:null,min:0,minLocal:null,minLabel:null,minLabelDifferent:null,max:100,maxLocal:null,maxLabel:null,maxLabelDifferent:null,precision:null,arrowPrecision:null,step:1,arrowStep:null,defaultVal:null,displayVertically:!1,cssPropertyToUpdate:null,showNumber:null,showNumberBecauseOfRequiredness:null,isCustomList:!1,showAllOptions:!1,sliderWidth:null,leftOffset:null,sliderHeight:null,topOffset:null,minSliderBallCenterPos:null,maxSliderBallCenterPos:null,noResponseSliderStartPos:null,noResponseWidth:null,noResponseWidthPlusMargin:null,noResponseHeight:null,$sliderBall:null,sliderBallWidth:null,$minmax:null,$sliderInput:null,$sliderValue:null,$options:null,setSliderBall:!1,isSliding:!1,sliderBallTimer:null,animationTimer:null,ariaLabelTimer:null,isDestroyed:!1,isRTL:!1,heightOnSelection:null,animating:!1,initialize:function(){var n;this.isDestroyed||(this.setSliderSizeAndOffset("",!0),this.__initQuestionEvents(),this.__initNoResponseEvents(),this.__initSliderEvents(),this.__initSliderBallEvents(),this.__initMinMaxEvents(),this.isCustomList?this.__initOptionEvents():this.__initInputEvents(),n=this.$sliderBall.add(this.$slider).add(this.$noResponse).add(this.$noResponseLabel),initTouch(n))},destroy:function(){this.$question.off("mousemove");this.$question=null;this.$sliderClickableArea.off("mousedown");this.$sliderClickableArea=null;this.$slider=null;this.$sliderBall.off("focus mousedown keydown");this.$sliderBall=null;this.$sliderInput.off("input updateslider focus");this.$sliderInput=null;this.$noResponseClickableArea.off("mousedown");this.$noResponseClickableArea=null;this.$noResponse=null;this.$noResponseLabel.off("mousedown keydown");this.$noResponseLabel=null;this.$minmax.find(".min > span, .mintext, .max > span, .maxtext").off("click keydown");this.$minmax=null;this.isDestroyed=!0},setSliderSizeAndOffset:function(n){if(!this.isDestroyed){var o,c,r,u,f,e,t,s,i=this.$slider.offset(),h=this.$noResponse.offset();if(i){if(this.sliderBallWidth=$$WPQuestionUtil.getElementWidth(this.$sliderBall),this.isCustomList?(s=this.$minmax.find(".option"),this.showAllOptions?(o=s.first(),c=s.last(),this.displayVertically?(t=o,u=Math.round(t.offset().top),e=$$WPQuestionUtil.getElementHeight(t),this.minSliderBallCenterPos=u-i.top+e/2):(t=this.isRTL?c:o,r=Math.round(t.offset().left),f=$$WPQuestionUtil.getElementWidth(t),this.minSliderBallCenterPos=r-i.left+f/2)):this.displayVertically?(t=this.$minmax.find(".max"),u=Math.round(t.offset().top),e=$$WPQuestionUtil.getElementHeight(t),this.minSliderBallCenterPos=u-i.top+e/2):(t=this.$minmax.find(".min"),this.isRTL&&(t=this.$minmax.find(".max")),r=Math.round(t.offset().left),f=$$WPQuestionUtil.getElementWidth(t)/2,this.minSliderBallCenterPos=r-i.left+f/2)):(this.__updateNumTextboxSize(),this.minSliderBallCenterPos=this.sliderBallWidth/2),this.displayVertically)this.__setHeight(i,h);else{if($$WP.ApplicationContext===applicationWelcome&&!this.setSliderBall)return void setTimeout($.proxy(function(){this.__setWidth(!0,i,h,n)},this),10);this.__setWidth(!1,i,h)}this.__setSliderBallLocationOnLoadOrResize("resize"===n);"resize"!==n&&"resetSliderOffset"!==n||this.displayVertically||this.__setHeightOnSelection()}}},markAsRequired:function(){this.isCustomList||(this.showNumber||(this.showNumberBecauseOfRequiredness=!0,this.showNumber=!0),this.$sliderInput.removeClass("sliderValidation"),$$WP.Utilities.UI.IsMobile||WP.DOM.Browser.isMobile||$$WP.ApplicationContext===applicationWelcome||$$WPQuestionUtil.isFakeResponsive()||(this.$sliderInput.safeAttr("tabindex","0"),this.$sliderInput.removeAttr("aria-hidden")),$$WP.ApplicationContext===applicationWelcome&&this.$sliderInput.css("pointer-events","auto"))},markAsUnrequired:function(){this.isCustomList||this.showNumberBecauseOfRequiredness&&(this.$sliderInput.addClass("sliderValidation"),$$WP.Utilities.UI.IsMobile||WP.DOM.Browser.isMobile||$$WP.ApplicationContext===applicationWelcome||$$WPQuestionUtil.isFakeResponsive()||(this.$sliderInput.safeAttr("tabindex","-1"),this.$sliderInput.safeAttr("aria-hidden","true")),$$WP.ApplicationContext!==applicationWelcome||$$WP.IsAccessibilityOn||this.$sliderInput.css("pointer-events","none"),this.showNumber=!1)},mouseUpEventHandler:function(){var n;this.isSliding&&(n=this.__calculateSliderBallPosition(this.valueOnDrop),this.__changeCss(n));this.isSliding=!1;this.__dropSlider()},__setBasicProperties:function(n,t){this.questionId=n;this.$question=t.$question;this.$noResponse=t.$noResponse;this.$noResponseClickableArea=this.$question.find(".noresponseclickablearea");this.$noResponseLabel=t.$noResponseLabel;this.$slider=t.$slider;this.$sliderClickableArea=this.$question.find(".sliderclickablearea");this.$sliderResponseContainer=this.$question.find(".sliderresponsecontainer");this.$sliderMaxTextHeight=this.$sliderResponseContainer.find(".sliderresponselabels .max");this.$sliderMinTextHeight=this.$sliderResponseContainer.find(".sliderresponselabels .min");this.$sliderBall=t.$sliderBall;this.$minmax=t.$minmax;this.$sliderInput=t.$sliderInput;this.$sliderValue=this.$question.find(".slidervalue");this.$options=this.$minmax.find(".option")},__setSliderOptions:function(n,t){for(this.min=n.Min,this.minLocal=n.MinLocal,this.minLabel=n.MinLabel,this.minLabelDifferent=this.min.toString()!==this.minLabel,t||(this.minLabelDifferent=this.minLocal.toString()!==this.minLabel),this.max=n.Max,this.maxLocal=n.MaxLocal,this.maxLabel=n.MaxLabel,this.maxLabelDifferent=this.max.toString()!==this.maxLabel,t||(this.maxLabelDifferent=this.maxLocal.toString()!==this.maxLabel),this.step=n.Step||1,this.arrowStep=1===this.step?1:.1;this.arrowStep>this.max-this.min;)this.arrowStep=this.arrowStep/10;this.displayVertically=n.DisplayVertically;this.isRTL=n.IsRTL;this.cssPropertyToUpdate=this.displayVertically?"top":"left";this.precision=Math.log10(1/this.step);this.arrowPrecision=Math.log10(1/this.arrowStep);this.defaultVal=this.min-this.arrowStep;this.showNumber=n.ShowNumber;this.showNumberBecauseOfRequiredness=n.ShowNumberBecauseOfRequiredness;this.isCustomList=t;this.showAllOptions=n.ShowAllOptions},__customListSpecificSetup:function(){$$WPQuestionUtil.waitForImages("",this.$minmax.find(".sliderresponseoptions"),this.displayVertically?$.proxy(this.__setSliderBarHeight,this):$.proxy(this.__setHeightOnSelection,this))},__setSliderBarHeight:function(){var n,u,f,e;if(this.displayVertically){if(this.isCustomList){for(var t=0,i=this.$sliderResponseContainer.find(".sliderresponseoptions")[0].children,r=0;r<i.length;r++)u=i[r].children[0].offsetHeight,u>t&&(t=u);n=(t+10)*i.length}else f=$$WPQuestionUtil.getElementHeight(this.$sliderResponseContainer.find(".sliderresponselabels").find(".max")),e=$$WPQuestionUtil.getElementHeight(this.$sliderResponseContainer.find(".sliderresponselabels").find(".min")),n=2*Math.max(f,e)+100;this.$sliderClickableArea.css("height",n+"px");this.$sliderResponseContainer.css("height",n+"px")}},__setHeight:function(n){this.__setSliderBarHeight();this.sliderHeight=$$WPQuestionUtil.getElementHeight(this.$slider);this.topOffset=Math.round(n.top);this.maxSliderBallCenterPos=this.sliderHeight-this.minSliderBallCenterPos;this.noResponseHeight=$$WPQuestionUtil.getElementHeight(this.$noResponse);this.noResponseSliderStartPos=this.sliderHeight+this.sliderBallWidth/2;this.__setSliderBallLocation(!0)},__setWidth:function(n,t,i,r){var u,f;this.isDestroyed||(this.sliderWidth=$$WPQuestionUtil.getElementWidth(this.$slider),this.leftOffset=Math.round(t.left),this.noResponseWidth=$$WPQuestionUtil.getElementWidth(this.$noResponse),u=Math.round(i.left),this.noResponseWidthPlusMargin=this.isRTL?0:this.leftOffset-u,this.minSliderBallCenterPos+=this.noResponseWidthPlusMargin,this.maxSliderBallCenterPos=this.sliderWidth-(this.minSliderBallCenterPos-this.noResponseWidthPlusMargin)+this.noResponseWidthPlusMargin,f=u+this.noResponseWidth/2,this.noResponseSliderStartPos=f-this.sliderBallWidth/2,this.noResponseSliderStartPos-=this.isRTL?this.leftOffset:u,n&&(this.__setSliderBallLocationOnLoadOrResize("resize"===r),"resize"!==r&&"resetSliderOffset"!==r||this.displayVertically||this.__setHeightOnSelection()))},__initQuestionEvents:function(){this.isDestroyed||this.$question.on("mousemove",$.proxy(function(n){this.__mouseMoveEventHandler(n)},this))},__initNoResponseEvents:function(){this.$noResponseClickableArea.on("mousedown",$.proxy(function(){this.isSliding=!0;this.__pickUpSlider();this.sliderBallTimer=0;this.__noResponseEventHandler()},this));this.$noResponseLabel.on("mousedown keydown",$.proxy(function(n){"keydown"===n.type&&13!==n.which&&32!==n.which||(this.sliderBallTimer=0,this.__noResponseEventHandler())},this))},__initSliderEvents:function(){this.isDestroyed||this.$sliderClickableArea.on("mousedown",$.proxy(function(n){this.sliderBallTimer=0;this.__sliderMousedown(n)},this))},__initSliderBallEvents:function(){this.isDestroyed||(this.$sliderBall.on("focus",$.proxy(function(){this.__changeAriaLabel(!0)},this)),this.$sliderBall.on("mousedown keydown",$.proxy(function(n){this.__sliderBallEventEntry(n)},this)))},__initInputEvents:function(){this.isDestroyed||(this.$sliderInput.on("input",$.proxy(function(n,t,i,r,u){this.__sliderInputUpdate(t,i,r,u)},this)),this.$sliderInput.on("updateslider",$.proxy(function(){this.__sliderInputUpdate()},this)),($$WP.Utilities.UI.IsMobile||WP.DOM.Browser.isMobile||$$WP.ApplicationContext===applicationWelcome||$$WPQuestionUtil.isFakeResponsive())&&this.$sliderInput.on("focus",$.proxy(function(){this.__changeAriaLabel(!0)},this)),$$WP.ApplicationContext===applicationWelcome&&this.$sliderInput.on("updatearia",$.proxy(function(){this.__ariaLabelCallback()},this)))},__initMinMaxEvents:function(){this.isCustomList||(this.$minmax.find(".min > span").on("click keydown",$.proxy(function(n){"keydown"===n.type&&13!==n.which&&32!==n.which||this.__minOrMaxClickEventHandler(this.min)},this)),this.$minmax.find(".max > span").on("click keydown",$.proxy(function(n){"keydown"===n.type&&13!==n.which&&32!==n.which||this.__minOrMaxClickEventHandler(this.max)},this)))},__initOptionEvents:function(){this.isDestroyed||this.$minmax.find(".option > *").on("click",$.proxy(function(n){this.__optionClickEventHandler(n)},this))},__mouseMoveEventHandler:function(n){this.setSliderSizeAndOffset(!1);this.isSliding&&this.__moveSlider(n)},__noResponseEventHandler:function(){var n;this.valueOnDrop="";this.isCustomList?((n=this.$minmax.find(".option.active input")).prop("wasChecked",n.prop("checked")),n.trigger("click",[0,!0]),this.$question.find(".currentlyselected").addClass("invisible"),this.__deactivateCurrentSelection(),this.__changeAriaLabel(!1)):this.__changeInput("","",!0);this.__moveSliderBallToNoResponse()},__sliderMousedown:function(n){this.isSliding=!0;this.setSliderSizeAndOffset();this.__pickUpSlider();this.__moveSlider(n);this.__activateCurrentSelection()},__sliderBallEventEntry:function(n){this.setSliderSizeAndOffset();"keydown"===n.type?this.__sliderBallKeydown(n):(this.isSliding=!0,this.__pickUpSlider())},__sliderBallKeydown:function(n){var t;37!==n.which&&38!==n.which&&39!==n.which&&40!==n.which||(this.__pickUpSlider(),t=this.isRTL?38===n.which||37===n.which:38===n.which||39===n.which,this.__moveSliderArrows(t),this.__dropSlider(),n.preventDefault())},__sliderInputUpdate:function(n,t,i,r){this.isSliding||n||(this.__updateNumTextboxSize(),t||this.sliderBallTimer||(i||r?(this.__inputChanged(!0),this.sliderBallTimer=0):this.sliderBallTimer=setTimeout($.proxy(function(){this.sliderBallTimer&&(this.__inputChanged(!1),this.sliderBallTimer=0)},this),500)))},__minOrMaxClickEventHandler:function(n){var t=this.__calculateSliderBallPosition(n,!0);this.valueOnDrop=n;this.__changeCss(t);this.__changeAriaLabel();this.__changeInput($$WP.I18N.formatNumber(n,this.precision),!1,!1,!1,!0);this.__activateCurrentSelection()},__optionClickEventHandler:function(n){this.__clickOption($afe.jq(n.target).parents(".option"),!1,!1);n.stopImmediatePropagation()},__moveSlider:function(n){if(!this.isDestroyed){var o,s,f,e,u,r,i,t;if(t=(i=this.displayVertically?(r=n.pageY)-this.topOffset:(r=n.pageX)-this.leftOffset+this.noResponseWidthPlusMargin)-this.sliderBallWidth/2,this.isCustomList&&(this.displayVertically?t<0?(t=0,u=!0):t+this.sliderBallWidth>this.sliderHeight&&(t=this.sliderHeight-this.sliderBallWidth,u=!0):t<this.noResponseWidthPlusMargin?(t=this.noResponseWidthPlusMargin,u=!0):t+this.sliderBallWidth>this.noResponseWidthPlusMargin+this.sliderWidth&&(t=this.noResponseWidthPlusMargin+this.sliderWidth-this.sliderBallWidth,u=!0)),i<this.minSliderBallCenterPos)if(this.displayVertically)this.isCustomList||(i=this.minSliderBallCenterPos);else if(r>=this.leftOffset)this.isCustomList||(i=this.minSliderBallCenterPos);else{if(this.isRTL)return;if(r>this.$noResponse.offset().left+this.noResponseWidth)return;e=!0}else if(i>this.maxSliderBallCenterPos)if(this.displayVertically)r<=this.topOffset+this.sliderHeight?this.isCustomList||(i=this.maxSliderBallCenterPos):e=!0;else if(this.isRTL)if(r>this.$noResponse.offset().left)e=!0;else{if(r>this.leftOffset+this.sliderWidth)return;this.isCustomList||(i=this.maxSliderBallCenterPos)}else this.isCustomList||(i=this.maxSliderBallCenterPos);e?(this.__moveSliderBallToNoResponse(!1),this.__changeInput("")):(s=this.max-this.min,o=$$WPQuestionUtil.calculateSliderBallPercent(i,this.minSliderBallCenterPos,this.maxSliderBallCenterPos,this.displayVertically,this.isRTL),value=this.min+o*s-0,f=$$WP.I18N.formatNumber(value,this.precision),this.valueOnDrop=(+value).toFixed(this.precision)-0,this.isCustomList&&(this.valueOnDrop<this.min?(this.valueOnDrop=this.min,f=this.valueOnDrop.toString()):this.valueOnDrop>this.max&&(this.valueOnDrop=this.max,f=this.valueOnDrop.toString())),u||(t=this.__calculateSliderBallPosition(value,!0)),this.__changeCss(t),this.__changeAriaLabel(),this.__changeInput(f),this.__activateCurrentSelection())}},__moveSliderArrows:function(n){if(!this.isDestroyed){var t,r,i=this.__getCurrentAnswer();if(""===i||null===i?i=this.defaultVal:this.isCustomList&&(i-=0),n)if(i>this.max)t=this.max;else{if(i===this.max)return;((t=(i+this.arrowStep).toFixed(this.arrowPrecision)-0)-i).toFixed(this.arrowPrecision+1)-0>this.arrowStep&&(t=(t-this.arrowStep).toFixed(this.arrowPrecision+1)-0)}else i<=this.min?r=!0:((t=(i-this.arrowStep).toFixed(this.arrowPrecision)-0)+this.arrowStep).toFixed(this.arrowPrecision+1)-0<i&&(t=(t+this.arrowStep).toFixed(this.arrowPrecision+1)-0);r?this.__noResponseEventHandler():(this.__calculateSliderBallPosition(t),this.__changeAriaLabel(),this.__activateCurrentSelection(),this.isCustomList||(t=$$WP.I18N.formatNumber(t,this.precision)),this.__changeInput(t,!1,!1,!0))}},__setSliderBallLocationOnLoadOrResize:function(n){this.isDestroyed||(this.$slider.is(":visible")?(!this.setSliderBall||n&&!this.isSliding)&&(this.__setSliderBallLocation(n),this.setSliderBall=!0):this.setSliderBall=!1)},__setSliderBallLocation:function(n){var t,i,r;this.isDestroyed||(t=this.__getCurrentAnswer(),r=this.__calculateSliderBallPosition(t),this.valueOnDrop=t,this.$sliderBall.hasClass("invisible")&&(i=!0,n=!0),n?(this.__changeCss(r),i&&this.$sliderBall.removeClass("invisible")):this.displayVertically?(this.animating=!0,this.$sliderBall.animate({top:this.__calculateSliderBallPosition(t)+"px"},250,$.proxy(this.__doneAnimating,this))):(this.animating=!0,this.$sliderBall.animate({left:this.__calculateSliderBallPosition(t)+"px"},250,$.proxy(this.__doneAnimating,this))))},__calculateSliderBallPosition:function(n,t){if(!this.isDestroyed)return n||""!==n&&null!==n?!t&&(n<this.min||n>this.max)?this.noResponseSliderStartPos:$$WPQuestionUtil.calculateSliderBallPercent(n,this.min,this.max,this.displayVertically,this.isRTL)*(this.maxSliderBallCenterPos-this.minSliderBallCenterPos)+this.minSliderBallCenterPos-this.sliderBallWidth/2:this.noResponseSliderStartPos},__moveSliderBallToNoResponse:function(n){this.valueOnDrop="";n?this.displayVertically?(this.animating=!0,this.$sliderBall.animate({top:this.noResponseSliderStartPos+"px"},250,$.proxy(this.__doneAnimating,this))):(this.animating=!0,this.$sliderBall.animate({left:this.noResponseSliderStartPos+"px"},250,$.proxy(this.__doneAnimating,this))):this.__changeCss(this.noResponseSliderStartPos);this.isCustomList||this.__deactivateCurrentSelection();this.__changeAriaLabel()},__changeInput:function(n,t,i,r,u){var f;this.isDestroyed||(this.isCustomList?""===n?(f=this.$minmax.find(".option.active"),this.__unclickOption(f)):(f=this.$minmax.find(".option[data-index='"+n+"'] input").parents(".option"),this.__clickOption(f,!r,!1)):(this.$sliderInput.val(n),this.__updateNumTextboxSize(),this.$sliderInput.trigger("change"),this.$sliderInput.trigger("input",[t,i,r,u])))},__inputChanged:function(n){var i,t=$$WP.I18N.parseNumber(this.$sliderInput.val());t||null!==t&&""!==t?t<this.min||t>this.max||isNaN(t)?(i=!0,this.valueOnDrop=""):this.valueOnDrop=t:i=!0;this.__changeAriaLabel();i?this.__moveSliderBallToNoResponse(!n):(this.__setSliderBallLocation(n),this.__activateCurrentSelection())},__clickOption:function(n,t,i){var f,e,r,u,o,s=n.data("index");this.valueOnDrop=+s;t||(f=this.__calculateSliderBallPosition(s),this.__changeCss(f));i||this.__activateCurrentSelection(n);this.__changeAriaLabel();(o=n.find("input")).prop("checked",!0);o.trigger("click",[1,i]);e=this.$question.find(".currentlyselected > img").safeAttr("src");r=n.find("img").safeAttr("src");u=n.find("img").safeAttr("alt")||n.find(".togglebuttontext").text();e!==r&&(this.$question.find(".currentlyselected > img").safeAttr("src",r),this.$question.find(".currentlyselected > img").safeAttr("alt",u),u||this.$question.find(".currentlyselected > img").removeAttr("alt"));r?this.$question.find(".currentlyselected").removeClass("invisible"):this.$question.find(".currentlyselected").addClass("invisible")},__unclickOption:function(n){this.__deactivateCurrentSelection(n);this.__changeAriaLabel();n.find("input").trigger("click",[0,!0]);this.$question.find(".currentlyselected").addClass("invisible")},__setHeightOnSelection:function(){var e,o,t,n,i,r,u,h,c,f,s;if(1===(e=this.$minmax.find(".option")).filter(".active").length&&(s=!0),0!==(o=this.$minmax.find(".sliderresponseoptions .togglebuttonimg img")).length){for(o=[],t=[],n=0;n<e.length;n++)i=$afe.jq(e[n]),currOptHeight=$$WPQuestionUtil.getElementHeight(i),s&&this.heightOnSelection&&(currOptHeight-=20),r=$$WPQuestionUtil.getElementWidth(i),1===(u=i.find(".togglebuttonimg img")).length?(o[n]=u,h=u[0].naturalWidth,r>150&&(r=150),c=u[0].naturalHeight*r/h,t[n]=$$WPQuestionUtil.getElementHeight(i.find(".togglebuttontext"))+c):t[n]=currOptHeight;for(f=0,n=0;n<t.length;n++)f=Math.max(f,t[n]);this.heightOnSelection=f+20;s&&this.$minmax.find(".sliderresponseoptions").css("height",this.heightOnSelection+"px")}else this.heightOnSelection=""},__doneAnimating:function(){this.animating=!1},__changeCss:function(n){this.animating?this.__waitToChangeCss(n):this.$sliderBall.css(this.cssPropertyToUpdate,n+"px")},__waitToChangeCss:function(n){this.animationTimer=setTimeout($.proxy(function(){this.animating||(this.$sliderBall.css(this.cssPropertyToUpdate,n+"px"),this.animationTimer=0)},this),250)},__getCurrentAnswer:function(n){var t,r,i,u;return this.isCustomList?(i=this.$minmax.find("input:checked"),t=n?1===i.length?1===(u=$afe.jq(i.next().find(".togglebuttontext"))).length?u.text():i.next().find("img").safeAttr("alt"):"":i.parents(".option").data("index")||""):""!==(r=this.$sliderInput.val())?(t=$$WP.I18N.parseNumber(r),isNaN(t)?t=n?r:"":n&&(t=t.toString())):t="",t},__updateNumTextboxSize:function(){this.$sliderValue.css("width","7.5rem");var n=this.$sliderValue[0].scrollWidth;this.$sliderValue.css("width","calc("+n+"px + 0.8rem)")},__changeAriaLabel:function(n){this.isDestroyed||this.ariaLabelTimer||(this.ariaLabelTimer=setTimeout($.proxy(function(){this.__ariaLabelCallback(n)},this),250))},__ariaLabelCallback:function(n){if(!this.isDestroyed){var t=this.__getCurrentAnswer(!0);$$WP.Strings.setDefaultNamespace("Questions.SliderQuestions");$$WP.Strings.addMnemonic("@MYCHART@MINLABEL@",this.minLabel,0,"Questions.SliderQuestions",0);$$WP.Strings.addMnemonic("@MYCHART@MAXLABEL@",this.maxLabel,0,"Questions.SliderQuestions",0);$$WP.Strings.addMnemonic("@MYCHART@CURRSLIDERVALUE@",t,0,"Questions.SliderQuestions",0);this.isCustomList?this.__handleCustomListAriaLabels(n,t,this.__getCurrentAnswer()):($$WP.Strings.addMnemonic("@MYCHART@MIN@",this.minLocal,0,"Questions.SliderQuestions",0),$$WP.Strings.addMnemonic("@MYCHART@MAX@",this.maxLocal,0,"Questions.SliderQuestions",0),this.__handleNumericAriaLabels(n,t),$$WP.Strings.removeMnemonic("@MYCHART@MIN@"),$$WP.Strings.removeMnemonic("@MYCHART@MAX@"));$$WP.Strings.removeMnemonic("@MYCHART@MINLABEL@");$$WP.Strings.removeMnemonic("@MYCHART@MAXLABEL@");$$WP.Strings.removeMnemonic("@MYCHART@CURRSLIDERVALUE@");$$WP.Strings.clearDefaultNamespace();this.ariaLabelTimer=0}},__handleNumericAriaLabels:function(n,t){var f,e,u,i,r;f=this.$sliderBall.safeAttr("aria-valuetext");oldValueNum=this.$sliderBall.safeAttr("aria-valuenow");i=this.minLabelDifferent?"SliderMinWithLabel":"SliderMin";r=this.maxLabelDifferent?"SliderMaxWithLabel":"SliderMax";t||""!==t&&null!==t?(u=$$WP.I18N.parseNumber(t),oldValueNum!==t&&this.$sliderBall.safeAttr("aria-valuenow",t),this.$sliderBall.safeAttr("aria-valuetext",t),($$WP.Utilities.UI.IsMobile||WP.DOM.Browser.isMobile||$$WP.ApplicationContext===applicationWelcome||$$WPQuestionUtil.isFakeResponsive())&&(u===this.min?this.$minmax.find(".min > span").safeAttr("aria-label",$$WP.Strings.getForTemplate(i+"Selected")):this.$minmax.find(".min > span").safeAttr("aria-label",$$WP.Strings.getForTemplate(i)),u===this.max?this.$minmax.find(".max > span").safeAttr("aria-label",$$WP.Strings.getForTemplate(r+"Selected")):this.$minmax.find(".max > span").safeAttr("aria-label",$$WP.Strings.getForTemplate(r)))):(f!==(e=$$WP.Strings.getForTemplate("SliderBlank"))&&this.$sliderBall.safeAttr("aria-valuetext",e),($$WP.Utilities.UI.IsMobile||WP.DOM.Browser.isMobile||$$WP.ApplicationContext===applicationWelcome||$$WPQuestionUtil.isFakeResponsive())&&(this.$minmax.find(".min > span").safeAttr("aria-label",$$WP.Strings.getForTemplate(i)),this.$minmax.find(".max > span").safeAttr("aria-label",$$WP.Strings.getForTemplate(r))))},__handleCustomListAriaLabels:function(n,t,i){var f,r,u,e;f=this.$sliderBall.safeAttr("aria-label");r=this.__getAppropriateAriaLabelCustomList(n,t);u=this.$sliderBall.safeAttr("aria-valuetext");r&&f!==r&&this.$sliderBall.safeAttr("aria-label",r);t?u!==t&&(this.$sliderBall.safeAttr("aria-valuetext",t),this.$sliderBall.safeAttr("aria-valuenow",i)):u!==(e=$$WP.Strings.getForTemplate("SliderBlank"))&&this.$sliderBall.safeAttr("aria-valuetext",e)},__getAppropriateAriaLabelCustomList:function(n,t){var i;return!n&&t||(i=t?this.displayVertically?$$WP.Strings.getForTemplate("VerticalCustomListSliderDescriptionWithValueAndLabelsWeb"):this.isRTL?$$WP.Strings.getForTemplate("HorizontalRTLCustomListSliderDescriptionWithValueAndLabelsWeb"):$$WP.Strings.getForTemplate("HorizontalCustomListSliderDescriptionWithValueAndLabelsWeb"):this.displayVertically?$$WP.Strings.getForTemplate("VerticalCustomListSliderDescriptionEmptyWithLabelsWeb"):this.isRTL?$$WP.Strings.getForTemplate("HorizontalRTLCustomListSliderDescriptionEmptyWithLabelsWeb"):$$WP.Strings.getForTemplate("HorizontalCustomListSliderDescriptionEmptyWithLabelsWeb")),i},__welcomeSpecificSetup:function(){},__pickUpSlider:function(){this.$sliderBall.removeClass("pressed");this.$sliderClickableArea.addClass("sliderup");this.$noResponseClickableArea.addClass("sliderup")},__dropSlider:function(){this.$sliderBall.addClass("pressed");this.$sliderClickableArea.removeClass("sliderup");this.$noResponseClickableArea.removeClass("sliderup")},__activateCurrentSelection:function(n){var t;n?n.hasClass("active")||(this.$minmax.find(".option.active .togglebuttonimg").removeClass("active"),this.$minmax.find(".option.active").removeClass("active"),n.addClass("active"),this.heightOnSelection&&this.$minmax.find(".sliderresponseoptions").css("height",this.heightOnSelection+"px"),n.find(".togglebuttonimg").addClass("active")):this.isCustomList||((t=this.__getCurrentAnswer()-0)===this.min?(this.$minmax.find(".max").removeClass("active"),this.$minmax.find(".min").addClass("active")):t===this.max?(this.$minmax.find(".min").removeClass("active"),this.$minmax.find(".max").addClass("active")):(this.$minmax.find(".min").removeClass("active"),this.$minmax.find(".max").removeClass("active")))},__deactivateCurrentSelection:function(){if(this.isCustomList)return this.$question.find(".option.active .togglebuttonimg").removeClass("active"),this.$question.find(".option").removeClass("active"),void(this.heightOnSelection&&this.$minmax.find(".sliderresponseoptions").css("height","auto"));this.$minmax.find(".min, .max").removeClass("active")}};$$WP.Questions=$$WP.Questions||{};$$WP.Questions.SliderQuestionController=n;n.extend($$WP.Controllers.Controller,"WP$Questions$SliderQuestionController")}();!function(){var n=function(n,t,i,r,u){this.WP$Controllers$Controller();this.$annotatedImage=n;this.$validationElement=t;this.$commentElement=i;this.questionId=r;this.imagePath=u;this.initialize()};n.prototype={COLOR_MAPPING:null,maxWidth:null,questionId:null,clickX:null,clickY:null,clickDrag:null,colorArray:null,patternArray:null,tempClickX:[],tempClickY:[],tempClickDrag:[],tempColorArray:[],tempPatternArray:[],imagePath:null,$annotatedImage:null,$validationElement:null,$commentElement:null,$container:null,$patternImages:null,$canvas:null,image:null,imageWidth:null,context:null,offset:null,scale:null,draw:null,leftCanvas:null,canvasPatterns:null,pattern:null,color:null,start:null,prevX:null,prevY:null,$prevpattern:null,tgtWidth:null,loaded:null,drawnAll:!1,isDestroyed:!1,initialize:function(){this.$annotatedImage&&(this.$annotatedImage.safeAttr("src",makeLink(this.imagePath)),this.pattern="-1",this.image=this.$annotatedImage[0],this.COLOR_MAPPING={1:"#000000",2:"#FF0000",3:"#FF6A00",4:"#FFD800",5:"#267F00",6:"#0025FF",7:"#B200FF",8:"#803300",9:"#808080",10:"#FF00DC",11:"#FFFFFF",12:"#00FFFF"},this.$container=this.$annotatedImage.parents(".drawingcontainer").first(),this.$patternImages=this.$container.find(".pattern img.image"),this.__handleRequiredImageLoading())},__handleRequiredImageLoading:function(){this.$annotatedImage.on("load.questions",$.proxy(this.__onImageLoaded,this));this.$patternImages.on("load.questions",$.proxy(this.__onImageLoaded,this));this.__onImageLoaded()},__onImageLoaded:function(){this.__isAllRequiredImagesLoaded()&&(this.$annotatedImage.off("load.questions"),this.$patternImages.off("load.questions"),this.startDrawing())},__isAllRequiredImagesLoaded:function(){return this.__isAnnotatedImageLoaded()&&this.__isDrawingPatternImagesLoaded()},__isAnnotatedImageLoaded:function(){return this.image.complete&&0!==this.image.naturalHeight},__isDrawingPatternImagesLoaded:function(){var n=!0;return this.$patternImages.each(function(){if(!this.complete)return n=!1,!1}),n},startDrawing:function(){var n,i,t,r;(t=this.$annotatedImage).addClass("imgLoaded");this.draw=!1;(n=$afe.jq(document.createElement("canvas"))).safeAttr("id","canvas"+t.safeAttr("id").substr(5));n.safeAttr("class","imgCanvas");n.safeAttr("aria-hidden","true");this.setImageWidth();i=this.$container;($$WP.Utilities.UI.IsMobile||$$WPQuestionUtil.isFakeResponsive())&&i.find(".imagecontainer").css("max-width",this.imageWidth+"px");n.css({"max-width":this.maxWidth+"px",width:"100%"});n.safeInsertAfter(t);this.setTargetWidth();r=n[0].getContext("2d");this.context=r;this.scaleCanvasSize(this.image,n[0],this.tgtWidth);this.$canvas=n;this.setScale();this.setOffset();this.__initDrawingData();this.__initPatterns();this.__initUndo();this.__initRedo();this.__initDelete();this.__redrawFromSavedImage();this.updateValidationElement(!1);this.__setUpMouseHandling();initTouch(this.$canvas);$afe.jq(document).mouseup($.proxy(function(){this.draw=!1},this));this.loaded=!0;$afe.jq(window).trigger("resetDrawingOffset")},destroy:function(){this.$canvas&&(this.$canvas.off("mousedown mouseover mouseup touchstart touchmove touchend touchcancel"),this.$canvas.css("cursor","unset"));this.$container.find(".pattern").off("click");this.__disableUndoAndClear();this.clickX=[];this.clickY=[];this.clickDrag=[];this.patternArray=[];this.colorArray=[];this.$annotatedImage=null;this.image=null;this.$commentElement=null;this.$validationElement=null;this.$canvas=null;this.$container=null;this.isDestroyed=!0},__initPatterns:function(){this.canvasPatterns=[];var n=this;this.$container.find(".pattern").each(function(){var i,t,r=$afe.jq(this),u=r.safeAttr("id");u&&(t=(i=u.split("_"))[1],i[2],"1"!==t&&(n.canvasPatterns[t]=n.context.createPattern(r.find("img.image")[0],"repeat")))}).click(function(){var i=$afe.jq(this),t=i.safeAttr("id").split("_");n.$prevpattern&&n.$prevpattern.removeClass("selected");i.addClass("selected");n.pattern=t[1];n.color=t[2];n.$prevpattern=i;78===$$WP.ApplicationContext?n.$canvas.css("cursor","crosshair"):"1"===n.pattern?(n.$canvas.css("cursor","url('"+makeStaticLink("images/patterns/Pen"+t[3]+".cur")+"'), crosshair"),n.$canvas.css("cursor","url('"+makeStaticLink("images/patterns/Pen"+t[3]+".cur")+"') 0 20, crosshair")):(n.$canvas.css("cursor","url('"+makeStaticLink("images/square.cur")+"'), crosshair"),n.$canvas.css("cursor","url('"+makeStaticLink("images/square.cur")+"') 7.5 7.5, crosshair"))}).first().click()},__initUndo:function(){var n=this.$container.find(".drawingtools .inlineedit");n.click($.proxy(function(){if(0!==this.clickX.length){for(;"1"===this.clickDrag[this.clickDrag.length-1];)this.removeClick();this.removeClick();this.tempClickX.length>0&&this.__enableRedo();this.drawAll();this.updateValidationElement(!0)}},this));this.clickX&&0!==this.clickX.length||n.safeAttr("disabled","")},__initRedo:function(){var n=this.$container.find(".drawingtools .inlineredo");n.click($.proxy(function(){var n,t,i=!1;if(0!==this.tempClickX.length){for(0===this.clickX.length&&(i=!0),n=this.tempClickX[this.tempClickX.length-1]*this.scale+this.offset.left,t=this.tempClickY[this.tempClickY.length-1]*this.scale+this.offset.top,this.addClick(n,t,"0",this.tempColorArray[this.tempColorArray.length-1],this.tempPatternArray[this.tempPatternArray.length-1]),this.tempClickX.pop(),this.tempClickY.pop(),this.tempClickDrag.pop(),this.tempColorArray.pop(),this.tempPatternArray.pop();"1"===this.tempClickDrag[this.tempClickDrag.length-1];)n=this.tempClickX[this.tempClickX.length-1]*this.scale+this.offset.left,t=this.tempClickY[this.tempClickY.length-1]*this.scale+this.offset.top,this.addClick(n,t,"1",this.tempColorArray[this.tempColorArray.length-1],this.tempPatternArray[this.tempPatternArray.length-1]),this.tempClickX.pop(),this.tempClickY.pop(),this.tempClickDrag.pop(),this.tempColorArray.pop(),this.tempPatternArray.pop();this.drawAll();i&&this.__enableUndoAndClear();0===this.tempClickX.length&&this.__disableRedo();this.updateValidationElement(!0)}},this));n.safeAttr("disabled","")},__initDelete:function(){var n=this.$container.find(".drawingtools .inlinedelete");n.click($.proxy(function(){this.clickX&&0!==this.clickX.length&&($$WP.ApplicationContext===applicationWelcome?this.__clearDrawing():$$WPUtil.quickMessageBox($$WP.Strings.get("DrawingClearWarning","Questions"),$$WP.Strings.get("DrawingClearWarningTitle","Questions"),[new $$WPComp.ComplexObjects.Button($$WP.Strings.get("DrawingClearContinue","Questions"),null,"inlinedelete","continue"),new $$WPComp.ComplexObjects.Button($$WP.Strings.get("DrawingGoBack","Questions"),null,"previousstep","cancel")],$.proxy(function(n,t){t===$$WPComp.TOOLBARIDENTIFIER+"continue"&&this.__clearDrawing()},this),[this]))},this));this.clickX&&0!==this.clickX.length||n.safeAttr("disabled","")},__clearDrawing:function(){this.clickX=[];this.clickY=[];this.clickDrag=[];this.colorArray=[];this.patternArray=[];this.scaleCanvasSize(this.image,this.$canvas[0],this.tgtWidth);this.__disableUndoAndClear();this.__clearTempArrays();this.__disableRedo();this.updateValidationElement(!0)},__clearTempArrays:function(){this.tempClickX=[];this.tempClickY=[];this.tempClickDrag=[];this.tempColorArray=[];this.tempPatternArray=[]},__enableUndoAndClear:function(){var n=this.$container.find(".drawingtools .inlineedit"),t=this.$container.find(".drawingtools .inlinedelete");n.removeAttr("disabled").prop("disabled",!1);t.removeAttr("disabled").prop("disabled",!1)},__enableRedo:function(){this.$container.find(".drawingtools .inlineredo").removeAttr("disabled").prop("disabled",!1)},__disableUndoAndClear:function(){var n=this.$container.find(".drawingtools .inlineedit"),t=this.$container.find(".drawingtools .inlinedelete");n.safeAttr("disabled","");t.safeAttr("disabled","")},__disableRedo:function(){this.$container.find(".drawingtools .inlineredo").safeAttr("disabled","")},__initDrawingData:function(){var n;n=this.$container.find(".drawingdata [name='clickX']").val();this.clickX=n.length>0?n.split(","):[];n=this.$container.find(".drawingdata [name='clickY']").val();this.clickY=n.length>0?n.split(","):[];n=this.$container.find(".drawingdata [name='dragging']").val();this.clickDrag=n.length>0?n.split(","):[];n=this.$container.find(".drawingdata [name='color']").val();this.colorArray=n.length>0?n.split(","):[];n=this.$container.find(".drawingdata [name='pattern']").val();this.patternArray=n.length>0?n.split(","):[]},__redrawFromSavedImage:function(){this.start=0;this.prevX=-30;this.prevY=-30;this.redraw(!1,this.start)},__setUpMouseHandling:function(){this.__addMousedownEvent();this.$canvas.mousemove($.proxy(function(n){!0===this.draw&&this.addClick(n.pageX,n.pageY,this.leftCanvas?"0":"1")&&(this.__clearTempArrays(),this.__disableRedo(),this.drawOne(this.clickX.length),this.leftCanvas=!1)},this)).mouseup($.proxy(function(){this.draw=!1;this.leftCanvas=!1},this)).mouseleave($.proxy(function(){this.leftCanvas=!0},this))},__addMousedownEvent:function(){this.$canvas.mousedown($.proxy(function(n){this.setOffset();this.__defaultMousedownHandler(n)},this))},__defaultMousedownHandler:function(n){this.__clearTempArrays();this.__disableRedo();this.draw=!0;this.leftCanvas=!1;this.addClick(n.pageX,n.pageY,"0");this.drawOne(this.clickX.length);this.updateValidationElement(!0);this.__enableUndoAndClear()},setImageWidth:function(){this.imageWidth=this.$annotatedImage[0].naturalWidth;this.maxWidth=Math.min(this.imageWidth,550)},setTargetWidth:function(){var n;n=$afe.select('.question.drawing[data-lql="'+this.questionId+'"]');this.tgtWidth=$$WP.Utilities.UI.IsMobile||$$WPQuestionUtil.isFakeResponsive()?this.__getTargetWidthForMobile(n):isDataTile()?this.__getTargetWidthForDataTiles(n):$$WP.ApplicationContext===applicationWelcome?this.__getTargetWidthForWelcome(n):this.__getTargetWidthForWeb(n)},__getTargetWidthForMobile:function(n){return n.find(".content.drawingcontainer .imagecontainer").width()},__getTargetWidthForDataTiles:function(n){var t,i,r;return r=(i=n.find(".content.drawingcontainer .imagecontainer .imagesection")).css("width"),i.css("width","100%"),t=(t=n.find(".content.drawingcontainer .imagecontainer .imgCanvas").width())||n.find(".content.drawingcontainer .imagecontainer").width(),i.css("width",r),t},__getTargetWidthForWelcome:function(n){var t,i,r;return r=(i=n.find(".content.drawingcontainer .imagecontainer .imagesection")).css("width"),i.css("width","100%"),t=(t=n.find(".content.drawingcontainer .imagecontainer .imgCanvas").width())||n.find(".content.drawingcontainer .imagecontainer").width(),i.css("width",r),t},__getTargetWidthForWeb:function(n){var t=Math.min(this.maxWidth,this.imageWidth),i=n.find(".content.drawingcontainer .imagecontainer").width();return Math.min(t,i)},setScale:function(){var n=this.tgtWidth/this.imageWidth,t=this.tgtWidth/this.maxWidth;this.scale=this.imageWidth<=this.maxWidth?n:t},drawAll:function(){this.start=0;this.drawnAll=!0;this.scaleCanvasSize(this.image,this.$canvas[0],this.tgtWidth);this.redraw(!1,0);this.drawnAll=this.$canvas.is(":visible")},drawOne:function(n){var e,t,i,r,u,f;t=10*this.scale;i=7.5*this.scale;r=15*this.scale;this.patternArray[n-1]&&("1"===this.patternArray[n-1]?this.redraw(!0,n-1):(u=this.clickX[n-1]*this.scale,f=this.clickY[n-1]*this.scale,(Math.abs(u-this.prevX)>t||Math.abs(f-this.prevY)>t)&&(e=this.patternArray[n-1],this.context.fillStyle=this.canvasPatterns[e],this.context.fillRect(u-i,f-i,r,r),this.context.beginPath())))},redraw:function(n,t,i,r){var u,s,h,c,f,e,o;for(i=i||this.context,r=r||this.scale,i.lineJoin="round",i.lineWidth=3,f=10*r,e=7.5*r,o=15*r,u=t;u<this.clickX.length;u++)this.patternArray[u]&&("1"===this.patternArray[u]?(s=this.colorArray[u],h=this.COLOR_MAPPING[s],i.beginPath(),"1"===this.clickDrag[u]&&u?i.moveTo(this.clickX[u-1]*r,this.clickY[u-1]*r):i.moveTo(this.clickX[u]*r-1,this.clickY[u]*r),i.lineTo(this.clickX[u]*r,this.clickY[u]*r),i.closePath(),i.strokeStyle=h,i.stroke()):n||(Math.abs(this.clickX[u-1]*r-this.prevX)>f||Math.abs(this.clickY[u-1]*r-this.prevY)>f||0===u)&&(c=this.patternArray[u],i.fillStyle=this.canvasPatterns[c],i.fillRect(this.clickX[u]*r-e,this.clickY[u]*r-e,o,o),i.beginPath()))},scaleCanvasSize:function(n,t,i){var r,u;i=i||this.maxWidth;n.naturalWidth<=i?(t.width=n.naturalWidth,t.height=n.naturalHeight):(r=i/n.naturalWidth,t.width=n.naturalWidth*r,t.height=n.naturalHeight*r);u=$(t).parents(".imagesection").first();u.css("height",t.height+"px");u.css("width",t.width+"px")},addClick:function(n,t,i,r,u){var f,e,o,s;return!(this.clickX.length>=2500)&&(f=this.offset.left,e=this.offset.top,o=this.offset.left+this.$canvas[0].width,s=this.offset.top+this.$canvas[0].height,n<f||n>o||t<e||t>s?(this.leftCanvas=!0,!1):(n=Math.round((n-this.offset.left)/this.scale),t=Math.round((t-this.offset.top)/this.scale),this.clickX.push(n),this.clickY.push(t),this.clickDrag.push(i),this.colorArray.push(r||this.color),this.patternArray.push(u||this.pattern),i||this.clickX.length>0&&(this.start=this.clickX.length),!0))},removeClick:function(){this.tempClickX.push(this.clickX.pop());this.tempClickY.push(this.clickY.pop());this.tempClickDrag.push(this.clickDrag.pop());this.tempColorArray.push(this.colorArray.pop());this.tempPatternArray.push(this.patternArray.pop());0===this.clickX.length&&this.__disableUndoAndClear()},updateValidationElement:function(n){this.$validationElement&&this.$commentElement&&(this.clickX&&this.clickX.length||this.$commentElement.val()?this.$validationElement.val("1"):this.$validationElement.val(""),n&&this.$validationElement.trigger("blur"))},setOffset:function(n){if(!this.isDestroyed){var t=this.$canvas.offset();t&&(t.top=Math.round(t.top),t.left=Math.round(t.left),this.offset=t,this.setTargetWidth(),this.setScale(),this.loaded&&n&&this.drawAll())}},getDrawingResponse:function(){var n={};return n.XValues=this.clickX,n.YValues=this.clickY,n.Dragging=this.clickDrag,n.Colors=this.colorArray,n.Patterns=this.patternArray,this.$container&&(this.$canvas&&(this.$container.find(".patternscontainer .pattern[data-baselocalebuttonprompt]").length?(n.OverrideCanvasData=this.getCanvasData(!1),n.CanvasData=this.getCanvasData(!0)):n.CanvasData=this.getCanvasData(!1)),n.Comments=(this.$container.find(".drawingcomment").val()||"").replace(/\s+$/,"")),n},addLegend:function(n,t){var r,f,o,i,s,e,c,h=this.$container.find(".patternscontainer .pattern"),u=2;f=0;o=0;n.width=this.$canvas[0].width/this.scale;n.width<=225&&(u=1);s=30*(h.length/u)+(h.length%u==0?15:30);r=this.$canvas[0].height/this.scale;n.height=r+s;(i=n.getContext("2d")).fillStyle="#ffffff";i.fillRect(0,0,n.width,r);try{e=this.image;i.drawImage(e,0,0,e.naturalWidth,e.naturalHeight,0,0,n.width,r);this.redraw(!1,0,i,1)}catch(n){}i.fillStyle="#e7e7e7";i.fillRect(0,r,n.width,s);c=this.COLOR_MAPPING;h.each(function(){var l,a,v,e,s,y,h=$afe.jq(this);(l=h.safeAttr("id"))&&(v=(a=l.split("_"))[1],s=r+10+30*o,e=10+f*((n.width-10)/u),"1"===v?(y=a[2],i.fillStyle=c[y],i.fillRect(e,s,25,25)):i.drawImage(h.find(".image")[0],e,s),i.fillStyle="black",i.font="16px Arial",i.fillText(t?h.data("baselocalebuttonprompt"):h.text(),e+30,s+15,(n.width-10)/u-30),f===u-1?(f=0,o+=1):f+=1)})},getCanvasData:function(n){var t,i;return t=$afe.jq(document.createElement("canvas")),n?t.safeAttr("id","baseLegend"+this.$canvas[0].id):t.safeAttr("id","legend"+this.$canvas[0].id),t.safeAttr("class","legendCanvas"),i=t[0],this.addLegend(i,n),i.toDataURL("image/png").replace("data:image/png;base64,","")}};$$WP.Questions=$$WP.Questions||{};$$WP.Questions.DrawingQuestionController=n;n.extend($$WP.Controllers.Controller,"WP$Questions$DrawingQuestionController")}();!function(){var t=$$WP.Questions.QuestionTypeEnum,n=$$WP.Questions.ResponseTypeEnum,i=$$WP.Questions.BaseQuestion,e=$$WP.Questions.FreeTextQuestion,o=$$WP.Questions.DateQuestion,s=$$WP.Questions.DrawingQuestion,h=$$WP.Questions.TimeQuestion,c=$$WP.Questions.NumericQuestion,l=$$WP.Questions.CustomListQuestion,a=$$WP.Questions.CategoryINIQuestion,v=$$WP.Questions.YesNoQuestion,y=$$WP.Questions.TimeWithUnitsQuestion,p=$$WP.Questions.UploadQuestion,w=$$WP.Questions.GroupQuestion,b=$$WP.Questions.AddressQuestion,k=$$WP.Questions.FamilyHistoryQuestion,d=$$WP.Questions.SearchTermQuestion,g=$$WP.Questions.DrawingQuestionController,nt=$$WP.Questions.SliderQuestionController,r=$$WP.Questions.AccordionController,u=null,f=function(n,t,i,r,u,f,e,o,s){this.WP$Controllers$Controller();this.$root=n;this.afterLoadCallback=i;this.hqaId=u;this.allowIframes=f;this.$requiredLegend=e;this.afterAccordionShownCallback=o;this.callingApp=s;this.initialize(t,r)};f.prototype={$root:null,QuestionViewBinder:null,QuestionCollection:null,DrawingQuestionCollection:null,SliderQuestionCollection:null,ChildQuestionControllerCollection:null,afterLoadCallback:null,questionConditionCallback:null,hqaId:null,ready:!1,isDestroyed:!1,allowIframes:!1,$requiredLegend:null,afterAccordionShownCallback:null,callingApp:null,initialize:function(n,t){this.QuestionCollection=i.createQuestionCollection();this.QuestionViewBinder=new $$WP.Questions.QuestionViewBinder(["OtherSelected"]);this.DrawingQuestionCollection=[];this.SliderQuestionCollection=[];this.ChildQuestionControllerCollection=[];this.questionConditionCallback=t;this.proxify("_questionConditionCallback");this._convertRawQuestionsToCollection(n,this.QuestionCollection,this._questionConditionCallback);this.QuestionViewBinder.setBindingRoot(this.$root);this.QuestionViewBinder.bindAllModels(this.QuestionCollection.Models);this.isDestroyed=!1;this.render();this.afterRender();this.ready=!0},render:function(){var n;this.isDestroyed||(n=$afe.renderTemplate($$WP.Templates.Questions.QuestionsList,this.QuestionCollection),$$WP.ApplicationContext===applicationWelcome&&$$WP.Utilities.UI.SandboxHtml(n,this.allowIframes),this.$root.safePrepend(n),7===this.QuestionCollection.Models[0].QuestionType&&EpicPx.addReactPortal("@epic-px/search-term-question","SearchTermQuestion",this.QuestionCollection.Models[0],"search-term-question-container"),this.__addAltTextsForReleasedQuestions(),isDataTile()&&$$WPQuestionUtil.waitForImages(this.$root.find("img"),null,null),$afe.select(".question-prompt-header.required").safeAttr("aria-required","true"),$afe.select("question-prompt-header.required + div input").safeAttr("required","true"))},afterRender:function(){var n,e,i,c,o,r,l,s,u,t,a,v,y,p,w,h,b,f;if(!this.isDestroyed){if((n=this.$root).find(".matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights),$$WP.Utilities.UI.IsMobile||$$WPQuestionUtil.isFakeResponsive()){for(n.find(".question .answers > textarea, .question .answers > input, .question .answers > select, .question .answers .otherOptionsContainer .numericFieldWrapper > input").parent().addClass("inputparent"),n.find(".questiongroup[class*='column_']").removeClass("column_1 column_2 column_3 column_4"),e=$afe.select(".questiongroup .answers .card .group-yes-no-answers > .messagedisplay"),i=0;i<e.length;i++)(c=$afe.jq(e[i])).safeInsertAfter(c.parent().find(".group-yes-no-buttons"));for($$WP.ApplicationContext!==applicationWelcome&&n.find(".question.SINGLEROW").removeClass("SINGLEROW").addClass("SINGLECOLUMN"),o=$afe.select(".question.timeWithUnits .answers .validationMessages > .messagedisplay.box"),r=0;r<o.length;r++)(l=$afe.jq(o[r])).safeInsertAfter(l.parent().parent().find("input[type='text']"));for(s=n.find(".question.drawing"),u=0;u<s.length;u++)a=(t=$afe.jq(s[u])).find(".drawingtools"),v=t.find(".imagecontainer"),y=t.find(".editdrawingbuttons"),p=t.find(".patternscontainer"),w=t.find(".commentsection"),h=t.find(".drawingdata"),b=t.find(".imagecontainer > .messagedisplay"),a.safePrepend(v),y.safeInsertBefore(p),w.safeInsertBefore(h),b.safeInsertBefore(h);$$WP.Utilities.Mobile.MobileOptimize()}else($$WP.Utilities.UI.IsMobile||WP.DOM.Browser.isMobile||$$WP.ApplicationContext===applicationWelcome||$$WPQuestionUtil.isFakeResponsive())&&$$WPUtil.UseHTML5InputControls();for($$WP.ApplicationContext===applicationWelcome&&n.find(".questiongroup > .answers[class*='column_3'],.questiongroup > .answers[class*='column_4']").removeClass("column_3 column_4").addClass("column_2"),n.find(".date input[type=date], .time input[type=time]").each(function(){this.value=this.defaultValue;this.defaultValue=""}),this.__handleSingleRowQuestionsOverflow(),this.__addDrawingQuestionListeners(),this.__addSliderQuestionListeners(),this.__addGroupQuestionListeners(),this.__addSingleRowQuestionListeners(),this.__addFollowUpQuestionListeners(),$$WPUtil.AddSingleLineTextareaListeners(),f=0;f<this.QuestionCollection.Models.length;++f)this._initQuestionControls(this.QuestionCollection.Models[f]);$$WP.FormValidation.initializeDOMSubtree(n,!1,!0);null!==this.afterLoadCallback&&"function"==typeof this.afterLoadCallback&&this.afterLoadCallback()}},destroy:function(){this.isDestroyed||(7===this.QuestionCollection.Models[0].QuestionType&&EpicPx.removeReactPortal("search-term-question-container"),this.$root&&(this.$root.off("DOMSubtreeModified",".messagedisplay"),this.$root.off("transitionend",".messagedisplay")),this.$root=null,this.QuestionCollection=[],this.__destroyDrawingQuestions(),this.DrawingQuestionCollection=[],this.__destroySliderQuestions(),this.SliderQuestionCollection=[],this.__removeSingleRowQuestionListeners(),this.__destroyChildQuestions(),this.ChildQuestionControllerCollection=[],this.QuestionViewBinder=null,this.isDestroyed=!0)},getCoreModelsWithAnswers:function(n){return this.isDestroyed?null:this.QuestionCollection.convertToCoreQuestionArray(n)},callPendingConditionalCallbacks:function(){var r,u,i,n;if(this.QuestionCollection&&this.QuestionCollection.Models)for(r=0;r<this.QuestionCollection.Models.length;r++)if((n=this.QuestionCollection.Models[r]).Timer&&(clearTimeout(n.Timer),n.Timer=0,n.AnswerChangedCallback(n)),n.QuestionType===t.Group||n.QuestionType===t.PatientSatisfactionGroup)for(u=0;u<n.GroupQuestions.Models.length;u++)(i=n.GroupQuestions.Models[u]).Timer&&(clearTimeout(i.Timer),i.Timer=0,i.AnswerChangedCallback(i))},updateQuestions:function(i,r){function ri(n){var t=n.elem.getElementsByTagName("legend");t.length>0&&(t[0].style.overflow="hidden");n.tweens=n.tweens.filter(function(n){return"width"!=n.prop})}function ui(n){var t=n.elem.getElementsByTagName("legend");t.length>0&&(t[0].style.overflow="visible")}var ft,a,f,h,c,u,l,b,ct,v,y,g,w,s,et,o,wt,e,lt,bt,kt,at,vt,nt,yt,pt,p,ot,tt,st,dt,ht,gt=[],k=$afe.jq(),it=[],d=$afe.jq(),ni=$afe.jq(),rt=$(),ut=$(),ti,ii;if(i&&!this.isDestroyed){for(ft=0;ft<i.length;ft++)for(a=i[ft],u=null,b=!1,l=null,w=!1,ct=!1,v=!1,y=!1,nt=!1,tt=!1,g=[],f=0;f<this.QuestionCollection.Models.length;f++){if(this.QuestionCollection.Models[f].ID===a.LqlID)(u=this.QuestionCollection.Models[f]).QuestionType!==t.Group&&u.QuestionType!==t.PatientSatisfactionGroup||(v=!0);else if(this.QuestionCollection.Models[f].QuestionType===t.Group||this.QuestionCollection.Models[f].QuestionType===t.PatientSatisfactionGroup)for(h=0;h<this.QuestionCollection.Models[f].GroupQuestions.Models.length;h++){if(this.QuestionCollection.Models[f].GroupQuestions.Models[h].ID===a.LqlID){u=this.QuestionCollection.Models[f].GroupQuestions.Models[h];b=!0;l=this.QuestionCollection.Models[f];w=this.QuestionCollection.Models[f].ShowGroupQuestionsAsList;nt=this.QuestionCollection.Models[f].GroupQuestionLayout===$$WP.Questions.GroupQuestionDisplayStyle.TableSingleColumn||this.QuestionCollection.Models[f].GroupQuestionLayout===$$WP.Questions.GroupQuestionDisplayStyle.TableTwoColumn;tt=this.QuestionCollection.Models[f].HasAnyFollowUpQuestions;ct=this.QuestionCollection.Models[f].AreAllQuestionsYesNo&&!w&&!nt&&!tt;break}if(this.QuestionCollection.Models[f].GroupQuestions.Models[h].ResponseType===n.YesNo){if(!this.QuestionCollection.Models[f].GroupQuestions.Models[h].FollowUpQuestions.Models)continue;for(c=0;c<this.QuestionCollection.Models[f].GroupQuestions.Models[h].FollowUpQuestions.Models.length;c++)if(this.QuestionCollection.Models[f].GroupQuestions.Models[h].FollowUpQuestions.Models[c].ID===a.LqlID){u=this.QuestionCollection.Models[f].GroupQuestions.Models[h].FollowUpQuestions.Models[c];break}}}else if(this.QuestionCollection.Models[f].ResponseType===n.YesNo){if(!this.QuestionCollection.Models[f].FollowUpQuestions.Models)continue;for(c=0;c<this.QuestionCollection.Models[f].FollowUpQuestions.Models.length;c++)if(this.QuestionCollection.Models[f].FollowUpQuestions.Models[c].ID===a.LqlID){u=this.QuestionCollection.Models[f].FollowUpQuestions.Models[c];break}}if(u){if(s=$afe.select("[data-lql='"+a.LqlID+"']"),at=u.QuestionType!==t.Group&&u.QuestionType!==t.PatientSatisfactionGroup||u.ShowGroupQuestionsAsList&&!u.HasAnyFollowUpQuestions,b&&(et=$afe.select("[data-lql='"+l.ID+"']")),0===(o=v&&w?s.find(".answers.groupAsList > .tbContainer > input "):s.find(".answers > input, .slidersection .slidervalue, .slidersection input.forslider, .answers > textarea, .answers > .tbContainer > input, .drawingValidation, .answers > select, .answers > .time-with-units-buttons > .tbContainer > input, .uploadValidation, .answers > .otherOptionsContainer > .numericFieldWrapper > input")).length&&b&&(o=s.find(".buttonList .tbContainer > input, .group-yes-no-buttons .tbContainer > input, input.groupAsListButton, .groupresponsecolumn input ")),st=o,v||(o=o.filter(function(){return s.is($afe.jq(this).closest("[data-lql]"))}),st=st.not(o)),a.IsEnabled){if(!u.IsEnabled&&(v?(u.DisabledBecauseChildrenAllDisabled=u._areAllChildrenDisabled(),(g=u._getInvalidInputs()).length>0&&(y=!0)):w?d=d.add(et):(tt||u._getInvalidInputs().length>0)&&(y=!0),!v||!u.DisabledBecauseChildrenAllDisabled))for(u.IsEnabled=!0,s.css("display","none").removeClass("jqHidden"),ut=ut.add(s),ct&&s.css("display","inline-block"),nt&&(yt=!0),e=0;e<o.length;e++)$afe.jq(o[e]).safeAttr("data-initially-invalid","true");b&&!l.IsEnabled&&l.DisabledBecauseChildrenAllDisabled&&(l.IsEnabled=!0,l.DisabledBecauseChildrenAllDisabled=!1,ut=ut.add(et))}else{if(v?u.DisabledBecauseChildrenAllDisabled=!1:w&&(d=d.add(et)),u.IsEnabled){for(v?(g=u._getInvalidInputs()).length>0&&(y=!0):u._getInvalidInputs().length>0&&(y=!0),u.IsEnabled=!1,rt=rt.add(s),e=0;e<o.length;e++)$afe.jq(o[e]).removeAttr("data-initially-invalid");nt&&(yt=!0)}if(b&&l.IsEnabled){for(pt=!1,p=0;p<it.length;p++)if(it[p].ID===l.ID){pt=!0;break}pt||it.push(l)}}if(at)if(a.IsRequired)u.IsRequired||(y=!0),8===u.ResponseType&&u.IncludeUnknown&&3===(wt=s.find(".answers > .tbContainer")).length&&wt.get(2).remove(),u.IsRequired=!0,s.find(".question-prompt-header, .accordion-heading .header").first().addClass("required"),u.ShowAsSlider&&u.SliderController.markAsRequired();else{for(u.IsRequired&&(y=!0),u.IsRequired=!1,s.find(".question-prompt-header, .accordion-heading .header").first().removeClass("required"),e=0;e<o.length;e++)$afe.jq(o[e]).removeAttr("data-initially-invalid");u.ShowAsSlider&&u.SliderController.markAsUnrequired()}if(!w&&(u._updateValidationSettings(),(kt=u._getGroupValidationSettings())&&s.safeAttr("data-validation-group",kt.toJSON()),at))for(e=0;e<o.length;e++)vt=$afe.jq(o[e]),(bt=u._getValidationSettingsForInput(vt))&&vt.safeAttr("data-validation-settings",bt.toJSON());y&&(k=g.length?k.add(g):k.add(o),tt&&(k=k.add(st)));break}}for(p=0;p<it.length;p++)(ot=it[p])._areAllChildrenDisabled()&&(ot.IsEnabled=!1,ot.DisabledBecauseChildrenAllDisabled=!0,ni=$afe.select("[data-lql='"+ot.ID+"']"),rt=rt.add(ni));this._updateAllFollowUpDisabledClass();ti=rt.hide({duration:250,start:ri,done:ui}).promise();ii=ut.show({duration:250,start:ri,done:ui}).promise();$.when(ti,ii).done($.proxy(function(){for(ht=0;ht<d.length;ht++)dt=$afe.jq(d[ht]),$$WP.FormValidation.initializeDOMSubtree(dt,!1,!0);k.filter(function(){return document.activeElement!==this&&(lt=$afe.jq(this).safeAttr("name"),!gt[lt]&&(gt[lt]=1,!0))}).trigger("validationUpdated",!0);this.$root.find(".matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights);yt&&this.__updateGroupQuestionStripeOnAttr();this.__handleSingleRowQuestionsOverflow();r&&"function"==typeof r&&r()},this))}},_updateAllFollowUpDisabledClass:function(){for(var r,s,f,e,u,h,o=[],i=0;i<this.QuestionCollection.Models.length;i++)if((r=this.QuestionCollection.Models[i]).ResponseType===n.YesNo&&r.FollowUpQuestions.Models)o.push(r);else if(r.QuestionType===t.Group||r.QuestionType===t.PatientSatisfactionGroup)for(f=0;f<this.QuestionCollection.Models[i].GroupQuestions.Models.length;f++)(s=this.QuestionCollection.Models[i].GroupQuestions.Models[f]).ResponseType===n.YesNo&&s.FollowUpQuestions.Models&&o.push(s);for(e=0;e<o.length;e++)u=o[e],h=$afe.select("[data-lql='"+u.ID+"']"),u._areAllFollowUpQuestionsDisabled()?(h.addClass("accordion-disabled"),u.AllFollowUpsDisabled=!0):(h.removeClass("accordion-disabled"),u.AllFollowUpsDisabled=!1)},_questionConditionCallback:function(t){(t.IsTrigger||this._containsFollowUpTriggerQuestion(t))&&t.ResponseType!==n.Upload&&t.ResponseType!==n.TimeWithUnits&&this.questionConditionCallback(t.ID)},_containsFollowUpTriggerQuestion:function(n){var t;if(!n.FollowUpQuestions||!n.FollowUpQuestions.Models)return!1;for(t=0;t<n.FollowUpQuestions.Models.length;t++)if(n.FollowUpQuestions.Models[t].IsTrigger)return!0;return!1},_convertRawQuestionsToCollection:function(r,u,f){var tt,g,nt;if(!this.isDestroyed){for(u.openChangeBatch(),tt=0;tt<r.length;tt++)if("object"==typeof(g=r[tt])&&null!==g){if(g.QuestionType===t.Group||g.QuestionType===t.PatientSatisfactionGroup)(nt=new w(g,f)).GroupQuestions=i.createQuestionCollection(),null!==g.GroupQuestions&&(this._convertRawQuestionsToCollection(g.GroupQuestions,nt.GroupQuestions,f),nt._updateLayoutSettings(),nt._updateClassName());else if(g.QuestionType===t.Drawing)nt=new s(g,f);else if(g.QuestionType===t.FamilyHistory)nt=new k(g,f);else if(g.QuestionType===t.SearchTerm)nt=new d(g,f);else switch(g.ResponseType){case n.Text:nt="MSPQADDRESS"===g.DisplayStyle?new b(g,f):new e(g,f);break;case n.Date:nt=new o(g,f);break;case n.Time:nt=new h(g,f);break;case n.Numeric:nt=new c(g,f);break;case n.CustomList:nt=new l(g,f);break;case n.CategoryINI:nt=new a(g,f);break;case n.YesNo:nt=new v(g,f);this._convertFollowUpQuestions(g,nt,f);break;case n.TimeWithUnits:nt=new y(g,f);break;case n.Upload:nt=new p(g,f)}null!==this.QuestionViewBinder&&nt.addViewBinderId(this.QuestionViewBinder.ViewBinderId);u.add(nt)}u.closeChangeBatch()}},_convertFollowUpQuestions:function(n,t,r){n&&n.FollowUpQuestions&&0!==n.FollowUpQuestions.length&&(t.FollowUpQuestions=i.createQuestionCollection(),this._convertRawQuestionsToCollection(n.FollowUpQuestions,t.FollowUpQuestions,r))},_initQuestionControls:function(i,r){if(!this.isDestroyed)if(i.QuestionType===t.Group||i.QuestionType===t.PatientSatisfactionGroup)this.__initGroupQuestionControls(i);else if(i.QuestionType===t.Drawing)this.__initDrawingControls(i);else switch(i.ResponseType){case n.Text:this.__initFreeTextControls(i);break;case n.Date:this.__initDateControls(i);break;case n.Numeric:this.__initNumericControls(i);break;case n.CustomList:this.__initCustomListControls(i);break;case n.CategoryINI:this.__initCategoryINIControls(i);break;case n.YesNo:this.__initYesNoControls(i,r);break;case n.TimeWithUnits:this.__initTimeWithUnitsControls(i);break;case n.Upload:this.__initUploadControls(i)}},__initGroupQuestionControls:function(n){var t,r,i;if(r=((n.GroupQuestions||{}).Models||[]).length,n.ShowGroupQuestionsAsList&&!n.HasAnyFollowUpQuestions)this.__initButtonControls(n);else for(t=0;t<r;++t)i=n.GroupQuestions.Models[t],this._initQuestionControls(i,!0),(n.HasAnyFollowUpQuestions||0===n.GroupQuestionLayout||6===n.GroupQuestionLayout)&&this.__initGroupRulerRowControls(i)},__initFreeTextControls:function(n){var r,t,i;r=$afe.jq(this.$root.find("input[name='"+n.FormElementName+"'], textarea[name='"+n.FormElementName+"']"));($$WP.Utilities.UI.IsMobile||$$WPQuestionUtil.isFakeResponsive())&&(t=n.MaxLength?2*n.MaxLength:n.IsMultiResponse?3e3:1e3,t=Math.min(t,3e3),this.__modifyMaxLengthOfInput(r,t));n.HasQuickButtons&&(i=$afe.jq(this.$root.find("input[id*='_"+n.ID+"_buttons']")),this.__initButtonControls(n,i),this.__initOtherButtonControls(n),this.__updateFocusOnOtherSelected(n,i),this.__updateValidationOnOtherSelected(n))},__updateFocusOnOtherSelected:function(n,t){var r,i;t=t||$afe.jq(this.$root.find("input[id*='_"+n.ID+"_']"));i=$afe.jq(this.$root.find("input[name='"+n.FormElementName+"']"));r=$afe.jq(this.$root.find("input[id*='_"+n.ID+"_buttons_other']"));t.on("input",$.proxy(function(){var n,t;return n=$afe.jq(r).is(":checked"),inputHidden=$afe.jq(i).is(":hidden"),$$WPQuestionUtil.enableInputField(i,n),n&&$$WP.ApplicationContext!==applicationWelcome&&!inputHidden&&i&&i.length>0?(t=i.val().length,i.get(0).setSelectionRange(t,t),i.focus()):i.focusout(),!0},this))},__updateValidationOnOtherSelected:function(n){var t,i;i=(t=$afe.jq(this.$root.find("input[name='"+n.FormElementName+"']"))).parent();$afe.jq(this.$root.find("input[id*='_"+n.ID+"_buttons_other']")).on("otherOptionToggled",$.proxy(function(){n._updateValidationSettings();t.safeAttr("data-validation-settings",n.ValidationSettings.toJSON());$$WP.FormValidation.resetValidationErrorForAnInput(t,!0)},this));i.on("collapsibleShown collapsibleCollapsed",$.proxy(function(){t.trigger("change",!0);this.$root&&$$WP.FormValidation.checkIfFormIsValid(this.$root,!0)},this))},__autoSelectOtherOption:function(n,t){var i;i=$afe.jq(this.$root.find("input[id*='_"+t.ID+"_buttons_other']"));n.on("input",$.proxy(function(){return $afe.jq(i).is(":checked")||(i.prop("checked",!0),i.trigger("click",[1,!1])),!0},this))},__modifyMaxLengthOfInput:function(n,t){n.removeAttr("maxlength");n.on("keydown keypress input",function(n){var i=$afe.jq(this).val();return i.length>t&&8!==n.which&&$afe.jq(this).val(i.substr(0,t)),!0})},__initDateControls:function(n){var t=$afe.jq(this.$root.find("input[id*='_"+n.ID+"-date']").not("[type='date']"));t.next().is(".datechooserAnchor")||writeCalendar(t,"",makeStaticImageLink("calendar.svg"),null,null,null,!1)},__initNumericControls:function(n){var t;n.ShowAsSlider?this.__setupSliderControllerInQuestionModel(n,!1):n.HasQuickButtons&&(t=$afe.jq(this.$root.find("input[id*='_"+n.ID+"_buttons']")),this.__initButtonControls(n,t),this.__initOtherButtonControls(n),this.__updateFocusOnOtherSelected(n,t),this.__updateValidationOnOtherSelected(n))},__initOtherButtonControls:function(n){var t,i,u;t=$afe.jq(this.$root.find("input[id*='_"+n.ID+"_buttons_other']"));otherChecked=$afe.jq(t).is(":checked");$textInput=$afe.jq(this.$root.find("input[name='"+n.FormElementName+"']"));i=$afe.jq(this.$root.find("[data-lql='"+n.ID+"']"));u=$afe.jq(this.$root.find(".tbContainer input[id*='"+n.ID+"']"));otherChecked||$$WPQuestionUtil.enableInputField($textInput,!1);accordionController=new r(i,u,{$requiredLegend:this.$requiredLegend,$questionsRoot:this.$root},n.IsMultiResponse,[t,$textInput])},__initTimeWithUnitsControls:function(n){var t=$afe.jq(this.$root.find("input[id*='_"+n.ID+"_buttons']"));this.__initButtonControls(n,t)},__initCustomListControls:function(n){n.ShowAsSlider?(this.__setupSliderControllerInQuestionModel(n,!0),this.__initButtonControls(n)):n.ShowAsSelectDropDown?n.IsMultiResponse?this.__initMultiResponseDropDownControls(n):this.__initSingleResponseDropDownControls(n):(this.__initCustomListWithImageControls(n),this.__initButtonControls(n))},__initCategoryINIControls:function(n){n.ShowAsSelectDropDown?n.IsMultiResponse?this.__initMultiResponseDropDownControls(n):this.__initSingleResponseDropDownControls(n):this.__initButtonControls(n)},__initMultiResponseDropDownControls:function(n){var t;t=this.$root.find("select[multiple][id='LQL_"+n.ID+"']");$$WP.Utilities.UI.IsMobile||$$WPQuestionUtil.isFakeResponsive()||t.find("option").mousedown(function(){var t=$afe.jq(this),n=t.parent(),i=n.scrollTop();return n.focus(),t.prop("selected",!t.prop("selected")),setTimeout(function(){n.scrollTop(i)},0),n.focusout(),!1});(WP.DOM.Browser.isIE||WP.DOM.Browser.isAndroid)&&t.on("change",function(){$afe.jq(this).trigger("input")})},__initSingleResponseDropDownControls:function(n){(WP.DOM.Browser.isIE||WP.DOM.Browser.isAndroid)&&this.$root.find("select[id='LQL_"+n.ID+"']").on("change",function(){$afe.jq(this).trigger("input")})},__initYesNoControls:function(n,t){var i,r;if(this.__initButtonControls(n),n.HasFollowUpQuestions)for(t||this.__initFollowUpControls(n),r=((n.FollowUpQuestions||{}).Models||{}).length,i=0;i<r;i++)this._initQuestionControls(n.FollowUpQuestions.Models[i])},__initButtonControls:function(i,r){r=r||$afe.jq(this.$root.find("input[id*='_"+i.ID+"_']"));i.IncludeUnknown&&($parent=r.parents("div.groupresponsecolumn"),$parent.unbind("click").on("click",function(n){var t;$currentDOMElement=$afe.jq(n.target);(t=$afe.jq(this).find("input.prettyradio, input.prettycheck")).prop("checked")||(t.prop("checked",!0),t.prop("wasChecked",!1),t.trigger("click"))}));r.on("click",function(t,r,u){i.ResponseType===n.YesNo&&(r=i.IncludeUnknown);$$WPQuestionUtil.onButtonToggle(t,this,r,u)});WP.DOM.Browser.isIE||WP.DOM.Browser.isFirefox||WP.DOM.Browser.isLegacyEdge||(r.on("keydown",function(n){32===n.which&&(u=this)}),r.on("keyup",function(r){var e,s,f,h,o;if(32===r.which&&(s=u,u=null,this===s)){if((f=i).QuestionType===t.Group||f.QuestionType===t.PatientSatisfactionGroup)for(h=s.value.substr(4),o=0;o<f.GroupQuestions.Models.length;o++)if(f.GroupQuestions.Models[o].ID===h){f=f.GroupQuestions.Models[o];break}switch(f.ResponseType){case n.Numeric:e=!1;break;case n.FreeText:if(f.IsMultiResponse)return;e=!1;break;case n.TimeWithUnits:e=!1;break;case n.CategoryINI:if(f.IsMultiResponse)return;e=!1;break;case n.CustomList:if(f.IsMultiResponse)return;break;case n.YesNo:if(f!==i)return;e=f.IncludeUnknown}$$WPQuestionUtil.onButtonToggle(r,this,e)}}))},__initCustomListWithImageControls:function(n){$afe.jq(this.$root.find(".question[data-lql='"+n.ID+"'] .togglebuttonimg img"))},__initDrawingControls:function(n){var i,r;n.QuestionType===t.Drawing&&(i=$afe.select("[data-lql='"+n.ID+"']"),n.controller=new g(i.find(".annotatedimage"),i.find(".drawingValidation"),i.find(".drawingcomment"),n.ID,"Image/Load?fileName="+n.DrawingDetails.ImagePath+"&withContentType=1"),this.DrawingQuestionCollection.push(n.controller),($$WP.Utilities.UI.IsMobile||$$WPQuestionUtil.isFakeResponsive())&&(r=i.find(".drawingcomment"),this.__modifyMaxLengthOfInput(r,3e3)),"function"==typeof MutationObserver&&new MutationObserver($.proxy(function(n){n.forEach(function(n){var t=$afe.jq(n.target);t.closest("[data-lql]").find(".drawingcomment").safeAttr(n.attributeName,t.safeAttr(n.attributeName))})},this)).observe(i.find(".drawingValidation").get(0),{attributes:!0,attributeFilter:["aria-required","required"]}))},__addDrawingQuestionListeners:function(){$afe.jq(window).on("resize.questions",$.proxy(function(){this.__callSetOffsets(!0)},this));$afe.jq(window).on("compactHeader.questions deCompactHeader.questions resetDrawingOffset",$.proxy(function(){this.__callSetOffsets(!1)},this))},__initGroupRulerRowControls:function(n){var t,i;n.HasFollowUpQuestions?this.__initFollowUpControls(n):(t=$afe.jq(this.$root.find("[data-lql='"+n.ID+"']")),i=new r(t,[],{$requiredLegend:this.$requiredLegend,$questionsRoot:this.$root},!1,null,function(){this.__handleSingleRowQuestionsOverflow(!1);this.afterAccordionShownCallback&&this.afterAccordionShownCallback()}.bind(this)),this.ChildQuestionControllerCollection.push(i))},__initFollowUpControls:function(n){var t,i,u;t=$afe.jq(this.$root.find("[data-lql='"+n.ID+"']"));i=$afe.jq(this.$root.find("input[id*='"+n.ID+"']"));u=new r(t,i,{$requiredLegend:this.$requiredLegend,$questionsRoot:this.$root},!1,null,function(){this.__handleSingleRowQuestionsOverflow(!1);this.afterAccordionShownCallback&&this.afterAccordionShownCallback()}.bind(this));this.ChildQuestionControllerCollection.push(u)},__addGroupQuestionListeners:function(){this.$root.find(".groupresponsecolumn").off("click").on("click",function(n){var i,r,t;((r=$afe.jq(n.target)).hasClass("prettyradio")||r.hasClass("prettycheck")||r.hasClass("prettylabel"))&&!r.hasClass("container")||((t=$afe.jq(this).find("input.prettyradio, input.prettycheck")).prop("checked")?(i=!1,t.prop("checked",i),t.trigger("click")):(i=!0,t.prop("checked",i),t.prop("wasChecked",!1),t.trigger("click")))})},__addSingleRowQuestionListeners:function(){$afe.jq(window).on("resize.questions",$.proxy(function(){this.__handleSingleRowQuestionsOverflow(!0)},this))},__addFollowUpQuestionListeners:function(){$afe.jq(window).on("resize.questions resetChildQuestionsStyling",$.proxy(function(){this.__updateChildQuestionStyling()},this))},__updateChildQuestionStyling:function(){var n;if(this.ready)for(n=0;n<this.ChildQuestionControllerCollection.length;n++)this.ChildQuestionControllerCollection[n].updateStyling()},__destroyChildQuestions:function(){for(var n=0;n<this.ChildQuestionControllerCollection.length;n++)this.ChildQuestionControllerCollection[n].destroy();this.__removeFollowUpQuestionListeners()},__removeFollowUpQuestionListeners:function(){$afe.jq(window).off("resize.questions resetChildQuestionsStyling")},__destroyDrawingQuestions:function(){for(var n=0;n<this.DrawingQuestionCollection.length;n++)this.DrawingQuestionCollection[n].destroy();this.__removeDrawingQuestionListeners()},__removeDrawingQuestionListeners:function(){$afe.jq(window).off("resize.questions compactHeader.questions deCompactHeader.questions resetDrawingOffset")},__removeSingleRowQuestionListeners:function(){$afe.jq(window).off("resize.questions")},__callSetOffsets:function(n){var t;if(this.ready)for(t=0;t<this.DrawingQuestionCollection.length;t++)this.DrawingQuestionCollection[t].loaded&&this.DrawingQuestionCollection[t].setOffset(n||!this.DrawingQuestionCollection[t].drawnAll)},__addSliderQuestionListeners:function(){$afe.jq(window).on("resize.questions compactHeader.questions deCompactHeader.questions resetSliderOffset",$.proxy(function(n){this.__setSliderSizesAndOffsets(n.type)},this));$afe.jq(document).on("mouseup.questions",$.proxy(function(){this.__sliderMouseUp()},this))},__destroySliderQuestions:function(){for(var n=0;n<this.SliderQuestionCollection.length;n++)this.SliderQuestionCollection[n].destroy();this.__removeSliderQuestionListeners()},__removeSliderQuestionListeners:function(){$afe.jq(window).off("resetSliderOffset resize.questions compactHeader.questions deCompactHeader.questions");$afe.jq(document).off("mouseup.questions")},__setSliderSizesAndOffsets:function(n){var t;if(this.ready)for(t=0;t<this.SliderQuestionCollection.length;t++)this.SliderQuestionCollection[t].setSliderSizeAndOffset(n)},__sliderMouseUp:function(){var n;if(this.ready)for(n=0;n<this.SliderQuestionCollection.length;n++)this.SliderQuestionCollection[n].mouseUpEventHandler()},__setupSliderControllerInQuestionModel:function(n,t){var i,r;r=$afe.jq(this.$root.find(".question[data-lql*='"+n.ID+"']"));i=$$WPQuestionUtil.getSliderElements(r);n.SliderController=new nt(n.ID,i,n.SliderOptions,t);this.SliderQuestionCollection.push(n.SliderController)},__initUploadControls:function(t){var e,i,h,r,u,f,o,s;t.ResponseType===n.Upload&&(e=this.$root.find(".upload-container[data-model-id='"+t.ModelId+"']"))&&e instanceof jQuery&&(u=$afe.select("[data-lql='"+t.ID+"']"),f=this.$root.find("textarea[data-model-id='"+t.ModelId+"']"),(u.on("focusout",function(n){f.is(n.target)||u.get(0).contains(n.relatedTarget)||f.trigger("focusout")}),"function"==typeof MutationObserver)&&(o="[data-function='upload']:first-child a",s=["aria-required","required","aria-invalid"],new MutationObserver($.proxy(function(n){n.forEach(function(n){var t=$afe.jq(n.target);t.closest("[data-lql]").find(o).safeAttr(n.attributeName,t.safeAttr(n.attributeName))})},this)).observe(f.get(0),{attributes:!0,attributeFilter:s}),new MutationObserver(function(n){n.forEach(function(n){var t=$afe.jq(n.target).closest("[data-lql]").find(".uploadValidation"),i=$afe.jq(n.addedNodes).find(o);s.forEach(function(n){i.safeAttr(n,t.safeAttr(n))})})}).observe(u.get(0),{childList:!0,subtree:!0})),i=new $$WP.Upload.Models.UploadConfiguration,96===this.callingApp&&(i.HideFileExtensions=!0,i.FromBedside=!0),i.ConfigUrl=makeLink("Questions/QuestionUpload/GetFileUploadConfiguration"),i.UploadUrl=makeLink("Questions/QuestionUpload/UploadFile"),i.EditUrl=makeLink("Questions/QuestionUpload/EditFileName"),i.DeleteUrl=makeLink("Questions/QuestionUpload/DeleteFile"),i.ContextData={AnswerId:this.hqaId,QuestionId:t.ID},i.HideMaxUploadsWarning=!0,h=new $$WP.Upload.Controllers.UploadController(e,i,t.Answers),r=$.proxy(this.__forceUpdateUploadTextArea,this,h,this.$root.find("textarea[data-model-id='"+t.ModelId+"']")),i.onConfigSucess=$.proxy(this.__showHelpTextPopupForUploads,this,t),i.onUploadSuccess=r,i.onEditSuccess=r,i.onDeleteSuccess=r)},__forceUpdateUploadTextArea:function(n,t){for(var u=n.getAllDocuments(),r=[],i=0;i<u.length;++i)r.push(u[i].toRawObject());r.length>0?t.val(JSON.stringify(r)):t.val("");t.trigger("blur")},__showHelpTextPopupForUploads:function(n,t){var i=this.$root.find(".question--upload-config-info[data-model-id='"+n.ModelId+"']"),r;i&&i.length>0&&(0===$$WP.$body.length&&($$WP.$body=$afe.select("body")),r=new $$WP.UI.InfoBubble($$WP.UI.InfoBubble.SimpleInfoBubble(t.AllowedDocumentsHelperText,"","",$$WP.Strings.get("UploadInfoBubbleLabel","Upload"))),i.empty().safeAppend($afe.renderTemplate($$WP.Templates.UI.InfoBubble,r)))},__updateGroupQuestionStripeOnAttr:function(){var n,i,r,t;this.$root.find(".questiongroup .grouptable").each(function(){n=0;t=$afe.jq(this);t.find(".grouptablerow").each(function(){"none"!==(r=$afe.jq(this)).css("display")&&(n++,i=!1,n%2==0&&(i=!0),r.safeAttr("data-zebrastripeon",i))});1===n||0===n?t.hide():"none"===t.css("display")&&t.show()})},__handleSingleRowQuestionsOverflow:function(n){for(var r,i=$afe.select(".SINGLEROW"),t=0;t<i.length;t++)r=$afe.jq(i[t]),this.__resizeSingleRowQuestion(r,n)},__resizeSingleRowQuestion:function(n,t){var i,e,o,f,h;if((i=n.find(".answers .tbContainer")).length>0){if(i.safeRemoveStyle(),e=i.first()[0].getBoundingClientRect().width,o=i.last()[0].getBoundingClientRect().width,$$WP.ApplicationContext===applicationWelcome){i.find(".togglebuttonimg").hide();e=i.first()[0].getBoundingClientRect().width;o=i.last()[0].getBoundingClientRect().width;var r=0,s=0,u=i.first();u.css("flex-grow","0");f=u.find(".togglebuttontext").first();f[0]&&(h=f[0].textContent,i.find(".togglebuttontext").each(function(n,t){for(var e,r=t.textContent.split(" "),i=0;i<r.length;i++)f[0].textContent=r[i],e=u[0].getBoundingClientRect().width,e>s&&(s=e)}),f[0].textContent=h,r=s);0===r&&(r=u[0].getBoundingClientRect().width);u.css("flex-grow","");i.css("flex-basis",r+"px");r=u[0].getBoundingClientRect().width;i.css("max-width",r);i.find(".togglebuttonimg").show()}else e!==o&&i.css("max-width",e);t?this.__matchSingleRowButtonHeights(i):$$WPQuestionUtil.waitForImages(null,n,$.proxy(function(){this.__matchSingleRowButtonHeights(i)},this))}},__matchSingleRowButtonHeights:function(n){var t,i;t=n.map(function(){return this.getBoundingClientRect().height}).get();i=Math.max.apply(Math,t);n.css("height",i)},__addAltTextsForReleasedQuestions:function(){this.$root.find("img.covidcardimg").attr("alt",$$WP.Strings.getForTemplate("CovidVaxUploadHelpAlt","Questions"))}};$$WP.Questions=$$WP.Questions||{};$$WP.Questions.QuestionsController=f;f.extend($$WP.Controllers.Controller,"WP$Questions$QuestionsController")}();!function(){var n=function(n,t){this.reactPortalConfig=t||{};this.QuestionCollection=$$WP.Questions.BaseQuestion.createQuestionCollection();this._convertRawQuestionsToCollection(n,this.QuestionCollection);this.__render()};n.prototype={reactPortalConfig:{},destroy:function(){EpicPx.removeReactPortal("family-history-host");this.reactPortalConfig={};this.isDestroyed=!0},__render:function(){this.reactPortalConfig.welcomeConfig&&!0===this.reactPortalConfig.welcomeConfig.displayedInWelcome?(this.reactPortalConfig.navigationOptions.buttonLabelOverrides.continueLabel=$$WP.Strings.get("WelcomeContinueButtonText","Questionnaire.Welcome"),this.__addPortal()):this.__addPortal()},__addPortal:function(){EpicPx.addReactPortal("@epic-px/family-history","FamilyHistoryQuestion",this.reactPortalConfig,"qnr-questions-container")}};$$WP.Questions=$$WP.Questions||{};$$WP.Questions.FamilyHistoryQuestionController=n;n.extend($$WP.Questions.QuestionsController,"WP$Questions$FamilyHistoryQuestionController")}();!function(){var t="collapsed",n="transitioning",i="show",f="data-collapsible-button",e="data-collapsible-target",a="collapsibleShow",v="collapsibleShown",y="collapsibleCollapse",p="collapsibleCollapsed",r=function(n){return n.hasClass(t)},u=function(n){return n.hasClass(i)},o=function(t){return t.hasClass(n)},s=function(n){var t;t=function(n){for(var r,u,o,s=[],i=$afe.select("["+f+"]"),t=0;t<i.length;t++)r=(o=$afe.jq(i[t])).safeAttr(e),u=$afe.select(r).filter(n),r&&u.length>0&&s.push(o);return s}(n);r(n)?$afe.jq(t).each(function(){this.safeAttr("aria-expanded",!1)}):u(n)&&$afe.jq(t).each(function(){this.safeAttr("aria-expanded",!0)})},h=function(u,f){var e,h;return!!r(u)||!o(u)&&(e=$.Event(y),u.trigger(e),!e.isDefaultPrevented()&&(isNaN(f)&&(f=250),u.removeClass(i),u.addClass(n),u.slideUp(f).promise().done(function(){u.removeClass(n);u.addClass(t);s(u);h=$.Event(p);u.trigger(h)}),!0))},c=function(r,f){var e,h;return!!u(r)||!o(r)&&(e=$.Event(a),r.trigger(e),!e.isDefaultPrevented()&&(isNaN(f)&&(f=250),r.addClass(n),r.slideDown(f).promise().done(function(){r.removeClass(n);r.addClass(i);s(r);h=$.Event(v);r.trigger(h)}),r.removeClass(t),!0))},l=function(n,t,i){switch(t.toLowerCase().trim()){case"toggle":return function(n,t){return r(n)?c(n,t):!!u(n)&&h(n,t)}(n,i);case"show":return c(n,i);case"collapse":return h(n,i);default:return!1}};$$WP.Questions=$$WP.Questions||{};$$WP.Questions.Utilities=$$WP.Questions.Utilities||{};$$WP.Questions.Utilities.Collapsible=function(n,t){n.click(function(n){var i,r,u;i=$afe.jq(this);u=i.safeAttr(f);r=i.safeAttr(e);$afe.select(r).each(function(){l($afe.jq(this),u,t)});n.stopPropagation()})};$$WP.Questions.Utilities.Collapsible.collapse=l}();$$WP.Questions.Utilities=$$WP.Questions.Utilities||{};var $$WPQuestionUtil=$$WP.Questions.Utilities;$$WPQuestionUtil.getSliderElements=function(n){var t={};return t.$question=n,t.$slider=n.find(".slider"),t.$noResponse=n.find(".noresponse"),t.$noResponseLabel=n.find(".noresponselabel"),t.$sliderBall=n.find(".sliderball"),t.$minmax=n.find(".minmax"),t.$sliderInput=n.find(".slidervalue"),t};$$WPQuestionUtil.calculateSliderBallPercent=function(n,t,i,r,u){var f=(n-t)/(i-t);return(r||u)&&(f=1-f),f};$$WPQuestionUtil.onButtonToggle=function(n,t,i,r){var u=$afe.jq(t);if(u.hasClass("forslider")){if(1!==i&&0!==i)return;$$WP.Utilities.UI.ToggleButtonClick(t,n,i,!0);r&&n.preventDefault();n.stopPropagation()}else if(u.parents(".accordion-heading, .quickPick").length>0&&(u.hasClass("togglebutton")||u.hasClass("buttoncheck"))){if("keyup"===n.type)return;if(u.parents(".accordion, .quickPickAccordion").hasClass("accordion-expanding")||u.parents(".accordion, .quickPickAccordion").hasClass("accordion-hiding"))return;$$WP.Utilities.UI.ToggleButtonClick(t,n,i);n.stopPropagation()}else"keyup"===n.type&&$afe.jq(t).is(":checked")&&(r=!0),$$WP.Utilities.UI.ToggleButtonClick(t,n,i,!0),r&&n.preventDefault()};$$WPQuestionUtil.waitForImages=function(n,t,i){var u,r;for(n=n||t.find(".togglebuttonimg img"),r=0;r<n.length;r++)n[r].complete||(u=!1);!1===u?setTimeout(function(){$$WPQuestionUtil.waitForImages(n,"",i)},250):i&&i()};$$WPQuestionUtil.getElementHeight=function(n){return n&&n[0]&&n[0].getBoundingClientRect().height||0};$$WPQuestionUtil.getElementWidth=function(n){return n&&n[0]&&n[0].getBoundingClientRect().width||0};$$WPQuestionUtil.getFocusableElement=function(n){return n&&0!==n.length?0!==n.find(".group-prompt, .question-prompt").length?$$WP.ApplicationContext===applicationWelcome||$$WP.Utilities.UI.IsMobile?n.find(".group-prompt, .question-prompt").addClass("no-outline-on-focus").safeAttr("tabindex","-1"):(n.is(".questiongroup, .questionGroupRulerStyle, .questionGroupAsList")||0===n.find(".accordion-heading").length||(n=n.find(".accordion-heading").first()),0!==n.find(".sliderball").length&&0!==n.find("div.answers input").length?n.find(".sliderball"):0!==n.find("div.answers.drawingcontainer input:hidden, div.answers .upload-container input:hidden").length?n.find(".group-prompt, .question-prompt").addClass("no-outline-on-focus").safeAttr("tabindex","-1"):0!==n.find("div.answers input, div.answers textarea, div.answers select").length?(n.is(".questionGroupRulerStyle")&&(n=n.find(".groupChildren .question:not(.jqHidden)").first()),n.find("div.answers input, div.answers textarea, div.answers select").first()):0!==n.find("div.grouptablecolumn.responses input").length?n.find("div.grouptablecolumn.responses input").first():n.find(".group-prompt, .question-prompt").addClass("no-outline-on-focus").safeAttr("tabindex","-1")):0!==n.hasClass("._PageHeading.questionPrompt, ._PageHeading.formHeader").length?n:n.find("input, textarea, select").first():null};$$WPQuestionUtil.enableInputField=function(n,t){t?(n.removeClass("disabled"),n.prop("disabled",!1)):(n.addClass("disabled"),n.prop("disabled",!0))};$$WPQuestionUtil.updateRequiredLegend=function(n,t,i){null!=n&&null!=t&&(0===n.find(".required").filter(":visible").length?t.hide(i):t.show(i))};$$WPQuestionUtil.isFakeResponsive=function(){return!($$WP.Utilities.UI.IsMobile||"echeckin"!==$$WP.Utilities.queryString("src")&&!$afe.select("html").hasClass("respquestionnaire")||!WP.DOM.Browser.isMobile)};$$WP.Utilities.UI.Cards=function(n){$$WP.Utilities.UI.IsMobile||("echeckin"===$$WP.Utilities.queryString("src")||$afe.select("html").hasClass("respquestionnaire"))&&WP.DOM.Browser.isMobile||("load"===n.type&&($afe.select(".cardlist.hoverable").each($$WP.Utilities.UI.Cards.HandleHoverable),$afe.select("body").on("cardLoad",".cardlist",$$WP.Utilities.UI.Cards.LoadCardlist).on("matchCardHeights",".cardlist.matchHeights",$$WP.Utilities.UI.Cards.MatchHeights)),$afe.select(".cardlist.matchHeights").each($$WP.Utilities.UI.Cards.MatchHeights))};$$WP.Utilities.UI.Cards.LoadCardlist=function(){var n=$afe.jq(this);isDataTile()&&n.is(".cardlist.column_3, .cardlist.column_4")&&n.removeClass("column_3 column_4").addClass("column_2");n.hasClass("hoverable")&&$.proxy($$WP.Utilities.UI.Cards.HandleHoverable,n)();n.hasClass("matchHeights")&&$.proxy($$WP.Utilities.UI.Cards.MatchHeights,n)()};$$WP.Utilities.UI.Cards.HandleHoverable=function(){var n=$afe.jq(this);n.hasClass("hoverable")&&n.find(".card").each(function(){var n=$afe.jq(this);n.prop("hoverable")||(n.hover(function(n){"mouseenter"===n.type?$afe.jq(this).addClass("hover"):$afe.jq(this).removeClass("hover")}),n.find(".button, [data-id='additem']").on("focus blur",function(n){"focus"===n.type?$afe.jq(this).parentsUntil(".card").addBack().parent(".card").addClass("hover"):$afe.jq(this).parentsUntil(".card").addBack().parent(".card").removeClass("hover")}),n.prop("hoverable",!0))})};$$WP.Utilities.UI.Cards.MatchHeights=function(){if(!($$WP.Utilities.UI.IsMobile||78===$$WP.ApplicationContext||("echeckin"===$$WP.Utilities.queryString("src")||$afe.select("html").hasClass("respquestionnaire"))&&WP.DOM.Browser.isMobile)){var r,i,n,u,f=$afe.jq(this),t=f.prop("class");if(t=parseInt(t.substr(t.indexOf("column_")+7)),!isNaN(t))for(r=f.find(".card, .innercard").css("minHeight",""),i=0;i<r.length;i+=t){for(u=r.eq(i).outerHeight(),n=1;n<t;n++)u=Math.max(u,r.eq(i+n).outerHeight());for(n=0;n<t;n++)r.eq(i+n).css("minHeight",u)}}};$$WP.Utilities.UI.Map.Support.cards=$$WP.Utilities.UI.Cards/*0*/