Jack Lowden broke out in the cheeky drama about the mundanity of espionage, and now he’s making a run for Emmys glory.
ByNicholas Quah,
a Vulture critic who covers podcasts, television, and pop culture
Photo: Pascal Le Segretain/Getty Images
Photo: Pascal Le Segretain/Getty Images
This interview was originally published on August 26, 2024, after Jack Lowden received an Emmy nomination for his performance in Slow Horses. We’re republishing it now that the Slow Horsesseason-four finale is streaming on Apple TV+.
Our choice of venue is less symbolic than practical. On a moody August morning, I meet the Scottish actor Jack Lowden in front of the Scottish Parliament, a severe postmodernist building, where in a few hours he’s due back to talk about access to the arts with the country’s presiding officer at Edinburgh’s Festival of Politics. It’s the buttoned-up stepcousin to the more famous Fringe Festival, taking over centuries-old buildings elsewhere in the city, and Lowden has “no idea what I’m going to say,” he admits with a shrug, dressed in casual layers befitting an individual well versed in Scotland’s fickle summer weather. “I’m surprised they asked me in the first place.”
He’s not exactly an odd choice for Scottish arts advocate. The Youth Theatre alum (the institution counts Gerard Butler and Karen Gillan among its ranks) has been performing in Edinburgh since he was a tween. He’s still a Scottish-theater regular to this day, but he also appears in Apple TV+’s classically British spy thriller Slow Horses, which sees him entering and exiting government buildings at an amusing clip. As River Cartwright, a down-and-out MI5 agent, Lowden is usually shoved into a chaotic side operation while his colleagues deal with the looming national catastrophe driving the season. Lowden solemnly fulfilling his civic duty while the more famous Fringe rages around him makes sense: River’s stuck in the B-plot once again.
In reality, Lowden is measurably happier to speak at the politics festival than River is to deliver another package to Regent’s Park. Particularly in Edinburgh, where later in the week he’ll open his first theater engagement in a decade, The Fifth Step. He had already premiered his movie The Outrun at the Edinburgh International Film Festival earlier in August alongside his partner, co-producer, and star Saoirse Ronan. Somehow amid it all, they found time last month to wed in a secret ceremony, announced within weeks of Lowden earning his first Emmy nomination for Slow Horses.
The Apple TV+ show adapts Mick Herron’s best-selling series of spy thrillers about the agents of Slough House, a bureaucratic purgatory where failed operatives — or “joes,” in Herron parlance — are shoved away to be sunsetted. In the pilot, River spectacularly bungles a training exercise but is protected by the fact that his grandfather, David Cartwright (Jonathan Pryce), had been an accomplished spymaster. In other words, River is a nepo baby, and instead of being discharged, he’s condemned to Slough House, where he and the other bargain-bin MI5 agents are lorded over by Jackson Lamb (Gary Oldman), an ornery but still-brilliant spy in his twilight years.
Slow Horses is a spy procedural by way of Office Space, a workplace sitcom with Mission: Impossible stakes. There’s a subtly satirical eye to the way the series fixates on the mundanity of the intelligence world as much as it does on explosive action. The MI5 of this universe is a corporate dystopia filled with greasy careerists like James “Spider” Webb (Freddie Fox); as the team combats terrorist plots from season to season, it also has to deal with the political machinations of Diana Taverner (Kristin Scott Thomas), the steely deputy head of MI5. The agents we follow are pros, but they aren’t sleek. Their punches are sloppier, and their deaths are treated with a cold matter-of-factness — managers debate the terms of their death payments. Slow Horses is comedic in a quintessentially Britishway: bone-dry and borderline nihilistic. Lamb looks like a guy who crawled out of the sewer. The dialogue is understated, taking real pleasure in language and sarcasm. “Bringing you up to speed is like trying to explain Norway to a dog,” Lamb says in an early episode, one of a million quips he lashes on his team.
On a more conventional drama, Lowden’s leading-man looks suggest he’ll promptly macho back into proper MI5 standing. But Slow Horses delights in subverting and constantly dunking on its grandfailson. (“Failson?” Lowden asks. “What is that?”) When he’s dispatched to the countryside in the second season as part of an op, he strikes up a flirtation with a local woman; her mother turns out to be a sleeper agent. River benefits from Lowden’s gift for physicality, the haughty entitlement of the character apparent in the way he settles his shoulders and raises his chin. In one of his earliest scenes, Lamb forces River to pick through a disgraced journalist’s trash, and you can see Lowden curl his expressions into a soup of anger, humiliation, and Pagliacci sadness — those leading-man looks transformed into an eminently punchable face.
This embrace of comedy is fairly new for Lowden, who has mostly starred in dramas but grew up worshipping British sitcoms like Fawlty Towers and Only Fools and Horses. “All I’ve ever wanted to do is make people laugh,” he says as we stroll up the Royal Mile, a touristy stretch connecting the Parliament grounds to Edinburgh Castle where you might find a shop peddling Princess Diana souvenirs. “It’s only taken me about 15 years to realize that.”
Lowden in Slow Horses, which returns for its fourth season September 4.
Lowden says he’s a lot like River, which is perhaps just a natural result of Slow Horses being his first recurring series after breaking out in the 2016 BBC miniseries War & Peace and featuring in historical films like Christopher Nolan’s Dunkirk and the Ronan-co-starring Mary Queen of Scots. Lowden acknowledges River’s aristocratic pomposity but also sees in the character a genuine care for his colleagues and family, particularly his devotion to his aging grandfather. Showing me around Edinburgh, the actor is hyperconsiderate, getting annoyed on my behalf when what’s ordinarily a great view of the city is obscured by temporary festival seating. He’s also quick to answer my questions as a first-time visitor, contextualizing buildings with centuries-old smoke stains (“That’s when Edinburgh used to be called Auld Reekie”) and unpacking the brain-drain crisis affecting the country. As it turns out, Lowden is a great tour guide.
By the fourth season, which kicks off on September 4, River is still stuck in Slough House, though the character seems more comfortable with the fact that he’s less a main character than an ensemble player. Slow Horses can be a grim show, but one of its pleasures lies in watching these rejects exist with one another; they’re colleagues who regularly face death and then complain about it over a pint. “He’s become begrudgingly happy there,” says Lowden. “He’s got the world’s worst boss that he secretly admires. He gets to be the king of a very small kingdom. And I don’t think he was ever very good at the job.” This new season is set to be particularly River-centric as he endeavors to unravel an attempted hit on his grandfather, who’s now firmly grappling with dementia. Meanwhile, a bomb goes off in London, and his co-workers are on the case. River is stuck in his own adventure once again, but it threatens to be the A-plot now.
Lowden has had a quiet ascent as an actor. Primarily coming up in theater, he won an Olivier Award in 2014 for playing Oswald in a revival of Ibsen’s Ghosts. A solid assortment of screen credits followed: Besides Dunkirk and Mary, there was Terence Davies’s Benediction and Stephen Merchant’s Fighting With My Family (also starring Florence Pugh). In 2022, he received the Trophée Chopard at Cannes, an award recognizing up-and-coming actors, despite the fact that he was already well into his career; Julia Roberts gave him the statuette. “I’m always referred to as rising, and I’m 34 now,” he says, laughing.
On paper, the Emmy nomination for his performance as River is another notch in his belt, and Slow Horses’ nine overall nominations seem to cement the show’s slow-burn rise to popular recognition — at least to a point. “A lot of people still get the name wrong,” he says. “I’ve had ‘You’re in Sea Horse’; ‘You’re in Fast Horse’; ‘You’re in the horse thing.’ People are starting to get it right, but it’s taken a bit.”
We arrive at the other end of the Royal Mile, where the millennia-old Edinburgh Castle looms overhead. “I remember when Mary Queen of Scots premiered here,” recalls Lowden. “They had this reception in the castle afterward. Nicola Sturgeon” — then the first minister of Scotland — “made a speech in the Great Hall, and I was just like, What is happening?!”
Lowden met Ronan while working on Mary Queen of Scots. She played the titular Mary; he played Henry Stuart, Lord Darnley, her husband who was coerced into killing his male lover to hide their relationship. He recalled the first time seeing Ronan on set; all he wanted to do was watch her. “We just fit like a glove since day one,” he says as if still surprised with his good fortune. Both are talkers. Both understand each other as actors. They give each other notes, as she did when she came to dress rehearsals for The Fifth Step, a dark comedy about an alcoholic in search of a sponsor, and they debriefed afterward. “I trust her implicitly,” he says. “I get to do this for a living with my best friend. It’s one of the great joys of my life.”
I ask if they navigate any cultural differences — with him being Scottish and her being Irish — and Lowden briefly indulges the obviously American question. “There’s always certain kinds of truths in generalizations,” he begins, as if prefacing a dissertation. The Irish, he says, are “mammoth and confident” with their history in poetry and the arts, which means they feel no embarrassment telling stories. With the Scots, not so much. “That was the thing with Saoirse,” he says. “When she first started spending time with me in Scotland, we’d go to restaurants or cafés or pubs. She was really loud, and she was like, ‘Why is everybody not talking?’ Because they don’t. We talk quietly or we don’t really talk. Scotland builds people that are very, very shy.” He pauses. “Or they build people like Brian Cox, who can run armies.”
Lowden and Ronan’s artistic partnership extends beyond rehearsals and sharing the screen. Working with the producer Dominic Norris, the duo established a studio, Arcade Pictures, to make The Outrun, which serves as a dramatic vehicle for Ronan. Arcade isn’t the first studio Lowden has set up; he previously raised another production shingle to make the 2020 horror film Kindred, starring Fiona Shaw, which he also acted in. Producing was his way back into loving a career he’d been building for nearly two decades by the time he was in his late 20s. Living in London at the end of the last decade, he started to feel painfully self-conscious as a performer. “Something just took over in my head,” he says. “It was like, You can’t do this. You’re not good at it.”
It got so bad he stopped taking pleasure in being on set. “I wanted to stop,” he says. “I rang my agents and told them, ‘I don’t want to do this anymore.’” That’s when the opportunity to produce Kindred fell into his lap, allowing him to redirect the anxieties of acting into the minutiae of producing: figuring out catering, sourcing electricity, scrambling to find a dinky wind machine to simulate a storm. Shortly before The Outrun premiered, Lowden and Ronan announced they were stepping away from Arcade Pictures and looking to form yet another production company, this time completely on their own so they can plan around their demanding acting engagements. They’re calling it Sad Dog Pictures, named after their dog Stella. (“Because she’s incredibly sad-looking,” he says.)
As we walk back toward the Parliament, I come to realize not a single person seems to notice the Slow Horses star. “I love it,” he says. “Sersh gets recognized all the time, of course.” In Lowden’s mind, the ideal level of fame is somewhere around Jesse Plemons or Tom Burke, last seen in Furiosa, whom he describes as “this complete vintage, mature-cheddar fucking actor.” Which is to say people with good, interesting careers and low profiles. We’ll see if the second part holds. Next year, Lowden is set to appear in a new American political comedy from James L. Brooks, Ella McCay, in which he’ll be part of a cast that includes Emma Mackey, Woody Harrelson, Jamie Lee Curtis, and Ayo Edebiri.
Now we’re back at the Parliament building. The clouds are threatening rain, and soon Lowden will be shuffled into a side entrance to opine on Scotland and the arts. We’d been talking about the very subject, among other things, for the past four hours. Before we part, I ask if he knows what he’s going to say yet. “Oh, no, not at all,” he responds before disappearing into the building’s gray curvatures.
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();
// ]]