module.exports = "(function(e,i,t){var n=t(5894),r=t(6487),a=t(2165),o=t(4451).b,d=t(4810),f={decideLayer:function(e,i){if(!e.decisionMetadata||!e.decisionMetadata.experimentPriorities)throw new o(\"No decisionMetadata.experimentPriorities on layer.\");for(var t=e.decisionMetadata.experimentPriorities.length,n=0;n<t;n++){var r=s(e,i.audienceIds,i.bucketingId,n);if(r){var d=a.selectVariation(r,i.audienceIds,i.bucketingId,i.activationId,i.preferredVariationMap);if(!e.decisionMetadata.offerConsistency||a.hasVariationActionsOnView(d,i.pageId))return{experiment:r,variation:d}}}throw new o(\"No eligible experiment and variation found.\")},includePageIdInDecisionTicket:function(e){return!(!e.decisionMetadata||!e.decisionMetadata.offerConsistency)}};function s(e,i,t,f){var s,u,c=e.decisionMetadata.experimentPriorities[f],g=null==(s=e.decisionMetadata)?void 0:s.experimentWeights,h=n.reduce(c,(function(t,n){var r=a.getExperimentById(e,n.entityId);return a.isValidExperiment(i,r)&&t.push(n.entityId),t}),[]);if(!n.isEmpty(h)){var l,p=n.filter(c,{endOfRange:null});if(p&&p.length===c.length){if(l=function(e){for(var i=[],t=Math.round(1e4/e.length),n=0;n<e.length;n++)i.push({entityId:e[n],endOfRange:t*(n+1)});return i[i.length-1].endOfRange=1e4,i}(h),!n.isEmpty(g)&&__ALLOCATE_PRIORITIZED_EXPERIENCE_TRAFFIC__)try{l=function(e,i){var t=0,r=n.reduce(n.values(i),(function(e,i){return e+i}),0);if(r>1e4)throw new o(\"Weight distribution is invalid. Total weights: \"+r);return n.map(e,(function(a,d){var f=i[a];if(!n.isNumber(f))throw new o(\"Weight distribution for Experiment ID \"+a+\" not found.\");return r<1e4&&(f=d===e.length-1?1e4-t:Math.floor(i[a]/r*1e4)),{entityId:a,endOfRange:t+=f}}))}(h,n.pick(g,h))}catch(e){d.warn(\"Decider / Could not allocate user-defined weights\",e)}}else{if(0!==p.length)throw new o(\"You must specify weights for all or none of the experiments in each priority layer.\");l=function(e,i){for(var t=[],r=[],a=0,o=0;o<i.length;o++){var d=0;e.indexOf(i[o].entityId)>=0&&(a+=d=0===o?i[0].endOfRange:i[o].endOfRange-i[o-1].endOfRange,r.push({entityId:i[o].entityId,points:d}))}if(n.isEmpty(t))for(var f=0,s=0;s<r.length;s++){var u=Math.round(1e4*r[s].points/a)+f;t.push({entityId:r[s].entityId,endOfRange:u}),f=u}return t[t.length-1].endOfRange=1e4,t}(h,c)}if(u=r.chooseWeightedCandidate(t,e.id,l)){var I=a.getExperimentById(e,u);if(I)return I}}}e.exports=function(e){e.registerDecider(\"equal_priority\",f)}})";