"undefined"==typeof FancyBetLotteryExposureHandler&&(FancyBetLotteryExposureHandler={}); (function(){function g(){MarketExposureObj.eventId=null;MarketExposureObj.marketId=null;MarketExposureObj.marketExposure=0;MarketExposureObj.betRunsExposures={}}function k(a){var d=a.runs,c=a.selectionWinPl,f=a.selectionLossPl,b=0;$j.each(MarketExposureObj.betRunsExposures,function(h,e){e=h==d?MathUtil.decimal.add(e,c):MathUtil.decimal.add(e,f);MarketExposureObj.betRunsExposures[h]=e;b=b>e?e:b});return b}MarketExposureObj={eventId:null,marketId:null,marketExposure:0,betRunsExposures:{}};FancyBetLotteryExposureHandler.getMarketExposure= function(){return JSON.parse(JSON.stringify(MarketExposureObj))};FancyBetLotteryExposureHandler.setMarketExposure=function(a){g();MarketExposureObj=JSON.parse(JSON.stringify(a))};FancyBetLotteryExposureHandler.initMarketInfo=function(a,d){g();MarketExposureObj.eventId=a;MarketExposureObj.marketId=d;for(var c in FancyBetLotterySelectionType)MarketExposureObj.betRunsExposures[FancyBetLotterySelectionType[c].value]=0};FancyBetLotteryExposureHandler.generateBetTicketObj=function(a,d,c,f,b){f=MathUtil.decimal.multiply(MathUtil.decimal.divide(f, 100),b);b=MathUtil.decimal.multiply(-1,b);return{eventId:a,marketId:d,runs:c,selectionWinPl:f,selectionLossPl:b}};FancyBetLotteryExposureHandler.calculateExposure=function(a){if(!$j.isArray(a))throw"betTickets must bet array type.[betTicketObj....]";$j.each(a,function(d,c){MarketExposureObj.marketExposure=k(c)})}})();