The poster for Jack Hill’s 1973 blaxploitation classic, Coffy, promises “the baddest one-chick hit squad to ever hit town. She’ll cream you!” The hit squad in question was Pam Grier, the legendary ’70s actor who helped pioneer the art of kicking ass and taking names for women onscreen. Whether her character was a nurse, an inmate in a Philippine prison, a Nubian warrior, or a private eye in Kentucky, Grier always found time to put a hurting on any man or woman who provoked her.
Over the four films they did together, Hill put Grier through some of her toughest hand-to-hand combat battles. In Foxy Brown, when a challenger informs Foxy that she has a black belt in karate, our hero clobbers her with a chair and quips, “Well, I got mine in barstool!” And in Coffy, Grier stars in one of the greatest all-women fights in cinema, one that culminates with one unlucky lady learning the hard way that you never, ever touch a Black woman’s hair without her permission. The suggestion for this scene came from Grier herself.
One of Grier’s most formidable onscreen foes was the great Margaret Markov, her co-star in Black Mama White Mama, in which the women play prisoners chained together who beat the stuffing out of each other before becoming allies. A year later, in The Arena, a triton-wielding Grier re-teamed with Markov to play gladiators in an arena where women fight to the death for the enjoyment of sickos. Both women did their own stunts in their films, usingreal weapons, including swords, in the battle sequences.
Grier now has over 100 credits to her name, with a decadeslong career that’s varied across action, drama, and comedy. But it was a poster for the fashion-filled 1975 comic-strip adaptation Friday Foster that perhaps best summed up Grier’s action persona: “Wham! Bam! Here Comes Pam!”
Excerpt from 'Black Caesars and Foxy Cleopatras'
Women in blaxploitation pictures were often disposable characters who served two purposes: Screw the hero and bring him information or a weapon. There were exceptions, from Judy Pace’s performer in Cotton Comes to Harlem to Diana Sands’s activist in Willie Dynamite. And while Black women were making strides as leads in blaxploitation-adjacent films like Sounder and Lady Sings the Blues, they had yet to showcase their talents by carrying a blaxploitation film the way Richard Roundtree and Ron O’Neal had done.
Pam Grier’s starring role in Coffy in 1973 changed all that. After several supporting roles, she landed the co-lead in Black Mama White Mama, an American International Picture with a story by future Oscar-winning director Jonathan Demme. Demme would cut his teeth on “chicks in chains” movies, making his directorial debut in 1974 with the humanistic women’s prison movie, Caged Heat. For Black Mama White Mama, he, Joe Viola, and screenwriter H.R. Christian paid homage to — or rather, blatantly ripped off — Stanley Kramer’s 1958 race drama The Defiant Ones. In that film, Tony Curtis and Sidney Poitier are chained together and must work through their hatred for one another in order to survive.
This time, Grier’s moll, Lee Daniels (like the director!), and Margaret Markov’s revolutionary, Karen Brent, are the interracial prisoners chained together. Markov had just come off a prior prison film written by Viola and Demme and shot in the Philippines, 1972’s The Hot Box. A hot box fits into Black Mama White Mama as well, when the duo get sentenced to time inside it by the angry lesbian guard who fancies them both. When their prison convoy is ambushed by machine-gun-toting criminals, Karen and Lee escape. Just like Poitier and Curtis, they get into a fistfight while tethered. Unlike the men, the ladies also do a nude shower scene and steal food from the house of a couple who are too busy having sex to notice. “I hope he can last,” Lee says to Karen as the lovers’ moans become more intense. Unfortunately, he cannot.
Markov got top billing on the poster, but Grier got top billing onscreen. As they would do for much of their careers, both actresses did their own stunts. The chemistry between them, and their penchant for looking like they’re having a great time, makes one wish they’d done more movies together. New World Pictures did have the good sense to re-team them for the violent 1974 gladiator spectacle The Arena, where their stunt work would have been even more impressive if Grier had been granted her wish to be totally nude in her battle sequences. (“See Pam’s bush!” is how Grier described this in her interview at the 2022 TCM Film Festival.) Both films were among the first to open in their respective years. Markov would retire from film after The Arena, just as Grier was becoming a major action star with Coffy and its pseudo-sequel, Foxy Brown. Coffy was director Jack Hill’s third collaboration with Grier, shot in Los Angeles in January and February 1973. It wastes no time in establishing its premise. Grier’s character, Coffy (short for Coffin!), is a nurse who despises drug dealers, and she’s willing to lure them to their violent ends by any means necessary. By day, she’s an angel of mercy; by night, she’s the angel of death. As the film opens, she entices two heroin pushers with the promise of a one-night stand at their apartment. As one guy strips down to his purple boxers, the other watches while prepping his fix. Horny viewers expecting the requisite nudity and intertwined bodies were in for a big surprise.
Coffy pulls out a sawed-off shotgun, calls the half-naked guy a motherfucker, and blows his head clean off. The effect is so outrageously graphic that it jolts the audience into wicked levels of applause. Then Coffy demands that the other guy shoot up with an enormous amount of horse. “This will kill me!” he pleads. “Maybe it will and maybe it won’t,” she says. “But if it do, you gonna fly through them pearly gates with the biggest fucking smile Saint Peter ever seen!”
Coffy is an unapologetically nasty piece of work. Its protagonist is one of blaxploitation’s meanest heroes, as tough as most of the men, if not tougher. “The baddest one-chick hit squad that ever hit town,” crowed the poster’s tagline. “She’ll cream you!” Coffy kicked off a long series of films where the ladies got to whip as much ass as the men, with Grier at the forefront of these roles.
Jack Hill described her as “having that something special only she has. She has it!” It’s the same kind of “it” Clara Bow displayed in her silent masterpiece, It, but a lot rougher and earthier. Whatever “it” was, it earned Coffy’s rightful place in the Holy Trinity of blaxploitation alongside Super Fly and Shaft.
Having a female hero wasn’t Coffy’s only deviation from the genre. The negative portrayal of drugs was also unusual, especially after Super Fly. Coffy’s 11-year-old sister has gotten hold of some bad smack and is now comatose at the hospital where Coffy works. She takes her cop ex-boyfriend, Carter (William Elliott), on a tour of the pediatric drug ward, pointing out that some of the patients are under 10 years old. Carter is the rare honest cop, uninterested in being on the take like the rest of the department. When he backs out of the latest shakedown, his colleagues beat him like a piñata while Coffy helplessly watches. This is a crucial mistake, because Coffy knows how to keep — and settle — a grudge. Meanwhile, Coffy’s current boyfriend, Howard Brunswick (Booker Bradshaw), is a smooth politician running for Congress. He’s suave and sexy, satisfying his leading lady in a nude sex scene mere minutes after he’s introduced to the audience. Howard may be a stud, but he’s also corrupt as shit and stupid as hell. Like most of the men in this picture, he will underestimate Coffy at his own peril. But the demands of Howard’s campaign give her time to plan and execute her revenge undetected.
After gleaning his whereabouts from a former employee (and evading her very angry lesbian lover), Coffy goes undercover as a sex worker for King George (Robert DoQui), the pimp whose bad heroin her sister injected. King George wears the eye-searing yellow outfit that influenced Antonio Fargas’s threads in the 1988 blaxploitation parody I’m Gonna Git You Sucka. His theme music, like Coffy’s, is by vibraphonist Roy Ayers. “George, King George,” repeats a smooth-voiced brother over Ayers’s music as George surveys his stable of women.
Jack Hill uses this location to stage one of the great catfights in exploitation film history. Bare breasts and broken glass fly everywhere, and in one of Grier’s script contributions, Coffy’s coif gives new meaning to the term “good hair” when one unlucky vixen discovers it’s loaded with razor blades. This display of feminine ferocity gets Coffy her first client for George, a freaky, racist Italian guy named Arturo — King George’s benefactor. It also affords her the opportunity to replace George’s heroin with sugar, which will save her when she’s later forced to inject a large amount of it.
If the Coalition Against Blaxploitation were going to complain, at least Coffy gives them a moment when they have a point. After a botched assassination attempt on Arturo, Coffy tells him King George hired her. As retribution, Arturo’s henchmen, one of whom is played by Sid Haig, tie George to the back of his own car using a noose. They then proceed to drag him behind it for what feels like an eternity. Though the gory aftermath looks far from realistic, the dragging scene itself is preternaturally vicious, hinting at some of the more gruesome moments that will occur in later blaxploitation films. Granted, the audience is baying for blood and rooting for Coffy’s revenge, but this scene temporarily throws the film off-kilter. On the TCM podcast The Plot Thickens, Grier said she wanted this scene to be even more graphic.
Despite giving its audience the gore-filled, vengeful goods, Coffy’s climax is quite nihilistic. Howard, who’s supposed to be running for office to help Black people, turns out to have no such good intentions and is in cahoots with Arturo. A distrust of authority figures is a running theme in blaxploitation, as is the character of the turncoat Negro willing to sell out his own people for a seat at the white man’s table. Howard’s betrayals are particularly egregious, considering he knows what Coffy has been through. In a hiss-worthy scene, he orders her death.
Since Sweet Sweetback spoiled audiences into demanding their Black heroes survive to the end credits, Jack Hill wasn’t going to disappoint them. After surviving the aforementioned sugar-filled fake overdose, Coffy dispatches Haig’s henchman with a jab to the jugular, causes another henchman to be splattered all over on the L.A. freeway, then drives a car through Arturo’s house (crushing his one-eyed bodyguard in the process). She kills everybody before returning to Howard’s beach house, the site of the one sex scene in the film. Howard is there, and he tries to sweet-talk Coffy into “his loving arms.”
“You always were a good talker,” she tells him while aiming the same sawed-off shotgun she used on those dope pushers in the first reel. But before she can succumb to the full effect of Howard’s silver tongue, they are interrupted by a naked White woman asking when Howard will be returning to bed. Mirroring her first use of the shotgun, Coffy shoots Howard in the head. Unfortunately for Howard, it’s not the one on his shoulders.
As she stumbles out onto the beach, alone and spent, Roy Ayers serenades Coffy with a song about how righteous she is. However, Grier’s lonely image in the frame visually questions the price of retribution. Like Charles Bronson’s vigilante in Death Wish, Coffy feels traumatized by her first killing, so much so that she takes people out only in self-defense afterward. It’s a satisfying ending, but one is left wondering what will happen to Nurse Coffin after the credits roll.
As expected, reviews for Coffy were not so hot when the film opened on June 13, 1973. In New York City, it played at the Penthouse in Times Square, where New York Daily News critic Ann Guardino saw it before filing her one-star review. In Chicago, it blew the roof off the Oriental (“the Oriental is Y’Oriental now!” read an ad for the theater), which is where Roger Ebert saw it. Coincidentally, Grier briefly appeared in the movie Ebert wrote for Russ Meyer, Beyond the Valley of the Dolls.
Ebert’s two-star review was one of the nicer pans of the film. Of course, the man who loved buxom women loved watching Grier. “She is a young actress of beautiful face and astonishing form,” he wrote, “who has previously been seen in the kinds of movies frequented only by demented creeps and movie critics.” Those demented creeps came out to say, “Wham! Bam! Thank you, Pam!” Coffy was a hit, making $2 million at the box office, four times its original budget.
Helping put asses in seats were the dynamic movie posters, which showed multiple pictures of Grier’s outfits and hairstyles. Another, more famous poster featured a gloriously Afro-crowned Grier wearing a red shirt tied above her midriff. That shirt was a happy accident; the poster photos were shot without much preparation or warning, forcing Grier to improvise on clothing. The red shirt she found was too small to be worn over her entire torso, so she tied it under her cleavage. An iconic image was born.
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();
// ]]