module.exports = "(function(e,t,r){var n=r(5894),u=r(2904),a=r(4527),i=r(4727).Promise,o=r(7241),s=r(7075),c=a.evaluate(r(5682));0;var f=a.get(\"stores/interest_group\"),g=a.get(\"stores/tag_group\"),p=a.get(\"stores/view_data\");function v(e){var r={},u=n.chain(t.interestGroupsToAffectingTags).pick(n.map(e,\"id\")).values().flatten().reduce((function(e,t){return n.some(e,n.partial(n.isEqual,t))||(e.push(t),t.viewId in r||(r[t.viewId]=t.viewId)),e}),[]).value(),a=c.query({version:\"0.2\",filter:[{field:[\"type\"],value:\"pageview\"},{field:[\"name\"],comparator:\"in\",value:n.map(r,n.bind(p.idToApiName,p))}]});n.forEach(a,(function(e){e.name=p.apiNameToId(e.name)}));var i=[];n.forEach(a,(function(e){var t=n.reduce(e.tags,(function(t,r,a){var i={viewId:e.name,tagApiName:a};return n.some(u,n.partial(n.isEqual,i))&&(t[a]=r),t}),{});n.isEmpty(t)||i.push(n.assign({},e,{tags:t}))}));var s=function(e){return n.isEmpty(e)?e:(e=n.sortBy(e,(function(e){return-e.time})),n.slice(e,0,o.MAX_EVENTS))}(i);return n.map(s,l)}function l(e){var t=n.reduce(e.tags,(function(e,t,r){return e.push({tag:r,value:t.substring(0,o.MAX_TAG_LENGTH)}),e}),[]);return{eventName:e.name,timestamp:e.time,content:{text:t}}}function d(){var e=f.getAll(),t=g.getAll();return n.reduce(e,(function(e,r){return e[r.id]=t[r.tagGroupId].tags,e}),{})}function m(){u(t,\"interestGroupsToAffectingTags\",d)}t.fetchScores=function(e){var t={interestGroups:e,tagGroups:n.reduce(e,(function(e,t){return t.tagGroupId in e||(e[t.tagGroupId]=g.getById(t.tagGroupId)),e}),{}),events:v(e)};return n.isEmpty(t.events)?i.resolve(function(e){return n.mapValues(e,(function(){return o.NEUTRAL_SCORE}))}(e)):s.gauge(t).then((function(e){return e.scores}))},f.observe(m),g.observe(m),m(),t.interestGroupsAffectedByTags=function(e){var t=n.chain(g.getAll()).filter((function(t){return n.some(t.tags,(function(t){return n.some(e,n.partial(n.isEqual,t))}))})).reduce((function(e,t){return e[t.id]=!0,e}),{}).value();return n.reduce(f.getAll(),(function(e,r){return r.tagGroupId in t&&(e[r.id]=r),e}),{})}})";