Note 1: This article is continually updated to ensure each item is accurate and needed today. Note 2: Achieving racial justice is a marathon, not a sprint. Our work to fix what we broke and left broken isnât done until Black folks tell us itâs done.
There are varied approaches to ending police violence. The best thing to do is to follow your local Black Lives Matter chapter or other local Black-led organization to find out the proposed policy and funding changes in your city or town. Donate to your local BLM chapter, sign up for updates, volunteer, and take action when asked.
Campaign Zero has ten evidence-based solutions to address police violence. Contact your city or town government representative(s) and police chief to advocate for these policies.
Within the evidence-based solutions in #2, Campaign Zero has a project called 8CanâtWait, with eight specific policies to be prioritized to end police violence. The website has a fantastic tool wherein you can see which of the policies your city or town have been enacted. Contact your city or town government representative(s) and police chief to advocate for the policies that have not yet been enacted.
Find out your city or townâs policy on no-knock warrants (the policy that led to Breonna Taylorâs murder). Contact your city or town government representative(s) and police chief to ban no-knock warrants.
Write to your state representative and senator to end qualified immunity like Colorado recently did. Qualified immunity permits government officials performing discretionary functions to be immune from civil suits unless the official violated âclearly established statutory or constitutional rights of which a reasonable person would have known.â In recent years, qualified immunity has been successfully used to defend the use of excessive or deadly force by police, like in this case. Thank you to Claudia S. Murrayfor the suggestion.
Fund a project facilitated by Leap, the Law Enforcement Accountability Project, a fund that empowers activists to change the narrative around the police abuse of Black People. Leap is founded by Ava DuVernay.
Understand and share what âdefund the policeâ really means. Itâs about a new, smarter approach to public safety, wherein we demilitarize the police and allocate resources into education, social services, and other root causes of crimes. What weâre doing now isnât working â There are so many who have been killed, and nearly every Black American has experienced some form of harassment by the police. Some good resources for this are here and here.
More and more stories of Black folks encountering racism are being documented and shared through social media â whether itâs at a hotel, with the police, in a coffee shop, at a school, etc. When you see such a post, call the organization, company, or institution involved to tell them how upset you are. Then share the post along with the institutionâs contact information, spreading the word about what happened and encouraging others to contact the institution as well. Whether the company initiated the event or failed to protect a POC during an onslaught by a third party, they need to hear from us.
If you or a friend is an educator, buy said friend books that feature POC as protagonists and heroes, no matter the racial make-up of the class. A few good lists are here, here, here, here, here, here, here, and here. And/or purchase educational toys that feature POC, such as finger puppets, Black History Flashcards, etc for their classroom. Use these items year-round, not just in February. The racial make-up of students doesnât matter â kids of every race need to know American history and be exposed to people from different races, religions, and countries. If the friend is interested, buy them for your palâs classroom. Donât be shy to ask Facebook friends that you havenât actually talked to in ten years.
If you or a friend or family member is an educator, watch or share this video of Neil deGrasse Tyson speaking about his experience as a Black student telling people he wanted to be a scientist and astrophysicist. Tysonâs experience reminds me of a Black friend whose high school teachers tried to dissuade her from taking AP classes, because, with the best of intentions, they thought the AP classes would be âtoo muchâ for her. Be an educator who supports and encourages, not one who dissuades. Talk to educators you know about being educators who support and encourage, not educators who dissuade.
Work on ensuring that Black educators are hired where Black children are being taught. If you want to know more about why and how this makes a difference for Black children, check out this episode of Malcolm Gladwellâs podcast. There are some really good nuggets in there about how schools can support the achievement of Black students â from ensuring Black students arenât closed out of gifted programs by using test results instead of white teachersâ recommendations to the influence that having a Black teacher has on a Black studentâs education to the importance to fostering a school ethos wherein Black students think, âThis school is here for me.â
Many companies have recruiting channels that are predominantly white. Work with your HR department to recruit Americans who are descendants of enslaved Africans. Recruiting from HBCUs is a good start. Work to put descendants of enslaved Africans already hired under supportive managers.
Bank Black. It doesnât have to be all of your checking or savings. Opening up an account with some money is better than no account at all. You can use the link from #14 (type âbankingâ in the Category field) or this site to find a bank. At the very least, move some or all of your checking, savings, mortgage, etc out of Wells Fargo as a part of the divestment movement to protect Standing Rock.
Donât buy from companies that use prison labor. Find a good list here. While Whole Foods is on that list, but pledged pledged to stop using prison labor in 2016, they havenât made amends for that abuse. You canât pour arson on a burning building, decide to stop pouring the arson, then walk away like everything is fine. Until Whole Foods pays reparations, they stay on the boycott list.
Stand outside of the stores from #16 with a sign that reads â[Company] uses prison laborâ even if for 30 mins a few times a month.
Read up about mandatory minimum sentences and watch videos about this on Families Against Mandatory Minimums (FAMMâs) website. FAMMâs website includes work being done at the federal level and state level. Call or write to your state legislators and governor about reducing mandatory minimum sentences for non-violent drug crimes.
To reduce mandatory minimum sentences on a federal level, call or write to your federal legislators in support of the bipartisan (sponsored by Sen Lee (R-UT)) Smarter Sentencing Act (S. 2850) which reduces the length of federal mandatory minimum drug sentences by half, makes the Fair Sentencing Actâs crack sentencing reforms retroactive, and expands the âsafety valveâ exception to mandatory drug sentences.
To reduce mandatory minimum sentences on a federal level, call or write to your federal legislators in support of the bipartisan (sponsored by Sen Paul (R-KY)) Justice Safety Valve Act (S. 399, H.R. 1097), which would allow judges to give sentences other than the mandatory minimum sentence for any federal crime.
To reduce mandatory minimum sentences on a federal level, call or write your federal legislators in support of another great criminal justice reform bill, the Second Look Act, which would make reduced sentences for crack convictions from the previously passed Fair Sentencing Act retroactive, reduce mandatory minimums for people convicted more than three times for drug crimes from life without parole after the third offense to 25 years, reduce mandatory sentences for drug crimes from 15 to 10 years, limit the use of solitary confinement on juvenile prisoners, etc.
Call or write to your state legislators and governor to support state-wide criminal justice reform including reducing mandatory minimum sentences, reducing sentences for non-violent drug crimes, passing âsafety valveâ law to allow judges to depart below a mandatory minimum sentence under certain conditions, passing alternatives to incarceration, etc. Study after study shows that racism fuels racial disparities in imprisonment, and about 90% of the US prison population are at the state and local level.
Call or write to state legislators to require racial impact statements be required for all criminal justice bills. Most states already require fiscal and environmental impact statements for certain legislation. Racial impact statements evaluate if a bill may create or exacerbate racial disparities should the bill become law. Check out the status of your stateâs legislation surrounding these statements here.
Find and join a local âwhite spaceâ to learn more about and talk out the conscious and unconscious biases us white folks have. If thereâs not a group in your area, start one.
Join or start a Daughters of Abraham book club in your Church, mosque, or synagogue.
Join your local Showing up for Racial Justice (SURJ) group. There is a lot of awesome work going on locally â Get involved in the projects that speak to you.
Do deep canvassing about race and racial justice. Many SURJ groups are organizing them, so many people can do it through your local SURJ group. If theyâre not already doing it, start it.
Research your local prosecutors. Prosecutors have a lot of power to give fair sentences or Draconian ones, influence a judgeâs decision to set bail or not, etc. In the past election, a slew of fair-minded prosecutors were elected. We need more.
Participate in reparations. One way is through this Facebook group. Remember reparations isnât just monetary â share your time, skills, knowledge, connections, etc. Thank you to Clyanna Blyanna for suggesting this addition.
Read The New Jim Crow by Michelle Alexander. Better yet, get a group of friends together to read it like a book club would â read, then discuss. Buy it from one of these Black-owned bookstores.
Read Caught by Marie Gottschalk. Better yet, get a group of friends together to read it like a book club would â read, then discuss. Buy it from one of these Black-owned bookstores.
Read Between the World and Me by Ta-Nehisi Coates. Yep, get a group of friends together to read it like a book club would â read, then discuss. Buy it from one of these Black-owned bookstores.
Read Orange is the New Black by Piper Kerman. The information the author shares about the ease with which one can be charged with âconspiracyâ to sell drugs, the damage done from long sentences that donât fit the crime due to mandatory minimum sentencing, the ever-present threat of solitary confinement at a Correction Officerâs whim, and other specific harmful practices in the prison system are well done. Get a group of friends together to read it like a book club would â read, then discuss. Buy the book from one of these Black-owned bookstores.
Buy books, choose TV shows and movies, and opt for toys for your kids, nieces, nephews, etc that show people from different races, religions, countries and that teach real American history. A few ideas: the books, toys, and flashcards from #9.
Find out how slavery, the Civil War, and the Jim Crow era are being taught in your local school. Advocate that history is taught correctly and certain parts are not skipped over or barely mentioned. Advocate that many voices be used in the study of history. Is the school teaching about post-Civil War convict leasing, the parent to our current mass incarceration system? Talking about slavery alone, is your high school showing images such as Gordonâs scourged back, a slave ship hold, and an enslaved nurse holding her young master? Are explorers, scientists, politicians, etc who are POC discussed? Are male and female authors who are POC on reading lists? In my mostly white high school, reading books like Having Our Say, To Be a Slave, The Bluest Eye, and Their Eyes Were Watching God was really important. A great starting list of such books is here. A great starting list of such books is here. Are Japanese internment camps being discussed? Is history explained correctly in history books? As an example of a severe failure to teach the reality of slavery and its ramifications, check out image 1 and image 2 . There are a lot of great resources out there with a little googling, like PBSâs resources for teaching slavery, this POC Online Classroom blog, Teaching for Change, The Zinn Projectâs This Day in History, Teaching Tolerance at the Southern Poverty Law Center (thank you Adajhand), and The National Association for Multicultural Education.
Arrange for cultural exchanges and cultural ambassadors in your local schoolâs classrooms. The International Classroom program at UPenn and People to People International are options. The Dept of Education has a good list. Cultural exchanges via the interwebs are very valuable. Actual human interaction between people from different races, religions, and countries (ie: cultural ambassadors) and students in the physical classroom is ideal.
Seek out a diverse group of friends for your kids.
Seek out a diverse group of friends for you. Practice real friendship and intimacy by listening when POC talk about their experiences and their perspectives. Theyâre speaking about their pain.
Watch these videos to hear first hand accounts of what our Black brothers and sisters live. Then read everyday peopleâs experiences through the hashtag #realizediwasblack. Watch the rules Tik Tok user @skoodupcamâs mother makes him follow just so he comes home each night. Share with others.
If there are Black children/teens in your life, contribute to their college savings plans. You can also contribute to an HBCU or to the UNCF. Thank you to Rev Dr Pollard for this contribution. Consider making HBCUs and the American Indian College Fund beneficiaries through your will or living trusts. Thank you Janice Crawford for this contribution.
Call or write to your national legislators, state legislators, and governor in favor of affirmative action. Encourage friends to do the same.
Write to your college/university about implementing all or some of these diversity strategies that effectively promote racial, ethnic, and socioeconomic diversity on campus. Write to the public universities your tax payer dollars support about implementing these diversity strategies.
Write to the US Sentencing Commission (PubAffairs@ussc.gov) and ask them to: â reform the career offender guideline to lessen the length of sentences â change the guidelines so that more people get probation â change the criminal history guidelines so that a personâs criminal record counts against them less â change guidelines to reduce mandatory minimum sentences for non-violent crimes â conduct a study to review the impact of parental incarceration on minor children. With more data, the Commission could modify the Sentencing Guidelines and allow judges to take this factor into account when sentencing individuals for non-violent crimes. â conduct a study to review whether the Bureau of Prisons is following the Commissionâs encouragement to file a motion for compassionate release whenever âextraordinary and compelling reasonsâ exist. â consider amending the guidelines to reduce sentences for first offenders.
Read Van Jonesâ short and to-the-point article about the racial biases of reporters. More examples are here and here. Check out this article discussing how media coverage of the opioid epidemic â which largely affects suburban and rural whites â portrays it as an outside threat and focuses on treatment and recovery, while stories of heroin in the 1970s, crack-cocaine in the 1980s, and other drug problems that impact urban people of color today have focused on the drug userâs morality. Keep an eye out for such biases, and use social media and direct communication to the media outlet to call them out when they occur.
Know our American history. Watch Roots, 12 Years a Slave, and Selma, to name a few.
Check out Black movies, TV, and other media that show POC as lead characters and in their full humanity. Queen Sugar, Insecure, Dear White People, The Carmichael Show, Blackish, Grownish, Atlanta, 2 Dope Queens, Black Panther, A Wrinkle in Time, Get Out, Girls Trip, Mudbound, How to Get Away with Murder, Scandal, The Cloverfield Paradox, Sorry to Bother You, Blindspotting, BlacKkKlansman, Little, If Beale Street Could Talk, Queen and Slim, A Black Lady Sketch Show, PBSâ Great Performance of Much Ado about Nothing, youtube videos of Amber Says What, and Pose are a few. Share them with friends. In addition, if you canât watch the whole video, watch 13:12 to 15:17 of this discussion about working in Hollywood when youâre not white.
Know what indigenous land youâre living on by looking that this map and research the groups that occupied that land before you did. Find out what local activism those groups are doing and give your money and time to those efforts.
When people say that Black Lives Matter is a violent/terrorist group, explain to them that there are fringe groups that are being misrepresented as part of BLM. If conservatives donât want to be lumped in with the KKK, they canât lump violent protesters in with BLM.
When people ask, âWhy aren't you talking about âblack-on-black crimeâ?â and other myths about BLM, let Francesca Ramsey help you with those talking points.
Be honest about our history. One genocide, another genocide, then apartheid. It sucks, but itâs true. Weâll never be free from our history unless weâre honest about it. Denial is our pathology, but the truth will set us free.
If you have a close relationship with a young person of color, make sure he/she knows how much you love them. Love and affirm that child. Thank you to Rev Dr Pollard for this contribution.
Write to your city or town government representative to replace Columbus Day with Indigenous Peopleâs Day like these cities did.
Personally divest your investments in private prisons and detention centers. Start here. Many people are divesting from Wells Fargo for their substantial role in Standing Rock and from private prison companies Corrections Corporation of America (CCA), GEO Group, CoreCivic, and G4S.
Write to your state legislators to end cash bail. It means that a someone who is legally innocent is put in jail because they canât afford bail. It means that a defendant can be released pre-trial because of their wealth, not how much of a flight risk they are. It puts more people in detention (which tax payers pay for) and affects a defendantsâ ability to maintain employment, access mental and physical healthcare, and be in communication with their family and friends, etc. Housing the approximately 500,000 people in jail in the US awaiting trial who cannot afford bail costs US taxpayers $9 billion a year. Thank you to Elizabeth B. and Cynthia Astle for suggesting this addition.
Attend town halls, candidate meet-and-greets, etc for political candidates and ask about ending mass incarceration, reducing mandatory minimum sentences, reducing or ending solitary confinement, decriminalizing weed, ending cash bail, divesting from private prisons, divesting from banks, divesting from banks that finance the Dakota Access Pipeline, etc.
Read this article about an overt white supremacistâs sonâs journey to relinquish white supremacy and watch this video about Daryl Davis, a Black man who gets KKK members to disavow by befriending them. For those you know who are overtly racist (see #57), think about ways you can create exposure for them to people who donât look like them, share their religion, etc. Jane Elliott says, âPeople who are racist arenât stupid, theyâre ignorant. And the answer to ignorance is education.â Frederick Douglass notes, âIt is easier to build strong children than to repair broken men.â It may be best to focus on children, adolescents, and young adults currently being raised by overtly racist parents. Maybe itâs tutoring them so they could get on a college track, encouraging them to study abroad, or turning them on to colleges where not everyone looks like them and shares their religion, etc. Maybe itâs spending time with them on some regularity and showing them the achievements and beauty of non-white cultures. Be creative.
Talk to the white people you know who arenât clearly upset by white supremacy. Use âIâ statements and âI careâ messages (âI feel [feeling] when you [behavior]â). They need to know you see a problem. Call them out, and call them in. As a start, ask them to watch the videos in #53. For people you know whoâve been radicalized by FOX News and other nationalist (not conservative) media, whoâve been so pummeled with fear and hatred of âthe otherâ that theyâve become ISIS-like towards others, how can you and other family and friends guide them through conversation to show them that their actions are now in direct contrast with the values they feign to purport?
A wise former teacher once said, âThe question isnât: Was the act racist or not? The question is: How much racism was in play?â So maybe racism was 3% of the motivation or 30% or 95%. Interrogate the question âHow much racism was in play?â as you think about an incident. Share this idea with the people in your life when they ask, âWas that racist?â
Credit Black men and women. Kara Springer, a Black woman artist, created the image/public art that begins this piece. Itâs called A Small Matter of Engineering, Part II. Christian Campbell tweeted to ensure the art was attributed appropriately and correctly.
Watch Jane Elliotâs blue eyes/brown eyes racism experiment here. Watch Jane Elliotâs a follow-up on the blue eyes/brown eyes racism experiment on Oprah here, and watch Jane Elliot and Roland Martinâs conversation at the University of Michiganâs Women of Color Task Force here. Thank you to Jourdain Blair for this suggestion.
Anti-racism is a global fight. Donât buy electronics or jewelry made from conflict minerals. Find an overview and rankings of electronics and jewelry companiesâ efforts to source conflict-free minerals here. At your place of work, establish a policy that your company or organization will only purchase electronics from companies that are top-rated. Write to companies on the list and ask them to improve their rank.
Read this article by educator and activity Bettina L. Love about the harm done by schools to their Black students. Ensure your local school/School Board has a clear and strong policy of zero tolerance for racial slurs, physically touching a child to discipline them, invasions of privacy like strip searches, hair discrimination, etc. âZero toleranceâ means loss of a job, loss of a pension, and mandatory reporting to state Department of Education. If and when school officials donât comply with their own policies, or when a school refuses to create these policies altogether, use resources at your disposal like social media, local news media, connections to the School Board, etc to hold them accountable.
Write to your state representative and senator to ban voter ID laws, ease the voter registration process, implement early voting, and implement voting-by-mail. The unfortunate reality of efforts to âfight against voter fraudâ is that voter fraud isnât statistically a problem in this country. Even The Heritage Foundation counts only 1,285 cases of voter fraud⌠since 1998. Just like poll taxes, literacy tests, and grandfather clauses were ârace-neutralâ policies that inhibited Black Americans from voting until the Voting Rights Act of 1965 passed, voter ID laws, cuts to voting registration processes, and cuts to early voting are efforts to inhibit Black Americans from voting today. A well-off white person in my life lamented that their children could easily get their ID, so why couldnât anyone else? This person neglected to recognize that her children had cars to get them to the DMV, lived relatively close to the DMV, had the time to go, etc. This excerpt from the previous link is quite striking: âIn the 1930s one Georgia man described the situation this way: âDo you know Iâve never voted in my life, never been able to exercise my right as a citizen because of the poll tax? ⌠I canât pay a poll tax, canât have a voice in my own government.â â Saying, âJust get your ID!â today is the equivalent of saying âJust pay the poll tax!â in 1964. Remember that the restrictive voting laws passed since 2013 have been considered legal only because the Supreme Court gutted the most powerful protections of the Voting Rights Act. Thank you Alice Smith and Sarah Weiss for this suggestion.
Ibram X Kendi says we need to move beyond saying âracistâ and ânot racist.â Instead, some white people are practicing anti-racism by (1) divesting themselves of white fragility and defensiveness and choosing to continue to learn and listen to Black folks and (2) dismantling white supremacy in the institutions around them. White supremacy is not just targeted murder of Black men by police. White supremacy pervades every institution â places of work, schools, all levels of govt, banks, places of worship, etc. It is our work to dismantle white supremacy in all of these institutions, not just the police. Those who are not practicing anti-racism are perpetuating white supremacy. And we cannot do the external work without doing the internal work.
Contact your high school and college/university to create a class that teaches white privilege, use of racial stereotypes by individuals and the media, the subconscious nature of racism in every US institution (schools, companies, etc). This class should be mandatory for all students. One such class is CFE 444 â Schooling & Diversity at Syracuse University.
Support that new apartment building proposed to be built in your neighborhood. Donât participate in âsnob zoning,â which is opposing new builds of apartments because wealthy white folks are afraid the apartment building will âchange the character of a community.â
Array is an independent film distribution and resource collective founded by Ava DuVernay. For students of all ages, Array is creating learning companions for the works they produce and distribute, starting with When They See Us. Check out the learning companion for it here.
Check out the White Ally Toolkit, which helps white folks become more persuasive in conversations with racism skeptics by empowering and equipping us with best practice communications skills based on listening, storytelling, and compassion.
'+bc(a,c)+"";d.contentWindow.document.open();
d.contentWindow.document.write(c);d.contentWindow.document.close()}else d=document.createElement("div"),d.id="branch-banner",d.className="branch-animation",d.innerHTML=bc(a,c),document.body.appendChild(d);return c=d};function dc(a,b,c,d){function e(){k();g.style.background="#FFD4D4";l.className="error";setTimeout(function(){g.style.background="#FFFFFF";l.className=""},2E3)}function f(){t=a.createElement("div");t.className="branch-icon-wrapper";t.id="branch-checkmark";t.style="opacity: 0;";t.innerHTML=window.ActiveXObject?'✓':'';
m.appendChild(t);g.style.opacity="0";l.style.opacity="0";n.style.opacity="0";setTimeout(function(){t.style.opacity="1"},20);l.value=""}function k(){g.removeAttribute("disabled");l.removeAttribute("disabled");g.style.opacity="1";l.style.opacity="1";n.style.opacity="0"}var l=a.getElementById("branch-sms-phone"),g=a.getElementById("branch-sms-send"),n=a.getElementById("branch-loader-wrapper"),m=a.getElementById("branch-sms-form-container"),t;if(l){var z=l.value;/^\d{7,}$/.test(z.replace(/[\s()+\-\.]|ext/gi,
""))?(O(b,"willSendBannerSMS"),g.setAttribute("disabled",""),l.setAttribute("disabled",""),g.style.opacity=".4",l.style.opacity=".4",n.style.opacity="1",l.className="",b.sendSMS(z,d,c,function(a){a?(O(b,"sendBannerSMSError"),e()):(O(b,"didSendBannerSMS"),f(),setTimeout(function(){m.removeChild(t);k()},3E3))})):e()}}
function ec(a,b,c,d){function e(a,c){"function"===typeof a&&(c=a,a={});a=a||{};"top"===b.position?k.style.top="-76px":"bottom"===b.position&&(k.style.bottom="-76px");"number"===typeof b.K?d.set("hideBanner",Wb(b.K),!0):d.set("hideBanner",!0,!0);a.X?("top"===b.position?document.body.style.marginTop=n:"bottom"===b.position&&(document.body.style.marginBottom=t),Vb("branch-banner-is-active"),N(k),N(document.getElementById("branch-css")),c()):(setTimeout(function(){N(k);N(document.getElementById("branch-css"));
c()},270),setTimeout(function(){"top"===b.position?document.body.style.marginTop=n:"bottom"===b.position&&(document.body.style.marginBottom=t);Vb("branch-banner-is-active")},20))}function f(){"top"===b.position?k.style.top="0":"bottom"===b.position&&(k.style.bottom="0");O(a,"didShowBanner")}if(!Zb(d,b))return O(a,"willNotShowBanner"),null;O(a,"willShowBanner");var k=cc(b,d);ac(b,k);c.channel=c.channel||"app banner";var l=b.D?k.contentWindow.document:document;if(B()){b.open_app=b.na;b.append_deeplink_path=
b.ba;b.make_new_link=b.ka;b.deepview_type="banner";a.deepview(c,b);var g=l.getElementById("branch-mobile-action");g&&(g.onclick=function(b){b.preventDefault();a.deepviewCta()})}else l.getElementById("sms-form")?l.getElementById("sms-form").addEventListener("submit",function(d){d.preventDefault();dc(l,a,b,c)}):k.onload=function(){l=k.contentWindow.document;l.getElementById("sms-form")&&l.getElementById("sms-form").addEventListener("submit",function(d){d.preventDefault();dc(l,a,b,c)})};var g=Xb("margin-top"),
n=document.body.style.marginTop,m=Xb("margin-bottom"),t=document.body.style.marginBottom,z=l.getElementById("branch-banner-close");z&&(z.onclick=function(b){b.preventDefault();O(a,"willCloseBanner");e({},function(){O(a,"didCloseBanner")})});Ub(document.body,"branch-banner-is-active");"top"===b.position?document.body.style.marginTop=Yb(g):"bottom"===b.position&&(document.body.style.marginBottom=Yb(m));b.X?f():setTimeout(f,20);return e};var fc,gc=1,P="top",hc="absolute",Q="76px",ic=!1,jc=!1,R=[],kc=!1,lc=window.innerHeight,mc=window.innerWidth;window.innerHeight((.|\s)*?)<\/script>/,qc=/"),o.close();var d=n.mapValues(c.SandboxedFunctions,(function(e){return i[e]}));u.dispatch(r.SANDBOXED_FUNCTIONS_ADDED,{sandboxedFunctions:d}),t.parentNode.removeChild(t)}catch(e){l.warn("Unable to create a sandbox: ",e)}}}),(function(e,t,i){var n=i(2),r=i(23),a=i(94),o=i(16),s=o.get("stores/plugins"),c=i(7),u=i(25),l=i(9),d=!1,f=[i(107),i(108),i(129)],p=["clientMetadata","cookieDomain","disable","load","optOut","rum"];t.push=function(e,t){var i,a,o,s;if(!n.isArray(e)&&n.isObject(e))s=n.isUndefined(e.version)?1:e.version,i=e.type,o=[e];else if(n.isArray(e))s=0,i=e[0],o=e.slice(1);else{if(!n.isString(e))return r.warn("API / Ignoring non-array/object/string argument:",e),!1;s=0,i=e,o=[]}if(f[s]&&(a=f[s][i]),t&&p.indexOf(i)===-1)return r.debug("API / Ignoring non high priority function:",i,o),!1;if(!a)return r.warn('API / No function found for "'+i+'" (v'+s+") with arguments:",o),!1;r.log('API / Executing: "'+i,'" with arguments:',o);try{a.apply(null,o),l.dispatch(c.RECORD_API_USAGE,{methodName:s?"v"+s+"."+i:i})}catch(e){r.error(e)}return!0},t.get=function(e){if(d&&"state"!==e)return void r.warn('Module "'+e+'" not found.');r.log('API / Getting module: "'+e+'"');var t=a[e];return t?n.isArray(t)&&(t=o.evaluate(t)):t=s.getPlugin(u.PluginTypes.apiModules,e),t?(l.dispatch(c.RECORD_API_USAGE,{methodName:"get."+e}),t):void r.warn('Module "'+e+'" not found.')}}),(function(e,t,i){function n(e,t,i,n){var r=e.getLayerState(n),a=t.get(n),s=i.get();if(!r||!a)return s?{layer:{name:s.layerName,id:s.layerId,policy:s.layerPolicy,integrationStringVersion:s.integrationStringVersion},experiment:{name:s.experimentName,id:s.experimentId},variation:{name:s.variationName,id:s.variationId},isLayerHoldback:!1}:null;if(l.isSingleExperimentPolicy(a.policy)&&r.decision.isLayerHoldback)return null;var c=r.decision.experimentId,u=r.decision.variationId;if(!c||!u)return null;var d,f;return(d=o.find(a.experiments,{id:c}))?(f=o.find(d.variations,{id:u}),f?{layer:{name:a.name,id:a.id,policy:a.policy,integrationStringVersion:a.integrationStringVersion},experiment:{name:d.name,id:d.id},variation:{name:f.name,id:f.id},isLayerHoldback:r.decision.isLayerHoldback}:null):null}function r(e,t,i,n,r,s){var c=[],u=e.getLayerStates();s.onlySingleExperiments&&(u=o.filter(u,(function(e){var i=t.get(e.layerId);return i&&l.isSingleExperimentPolicy(i.policy)})));var f=o.map(u,(function(e){var t=!!e.decision.variationId,i=e.decisionActivationId&&e.decisionActivationId===n.getActivationId(),r=d.getExperimentAndVariation(),a=r?r.variationId:null,s=t&&e.decision.variationId===a;return o.extend(e,{isActive:t&&i||s,visitorRedirected:s})})),p=r?o.filter(f,r):f;return o.each(p,(function(e){var n=a(e,t,i,s.includeOfferConsistency);n&&c.push(n)})),c}function a(e,t,i,n){var r,a,s=e.layerId,c=t.get(s)||{},u=o.map(c.experiments,(function(e){return o.pick(e,["id","name"])}));if(n||!c.decisionMetadata||!c.decisionMetadata.offerConsistency){var l={id:s,campaignName:c.name||null,experiment:null,allExperiments:u,variation:null,reason:e.decision.reason,isActive:!!e.isActive,visitorRedirected:e.visitorRedirected,isInCampaignHoldback:e.decision.isLayerHoldback};e.decision&&e.decision.experimentId&&(r=o.find(c.experiments,{id:e.decision.experimentId})),r&&(l.experiment=o.pick(r,["id","name","campaignName"])),r&&e.decision.variationId&&(a=o.find(r.variations,{id:e.decision.variationId})),a&&(l.variation=o.pick(a,["id","name"]));var d=o.map(e.decisionTicket.audienceIds,(function(e){return o.pick(i.get(e),["id","name"])}));return l.audiences=d,c.decisionMetadata&&c.decisionMetadata.offerConsistency&&(l.pageId=e.pageId),l}}var o=i(2),s=i(95),c=i(96),u=i(98),l=i(45),d=i(99);t.data=["stores/audience_data","stores/client_metadata","stores/event_data","stores/layer_data","stores/view_data","stores/group_data","stores/interest_group","stores/tag_group","stores/global",function(e,t,i,n,r,a,s,l,d){var f={},p={},g={},h={audiences:e.getAudiencesMap(),events:i.getEventsMap(),campaigns:f,pages:r.getPagesMap(),experiments:p,variations:g,projectId:d.getProjectId(),snippetId:d.getSnippetId(),accountId:d.getAccountId(),dcpServiceId:d.getDCPServiceId(),revision:d.getRevision(),clientName:t.getClientName(),clientVersion:t.getClientVersion()},_=u.dereferenceChangeId;return o.each(n.getAll(),(function(e){c.defineProperty(f,e.id,(function(){var t=o.extend({},e);return c.defineProperty(t,"changes",(function(){return o.map(e.changes,_)}),"campaign"),c.defineProperty(t,"experiments",(function(){return o.map(e.experiments,(function(e){return p[e.id]}))}),"campaign"),t}),"campaignMap","byId"),o.each(e.experiments,(function(e){c.defineProperty(p,e.id,(function(){var t=o.extend({},e);return c.defineProperty(t,"changes",(function(){return o.map(e.changes,_)}),"experiment"),c.defineProperty(t,"variations",(function(){return o.map(e.variations,(function(e){return g[e.id]}))}),"experiment"),t}),"experimentMap","byId"),o.each(e.variations,(function(e){c.defineProperty(g,e.id,(function(){var t=o.extend({},e);return c.defineProperty(t,"actions",(function(){return o.map(e.actions,(function(e){return o.extend({},e,{changes:o.map(e.changes,_)})}))}),"variation"),t}),"variationMap","byId")}))}))})),h.groups=a.getGroupsMap(),h}],t.session=["stores/session",function(e){return e.getState()}],t.visitor=["stores/visitor",function(e){return o.cloneDeep(e.getVisitorProfile())}],t.visitor_id=["stores/visitor_id",function(e){return{randomId:e.getRandomId()}}],t.state=["stores/audience_data","stores/layer_data","stores/layer","stores/view_data","stores/view","stores/global","stores/observed_redirect",function(e,t,i,a,c,u,f){
return{getCampaignStates:function(n){var a={},s=r(i,t,e,u,n,{includeOfferConsistency:!1});return o.each(s,(function(e){a[e.id]=e})),a},getExperimentStates:function(n){var a=r(i,t,e,u,n,{includeOfferConsistency:!1,onlySingleExperiments:!0}),s=["audiences","variation","reason","visitorRedirected","isActive"],c=o.reduce(a,(function(e,t){var i=t.allExperiments[0];return e[i.id]=o.extend({},o.pick(t,s),{id:i.id,experimentName:i.name,isInExperimentHoldback:t.isInCampaignHoldback}),e}),{});return c},getCampaignStateLists:function(n){var a={},s=r(i,t,e,u,n,{includeOfferConsistency:!0});return o.each(s,(function(e){var t=e.id;a[t]||(a[t]=[]),a[t].push(e)})),a},getPageStates:function(e){var t=c.getAll(),i=o.reduce(t,(function(e,t){var i=a.get(t.id);return e[t.id]=o.extend({},o.pick(i,["id","name","apiName","category","staticConditions","tags"]),o.pick(t,["isActive","metadata"])),e[t.id].isActive=!!e[t.id].isActive,e}),{});return e?o.pickBy(i,e):i},isGlobalHoldback:function(){return u.isGlobalHoldback()},getActivationId:function(){return u.getActivationId()},getVariationMap:function(){var e=i.getLayerStates(),n={};return o.each(e,(function(e){var i=t.get(e.layerId);if(e.decision&&e.decision.experimentId&&(n[e.decision.experimentId]={id:e.decision.variationId,name:null,index:null},i)){var r=o.find(i.experiments,{id:e.decision.experimentId});if(r&&e.decision.variationId)var a=o.find(r.variations,{id:e.decision.variationId}),s=o.findIndex(r.variations,{id:e.decision.variationId});a&&(n[e.decision.experimentId]={id:e.decision.variationId,name:a.name,index:s})}})),n},getActiveExperimentIds:function(){var e={};return o.each(this.getCampaignStateLists({isActive:!0}),(function(t){o.each(t,(function(t){e[t.experiment.id]=!0}))})),o.keys(e)},getRedirectInfo:function(){var e=d.getExperimentAndVariation();return e&&(e.referrer=d.getReferrer()),e},getDecisionString:function(e){if(!e)throw new Error("Must pass a config to getDecisionString");e=o.extend({maxLength:255,shouldCleanString:!1},e);var r=n(i,t,f,e.campaignId);return r?s.generateAnalyticsString(r.layer,r.experiment,r.variation,r.isLayerHoldback,e.maxLength,e.shouldCleanString):null},getDecisionObject:function(e){if(!e)throw new Error("Must pass a config to getDecisionObject");e=o.extend({maxLength:255,shouldCleanString:!1},e);var r=n(i,t,f,e.campaignId);if(!r)return null;var a=s.formatNamesAndIdsForAnalytics(r.layer,r.experiment,r.variation,e.shouldCleanString),c=o.mapValues(a.names,(function(t,i){return s.combineAndTruncateIdAndName(t,a.idStrings[i],e.maxLength)})),u={experiment:c.experiment,variation:c.variation};return l.isSingleExperimentPolicy(r.layer.policy)||o.extend(u,{campaign:c.layer,holdback:r.isLayerHoldback}),u}}}],t.utils=i(100).create(),t.jquery=["env/jquery",function(e){return e}],t.event_emitter=i(106)}),(function(e,t,i){function n(e){return e.replace(/[^a-zA-Z0-9\.\~\!\*\(\)\']+/g,"_")}function r(e){return!c.isEmpty(e)&&c.includes(["and","or","not"],e[0])}function a(e,t){var i="";return c.isEmpty(t)?i=d:(i=c.reduce(t,(function(t,i){var r=e.get(i);return r?t+n(r.name?r.name:r.id)+",":t}),""),i=i.slice(0,-1)),i}function o(e,i,n,r,a,o){if(!_.isSingleExperimentPolicy(e.policy)||!r){var s=!_.isSingleExperimentPolicy(e.policy)&&r,u=t.formatNamesAndIdsForAnalytics(e,i,n,o),d=[u.names.experiment,u.names.variation],p=[u.idStrings.experiment,u.idStrings.variation];_.isSingleExperimentPolicy(e.policy)||(d.unshift(u.names.layer),p.unshift(u.idStrings.layer));var g=c.reduce(p,(function(e,t){return e+t.length}),0),h=d.length-1+(s?1:0),v=h*l.length,E=g+v;if(s&&(E+=f.length),E>a)throw new Error("The analytics string size is too low to send the entity IDs.");for(var m=a-E,I=d.length,y=[],T=d.length-1;T>=0;T--){var S=d[T],A=Math.min(S.length,Math.floor(m/I));m-=A,I--,y.unshift(S.substring(0,A))}var D=c.map(y,(function(e,t){return e+p[t]}));return s&&D.push(f),D.join(l)}}function s(e,i,n,r,a,o){var s=r?f:p,u=3*l.length,d=t.formatNamesAndIdsForAnalytics(e,i,n,o),g=d.names,h=d.idStrings,v=c.reduce(h,(function(e,t){return e+t.length}),0);if(v+u+s.length>a)throw new Error("The analytics string size is too low to send the campaign, experiment, and variation IDs.");var E=a-v-u-s.length,m={};m.variation=Math.min(g.variation.length,Math.floor(E/3)),E-=m.variation,m.experiment=Math.min(g.experiment.length,Math.floor(E/2)),E-=m.experiment,m.layer=E;var I={};c.each(g,(function(e,t){I[t]=e.substring(0,m[t])}));var y=[];return _.isSingleExperimentPolicy(e.policy)||y.push(I.layer+h.layer),y=y.concat([I.experiment+h.experiment,I.variation+h.variation,s]),y.join(l)}var c=i(2),u=i(16),l=":",d="everyone_else",f="holdback",p="treatment",g="",h=i(23),_=i(45);t.formatNamesAndIdsForAnalytics=function(e,t,i,o){var s={layer:e.name||g,experiment:t.name||g,variation:i.name||g};if(o&&(s=c.mapValues(s,n)),s.experiment===g&&(!e.integrationStringVersion||1===e.integrationStringVersion))if(r(t.audienceIds))s.experiment="Exp";else{var l=u.get("stores/audience_data");s.experiment=a(l,t.audienceIds)}var d={layer:"("+n(e.id)+")",experiment:"("+n(t.id)+")",variation:"("+n(i.id)+")"};return{names:s,idStrings:d}},t.combineAndTruncateIdAndName=function(e,t,i){var n=i-t.length;if(n<0&&(h.warn("maxLength must be at least long enough to fit the entity ID, which is length"+t.length+". Defaulting to only use entity ID as name."),e=g),e===g)return t;if(e.length>n){var r=Math.min(e.length,n);return e=e.substring(0,r),e+t}return e+" "+t},t.generateAnalyticsString=function(e,t,i,n,r,a){return e.integrationStringVersion&&2===e.integrationStringVersion?o(e,t,i,n,r,a):s(e,t,i,n,r,a)}}),(function(e,t,i){var n=i(97),r=i(7),a=i(9),o=i(23);t.defineProperty=function(e,t,i,s,c){n(e,t,(function(){var e=["prop",s,c||t].join(".");return o.debug('Evaluating getter: "'+e+'"'),a.dispatch(r.RECORD_API_USAGE,{methodName:e}),i()}),!0)}}),(function(e,t){"use strict";function i(e,t,i,n){Object.defineProperty(e,t,{get:function(){var e=i.call(this);return Object.defineProperty(this,t,{value:e,enumerable:!!n,writable:!0}),e},set:function(e){return Object.defineProperty(this,t,{value:e,enumerable:!!n,writable:!0}),e},enumerable:!!n,configurable:!0})}e.exports=i}),(function(e,t,i){function n(e){var i=r.cloneDeep(e);return i.changes&&(i.changes=r.map(i.changes,t.dereferenceChangeId)),i.experiments&&r.each(i.experiments,(function(e){e.changes&&(e.changes=r.map(e.changes,t.dereferenceChangeId)),e.variations&&r.each(e.variations,(function(e){e.actions&&r.each(e.actions,(function(e){e.changes&&(e.changes=r.map(e.changes,t.dereferenceChangeId))}))}))})),i}var r=i(2),a=i(16),o=i(22),s=i(96),c=a.get("stores/change_data");t.translateDecisionToCampaignDecision=function(e){return u(r.cloneDeep(e),{layerId:"campaignId",isLayerHoldback:"isCampaignHoldback"})},t.translateLayerEventToCampaignEvent=function(e){var t={};return s.defineProperty(t,"campaign",(function(){var t=n(e.data.layer);return t}),"campaignEvent"),t.decisionTicket=e.data.decisionTicket,t.decision=this.translateDecisionToCampaignDecision(e.data.decision),t.audiences=e.data.audiences,{type:"lifecycle",name:"campaignDecided",data:t}},t.translateViewActivatedToPageActivated=function(e){return{type:"lifecycle",name:"pageActivated",data:{page:e.data.view}}},t.dereferenceChangeId=function(e){var t=c.getChange(e);return t?o.safeReference(t):e};var u=function(e,t){var i=r.omit(e,r.keys(t));return r.each(t,(function(t,n){i[t]=e[n]})),i}}),(function(e,t,i){var n=i(2),r=i(16),a=r.get("stores/global_state"),o=r.get("stores/layer_data"),s=r.get("stores/observed_redirect");t.getReferrer=function(){var e=s.get();return e?e.referrer:n.isString(a.getEffectiveReferrer())?a.getEffectiveReferrer():null},t.getExperimentAndVariation=function(){var e=s.get();if(e&&n.isString(e.variationId))return n.pick(e,["experimentId","variationId"]);if(n.isString(a.getEffectiveVariationId())){var t=a.getEffectiveVariationId(),i=o.getExperimentByVariationId(t),r=i?i.id:null;return{experimentId:r,variationId:t}}return null}}),(function(e,t,i){var n=i(12).Promise,r=i(101).observeSelector,a=i(102).poll,o=i(104).waitForElement,s=i(105).waitUntil;t.create=function(){return{observeSelector:r,poll:a,Promise:n,waitForElement:o,waitUntil:s}}}),(function(e,t,i){function n(){if(f.shouldObserveChangesIndefinitely()){var e={attributes:!0,childList:!0,subtree:!0,characterData:!0},t=p.getDocumentElement(),i=new MutationObserver(function(){this.disconnect(),l.each(l.keys(E),a),this.observe(t,e)});return function(n){var r=E[n];i.observe(t,e),r.cancelObservation=function(){delete E[n],l.isEmpty(E)&&i.disconnect()}}}return function(e){var t=h.poll(l.partial(a,e));E[e].cancelObservation=function(){t(),delete E[e]}}}function r(e){var t=E[e];t&&t.cancelObservation&&t.cancelObservation()}function a(e){if(E[e]){if(o(E[e]))return 0===E[e].matchedCount&&l.isFunction(E[e].options.onTimeout)&&E[e].options.onTimeout(),void r(e);var t=document.querySelectorAll(E[e].selector);t.length&&(l.each(t,(function(t){t.ti&&t.ti[e]||E[e].callbackQueue.push(t)})),s(e))}}function o(e){var t=e.options.timeout;if(null!==t)if("function"==typeof t)try{return t()}catch(e){}else if(Date.now()-e.startTime>t)return!0;return!1}function s(e){for(;E[e]&&E[e].callbackQueue.length;){var t=E[e].callbackQueue.shift();if(c(t,e),E[e].matchedCount=E[e].matchedCount+1,E[e].callback(t),E[e]&&E[e].options.once)return void r(e)}}function c(e,t){e.ti||(e.ti={}),e.ti[t]=!0}function u(e){try{document.querySelector(e)}catch(e){return!1}return!0}var l=i(2),d=(i(7),i(16)),f=d.get("stores/directive"),p=i(81),g=(i(25),i(9),i(5).generate),h=i(102),_=i(41),v=(d.get("stores/rum"),{once:!1,onTimeout:null,timeout:null}),E={},m=function(e){(m=n())(e)};t.observeSelector=function(e,t,i){if(!u(e))throw new Error("observeSelector expects a valid css selector as its first argument");if(!l.isFunction(t))throw new Error("observeSelector expects a function as its second argument");if(i&&(!l.isObject(i)||l.isFunction(i)))throw new Error("observeSelector expects an object as its third argument");var n=g();return i=l.assign({},v,i||{}),E[n]={callback:t,callbackQueue:[],matchedCount:0,options:i,selector:e,startTime:Date.now()},m(n),_.setTimeout(l.bind(a,null,n),0),l.partial(r,n)}}),(function(e,t,i){function n(e){l[e]&&a.each(l[e].callbacks,(function(e){e.call(null)}))}function r(e,t){l[t]&&l[t].callbacks[e]&&(delete l[t].callbacks[e],a.some(l[t].callbacks)||(clearInterval(l[t].id),delete l[t]))}var a=i(2),o=(i(7),i(16)),s=(i(25),i(9),i(5).generate),c=i(41),u=i(103).DEFAULT_INTERVAL,l=(o.get("stores/rum"),{});t.poll=function(e,t){a.isNumber(t)||(t=u),l[t]||(l[t]={callbacks:{},id:c.setInterval(a.partial(n,t),t)});var i=s();return l[t].callbacks[i]=e,a.partial(r,i,t)},t.cancelAll=function(){a.each(l,(function(e,t){clearInterval(e.id),delete l[t]}))}}),(function(e,t){e.exports={DEFAULT_INTERVAL:20}}),(function(e,t,i){var n=i(12).Promise,r=i(101).observeSelector;t.waitForElement=function(e){return new n(function(t,i){r(e,t,{once:!0})})}}),(function(e,t,i){var n=i(12).Promise,r=i(102).poll;t.waitUntil=function(e){return new n(function(t,i){if(e())return void t();var n=r((function(){e()&&(n(),t())}))})}}),(function(e,t,i){var n=i(87);t.on=function(e){return e.publicOnly=!0,n.on(e)},t.off=n.off,t.emit=function(e){n.emit(e)}}),(function(e,t,i){function n(e){var t,i={};if(e)if(r(e))t=Number(e);else{if("object"!=typeof e)throw new Error("tracker","Revenue argument",e,"not a number.");if(i=a.extend({},e),"revenue"in i){if(!r(i["revenue"]))throw new Error("tracker","Revenue value",i["revenue"],"not a number.");t=Number(i["revenue"]),delete i["revenue"]}}return a.isUndefined(t)||(i.revenue=t),i}function r(e){return a.isNumber(e)||a.isString(e)&&Number(e)==e}var a=i(2),o=i(108);t.activateGeoDelayedExperiments=function(e,t){t||(t=e.lists?"odds":"cdn3"),o.dataFromSource({data:e,source:t})},t.activateSiteCatalyst=function(e){e&&e.sVariable&&o.integrationSettings({id:"adobe_analytics",settings:{sVariableReference:e.sVariable}})},t.bucketUser=t.bucketVisitor=function(e,t){if(e&&t){var i={experimentId:String(e)};t>256?i.variationId=String(t):i.variationIndex=String(t),o.bucketVisitor(i)}},t.disable=function(e){o.disable({scope:e})},t.log=function(e){a.isUndefined(e)&&(e=!0),o.log({level:e?"INFO":"OFF"})},t.optOut=function(e){a.isUndefined(e)&&(e=!0),o.optOut({isOptOut:e})},t.setCookieDomain=function(e){o.cookieDomain({cookieDomain:e})},t.setCookieExpiration=function(e){o.cookieExpiration({cookieExpirationDays:e})},t.setDimensionValue=function(e,t){var i={};i[e]=t,o.user({attributes:i})},t.setUserId=function(e){o.user({userId:e})},t.storeThirdPartyData=function(e,t){o.dataFromSource({source:e,data:t})},t.trackEvent=function(e,t){o.event({eventName:e,tags:n(t)})}}),(function(e,t,i){function n(e){var t;return e.eventId&&(t=I.create(e.eventId,e.eventName,"custom")),w.updateAllViewTags(),function(){var i=p.trackCustomEvent(e.eventName,e.tags,t);i?D.log("API / Tracking custom event:",e.eventName,e.tags):D.log("API / Not tracking custom event:",e.eventName)}}function r(e){var t;return e.eventData&&(t=I.create(e.eventData.id,e.eventData.apiName,"click",e.eventData)),function(){var e=p.trackClickEvent(t);e?D.log("API / Tracking click event:",e):D.log("API / Not tracking click event:",e)}}function a(e){var t=e.eventData,i=A.createLayerState(t.layerId,t.experimentId,t.variationId),n=A.createSingle(t.layerId,t.experimentId,t.variationId);return function(){A.recordLayerDecision(i.layerId,i.decisionTicket,i.decision),D.log("API / Tracking decision event:",i),p.trackDecisionEvent(i.decision,i.decisionTicket,n)}}function o(e){var t=w.create(e.eventData.id,e.eventData.apiName),i=w.createState(t.id);return function(){var e=p.trackViewActivation(t,i);e?D.log("API / Tracking pageview event:",e):D.log("API / Not tracking pageview event:",e)}}var s=i(2),c=i(7),u=i(93),l=i(94),d=i(109),f=i(25),p=i(110),g=i(117),h=i(6),_=i(77).create,v=i(24),E=i(118),m=i(121),I=i(122),y=i(87),T=i(9),S=i(26),A=i(113),D=i(23),R=i(123),b=i(114),w=i(124),O=i(75),N=i(16),C=N.get("stores/dimension_data"),P=N.get("stores/view"),L=N.get("stores/view_data"),V=N.get("stores/visitor_id"),k=N.get("stores/layer_data"),x=N.get("stores/directive"),F=!1,M=!1,U=F||M,G=86400,B=90,z=t.ApiListenerError=_("ApiListenerError");t.event=function(e){var t;switch(e.eventType){case"click":t=r(e);break;case"decision":t=a(e);break;case"pageview":t=o(e);break;case"custom":default:t=n(e)}V.getBucketingId()?t():T.dispatch(c.ADD_CLEANUP_FN,{lifecycle:f.Lifecycle.postActivate,cleanupFn:t})},t.clientMetadata=function(e){U&&(T.dispatch(c.SET_CLIENT_NAME,e.clientName),T.dispatch(c.SET_CLIENT_VERSION,e.clientVersion)),F&&e.forceVariationIds&&T.dispatch(c.LOAD_DIRECTIVE,{forceVariationIds:e.forceVariationIds})},t.priorRedirectString=function(e){U&&b.load(e.value)},t.microsnippetError=function(e){if(U){var t=e.errorData.metadata&&e.errorData.metadata.err||{};t.name=e.errorData.code;var i={engine:e.engine,msVersion:e.errorData.msVersion,requestId:e.errorData.requestId,projectId:e.errorData.projectId,snippetKey:e.errorData.snippetKey,args:e.errorData.args};m.handleError(t,i)}},t.rum=function(e){T.dispatch(c.SET_RUM_DATA,e.eventData)},t.initialViewStates=function(e){var t=s.map(e.states,(function(e,t){return{id:t,isActive:e}}));w.registerViews(t)},t.page=function(e){var t=L.getByApiName(e.pageName);if(!t)throw new Error('Unknown page "'+e.pageName+'"');var i=!e.hasOwnProperty("isActive")||e.isActive,n=function(){i?w.activateViaAPI(t,e.tags):(w.deactivate(t),D.log("API / Deactivated Page",w.description(t)))};V.getBucketingId()?n():T.dispatch(c.ADD_CLEANUP_FN,{lifecycle:f.Lifecycle.postViewsActivated,cleanupFn:n})},t.tags=function(e){w.setGlobalTags(e.tags)},t.user=function(e){U&&e.visitorId&&(V.getBucketingId()?(D.log("API / Setting visitor Id:",e.visitorId),O.setId({randomId:e.visitorId})):(D.log("API / Setting visitor Id for activation:",e.visitorId),T.dispatch(c.SET_VISITOR_ID_VIA_API,e.visitorId))),F&&s.each(["IP","location","queryParams","url"],(function(t){e[t]&&(D.log("API / Setting",t,":",e[t]),j(t,e[t],!1))})),D.log("API / Setting visitor custom attributes:",e.attributes),s.each(e.attributes,(function(e,t){var i,n,r=t,a=C.getById(t)||C.getByApiName(t);a&&(r=a.id,i=a.apiName,n=a.segmentId||a.id);var o={id:n,value:e};i&&(o.name=i),j(r,o,!0)}))};var j=function(e,t,i){var n=[{key:i?["custom",e]:[e],value:t,metadata:{lastModified:v.now()}}],r=function(){T.dispatch(c.SET_VISITOR_ATTRIBUTES,{attributes:n})};V.getBucketingId()?r():T.dispatch(c.ADD_CLEANUP_FN,{lifecycle:f.Lifecycle.postVisitorProfileLoad,cleanupFn:r})};t.optOut=function(e){var t=!e.hasOwnProperty("isOptOut")||e.isOptOut;E.setOptOut(t)},t.cookieExpiration=function(e){var t=e.cookieExpirationDays;t0&&(a=s[0]),s.length>1&&(o=s[1]),i.push([a,o])}return i},t.getQueryParamValue=function(e){for(var i=t.getQueryParams(),n=0;n');var s=n.querySelector("#"+o);if(!s)throw new Error("Document.write failed to append script");s.onload=i,s.onerror=function(n){r.warn("Failed to load script ("+e+") synchronously:",n),t.addScriptAsync(e,i)}}catch(n){r.debug("Document.write failed for "+e+": "+n.message);var c=function(e){var t=new Function(e.responseText);t(),i&&i()};return a.request({url:e,async:!1,contentType:"text/plain",success:c})["catch"]((function(n){r.error("Failed to load "+e+" via synchronous XHR: "+n.message),t.addScriptAsync(e,i)}))}}}),(function(e,t,i){function n(){var e=null;b.isNumber(e)&&0===Ee.getCount()?(J.log("Activating after delay of",e,"ms because no Experiments are running"),W.dispatch(P.SET_RUM_DATA,{data:{activateDfd:!0}}),le.setTimeout(V.emitActivateEvent,e)):V.emitActivateEvent()}function r(e){Ne.handleError(e.data.error,e.data.metadata)}function a(){b.isArray(window.optimizely)&&(window.optimizely=b.filter(window.optimizely,(function(e){var t=!0;return!Oe.push(e,t)})))}function o(){var e=i(85),n=!!ue.getCurrentId(),r=!!n&&ue.hasSomeData();n?r?J.log("xd / Existing visitor; has data on this origin"):J.log("xd / Existing visitor; new to this origin"):J.log("xd / New visitor");var a=_e.getAccountId(),o="https://a16180790160.cdn.optimizely.com".replace("__SUBDOMAIN__","a"+a+"."),c="/client_storage/a"+a+".html";e.subscribe((function(e,t){ue.checkKeyForVisitorId(e)&&$.setItem(e,t)}));var u=e.fetchAll().then((function(t){var i=we.getCanonicalOrigins();if(i){var n=e.getXDomainUserId(t,i);n&&(J.log("Syncing cross-origin visitor randomId:",n),ue.maybePersistVisitorId({randomId:n}))}return ue.deleteOldForeignData(),t})).then(t.persistItemsWithId).then((function(e){if(ue.loadForeignData(),n&&!r){var t=!b.isEmpty(e);J.debug("xd / Loaded foreign data? ",t),s(t)}J.log("Loaded visitor data from foreign origins"),V.emitOriginsSyncedEvent()}),(function(e){throw n&&!r&&(J.debug("xd / Failed to load foreign data:",e),s(!1,e)),e}));return ne.all([e.load(o,c)["catch"]((function(e){throw J.debug("xd / Failed to load iframe:",e),n&&!r&&s(!1,e),e})),u["catch"]((function(e){J.debug("xd / Ignored error syncing foreign data (expected if waitForOriginSync used):",e.message),J.debug("xd / Enqueuing sync to happen after visitorId set."),W.dispatch(P.ADD_CLEANUP_FN,{lifecycle:H.Lifecycle.postVisitorProfileLoad,cleanupFn:V.emitOriginsSyncedEvent})}))])}function s(e,t){W.dispatch(P.SET_RUM_DATA,{data:{extras:{xdAttempt:e,xdError:t?t.toString():void 0}}})}function c(e){var t=Se.getVisitorProfile();return ue.populateEagerVisitorData(e,t)}function u(e,t,i){e=e||[];var n=ye.getAllPlugins(H.PluginTypes.visitorProfileProviders),r=_e.getGlobalHoldbackThreshold(),a=Se.getVisitorProfile();ue.populateLazyVisitorData(n,a);var o=Re.getBucketingId();if(!o)throw new Error("bucketingId not set");var s,c=Se.getVisitorProfile();if(t&&!Ve){var u=be.getVariationIdMap();s=u[t.id]}var l={bucketingId:o,visitorProfile:c,audiences:e,globalHoldback:r,preferredVariationMap:s,layer:t};return t&&i&&G.isPageIdRelevant(t)?b.map(i,(function(e){return G.createTicket(b.extend({},l,{pageId:e}))})):[G.createTicket(l)]}function l(e){return{bucketingId:Re.getBucketingId(),preferredLayerId:be.getPreferredLayerMap()[e.id]}}function d(e){var i=Ee.getAllByPageIds(e),n=he.getForceVariationIds(),r=he.getForceAudienceIds(),a=!b.isEmpty(n);a&&J.log("Force variations are in use. Disabling mutual exclusivity.");var o=a?{individual:i}:b.reduce(i,(function(e,t){return t.groupId?e.groups[t.groupId]||(e.groups[t.groupId]=ve.get(t.groupId)):e.individual.push(t),e}),{groups:{},individual:[]});J.log("Deciding Campaigns/Experiments for Page(s)",e);var s=b.map(o.groups,X.description).join(", ");J.log("Groups:",s);var c=b.map(o.individual,Q.description).join(", ");J.log("Campaigns/Experiments not in Groups (by Campaign id):",c);var u=b.map(o.groups,b.partial(f,n,r,e))||[],l=b.map(o.individual,(function(i){var a=b.filter(i.pageIds,b.partial(b.includes,e));return t.decideAndExecuteLayerASAP(n,r,a,i)})),d=u.concat(l);return ne.all(d).then((function(t){var i=b.filter(t,(function(e){return!!e}));return J.log("All Campaigns/Experiments for Page(s) (by Campaign id)",e,"resolved:",b.map(i,Q.description).join(", ")),i}))}function f(e,i,n,r){try{var a=l(r),o=G.decideGroup(r,a);if(o.reason)return J.debug("Not activating Group",X.description(r),"; reason:",o.reason),Te.getSampleRum()&&W.dispatch(P.RECORD_LAYER_FEATURE_USAGE,{feature:"mutex",entityId:r.id}),ne.resolve();var s=Ee.get(o.layerId);if(!s)return J.debug("Visitor was bucketed into a Campaign ("+o.layerId+") which is not in this snippet"),ne.resolve();var c=b.filter(s.pageIds,b.partial(b.includes,n));return b.isEmpty(c)?(J.debug("Not activating Group",X.description(r),"; reason: visitor was bucketed into a Campaign/Experiment not related to the currently-activating Page(s)"),ne.resolve()):(Te.getSampleRum()&&W.dispatch(P.RECORD_LAYER_FEATURE_USAGE,{feature:"mutex",entityId:r.id}),t.decideAndExecuteLayerASAP(e,i,c,s))}catch(e){return J.error("Error getting decision for Group",X.description(r),"; ",e),ne.reject(e)}}function p(e,t,i,n){return new ne(function(r,a){try{E(n,e,t,i,(function(a){b.each(a,(function(r){var a=r.pageId?[r.pageId]:i;J.debug("Deciding layer: ",n,"with decisionTicket: ",r,"and actionViewIds: ",a),g(n,e,t,a,r)})),r(n)}))}catch(e){J.error("Error getting decision for Campaign: "+Q.description(n),e),a(e)}})}function g(e,i,n,r,a){var o=Q.description(e);J.log("Activating Campaign",o,"on Page(s)",r),n.length&&(J.log("Applying force audienceIds:",n,"to Campaign",o),a=b.cloneDeep(a),a.audienceIds=n);var s=t.decideLayer(e,a,i),c=!(!i.length&&!n.length),u=t.getActionsForDecision(e,s,c),l=R(u.actions,r);if(u.maybeExecute&&h(l,e,s,r),b.forEach(r,(function(){L.trackDecisionEvent(s,a)})),V.emitLayerDecided({layer:e,decisionTicket:a,decision:s}),s.error)throw s.error;if(Te.getSampleRum()){W.dispatch(P.RECORD_LAYER_POLICY_USAGE,{policy:e.policy,layerId:e.id});var d=v(u.actions);W.dispatch(P.RECORD_CHANGE_TYPE_USAGE,{changeTypes:b.keys(d),layerId:e.id}),b.isEmpty(e.integrationSettings)||W.dispatch(P.RECORD_INTEGRATION_USAGE,{integrations:Q.getIntegrationTypes(e),layerId:e.id})}return G.isInCohort(s)?void(u.maybeExecute&&_(l,e,s,r)):void J.log("Not activating Campaign: "+Q.description(e)+"; not in the cohort because:",s.reason)}function h(e,t,i,n){var r=Q.description(t);J.log("Preparing actions",e,"for Campaign",r,"on Page(s)",n),b.forEach(e,C.prepareAction)}function _(e,t,i,n){var r=Q.description(t);return J.log("Executing actions",e,"for Campaign",r,"on Page(s)",n),ne.all(b.map(e,(function(e){return C.executePreparedAction(e).then(b.partial(V.emitActionAppliedEvent,e))}))).then((function(){J.log("All page actions for",i,"applied:",e),V.emitActionsForDecisionAppliedEvent(i,e)}))["catch"]((function(e){J.warn("Error evaluating page actions for decision",i,"because:",e)}))}function v(e){var t={};return b.each(e,(function(e){b.each(e.changeSet,(function(e){t[e.type]||(t[e.type]=!0)}))})),t}function E(e,t,i,n,r){if(t.length||i.length)return void r(u([],void 0,n));var a=Q.relatedAudienceIds(e),o=b.reduce(a,(function(e,t){var i=fe.get(t);return i&&e.push(i),e}),[]),s=ye.getAllPlugins(H.PluginTypes.audienceMatchers);if(Te.getSampleRum()){var c={};if(b.each(o,(function(e){b.extend(c,m(e.conditions,s))})),!b.isEmpty(c)){var l=b.keys(c);W.dispatch(P.RECORD_AUDIENCE_USAGE,{audienceTypes:l,layerId:e.id})}}T(o,s,Q.getActivationTimeout(e),(function(){var t=u(o,e,n);b.map(t,(function(t){I(t,o,e)})),r(t)}))}function m(e,t){var i={};return b.each(e,(function(e){b.isArray(e)?b.extend(i,m(e,t)):b.isObject(e)&&t[e.type]&&(i[e.type]=!0)})),i}function I(e,t,i){var n=b.map(e.audienceIds,b.bind(fe.get,fe)),r=b.filter(t,(function(t){return!b.includes(e.audienceIds,t.id)}));J.log("When deciding Campaign",Q.description(i),"visitor is in audiences:",y(n),"and not in audiences:",y(r))}function y(e){var t=[];return b.each(e,(function(e){t.push(e.name,e)})),t}function T(e,t,i,n){var r=b.reduce(e,(function(e,i){return b.extend(e,k.requiredAudienceFieldsForConditions(i.conditions,t))}),{}),a=b.reduce(r,(function(e,t){if(b.isUndefined(ue.getAttribute(t))){var i=ue.getPendingAttributeValue(t);b.isUndefined(i)||e.push(i)}return e}),[]);if(0===a.length)return n();var o=[].concat(e),s=re.firstToResolve(b.map(a,(function(e){return ne.resolve(e).then((function(){var e=Se.getVisitorProfile();if(o=b.filter(o,(function(i){return b.isUndefined(k.isInAudience(e,i,t))})),!b.isEmpty(o))throw new Error("At least one audience is still pending")}))})));ne.race([s,new ne(function(e,t){le.setTimeout(t,i)})]).then((function(){J.log("Activating Campaign after pending Audiences resolved",e),n()}),(function(){J.log("Activating Campaign after timeout on Audiences",e),n()}))}function S(e,t,i){var n,r=Q.description(e);return n=i.length?G.getDummyLayerDecision(e,i):G.decideLayer(e,t),J.log("Recording decision for Campaign",r,t,"->",n),Q.recordLayerDecision(e.id,t,n),Ve||(n.variationId&&n.experimentId&&ue.updateVariationIdMap(e.id,n.experimentId,n.variationId),e.groupId&&ue.updatePreferredLayerMap(e.groupId,e.id)),n}function A(e){var t=ge.getCleanupFns(e);if(t.length>0){for(;t.length>0;)t.shift()();W.dispatch(P.CLEAR_CLEANUP_FN,{lifecycle:e})}}function D(e,t,i){var n=Q.description(e),r="NOT applying changes for Campaign",a={actions:[],maybeExecute:!1};return a.actions=[].concat(pe.getLayerActions(t.layerId)||[],pe.getExperimentActions(t.experimentId)||[],pe.getExperimentVariationActions(t.experimentId,t.variationId)||[]),!i&&_e.isGlobalHoldback()?(J.log(r,n,"(visitor is in global holdback)"),a):t.isLayerHoldback?(J.log(r,n,"(visitor is in layer holdback)"),a):t.experimentId&&t.variationId?(a.maybeExecute=!0,J.log("Got Actions for Campaign:",n,a.actions),a):(J.log(r,n,"(visitor is not eligible for any Experiments)"),a)}function R(e,t){return b.filter(e,(function(e){return b.isUndefined(e.pageId)||b.includes(t,e.pageId)}))}var b=i(2),w=i(77).create,O=t.ActivationCodeError=w("ActivationCodeError"),N=t.ProjectJSError=w("ProjectJSError"),C=i(135),P=i(7),L=i(110),V=i(117),k=i(139),x=i(76),F=i(86),M=i(109),U=i(24),G=i(140),B=i(16),z=i(118),j=i(81),H=i(25),K=i(87),Y=i(111),q=i(145),W=i(9),X=i(144),Q=i(113),$=i(82).LocalStorage,J=i(23),Z=i(146),ee=i(84),te=i(123),ie=i(88),ne=i(12).Promise,re=i(147),ae=i(114),oe=i(116),se=i(137),ce=i(124),ue=i(75),le=i(41),B=i(16),de=B.get("stores/session"),fe=B.get("stores/audience_data"),pe=B.get("stores/action_data"),ge=B.get("stores/cleanup"),he=B.get("stores/directive"),_e=B.get("stores/global"),ve=B.get("stores/group_data"),Ee=B.get("stores/layer_data"),me=B.get("stores/layer"),Ie=B.get("stores/pending_events"),ye=B.get("stores/plugins"),Te=B.get("stores/rum"),Se=B.get("stores/visitor"),Ae=B.get("stores/view_data"),De=B.get("stores/view"),Re=B.get("stores/visitor_id"),be=B.get("stores/visitor_bucketing"),we=B.get("stores/xdomain"),Oe=i(93),Ne=i(121),Ce=i(1),Pe=1e3,Le=!1,Ve=!1,ke=!1,xe=Ve||ke,Fe=1e3,Me=t;
t.initialize=function(e){var i=e.clientData;if(M.normalizeClientData(e.clientData),K.on({filter:{type:"error"},handler:r}),W.dispatch(P.DATA_LOADED,{data:i}),J.log("Initialized with DATA:",i),a(),z.setOptOut(he.shouldOptOut()),he.isDisabled()||he.shouldOptOut())return void J.log("Controller / Is disabled");Ce.queueBeacons(),j.isReady()?W.dispatch(P.SET_DOMCONTENTLOADED):j.addReadyHandler((function(){W.dispatch(P.SET_DOMCONTENTLOADED)}));var o=!1,s=x.get(H.COOKIES.REDIRECT);if(s){var c=s.match(/^(\d+)\|(.*)/);if(c){J.debug("Found legacy redirect data:",s);var u=c[1],l=c[2];W.dispatch(P.INITIALIZE_STATE,{effectiveVariationId:u,effectiveReferrer:l}),o=!0}}if(!xe){ee.time("projectJS");var d=_e.getProjectJS();if(b.isFunction(d))try{q.apply(d)}catch(e){J.error("Error while executing projectJS: ",e),F.emitError(new N(e))}ee.timeEnd("projectJS")}b.each(e.plugins||[],(function(e){try{e(te)}catch(e){F.emitInternalError(e)}})),b.each(_e.getPlugins()||[],(function(e){try{q.apply(e,[te])}catch(e){F.emitError(e)}})),o||ae.load();var f=K.on({filter:{type:"lifecycle",name:"activated"},handler:function(){Se.observe(ue.persistVisitorProfile),me.observe(ue.persistLayerStates),de.observe(ue.persistSessionState),Ie.observe(Z.persistPendingEvents),Ve||be.observe(ue.persistVisitorBucketingStore),K.off(f)}});K.on({filter:{type:"lifecycle",name:"viewsActivated"},handler:t.onViewsActivated}),K.on({filter:{type:"lifecycle",name:"pageDeactivated"},handler:t.onPageDeactivated}),t.initializeApi();var p=Z.getPendingEvents();if(p&&(W.dispatch(P.LOAD_PENDING_EVENTS,{events:p}),Z.retryPendingEvents(p)),K.on({filter:{type:"lifecycle",name:"activate"},handler:t.activate}),V.emitInitializedEvent(),!he.shouldActivate())return ne.resolve();var g=[];if(we.isDisabled())n();else{var h=t.initializeXDomainStorage();g.push(h);var _=Boolean(we.getCanonicalOrigins());if(_){var v=oe.makeTimeoutPromise(Fe);ne.race([h,v])["catch"]((function(e){J.error("Failed to initialize xDomain storage: ",e)})).then(n)["catch"](Ne.handleError)}else n()}return ne.all(g)},t.activate=function(){try{var e=[];J.log("Activated client"),A(H.Lifecycle.preActivate);var t=U.now();W.dispatch(P.ACTIVATE,{activationId:String(t),activationTimestamp:t});var i=Ae.getAll();ce.registerViews(i),ue.setId(ue.getOrGenerateId()),e.push(L.trackPostRedirectDecisionEvent()),W.dispatch(P.MERGE_VARIATION_ID_MAP,{variationIdMap:ue.getVariationIdMap()}),W.dispatch(P.MERGE_PREFERRED_LAYER_MAP,{preferredLayerMap:ue.getPreferredLayerMap()}),A(H.Lifecycle.postVisitorProfileLoad),e.push(c(ye.getAllPlugins(H.PluginTypes.visitorProfileProviders)).then((function(){J.log("Populated visitor profile")})));var n=u(),r=G.decideGlobal(n);J.log("Made global decision",n,"->",r),W.dispatch(P.RECORD_GLOBAL_DECISION,r);var a=L.trackClientActivation();a?J.log("Tracked activation event",a):J.log("Not tracking activation event");var o=Me.setUpViewActivation(i),s=[];return Le?s=ce.activateMultiple(o):b.each(o,(function(e){s=s.concat(ce.activateMultiple([e]))})),Ve&&Te.getSampleRum()&&W.dispatch(P.RECORD_VIEWS_INITIALLY_ACTIVATED_COUNT,{viewsInitiallyActivatedCount:s.length}),A(H.Lifecycle.postViewsActivated),A(H.Lifecycle.postActivate),V.emitActivatedEvent(),ne.all(e).then((function(){K.emit({type:Y.TYPES.LIFECYCLE,name:"activateDeferredDone"}),J.log("All immediate effects of activation resolved")}),F.emitError)}catch(e){return F.emitError(e),ne.reject(e)}},Me.setUpViewActivation=function(e){var t=[];return b.each(e,(function(e){b.isBoolean(De.getViewState(e.id).isActive)&&ce.isActivationTypeImmediate(e.activationType)?J.debug("Skipping page: already evaluated, presumably at the edge",ce.description(e)):ce.shouldTriggerImmediately(e.activationType)?t.push(e):e.activationType===H.ViewActivationTypes.callback?(J.debug("Setting up conditional activation for Page",ce.description(e)),Me.activateViewOnCallback(e)):e.activationType===H.ViewActivationTypes.polling?(J.debug("Setting up polling activation for Page",ce.description(e)),ie.pollFor(b.partial(q.apply,e.activationCode),null,b.partial(se.isTimedOut,U.now())).then((function(){ce.activateMultiple([e])}))["catch"]((function(t){J.warn("Failed to activate view ",e,t)}))):e.activationType!==H.ViewActivationTypes.manual&&F.emitError(new Error("Unknown view activationType: "+e.activationType))})),t},Me.activateViewOnCallback=function(e){var t=function(t){var i=b.extend({},t,{pageName:e.apiName,type:"page"});Oe.push(i)},i={pageId:e.id};Object.defineProperty(i,"isActive",{get:function(){return De.isViewActive(e.id)}});try{q.apply(e.activationCode,[t,i])}catch(t){var n=new O("("+t.toString()+") in activationCode for "+ce.description(e));F.emitError(n,{originalError:t,userError:!0})}},t.onViewsActivated=function(e){var t,i=e.data.views,n=b.map(i,"id");try{if(!Re.getBucketingId())throw new Error("View activated with no visitorId set");var r=d(n)["catch"](F.emitError);return t=ne.all(b.map(i,(function(e){var t=function(){ce.parseViewTags(e);var t=L.trackViewActivation(e);t?J.log("Tracked activation for Page",ce.description(e),t):J.log("Not Tracking activation for Page",ce.description(e))};return j.isReady()?ne.resolve(t()):ie.pollFor(j.isReady,Pe).then(t)}))),ne.all([r,t])}catch(e){F.emitError(e)}},t.onPageDeactivated=function(e){var t=e.data.page,i=pe.getAllActionIdsByPageId(t.id);b.each(i,(function(e){var i=pe.getActionState(e);i&&(b.each(i,(function(e,i){if(e.cancel)try{e.cancel(),J.debug("Controller / Canceled change",i,"observation due to deactivation of page:",t)}catch(e){J.error("Controller / Error canceling change",i,"observation upon deactivation of page.",e)}if(t.undoOnDeactivation&&e.undo)try{e.undo(),J.debug("Controller / Undid change",i,"due to deactivation of page:",t)}catch(e){J.error("Controller / Error undoing change upon deactivation of page.",e)}})),W.dispatch(P.REMOVE_ACTION_STATE,{actionId:e}),J.debug("Controller / Undid changes and/or canceled change observation due to deactivation of page:",t,e))}))},t.initializeApi=function(){var e={push:Oe.push};ke||(e.get=Oe.get);var t=window.optimizely;b.isArray(t)&&b.each(t,(function(t){e.push(t)})),e.data={note:"Obsolete, use optimizely.get('data') instead"},e.state={},window.optimizely=e},t.persistItemsWithId=function(e){return b.each(e,(function(e,t){ue.checkKeyForVisitorId(t)&&$.setItem(t,e)})),e},t.initializeXDomainStorage=o,t.decideAndExecuteLayerASAP=p,t.decideLayer=S,t.getActionsForDecision=D}),(function(e,t,i){function n(e,t,i){var n=v.getActionState(t.id);if(!n)return void p.warn("Action / Attempted to prepare change for inactive action: ",t);var r=v.getChangeApplier(e.id,t.id);if(!a.isUndefined(r))return void p.warn("Action / Attempted to prepare a change which is already being applied: ",e);var s={changeId:e.id,actionId:t.id,changeApplier:I.create(e,t,i)};f.dispatch(o.SET_CHANGE_APPLIER,s)}function r(e,t,i,o){if(a.includes(o,t))return void p.error("Change with id "+t+" has circular dependencies: "+o.concat(t));if(!e[t]){var u=E.getChange(t);if(!u){var d="Change with id "+t+" is absent";return o.length&&(d+=" but listed as a dependency for "+o[o.length-1]),void p.warn(d)}e[t]=new g(function(d){var f=a.map(u.dependencies||[],(function(n){return r(e,n,i,o.concat([t]))}));if(u.src){var _="change_"+u.src,m=c.makeAsyncRequest(_,(function(){return h.addScriptAsync("https://cdn.optimizely.com/public/16180790160/data"+u.src,(function(){c.resolveRequest(_)}))})).then((function(){var e=E.getChange(u.id);e||s.emitError(new T("Failed to load async change from src: "+u.src)),n(e,i,l.now())}));f.push(m)}g.all(f).then((function(){var e=l.now(),n=v.getChangeApplier(t,i.id);return n?(p.debug("Action / Applying change:",u),n.apply().then((function(t){t?p.log(t):p.debug("Action / Applied change for the first time in "+(l.now()-e)+"ms:",u),d()}))):(p.debug("Action / Not applying change ",t," - No changeApplier found."),void d())}))["catch"]((function(e){p.error("Action / Failed to apply change:",u,e),d()}))})}return e[t]}var a=i(2),o=i(7),s=i(86),c=i(6),u=i(77).create,l=i(24),d=i(16),f=i(9),p=i(23),g=i(12).Promise,h=i(133),_=d.get("stores/global"),v=d.get("stores/action_data"),E=d.get("stores/change_data"),m=d.get("stores/session"),I=i(136),y=i(137);y.initialize();var T=u("ActionError");t.prepareAction=function(e){p.debug("Action / Preparing:",e),f.dispatch(o.ACTION_EXECUTED,{actionId:e.id,sessionId:m.getSessionId(),layerId:e.layerId,pageId:e.pageId,timestamp:l.now(),activationId:_.getActivationId()});var t=l.now();a.forEach(e.changeSet,(function(i){var r=a.isObject(i)?i.id:i,s=E.getChange(r);s||(f.dispatch(o.ADD_CHANGE,i),s=E.getChange(i.id)),s.src||n(s,e,t)}))},t.executePreparedAction=function(e){p.debug("Action / Executing:",e);var t={},i=a.map(e.changeSet,(function(i){var n=a.isObject(i)?i.id:i;return r(t,n,e,[])}));return g.all(i).then((function(){p.debug("changes for action id="+e.id+" applied")}))}}),(function(e,t,i){var n=i(13).Promise,r=i(24),a=i(16),o=a.get("stores/plugins"),s=i(25),c=i(23);t.create=function(e,t,i){var a={identifier:e.id,action:t,startTime:i||r.now()};try{var u=o.getPlugin(s.PluginTypes.changeAppliers,e.type);if(!u)throw new Error("Unrecognized change type "+e.type);return new u(e,a)}catch(e){c.error("Change applier was never properly constructed:",e);var l={apply:function(){return n.reject(e)}};return l}}}),(function(e,t,i){function n(){"interactive"!==document.readyState&&"complete"!==document.readyState||(t.domReadyTime=Date.now())}var r=i(138),a=i(16).get("stores/directive");t.domReadyTime=null,t.initialize=function(){n(),document.addEventListener("readystatechange",n,!0)},t.isTimedOut=function(e){var i=Date.now();if(!t.domReadyTime||!e)return!1;var n=Math.max(e,t.domReadyTime);return a.isEditor()&&(n=t.domReadyTime),!(i-n-1)return{experimentId:e.experiments[i].id,variationId:e.experiments[i].variations[n].id};return null}function a(e){var t=y.getPlugin(h.PluginTypes.deciders,e);if(s.isEmpty(t))throw new Error("No deciders found for policy: "+e);return t}function o(e,t){var i=y.getAllPlugins(h.PluginTypes.audienceMatchers);return s.reduce(t,(function(t,n){return u.isInAudience(e,n,i)&&t.push(n.id),t}),[])}var s=i(2),c=i(86),u=i(139),l=i(141),d=i(142),f=i(143).DecisionError,p=i(7),g=i(16),h=i(25),_=i(9),v=i(144),E=i(113),m=i(23),I=i(45),y=g.get("stores/plugins"),T=g.get("stores/global"),S=g.get("stores/layer_data");t.isPageIdRelevant=function(e){if(!e)return!1;var t=a(e.policy);return s.isFunction(t.includePageIdInDecisionTicket)?t.includePageIdInDecisionTicket(e):t.includePageIdInDecisionTicket===!0},t.createTicket=function(e){var t=s.pick(e,["bucketingId","globalHoldback","preferredVariationMap","pageId"]);return s.extend(t,{audienceIds:o(e.visitorProfile,e.audiences),activationId:T.getActivationId()}),t},t.decideGlobal=function(e){var t=l.isHoldback(e.bucketingId,{id:null,holdback:e.globalHoldback});return{isGlobalHoldback:t}},t.decideGroup=n,t.decideLayer=function(e,t){m.debug("Deciding: ",e,t);var i,n,r=a(e.policy),o={layerId:e.id,experimentId:null,variationId:null,isLayerHoldback:l.isHoldback(t.bucketingId,e)};if(s.isEmpty(e.experiments))throw new f("No experiments in layer.");try{if(r.decideLayer){m.debug("Decision / Using decider's custom decideLayer.");var u=r.decideLayer(e,t);i=u.experiment,n=u.variation}else m.debug("Decision / Using default decideLayer behavior."),i=r.selectExperiment(e,t.audienceIds,t.bucketingId),n=d.selectVariation(i,t.audienceIds,t.bucketingId,t.activationId,t.preferredVariationMap)}catch(e){e instanceof f?o.reason=e.message:o.error=e}return o.experimentId=i?i.id:null,o.variationId=n?n.id:null,o.error&&(o.error.name="DecisionEngineError",c.emitError(o.error)),o},t.getDummyLayerDecision=function(e,t){var i,n=r(e,t);return n?(m.log("Decision / Applying force variation:",n.variationId,"to Campaign",E.description(e)),i={layerId:e.id,variationId:n.variationId,experimentId:n.experimentId,isLayerHoldback:!1,reason:"force"}):(m.log("No variation matches ids:",t,"in Campaign",E.description(e)),i={layerId:e.id,variationId:null,experimentId:null,isLayerHoldback:!1,reason:"force"}),i},t.isInCohort=function(e){if(!e.experimentId||!e.variationId)return!1;var t=S.get(e.layerId);return!(I.isSingleExperimentPolicy(t.policy)&&e.isLayerHoldback)}}),(function(e,t,i){var n=i(65),r=t.TOTAL_POINTS=1e4;t.bucketingNumber=function(e,t,i){var a=n.hashToInt(e+t,i,r);return a},t.isHoldback=function(e,i){return t.bucketingNumber(e,i.id,n.Seed.IGNORING)<(i.holdback||0)},t.chooseWeightedCandidate=function(e,i,r){for(var a=t.bucketingNumber(e,i,n.Seed.BUCKETING),o=0;oa)return r[o].entityId;throw new Error("Unable to choose candidate")}}),(function(e,t,i){var n=i(2),r=i(141),a=i(125),o=i(143).DecisionError,s=i(23),c=i(9),u=i(7),l="impression";t.isValidExperiment=function(e,t){var i,r=n.partial(n.includes,e);return s.groupCollapsed("Decision / Evaluating audiences for experiment:",t,e),i=!t.audienceIds||a.evaluate(t.audienceIds,r),s.groupEnd(),s.debug("Decision / Experiment",t,"is valid?",i),i},t.selectVariation=function(e,t,i,a,d){if(!e.variations||0===e.variations.length)throw new o('No variations in selected experiment "'+e.id+'"');if(!e.weightDistributions&&e.variations.length>1)throw new o('On selected experiment "'+e.id+'", weightDistributions must be defined if # variations > 1');var f;if(e.bucketingStrategy&&e.bucketingStrategy===l)if(1===e.variations.length)f=e.variations[0].id;else{var p=a;f=r.chooseWeightedCandidate(i+p,e.id,e.weightDistributions)}else if(f=1===e.variations.length?e.variations[0].id:r.chooseWeightedCandidate(i,e.id,e.weightDistributions),d&&d[e.id]){s.debug("Decision / Using preferredVariationMap to select variation for experiment:",e.id);var g=d[e.id];if(!n.find(e.variations,{id:g}))return c.dispatch(u.RECORD_STICKY_BUCKETING_FEATURE,{feature:"stoppedVariation",id:e.id}),s.debug("Decision / Preferred variation:",g,"not found on experiment:",e.id,". Visitor not bucketed."),null;g!==f&&(c.dispatch(u.RECORD_STICKY_BUCKETING_FEATURE,{feature:"preferredVariation",id:e.id}),f=g)}var h=n.find(e.variations,{id:f});if(h)return s.debug("Decision / Selected variation:",h),h;throw new o('Unable to find selected variation: "'+f+'".')},t.getExperimentById=function(e,t){var i=n.find(e.experiments,{id:t});if(i)return i;throw new o("Unable to find selected experiment.")},t.hasVariationActionsOnView=function(e,t){return s.debug("Decision / Checking variation:",e,"for actions on pageId:",t),!!n.find(e.actions,(function(e){return e.pageId===t&&!n.isEmpty(e.changes)}))}}),(function(e,t){function i(e){this.message=e}i.prototype=new Error,t.DecisionError=i}),(function(e,t,i){function n(e){return r.map(e.weightDistributions,"entityId")}var r=i(2);t.description=function(e){var t=!!e.name,i=t?'"'+e.name+'" ':"",r=n(e).join(", ");return i+"(id "+e.id+", campaigns: "+r+")"}}),(function(module,exports,__webpack_require__){var createError=__webpack_require__(78),di=__webpack_require__(16),Logger=__webpack_require__(23),CSP_MODE=!1,EXEC_WITH_JQUERY=!0,ExecError=exports.Error=createError("ExecError");exports.apply=function(e,t){t=t||[],EXEC_WITH_JQUERY&&(t=t.concat(di.get("env/jquery")));try{return e.apply(void 0,t)}catch(i){throw Logger.warn("Error applying function",e,"with args:",t,i),new ExecError(i)}},exports.eval=function(str){if(CSP_MODE)throw new ExecError("eval is not supported in CSP mode");try{return EXEC_WITH_JQUERY&&(str="var $ = optimizely.get('jquery');"+str),eval(str)}catch(e){throw Logger.warn("Error executing JS:",str,e),new ExecError(e)}}}),(function(e,t,i){var n=i(2),r=i(86),a=i(25),o=i(26),s=i(82).LocalStorage,c=i(23),u=i(91),l=i(16),d=l.get("stores/pending_events"),f=a.StorageKeys.PENDING_EVENTS;t.persistPendingEvents=function(){try{var e=d.getEventsString();s.setItem(f,e),i(85).setItem(f,e)}catch(e){c.warn("PendingEvents / Unable to set localStorage key, error was: ",e),r.emitInternalError(e)}},t.getPendingEvents=function(){try{return o.parse(s.getItem(f))}catch(e){return null}},t.retryPendingEvents=function(e){n.forOwn(e,(function(e,t){u.retryableRequest(e.data,t,e.retryCount)})),n.isEmpty(e)||c.log("Retried pending events: ",e)}}),(function(e,t,i){var n=i(2),r=i(12).Promise;t.firstToResolve=function(e){return new r(function(t){n.each(e,(function(e){r.resolve(e).then(t,(function(){}))}))})}}),(function(e,t,i){function n(e){var t=!1;if(a.isArray(window.optimizely)&&a.each(window.optimizely,(function(i){a.isArray(i)&&"verifyPreviewProject"===i[0]&&String(i[1])===e&&(t=!0)})),!t)throw new Error("Preview projectId: "+e+" does not match expected")}function r(){s.on({filter:{type:c.TYPES.ANALYTICS,name:"trackEvent"},handler:f}),s.on({filter:{type:c.TYPES.LIFECYCLE,name:"viewActivated"},handler:f}),s.on({filter:{type:c.TYPES.LIFECYCLE,name:"layerDecided"},handler:f}),s.on({filter:{type:"error"},publicOnly:!0,handler:f})}var a=i(2),o=i(16),s=i(87),c=i(111),u=i(41),l=o.get("stores/directive"),d="optimizelyPreview",f=function(e){var t=u.getGlobal(d);t.push(e)};t.initialize=function(e){l.isSlave()&&n(e),r()},t.setupPreviewGlobal=function(){u.getGlobal(d)||u.setGlobal(d,[])},t.pushToPreviewGlobal=function(e){f(e)}}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(150))}}),(function(e,t){e.exports={provides:"visitorId",getter:["stores/visitor_id",function(e){return e.getRandomId()}]}}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(152)),e.registerAudienceMatcher("behavior",i(154))}}),(function(e,t,i){var n=i(153);e.exports={provides:"events",isTransient:!0,getter:[function(){return n.getEvents()}]}}),(function(e,t,i){var n=i(2),r=i(73),a=i(16),o=a.get("stores/visitor_events"),s=1e3;t.getEvents=function(){var e=r.getEvents(),t=[].concat.apply([],n.values(o.getForeignEvents())),i=[].concat.apply([],n.values(o.getForeignEventQueues())),a=r.mergeAllEvents([e,t,i]);return a.slice(a.length-s)}}),(function(e,t,i){var n=i(2),r=i(26),a=i(155),o=i(156);e.exports={fieldsNeeded:["events"],match:function(e,t){var i=[],s=r.parse(t.value);return i=n.isUndefined(s.version)?[s]:a.buildFromSpecV0_1(s),n.every(i,(function(t){return o.isSatisfied(t,e.events)}))}}}),(function(e,t,i){function n(e){return e=(e||"").toString().trim(),p[e]||e}function r(e,t,i){var n={where:t};if(e.count&&(n["limit"]=e.count),e.modifier===s.FREQUENCY_FILTERS.MOST_FREQUENT){var r=s.getFieldKeyPathForSource(e.name,i),a=s.aggregate("count"),o=s.aggregateField("count"),l=s.groupField(r);return c.extend(n,{select:[{field:l}],groupBy:s.groupBy([r]),aggregate:[a],orderBy:[{field:o,direction:"DESC"}]})}return c.extend(n,{orderBy:[{field:[u.FIELDS.TIME],direction:"DESC"}]})}function a(e){var t=[];if(c.isUndefined(e))throw new Error("rule is undefined");if(!c.isObject(e))throw new Error("rule is not an Object");"0.2"!==e["version"]&&t.push('version: not "0.2"'),e["filter"]&&(c.isArray(e["filter"])?c.each(e["filter"],(function(e,i){var n=s.validateFieldKeyPathV0_2(e["field"],s.FieldPurpose.FILTER);n&&t.push("filter["+i+"]: "+n);var r=s.validateComparatorAndValue(e["comparator"],e["value"]);r&&t.push("filter["+i+"]: "+r)})):t.push("filter: not an array"));var i=[],n=[];if(e["sort"]&&(e["reduce"]&&e["reduce"]["aggregator"]&&"nth"!==e["reduce"]["aggregator"]&&t.push("sort: superfluous because we can apply aggregator "+l.stringify(e["reduce"]["aggregator"])+" to unsorted items"),c.isArray(e["sort"])?c.each(e["sort"],(function(e,r){var a=s.validateFieldKeyPathV0_2(e["field"],s.FieldPurpose.SORT);a&&t.push("sort["+r+"]: "+a),e["field"]&&"frequency"===e["field"][0]?i.push(e):n.push(e);var c=o(e["direction"]);c&&t.push("sort["+r+"]: "+c)})):t.push("sort: not an array"),i.length&&n.length&&t.push('sort: sorting by non-["frequency"] field is pointless because we are going to sort the picked values by ["frequency"]'),i.length&&!e["pick"]&&t.push('sort: sorting by ["frequency"] is impossible because no values have been picked')),e["pick"]){e["reduce"]&&"count"===e["reduce"]["aggregator"]&&t.push('pick: superfluous because we can apply aggregator "count" to raw events');var r=s.validateFieldKeyPathV0_2(e["pick"]["field"]);r&&t.push("pick: "+r)}if(e["reduce"]){var a=e["reduce"]["aggregator"],u="aggregator "+(l.stringify(a)||String(a)),d=e["reduce"]["n"],f="index "+(l.stringify(d)||String(d));c.includes(["sum","avg","max","min","count","nth"],a)||t.push("reduce: "+u+" is unknown"),c.includes(["sum","avg","max","min"],a)&&(e["pick"]||t.push("reduce: "+u+" is impossible to use because no values have been picked")),"nth"===a?((!c.isNumber(d)||isNaN(d)||parseInt(d,10)!==d||d<0)&&t.push("reduce: "+f+" is not a non-negative integer (mandated by "+u+")"),e["sort"]||t.push('reduce: aggregator "nth" is meaningless without a specific sort order')):c.isUndefined(d)||t.push("reduce: "+f+" is defined (not mandated by "+u+")")}if(t.length)throw new Error(t.join("\n"))}function o(e){var t="direction "+(l.stringify(e)||String(e));if(!c.includes(["ascending","descending"],e))return t+' is not "ascending" or "descending"'}var s=t,c=i(2),u={FIELDS:i(64).FIELDS,FIELDS_V0_2:i(64).FIELDS_V0_2},l=i(26),d=i(23),f=i(156);s.MILLIS_IN_A_DAY=864e5,s.aggregateField=function(e,t){return c.isString(t)&&(t=[t]),t=t||f.DEFAULT_FIELD,[f.generateAlias(e,t)]},s.groupField=function(e){return c.isString(e)&&(e=[e]),e=e||f.DEFAULT_FIELD,[e.join(".")]};var p={"<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","==":"eq"};s.fieldComparison=function(e,t,i){return e=n(e),c.isString(t)&&(t=[t]),"exists"===e?{op:e,args:[{field:t}]}:{op:e,args:[{field:t},{value:i}]}},s.relativeTimeComparison=function(e,t){return{op:n(e),args:[{op:"-",args:[{eval:"now"},{field:[u.FIELDS.TIME]}]},{value:t*s.MILLIS_IN_A_DAY}]}},s.rangeTimeComparison=function(e){return c.isArray(e)?{op:"between",args:[{field:[u.FIELDS.TIME]},{value:[e[0]||+new Date(0),e[1]||+new Date]}]}:(d.error("Rule builder","rangeTimeComparison passed invalid range",e),null)},s.groupBy=function(e){for(var t=[],i=0;i0)throw new Error('A "pick" clause must not be specified with "count" or "most_recent", "most_frequent" modifiers'+l.stringify(e));return[r(e.pick,t,e.source)]}return i.length>0?i:[{where:t}]},s.buildFromSpecV0_2=function(e){a(e);var t={where:{op:"and",args:c.map(e["filter"]||[],(function(e){return"age"===e["field"][0]?s.relativeTimeComparison(e["comparator"]||"eq",e["value"]/s.MILLIS_IN_A_DAY):s.fieldComparison(e["comparator"]||"eq",s.convertFieldKeyPathFromSpecV0_2(e["field"]),e["value"])}))}};if(e["reduce"]&&"count"===e["reduce"]["aggregator"])return c.extend(t,{aggregate:[{op:"count",args:[{field:["*"]}]}],select:[{field:["_count_*"]}]});var i=[],n=[];if(e["sort"]&&(c.each(e["sort"],(function(e){c.includes(["ascending","descending"],e["direction"])&&(c.includes(["time","age"],e["field"][0])&&n.push(e),"frequency"===e["field"][0]&&i.push(e))})),n.length&&!i.length&&(t["orderBy"]=c.filter(c.map(n,(function(e){return"time"===e["field"][0]?{field:s.convertFieldKeyPathFromSpecV0_2(["time"]),direction:"ascending"===e["direction"]?"ASC":"DESC"}:"age"===e["field"][0]?{field:s.convertFieldKeyPathFromSpecV0_2(["time"]),direction:"ascending"===e["direction"]?"DESC":"ASC"}:void 0}))))),e["pick"]&&e["pick"]["field"]){var r=s.convertFieldKeyPathFromSpecV0_2(e["pick"]["field"]);if(e["reduce"]&&c.includes(["avg","max","min","sum"],e["reduce"]["aggregator"]))return c.extend(t,{aggregate:[{op:e["reduce"]["aggregator"],args:[{field:r}]}],select:[{field:[f.generateAlias(e["reduce"]["aggregator"],r)]}]});t=i.length?c.extend(t,{groupBy:[{field:r}],aggregate:[{op:"count",args:[{field:["*"]}]}],orderBy:[{field:["_count_*"],direction:"ascending"===i[0]["direction"]?"ASC":"DESC"}],select:[{field:[r.join(".")]}]}):c.extend(t,{select:[{field:r}]})}if(e["reduce"]&&"nth"===e["reduce"]["aggregator"]){var o=e["reduce"]["n"];if(c.isNumber(o)&&o>=0&&Number(o)===Math.floor(Number(o)))return c.extend(t,{offset:o,limit:1})}return t},s.convertFieldKeyPathFromSpecV0_2=function(e){return"tags"===e[0]&&"revenue"===e[1]?["r"]:[u.FIELDS_V0_2[e[0]]].concat(e.slice(1))},s.FieldPurpose={FILTER:"filter",SORT:"sort",PICK:"pick"},s.validateFieldKeyPathV0_2=function(e,t){var i="field "+(l.stringify(e)||String(e));if(!c.isArray(e)||!c.every(e,c.isString))return i+" is not an array of strings";if("tags"===e[0]&&e.length>2||"tags"!==e[0]&&e.length>1)return i+" includes too many strings";if("tags"===e[0]&&e.length<2)return i+" does not specify an exact tag";if(e.length<1)return i+" does not specify a top-level field";var n=c.keys(u.FIELDS_V0_2),r=["age","frequency"];return t===s.FieldPurpose.FILTER&&(n.push("age"),r=["frequency"]),t===s.FieldPurpose.SORT&&(n=["time","age","frequency"],r=["name","type","category","tags"]),c.includes(r,e[0])?i+" is not supported here":c.includes(n,e[0])?void 0:i+" is unknown"},s.validateComparatorAndValue=function(e,t){var i="comparator "+(l.stringify(e)||String(e)),n="value "+(l.stringify(t)||String(t));if(!c.isString(e)&&!c.isUndefined(e))return i+" is not a string";switch(e){case void 0:case"eq":case"is":case"contains":break;case"lt":case"gt":case"lte":case"gte":if(!c.isNumber(t))return n+" is not a number (mandated by "+i+")";break;case"in":if(!c.isArray(t))return n+" is not an array (mandated by "+i+")";break;case"between":if(!(c.isArray(t)&&2===t.length&&c.isNumber(t[0])&&c.isNumber(t[1])&&t[0]<=t[1]))return n+" is not a pair of increasing numbers (mandated by "+i+")";break;case"regex":if(!(c.isString(t)||c.isArray(t)&&2===t.length&&c.isString(t[0])&&c.isString(t[1])))return n+" is not a pattern string or a [pattern string, flags string] array (mandated by "+i+")";break;case"exists":if(!c.isUndefined(t))return n+" is not undefined (mandated by "+i+")";break;default:return i+" is unknown"}}}),(function(e,t,i){var n=i(2),r=i(25),a=i(23),o=n.bind(a.log,a),s=i(24),c=i(19).getFieldValue,u=i(26),l=function(e,t,i){if(e.getValueOrDefault)return e.getValueOrDefault(t,i);if(!n.isArray(t))return i;var r=c(e,t);return"undefined"==typeof r&&(r=i),r},d=function(e){return"string"==typeof e?e.trim().toLowerCase():e};t.clause={WHERE:"where",GROUP_BY:"groupBy",AGGREGATE:"aggregate",HAVING:"having",ORDER_BY:"orderBy",SELECT:"select",OFFSET:"offset",LIMIT:"limit",FROM:"from"},t.DEFAULT_FIELD=["*"],t.booleanOperators={eq:function(e){var t=n.map(e,d);return t[0]==t[1]},is:function(e){return e[0]===e[1]},gt:function(e){return e[0]>e[1]},lt:function(e){return e[0]=e[1]},lte:function(e){return e[0]<=e[1]},"in":function(e){var t=n.map(e[1]||[],d);return n.includes(t,d(e[0]))},between:function(e){return e[1][0]<=e[0]&&e[0]<=e[1][1]},contains:function(e){var t=n.map(e,(function(e){return"string"==typeof e?e.toLowerCase():e}));return(t[0]||"").indexOf(t[1])!==-1},regex:function(e){try{var t,i;return n.isString(e[1])?(t=e[1],i="i"):(t=e[1][0]||"",i=e[1][1]||""),new RegExp(t,i).test(e[0])}catch(e){return a.error("Rules",'In operator "regex", error: '+(e.message||"invalid RegExp /"+[t,i].join("/"))),!1}},exists:function(e){return"undefined"!=typeof e[0]},and:function(e){return n.every(e,(function(e){return e}))},or:function(e){return n.some(e,(function(e){return e}))},not:function(e){return!e[0]}},t.arithmeticOperators={"+":function(e){return(e[0]||0)+(e[1]||0)},"-":function(e){return(e[0]||0)-(e[1]||0)},"/":function(e){return(e[0]||0)/(e[1]||1)},"%":function(e){return(e[0]||0)%(e[1]||1)}},t.aggregateOperators={sum:function(e,i){for(var n=e[0]||t.DEFAULT_FIELD,r=0,a=0;au)return o}return 0})):(o("Rules","groupBy rule must be an array"),t)};t.rewrite=function(e){function i(e,s){if(n.isArray(e)&&("and"!==e[0]&&"or"!==e[0]&&"not"!==e[0]&&a.error("Rules","Unexpected operation "+e[0]+". Continuing optimistically."),e={op:e[0],args:e.slice(1)}),e.hasOwnProperty("field")||e.hasOwnProperty("value")||e.hasOwnProperty("eval"))return e;if(s&&e["op"]in t.aggregateOperators){var c=(e["args"]&&e["args"][0]||{})["field"]||t.DEFAULT_FIELD,u=t.generateAlias(e["op"],c);return u in o||(r.push({op:e["op"],args:e["args"]}),o[u]=!0),{field:[u]}}for(var l=[],d=e["args"]||[],f=0;f0)&&(s[t.clause.AGGREGATE]=(e[t.clause.AGGREGATE]||[]).concat(r));for(var c=[t.clause.GROUP_BY,t.clause.ORDER_BY,t.clause.SELECT,t.clause.OFFSET,t.clause.LIMIT],u=0;u0&&(r=n.map(r,(function(e){return"Sub-rule "+i+": "+e}))),e.hasOwnProperty(t.clause.FROM)&&(r=r.concat(m(e[t.clause.FROM],i+1))),r},I=function(e,t){return n.map(t,(function(t){return n.map(e,(function(e){return g(t,e)}))}))},y=function(e,i){var r=i;if(e.hasOwnProperty(t.clause.FROM)&&(a.debug("Evaluating FROM clause:",e[t.clause.FROM]),r=y(e[t.clause.FROM],r),a.debug("Results after FROM:",r)),a.debug("Evaluating WHERE clause:",e[t.clause.WHERE]),r=n.filter(r,(function(i){return g(i,e[t.clause.WHERE])})),a.debug("Results after WHERE:",r),e.hasOwnProperty(t.clause.AGGREGATE)){a.debug("Evaluating AGGREGATE clause:",e[t.clause.AGGREGATE]);var o=h(e[t.clause.GROUP_BY],r),s=_(e[t.clause.AGGREGATE],o);r=v(o,s),a.debug("Results after AGGREGATE:",r)}e.hasOwnProperty(t.clause.HAVING)&&(a.debug("Evaluating HAVING clause:",e[t.clause.HAVING]),r=n.filter(r,(function(i){return g(i,e[t.clause.HAVING])})),a.debug("Results after HAVING:",r)),e.hasOwnProperty(t.clause.ORDER_BY)&&(a.debug("Evaluating ORDER_BY clause:",e[t.clause.ORDER_BY]),r=E(e[t.clause.ORDER_BY],r),a.debug("Results after ORDER_BY:",r));var c=0;e.hasOwnProperty(t.clause.OFFSET)&&(a.debug("Evaluating OFFSET clause:",e[t.clause.OFFSET]),c=Number(e[t.clause.OFFSET]));var u;return e.hasOwnProperty(t.clause.LIMIT)&&(a.debug("Evaluating LIMIT clause:",e[t.clause.LIMIT]),u=c+Number(e[t.clause.LIMIT])),(c>0||!n.isUndefined(u))&&(r=r.slice(c,u),a.debug("Results after OFFSET/LIMIT:",r)),e.hasOwnProperty(t.clause.SELECT)&&(a.debug("Evaluating SELECT clause:",e[t.clause.SELECT]),r=I(e[t.clause.SELECT],r),a.debug("Results after SELECT:",r)),r};t.execute=function(e,i){e=t.rewrite(e),a.shouldLog(r.LogLevel.DEBUG)&&a.groupCollapsed("Evaluating Behavioral Rule"),a.debug("Rule:",e,u.stringify(e)),a.debug("Events:",i);var n=m(e);if(n.length>0)throw new Error("Rule "+u.stringify(e)+" has violations: "+n.join("\n"));var o=y(e,i);return a.debug("Rule result:",o),a.shouldLog(r.LogLevel.DEBUG)&&a.groupEnd(),o},t.isSatisfied=function(e,i){try{return t.execute(e,i).length>0}catch(t){return a.error("Rules","Error "+t.toString()+" while evaluating rule "+u.stringify(e)),!1}}}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(158))}}),(function(e,t,i){var n=i(2),r=i(159),a=i(153),o=i(26),s=i(155);e.exports={provides:"customBehavior",shouldTrack:!0,isLazy:!1,getter:["stores/global","stores/visitor_attribute_entity",function(e,t){var i=e.getProjectId(),c=n.filter(n.map(t.getCustomBehavioralAttributes(i),(function(e){try{return{id:e.id,granularity:r.GRANULARITY.ALL,rule:s.buildFromSpecV0_2(o.parse(e.rule_json))}}catch(e){return}}))),u=a.getEvents();return r.evaluate(c,u)}]}}),(function(e,t,i){function n(e){if(0===e.length)return[];for(var t=e.length-1,i=o.FIELDS.SESSION_ID,n=e[t][i];t>0&&n===e[t-1][i];)t--;return e.slice(t)}function r(e,t){if(0===e.length||t<=0)return[];var i=+new Date-t*s.MILLIS_IN_A_DAY;i-=i%s.MILLIS_IN_A_DAY;for(var n=e.length;n>0&&i<=e[n-1][o.FIELDS.TIME];)n--;return e.slice(n)}var a=i(23),o={FIELDS:i(64).FIELDS},s=i(155),c=i(156);t.GRANULARITY={ALL:"all",CURRENT_SESSION:"current_session",LAST_30_DAYS:"last_30_days",LAST_60_DAYS:"last_60_days"},t.evaluate=function(e,i){var o={};if(0===i.length){for(var s=0;s0){var t=e[0],i=a(t,[n.FIELDS.SESSION_INDEX]);return i===o}return!0}]}}),(function(e,t){e.exports={fieldsNeeded:["first_session"],match:function(e){return!!e.first_session}}}),(function(e,t,i){e.exports=function(e){e.registerApiModule("behavior",i(164))}}),(function(e,t,i){function n(e,t){var i=d.buildFromSpecV0_1(t);if(1!==i.length)throw new Error("Invalid query descriptor; verify that no aggregators are specified");return f.execute(i[0],e)}function r(e,t){return u.map(e,(function(e){return u.isFunction(e.toObject)?e.toObject(t):e}))}function a(e,t){if(!e)return["Descriptor not defined"];var i=[];return e.count&&i.push('Unexpected "count" clause specified'),e.pick&&e.pick.modifier&&t.indexOf(e.pick.modifier)===-1&&i.push('Invalid "pick" modifier "'+e.pick.modifier+'"'),u.each(e.filters,(function(e){u.isUndefined(e.modifier)||i.push('Unexpected "filter" modifier "'+e.modifier+'"')})),i.length>0?i:void 0}function o(e,t){var i,o={revenueAsTag:!1,timeAsTimestamp:!0};if(u.isUndefined(t))return i=l.getEvents(e),r(i,o);if(u.isNumber(t)){if(t<=0)throw new Error("Count must be a positive integer, got "+t);return i=l.getEvents(e),r(i.slice(-t),o)}var s=a(t,u.values(d.RECENCY_FILTERS));if(s)throw new Error(s.join("\n"));return i=l.getEvents(e),r(n(i,t),o)}function s(e,t){if(t=u.cloneDeep(t)||{},!t.pick)throw new Error('No "pick" clause provided in query descriptor');if(!t.pick.name)throw new Error('No field name provided in "pick" clause');t.pick.modifier=t.pick.modifier||d.FREQUENCY_FILTERS.MOST_FREQUENT;var i=a(t,u.values(d.FREQUENCY_FILTERS));if(i)throw new Error(i.join("\n"));var r=l.getEvents(e);return n(r,t)}function c(e,t){var i=d.buildFromSpecV0_2(t),n=l.getEvents(e),a=r(f.execute(i,n),{revenueAsTag:!0,timeAsTimestamp:!1});return(t.pick||t.reduce&&"count"===t.reduce.aggregator)&&(a=u.flatten(a)),t.reduce&&(a=a[0]),a}var u=i(2),l=i(153),d=i(155),f=i(156);e.exports=["stores/visitor_events",function(e){return{getEvents:u.partial(o,e),getByFrequency:u.partial(s,e),query:u.partial(c,e)}}]}),(function(e,t,i){e.exports=function(e){e.registerDependency("sources/browser_id",i(166)),e.registerVisitorProfileProvider(i(171)),e.registerVisitorProfileProvider(i(172)),e.registerAudienceMatcher("browser_version",i(173))}}),(function(e,t,i){var n=i(167);t.getId=function(){return n.get().browser.id},t.getVersion=function(){return n.get().browser.version}}),(function(e,t,i){var n=i(2),r=i(168),a=i(41),o=i(7),s=i(16),c=i(9),u=s.get("stores/ua_data");t.get=function(){var e=u.get();return n.isEmpty(e)&&(e=r.parseUA(a.getUserAgent()),c.dispatch(o.SET_UA_DATA,{data:e})),e}}),(function(e,t,i){function n(e){if(e=(e||"").toLowerCase(),e in c)return e;var t=a.keys(c);return a.find(t,(function(t){var i=c[t];return a.includes(i,e)}))||"unknown"}function r(e,t,i){return t?t:"unknown"===e?"unknown":i?"mobile":"desktop_laptop"}var a=i(2),o=i(169);t.parseUA=function(e){var t=new o(e),i=t.getBrowser(),a=t.getOS(),c=t.getDevice(),l=(a.name||"unknown").toLowerCase(),d=(i.name||"unknown").toLowerCase(),f=s(c.type,d,l);return{browser:{id:n(i.name),version:i.version},platform:{name:l,version:a.version},device:{model:u[c.model]||"unknown",type:r(d,c.type,f),isMobile:f}}};var s=function(e,t,i){if(a.includes(["mobile","tablet"],e))return!0;if(a.includes(["opera mini"],t))return!0;var n=["android","blackberry","ios","windows phone"];return!!a.includes(n,i)},c={gc:["chrome","chromium","silk","yandex","maxthon","chrome webview"],edge:["edge"],ie:["internet explorer","iemobile"],ff:["firefox","iceweasel"],opera:["opera","opera mini","opera tablet"],safari:["safari","mobile safari","webkit"],ucbrowser:["uc browser"]},u={iPhone:"iphone",iPad:"ipad"}}),(function(e,t,i){var n;!(function(r,a){"use strict";var o="0.7.17",s="",c="?",u="function",l="undefined",d="object",f="string",p="major",g="model",h="name",_="type",v="vendor",E="version",m="architecture",I="console",y="mobile",T="tablet",S="smarttv",A="wearable",D="embedded",R={extend:function(e,t){var i={};for(var n in e)t[n]&&t[n].length%2===0?i[n]=t[n].concat(e[n]):i[n]=e[n];return i},has:function(e,t){return"string"==typeof e&&t.toLowerCase().indexOf(e.toLowerCase())!==-1},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===f?e.replace(/[^\d\.]/g,"").split(".")[0]:a},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},b={rgx:function(e,t){for(var i,n,r,o,s,c,l=0;l0?2==o.length?typeof o[1]==u?this[o[0]]=o[1].call(this,c):this[o[0]]=o[1]:3==o.length?typeof o[1]!==u||o[1].exec&&o[1].test?this[o[0]]=c?c.replace(o[1],o[2]):a:this[o[0]]=c?o[1].call(this,c,o[2]):a:4==o.length&&(this[o[0]]=c?o[3].call(this,c.replace(o[1],o[2])):a):this[o]=c?c:a;l+=2}},str:function(e,t){for(var i in t)if(typeof t[i]===d&&t[i].length>0){for(var n=0;nNumber(i[a]))return 1}}return 0}}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(176)),e.registerAudienceMatcher("campaign",i(177))}}),(function(e,t,i){var n=i(119);e.exports={provides:"campaign",shouldTrack:!0,isSticky:!0,getter:[function(){return n.getQueryParamValue("utm_campaign")}]}}),(function(e,t,i){var n=i(20);e.exports={fieldsNeeded:["campaign"],match:function(e,t){return n.hasMatch(t.value,t.match,e.campaign)}}}),(function(e,t,i){e.exports=function(e){e.registerAudienceMatcher("code",i(179))}}),(function(e,t,i){var n=i(2),r=i(145);t.fieldsNeeded=[],t.match=function(e,t){if(n.isUndefined(t.value))return!0;if("function"==typeof t.value)try{return Boolean(r.apply(t.value))}catch(e){return!1}else try{return Boolean(r.eval(t.value))}catch(e){return!1}return!1}}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(181));var t=i(182);e.registerAudienceMatcher("custom_attribute",t),e.registerAudienceMatcher("custom_dimension",t)}}),(function(e,t,i){var n=i(2),r=i(25),a=i(23),o=i(16),s=o.get("stores/dimension_data");e.exports={provides:"custom",attributionType:r.AttributionTypes.LAST_TOUCH,restorer:function(e){return n.reduce(e,(function(e,t,i){var r=i,o=s.getByApiName(i),c=s.getById(i),u=c;return n.isObject(t)?(!t.id&&o&&(u=o,r=o.id,n.extend(t,{id:u.segmentId||u.id})),t.name||u&&u.apiName&&(t.name=u.apiName),t.id||u||a.warn("Unable to determine ID for custom attribute:",i,"; segmentation is disabled."),e[r]=t,e):(a.error('Unable to restore custom attribute "'+i+'" because value is not an object'),e)}),{})},shouldTrack:!0}}),(function(e,t,i){var n=i(2),r=i(20);t.match=function(e,t){var i;return e.custom&&(i=e.custom[t.name]),n.isObject(i)&&(i=i.value),r.hasMatch(t.value,t.match,i)}}),(function(e,t,i){e.exports=function(e){e.registerDependency("sources/device",i(184)),e.registerVisitorProfileProvider(i(185)),e.registerAudienceMatcher("device",i(186))}}),(function(e,t,i){var n=i(167);t.getDevice=function(){var e=n.get().device;return"unknown"!==e.model?e.model:"tablet"===e.type?"tablet":e.isMobile?"mobile":"desktop"}}),(function(e,t){e.exports={provides:"device",shouldTrack:!0,isSticky:!0,getter:["sources/device",function(e){return e.getDevice()}]}}),(function(e,t){e.exports={fieldsNeeded:["device"],match:function(e,t){return e.device===t.value}}}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(188)),e.registerAudienceMatcher("device_type",i(189))}}),(function(e,t,i){var n=i(167);e.exports={provides:"device_type",shouldTrack:!0,isSticky:!0,getter:[function(){var e=n.get().device;switch(e.type){case"mobile":return"phone";case"tablet":case"desktop_laptop":return e.type;default:return"other"}}]}}),(function(e,t){e.exports={fieldsNeeded:["device_type"],match:function(e,t){return e.device_type===t.value}}}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(191)),e.registerAudienceMatcher("referrer",i(192))}}),(function(e,t,i){var n=i(81),r=i(99);e.exports={provides:"referrer",shouldTrack:!0,isSticky:!0,getter:[function(){var e=r.getReferrer()||n.getReferrer();return""===e&&(e=null),e}]}}),(function(e,t,i){var n=i(193);t.fieldsNeeded=["referrer"],t.match=function(e,t){return null!==e.referrer&&n(e.referrer,t)}}),(function(e,t,i){function n(e){var t=e.indexOf("?");return t!==-1&&(e=e.substring(0,t)),t=e.indexOf("#"),t!==-1&&(e=e.substring(0,t)),e}function r(e){return a(n(e))}function a(e,t){e=e.replace("/?","?"),e=e.toLowerCase().replace(/[\/&?]+$/,"");var i=l.slice(0);t||(i=i.concat(c));for(var n=i.length,r=0;r0&&(t[1]="?"+o.join("&")),r&&(t[1]+="#"+r),t.join("")}return e}var s=i(2);e.exports=function(e,t){e=o(e);var i=t.value;switch(t.match){case"exact":return e=a(e),e===a(i);case"regex":try{return Boolean(e.match(i))}catch(e){}return!1;case"simple":return e=r(e),i=r(i),e===i;case"substring":return e=a(e,!0),i=a(i,!0),e.indexOf(i)!==-1;default:return!1}};var c=["www."],u="optimizely_",l=["https?://.*?.?optimizelyedit.(com|test)/","https?://.*.?optimizelypreview.(com|test)/","https?://(edit|preview)(-hrd|-devel)?.optimizely.(com|test)/","https?://.*?.?optimizelyedit(-hrd)?.appspot.com/","https?://"]}),(function(e,t,i){e.exports=function(e){e.registerVisitorProfileProvider(i(195)),e.registerAudienceMatcher("source_type",i(197))}}),(function(e,t,i){var n=i(119),r=i(81),a=i(99),o=i(196),s=["google\\.\\w{2,3}(\\.\\w{2,3})?/(search|url)","https://(www)?\\.google\\..*?/$","bing\\.\\w{2,3}(\\.\\w{2,3})?/(search|url)","yahoo\\.\\w{2,3}(\\.\\w{2,3})?/search","baidu\\.\\w{2,3}(\\.\\w{2,3})?/s?"];e.exports={provides:"source_type",shouldTrack:!0,isSticky:!1,getter:[function(){return function(e,t){var i=function(){if(n.getQueryParamValue("utm_source")||n.getQueryParamValue("gclid")||n.getQueryParamValue("otm_source"))return"campaign";for(var e=a.getReferrer()||r.getReferrer(),t=0;t=s&&u<=c&&a.includes(o.days,l)}}),(function(e,t,i){function n(e){function t(e,t,i){try{c(t),e[i]=t}catch(e){C.emitError(new X("Bad value for eventTags["+i+"]: "+e.message))}return e}var i=N.keys(ie),n=N.omit(e,i),r=N.pick(e,i),a=N.reduce(n,t,{}),o=N.reduce(r,(function(e,i,n){var r=ie[n];r.excludeFeature||t(a,i,n);try{r.validate(i),e[n]=r.sanitize(i),a[n]=e[n]}catch(e){C.emitError(new X("Bad value for eventMetrics["+n+"]: "+e.message))}return e}),{});return o.tags=a,o}function r(e){var t=N.extend({entity_id:e.pageId,key:e.pageApiName,timestamp:e.timestamp,uuid:e.eventId,type:J},n(e.eventTags));return t}function a(e){return N.extend({entity_id:e.eventEntityId,key:e.eventApiName,timestamp:e.timestamp,uuid:e.eventId,type:e.eventCategory},n(e.eventTags))}function o(e){return N.extend({entity_id:e.eventEntityId,key:e.eventApiName,timestamp:e.timestamp,uuid:e.eventId,type:e.eventCategory},n(e.eventTags))}function s(e){return{entity_id:null,type:Q,uuid:e.eventId,timestamp:e.timestamp}}function c(e){if(null==e)throw new Error("Feature value is null");if("object"==typeof e){var t;try{t=x.stringify(e)}catch(e){}throw new Error('Feature value is complex: "'+t||'[object]"')}}function u(e){if(null==e)throw new Error("Metric value is null");if(!N.isNumber(e))throw new Error("Metric value is not numeric")}function l(e){return N.reduce(e,(function(e,t){try{c(t.value),e.push({entity_id:t.id||null,key:t.name,type:t.type,value:t.value})}catch(e){F.warn("Error evaluating user feature",t,e)}return e}),[])}function d(e,t,i){Y.dispatch(V.REGISTER_TRACKER_EVENT,{event:e,decisions:i}),f(t),b()}function f(e){var t=l(e);Y.dispatch(V.UPDATE_TRACKER_VISITOR_ATTRIBUTES,{attributes:t})}function p(e){var t=l(e.userFeatures),i={account_id:e.accountId,anonymize_ip:e.anonymizeIP,client_name:e.clientName,client_version:e.clientVersion,project_id:e.projectId,visitors:[{session_id:h(e.sessionId),visitor_id:e.visitorId,attributes:t,snapshots:[{decisions:[{campaign_id:e.layerId,experiment_id:e.experimentId,variation_id:e.variationId,is_campaign_holdback:e.isLayerHoldback}],events:[{uuid:e.decisionId,entity_id:e.layerId,timestamp:e.timestamp,type:$}]}]}]};Y.dispatch(V.REGISTER_PREVIOUS_BATCH,i),b()}function g(e){var t=N.isNull(q.getAnonymizeIP())?void 0:q.getAnonymizeIP(),i={account_id:e.accountId,anonymize_ip:t,client_name:e.clientName,client_version:e.clientVersion,project_id:e.projectId,visitors:[]};i.revision=e.revision,Z&&(i.enrich_decisions=!0);var n={session_id:h(e.sessionId),visitor_id:e.visitorId,attributes:[],snapshots:[]},r=w(e.layerStates);Y.dispatch(V.REGISTER_TRACKER_VISITOR,{data:i,visitor:n,decisions:r}),b()}function h(e){return oe?ae:e}function _(e){var t={entity_id:e.layerId,type:$,uuid:e.decisionId,timestamp:e.timestamp};Y.dispatch(V.REGISTER_TRACKER_DECISION,{decisionEvent:t,decisions:w(e.layerStates)}),f(e.userFeatures),b()}function v(){if(!W.canSend())return void F.debug("Not sending events (holding)");var e=W.hasEventsToSend(),t=W.hasPreviousBatchesToSend();return e||t?(t&&(N.each(W.getPreviousBatches(),E),Y.dispatch(V.RESET_TRACKER_PREVIOUS_BATCHES)),void(e&&(Y.dispatch(V.FINALIZE_BATCH_SNAPSHOT),E(W.getEventBatch()),Y.dispatch(V.RESET_TRACKER_EVENTS)))):void F.debug("Not sending events because there are no events to send")}function E(e){F.debug("Sending ticket:",e);var t=P.generate();B.retryableRequest({url:L,method:"POST",data:m(e)},t)}function m(e){var t=N.extend({},N.pick(e,["account_id","anonymize_ip","client_name","client_version","enrich_decisions","project_id","revision"]),{visitors:N.map(e.visitors,I)});return t}function I(e){return{visitor_id:e.visitor_id,session_id:ae,attributes:N.map(e.attributes,y),snapshots:N.map(e.snapshots,T)}}function y(e){return R(e,{entity_id:"e",key:"k",type:"t",value:"v"})}function T(e){var t=e.events;return t=S(t),{activationTimestamp:q.getActivationTimestamp(),decisions:N.map(e.decisions,A),events:N.map(t,D)}}function S(e){var t=N.reduce(e,(function(e,t){var i,n=t.type===J&&N.isEmpty(t.tags)&&N.isEmpty(N.pick(t,N.keys(ie)));if(i=n?t.type:t.uuid,e[i]){var r=e[i].timestamp;t.timestamp>r&&(r=t.timestamp),e[i]=N.extend({},e[i],{key:e[i].key+"-"+(t.key||""),entity_id:e[i].entity_id+"-"+t.entity_id,timestamp:r})}else e[i]=t;return e}),{});return N.values(t)}function A(e){return R(e,{campaign_id:"c",experiment_id:"x",is_campaign_holdback:"h",variation_id:"v"})}function D(e){return e.key===$&&(e.type=$,delete e.key),R(e,{entity_id:"e",key:"k",quantity:"q",revenue:"$",tags:"a",timestamp:"t",uuid:"u",value:"v",type:"y"})}function R(e,t){return N.reduce(e,(function(e,i,n){return n in t&&(e[t[n]||n]=i),e}),{})}function b(){function e(){var t=!ne||j.isLoaded();t&&v(),W.isPolling()&&G.setTimeout(e,te)}return W.shouldBatch()?void(W.isPolling()||(G.setTimeout(e,te),Y.dispatch(V.SET_TRACKER_POLLING,!0),G.setTimeout((function(){Y.dispatch(V.SET_TRACKER_BATCHING,!1),Y.dispatch(V.SET_TRACKER_POLLING,!1)}),ee))):void v()}function w(e){return N.map(e,(function(e){return{campaign_id:e.layerId,experiment_id:e.decision.experimentId,variation_id:e.decision.variationId,is_campaign_holdback:e.decision.isLayerHoldback}}))}function O(){var e=W.getPersistableState();if(e)try{F.debug("Persisting pending batch:",e),U.persistTrackerOptimizelyData(e),Y.dispatch(V.SET_TRACKER_DIRTY,!1)}catch(e){F.debug("Failed to persist pending batch:",e)}}var N=i(2),C=i(86),P=i(5),L="https://logx.optimizely.com/v1/events",V=i(7),k=i(77).create,x=i(26),F=i(23),M=i(115),U=i(75),G=i(41),B=i(91),z=i(16),j=i(81),H=i(87),K=i(111),Y=i(9),q=z.get("stores/global"),W=z.get("stores/tracker_optimizely"),X=t.Error=k("OptimizelyTrackerError"),Q="client_activation",$="campaign_activated",J="view_activated",Z=!1,ee=1e4,te=1e3,ie={revenue:{validate:u,sanitize:Math.floor,excludeFeature:!0},quantity:{validate:u,sanitize:Math.floor,excludeFeature:!0},value:{validate:u,sanitize:N.identity}},ne=!1,re=!1,ae="AUTO",oe=!0,se=function(e){e.timing===M.TrackLayerDecisionTimingFlags.postRedirectPolicy?p(e):_(e)},ce=[function(){return function(e){d(r(e),e.userFeatures,w(e.layerStates))}}],ue=[function(){return function(e){g(e),d(s(e),e.userFeatures,w(e.layerStates))}}],le=[function(){return function(e){d(o(e),e.userFeatures,w(e.layerStates))}}],de=[function(){return function(e){d(a(e),e.userFeatures,w(e.layerStates))}}],fe={trackLayerDecision:se,postRedirectPolicy:M.PostRedirectPolicies.TRACK_AFTER_SYNC,nonRedirectPolicy:M.NonRedirectPolicies.TRACK_IMMEDIATELY,onPageActivated:ce,onClientActivation:ue,onClickEvent:de,onCustomEvent:le};e.exports=function(e){e.registerAnalyticsTracker("optimizely",fe),H.on({filter:{type:K.TYPES.ANALYTICS,name:"sendEvents"},handler:function(){Y.dispatch(V.SET_TRACKER_SEND_EVENTS,!0),W.isPolling()||v()}}),H.on({filter:{type:K.TYPES.ANALYTICS,name:"holdEvents"},handler:function(){Y.dispatch(V.SET_TRACKER_SEND_EVENTS,!1)}}),Y.dispatch(V.SET_TRACKER_SEND_EVENTS,!re);var t=H.on({filter:{type:"lifecycle",name:"activated"},handler:function(){W.observe(O),H.off(t)}})}}),(function(e,t,i){e.exports=function(e){e.registerViewProvider(i(205)),e.registerViewMatcher("url",i(206))}}),(function(e,t,i){var n=i(119);e.exports={provides:"url",getter:[function(){return n.getUrl()}]}}),(function(e,t,i){var n=i(193);e.exports={fieldsNeeded:["url"],match:function(e,t){return n(e.url,t)}}}),(function(e,t,i){var n=i(145),r="custom_code",a={match:function(e,t){return n.apply(t.value)}};e.exports=function(e){e.registerViewMatcher(r,a)}}),(function(e,t,i){var n="element_present",r={match:function(e,t){return!!document.querySelector(t.value)}};e.exports=function(e){e.registerViewMatcher(n,r)}}),(function(e,t,i){var n=i(81),r=i(25),a=i(87),o=i(210),s=i(124),c="DOMChanged",u={token:void 0,setUpObserver:function(){o.createDOMChangedObserver(),this.token=a.on({filter:{type:"viewTrigger",name:"DOMChanged"},handler:function(){s.getViewsAndActivate(r.ViewActivationTypes.DOMChanged)}})},turnOffObserver:function(){a.off(this.token)}};e.exports=function(e){n.isReady()?u.setUpObserver():n.addReadyHandler(u.setUpObserver),e.registerViewTrigger(c,u)}}),(function(e,t,i){var n=i(81),r=i(87),a=i(211);t.createDOMChangedObserver=function(){var e=n.getDocumentElement(),t={type:"viewTrigger",name:"DOMChanged"},i={attributes:!0,childList:!0,subtree:!0,characterData:!0},o=a.create((function(){r.emit(t,!0)}));a.observe(o,e,i)}}),(function(e,t){t.create=function(e){return new MutationObserver(e)},t.observe=function(e,t,i){e.observe(t,i)}}),(function(e,t,i){function n(e){return"apiName: "+e.apiName+", selector: "+e.eventFilter.selector}var r=i(110),a=i(213),o=i(23),s=i(124);e.exports=function(e){var t=new a(function(e){s.updateAllViewTags();var t=r.trackClickEvent(e);t?o.log("Tracking click event:",e):o.log("Not tracking click event:",e)});e.registerEventImplementation("click",{attach:function(e){t.hasEvents()||t.listen(),t.addEvent(e),o.debug("Started listening for click event ("+n(e)+"):",e)},detach:function(e){t.removeEvent(e),t.hasEvents()||t.unlisten(),o.debug("Stopped listening for click event ("+n(e)+"):",e)}})}}),(function(e,t,i){function n(e){this.handler=e,this.events=[],this.unlistenFn=null,this.clickHandler=a.bind((function(e){a.forEach(this.events,a.bind((function(t){try{var i=t.config&&t.config.selector?t.config.selector:t.eventFilter.selector;r(e,i,t)&&this.handler(t)}catch(e){o.emitError(new l("Unable to handle click for selector"+i+":"+e.message))}}),this))}),this)}function r(e,t,i){for(var n=e.target,r=0;n;){var s;try{s=u(n,t)}catch(s){var c={typeofElementValue:typeof n,nodeName:a.result(n,["nodeName"],null),nodeType:a.result(n,["nodeType"],null),targetName:a.result(e,["target","nodeName"],null),targetType:a.result(e,["target","nodeType"],null),numParentsTraversed:r,selector:t,errorMessage:s.message,eventId:i.id};return o.emitError(new l("Unable to evaluate match for element"),c),!1}if(s)return!0;n=n.parentElement,r++}return!1}var a=i(2),o=i(86),s=i(77).create,c=i(81),u=i(214),l=t.Error=s("ClickDelegateError");n.prototype.listen=function(){this.unlistenFn=c.addEventListener("click",this.clickHandler,!0)},n.prototype.unlisten=function(){this.unlistenFn&&(this.unlistenFn(),this.unlistenFn=null)},n.prototype.hasEvents=function(){return this.events.length>0},n.prototype.addEvent=function(e){this.events.push(e)},n.prototype.removeEvent=function(e){this.events=a.filter(this.events,(function(t){return t.apiName!==e.apiName}))},e.exports=n}),(function(e,t,i){e.exports=i(215)}),(function(e,t){"use strict";function i(e,t){if(r)return r.call(e,t);for(var i=e.parentNode.querySelectorAll(t),n=0;n