Christina Hendricks as Joan on Mad Men.
Photo: Courtesy of AMC
The “previously on” montage that ran before “Lost Horizon” featured Roger Sterling saying, “If you had to choose a place to die, it would be in the middle of a pitch,” as well as McCann boss Jim Hobart describing the agency as “advertising heaven.” Those were two potent bits of mortal imagery, and the episode proper hadn’t begun yet. Once it did get going, it teased and neutralized some of the sillier fan predictions of what might happen in the final episodes: Roger having another, this-time-fatal heart attack (“I have a heart condition, you know!” he warned Peggy when she snuck up on him in the old SC&P office); Don Draper, Pete Campbell, or some other character making the show’s credits sequence more than figurative by leaping out of an office window (see that lingering shot of Don noticing that the McCann office windows didn’t open); Don reinventing himself one more time, as disappearing hijacker D.B. Cooper (the shot of the jet behind the Empire State Building). But while nobody kicked off during the hour, a sense of finality did hang over this episode, and it was mostly more purgatorial or hellish than heavenly: It was the spirit, not the flesh, that was threatened.
Written by Semi Chellas and Matthew Weiner and directed by Phil Abraham, the hour was titled “Lost Horizon,” after the James Hilton novel; the titular city-state is a utopia in the Himalayas where people can live forever in peace. The show has referenced it repeatedly, sometimes obliquely (“The Jet Set”), sometimes overtly (“Time Zones”), but always with an air of numbed longing for a state of being that can exist only fleetingly, if at all. Sterling, Cooper & Partners has reinvented itself just as the main characters have, changing names, locations, and management many times during the show’s run (which covers about 11 and a half years, by my calendar), and it was always either to escape ruination or seek a better future (as if the two are really separable).
There seems to be no exit now. Hobart and his primordial douche-bro army at McCann seem to have outflanked Roger, Don, and the SC&P gang in a Machiavellian long-wait maneuver, purchasing and dismantling and absorbing them, winning the loyalty of some SC&P employees with money and perks (Pete Campbell and Harry Crane seem happy) while attempting to bring others (Joan, Peggy, Roger, Don) to heel by peeling away even the illusion that they have autonomy, or a real purpose. The episode is haunted by ghosts and ghostly figures; there are times when a character thinks of him- or herself as the living but is actually behaving as an apparition might (Ed, Peggy, and Roger all hang around the old SC&P office, and Don hallucinates a conversation with Bert Cooper). Don does “die,” professionally speaking, in the middle of a pitch — not by Don but by Bill Phillips of Continental Research, a Don Draper–esque adman/storyteller type whom Don will impersonate while chasing after Diana in Racine. Don zones out and peers through the window, spying the aforementioned jet and its vapor trail behind the Empire State Building; throughout the show’s run, jets have been emblems of the newly easy freedom to relocate: the well-off citizen’s equivalent of doing a Jack Kerouac and hopping a boxcar to wherever. The plane seems to trigger his wanderlust, or his desire to escape entanglement/commitment (same difference: It’s Don). He walks out in the middle of the meeting, hits the road in a big American car, seeks out Diana but doesn’t find her (will she turn out to be this show’s equivalent of the Russian in TheSopranos’ “Pine Barrens”?), then keeps driving, eventually picking up a hippie (remember when Don hated beatniks?) and cruising toward the horizon while David Bowie’s “Space Oddity” blasts off on the soundtrack. (This is not just a callback to the moon landing of season seven, part one’s “Waterloo” — it’s one chameleon providing another chameleon with a soundtrack: Bowie has reinvented himself, by one critic’s estimation, 12 times.) So while he doesn’t swan-dive from the McCann headquarters, he does off himself, in a sense, committing career suicide. “Tell him that he missed Nabisco and National Cash Register, so he might as well take the rest of the day off,” Hobart tells Don’s secretary Meredith, unaware that Don has taken the rest of his life off. Prisoners commit suicide in captivity all the time, and McCann is a lushly appointed gulag (two of Joan’s erstwhile co-workers call the bureaucracy “the Soviets”), a place where whatever workplace fate you fear most is what’s going to happen to you. If you fight your captors, you face a slog that’ll sap your money and spirit and leave you with a pyrrhic victory at best. If you don’t fight, you end up having to suffer with a smile. Oh, well: At least the partners are still rich.
There’s a Count of Monte Cristo–like cold-dish viciousness to what Hobart and company are doing to our heroes — see Hobart forcing Don to identify himself as, basically, the wholly owned property of McCann — and even more so, to our heroines. “Women love it here,” Hobart informs Joan, after we’ve seen her get hot-boxed into flying to Atlanta with her self-appointed white knight and minder, Ferg. Peggy goes on strike after being denied an office at McCann and given a bouquet of flowers as if she were still a secretary. The episode was filled with echoes of Mad Men’s second episode, “Ladies Room,” which laid out the show’s unsettling gender hierarchy at the old agency, with the secretaries (including Joan and Peggy) serving as nannies to the overgrown boys around them, and seething inwardly as they inspected them like cattle and subjected them to what we’d now call blatant sexual harassment. At lunch with the “boys,” the men speculate on whether Peggy will put out, and when, and under what circumstances, at one point jokingly implying that she’ll do it for pay. Things have changed since 1959–60, to the point where Joan can be a partner and Peggy a supervising copywriter, but not too much. The secretaries are still babysitting/mothering/rescuing their male co-workers and bosses (though at least Roger’s other secretary Shirley ankles with dignity, and a parting dig at the agency’s smothering whiteness), and the more dynamic women’s advances can be minimized or neutralized by a change of ownership or venue, as McCann’s goons make all too clear. Peggy gets her office, finally, but it’s a tossed-together space with a drafting table in place of a proper desk. Joan gets an office with windows, at long last, but she’s quickly shunted to McCann’s margins with her not-too-important accounts, and left to try to wriggle away from Ferg, a human version of the cunnilingus-crazed mollusk in the Bert Cooper painting that Roger hands down to Peggy. Tough, Hobart tells the protesting Joan: You’re stuck with the guy, so learn to live with it. As if Ferg’s manipulations weren’t insulting enough, they’re actually a by-product of what initially seemed like a solution to a different bit of male arrogance: Dennis’s shitty casual ableism towards an Avon executive, whom he unthinkingly invited to play golf during a conference call with Joan, not knowing he was paralyzed. Called on his insensitivity, he said that the man shouldn’t have confused him by using the word “walking.” Mad Men is uncomfortably astute in identifying the various ways in which male supremacy fortifies itself against criticism by deciding that people who say there’s a problem are themselves the problem. “He has a wife and three children,” says Ferg, just another guy defending a guy. “He’s not gonna work for a girl. What’s he gonna say to a client? ‘She’s my boss?’”
It’s also painfully realistic about how social progress of every kind occurs: stingily, two millimeters forward and a millimeter and a half back. As we close in on the series finale, it’s not blowing sunshine up our collective backside and telling us, “Hey, things got better, we’ve made such progress since 1959, you’ve come a long way, baby,” because while its main cast is filled with deceptive and self-deceptive characters, the show itself is honest about reality. Anybody who gave a damn about Joan’s happiness, or cosmic justice generally, cheered when Joan threatened Hobart with an Equal Employment Opportunity Commission complaint, legal representation by the American Civil Liberties Union, and a protest by Betty Friedan (who’d led the Women’s Strike for Equality in August 1970). We want Joan to burn it all down — as she threatened to do in the half-season opener, after McCann bullies drowned her and Peggy in pea-brained single entendres.
“You know I need to make men feel at ease!” Peggy says, staring at the octopus painting. “Who told you that?” asks Roger. A few scenes later, we see a hung-over Peggy power-trudging through the halls of McCann with the octopus painting, eyes hidden by sunglasses, cigarette dangling from her lips. Will she be a female Don Draper, after a fashion, acting out against the Man by doing whatever the hell she pleases? We can dream, but the reality will probably be depressingly mundane, because Mad Men isn’t big on wish fulfillment. Joan’s threat would’ve led to a two- or three-part arc on an old David E. Kelley legal drama, complete with soapbox speeches and a soaring final summation backed by inspirational music, but here it’s resolved by having Hobart buy her out for 50 cents on the dollar. It’s depressing that Joan has no realistic choice but to accept his offer, but what’s the alternative? Fighting on for years while continuing to keep an office in the same building where the bosses have it in for her? Quagmire, indeed.
Betty Francis, née Draper, makes a cameo as the ghost of Eisenhower stereotypes past, studying up for grad school by reading, of all things, Freud’s Dora: An Analysis of a Case of Hysteria. Beyond the case study itself — which is worth reading, or reading about, for the ways in which it echoes the plight of women in “Lost Horizon” — the title is notable because of that final word, hysteria, a gendered “diagnosis” that dates back to Ancient Egypt and was linked to “spontaneous uterus movement within the female body.”
This episode is depressingly frank about the failures of what passes for gentlemanly or “chivalrous” behavior. Don offers words of encouragement to Joan this episode, just as Pete did in the cab last episode (and in the hallway with Ferg in this episode, offering to “put a word in” to get Joan on the Sears account, even though in theory she should be his workplace equal). But these are empty substitutes for meaningful support — forget about deep institutional change — and like such gestures as men holding doors open and pulling chairs out for women and helping them with their coats, they amount to tiny subliminal reminders of who’s truly, deeply in charge. Joan’s real-estate-agent boyfriend* offers to “call a guy” to solve her Ferg problem, which only reminds Joan of what the larger problem actually is. In this same conversation, Richard offers to whisk her off to Bermuda or Cape Cod, and she snaps, “I don’t want to go anywhere I don’t want to go. Don’t make plans for me.” This, too, explains what the problem actually is.
Speaking of Bermuda, images of nautical menace recur throughout “Lost Horizon.” Roger tells Peggy of a two-story jump he didn’t take from a cruiser during World War II, a story that also ties in with both the show’s “road not taken” obsession and its fascination with literal and metaphorical abysses. Hobart, meanwhile, rather unsubtly likens Don Draper to Moby Dick, a comparison he must not have thought about too hard, otherwise he would’ve remember what happened to Ahab. In the end, though, the Melville classic that this episode most strongly evokes is Bartleby the Scrivener, in which an office manager is held hostage by an employee who prefers not to do what he prefers not to do. Would that all of McCann’s remaining new employees cause as much casual distress as Don and Joan did this week: To quote Bartleby’s narrator, “Nothing so aggravates an earnest person as a passive resistance.”
Odds and Ends
I loved Peggy skating around the desolate SC&P offices while Roger played organ, a visual callback to season four’s “The Chrysanthemum and the Sword.” In fact, I loved everything about the Peggy-Roger scenes, including the bestowing of the oral octopod painting, Roger’s Phantom of the Opera–like audio “entrance” offscreen, and the business with Roger convincing her to go out for liquor. “I’d do it for you,” he said, which is patently untrue. “Would you drink vermouth?” Peggy asks. “Yes,” Roger replies, with a slightly faraway look in his eyes. “I’m afraid I would.”
Like The Sopranos before it (a series on which Matthew Weiner served as co-writer and co-producer), Mad Men is old-school Freudian, and that extends to its understanding of compulsion. Don’s sleepy hallucination of Bert visualizes him as a spectral therapist, interrogating Don in language that Don, a bit of a hambone, might use. Dream Bert asks Don if he’s going to Racine to see “some waitress who doesn’t care about you,” adding, “You shouldn’t do that.” “That’s not gonna stop me,” Don says. The last two sentences distill the show to nine words.
“She comes and goes as she pleases,” Betty tells Don, breaking the news that Sally left before he could give her a ride to school. “We can’t get mad at her for being independent. It’s normal.” Although Betty and Joan are younger than Don, they represent a ‘50s notion of American feminine ideals (which they themselves partly undermine). Peggy is the ‘60s. Sally might be the ‘70 or ‘80s. Hopefully she’ll have an easier time of it, and make her way in the world with fewer, or at least less blatant, indignities.
Is there any significance to the fact that Peggy is seen watching McCloud? Who knows? But the show was a fish-out-of-water actioner about a cowboy cop (Dennis Weaver) doing his own thing in the big city, outsmarting the slickers with his prairie cunning. That points toward a romanticized view of the outsider as epitomized by Don and Diana, who came to New York from somewhere else. Unfortunately, they both got their hearts broken and fled.
*A previous version of this post identified Joan’s boyfriend Richard as a real estate agent. He is a real estate developer.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(4),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(135),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"4":4,"12":12,"124":124,"135":135}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(406),Fingerprint2=require(408),DS=require(407),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(406),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"406":406,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]