ByDevon Ivie,
a staff writer covering classic rock and TV
“I don’t know what the point of life is if you don’t do some dumb shit sometimes.”
Photo-Illustration: Vulture; Photo: Getty Images
For the first time in Kesha’s career, the only person she’s answering to is her own damn self. This summer,following a lengthy legal battle against her former producer Dr. Luke — whom she accused of sexual assault in 2013 — the singer-songwriter dropped “Joy Ride,” her first single as an independent artist under her newly established label, Kesha Records. (The 37-year-old star had been contractually obligated to release five studio albums under Luke’s record company, which she fulfilled with her last project, 2023’s Gag Order.) “It’s crazy that it’s taken this long to get to this point in my life, but I feel like this is my first single,” she says. “I’m so happy people have stuck around for the whole messy ride.”
That messiness manifests itself in “Joy Ride,” which Kesha describes as “a song for driving 120 miles per hour down the 405 laughing maniacally with a knife in one hand and a Birkin in the other.” She wanted her first new single as a free woman to be all about joy and celebration — ideas that, against all odds, have been a constant in her music since the start of her career. (The song was unveiled to the public, fittingly, on Independence Day.) But with six lead singles to discuss for our latest Song Roulette column, she has to walk through the rain before getting to the rainbow. “It feels good to be exactly who I am and not ask anybody else’s permission,” she says. “I’m a free motherfucking woman. Let’s party.”
🎵
“Tik Tok,” Animal (2009)
.
The Song
I started “Tik Tok” not being quite so dumb, and then the writing room was like, Make it dumber, make it dumber, make it dumber. Where we ended up was as dumb as I could make the lyrics. After I wrote them, I was like, This is too dumb, right? It doesn’t make sense to brush your teeth with a bottle of Jack Daniel’s. But I remember Benny Blanco was like, No, it’s sick. Just don’t overthink it. That’s what we ended up with.
“Tik Tok” was my youth. I was a baby as an artist. It was my coming-out-of-the-womb song. People now know I’m a funny bitch but at the beginning, I think they quite literally thought I brushed my teeth with Jack Daniel’s every day. I’ve had that question asked to me like fifty thousand times at this point.
.
The Bet
I had no autonomy whatsoever. I wrote every song on the album, and I’ve favored myself as a songwriter first and foremost, so in some instances I had autonomy over that. Even though I had no real control in other areas, I could always let myself shine through in the lyrics. I feel like that’s the place I get to be myself.
.
The Payoff
I had no idea that it would explode into what it exploded into. It felt very surreal and overwhelming in the best of ways. I went from playing shows to seven people — if you count the one guy who was asleep at the bar — to then playing Lollapalooza. It all happened really fast and it was so exciting, but I had no idea how to do what I was doing. Nobody really knows. You just keep up and try to enjoy the ride. I always made sure that I was just writing music constantly during this period and capturing all the highs and lows. I didn’t ever intend on becoming a pop star. I never, still to this day, think of myself as a pop girl. So it took me by surprise with what the world did with “Tik Tok.” It took me all over. It was the first thing that led me into the life I now get the privilege of living.
🎵
“Die Young,” Warrior (2012)
.
The Song
Something that’s always been important to me is taking advantage of the present moment. I always try to capture that when performing “Tik Tok” and “Die Young.” But this song sits with me in a more complicated way. Although it’s one of my biggest hits, it brought up mixed reactions even before it was released. When I was writing and recording it, the title didn’t sit right with me. It was at a time where our country had already been dealing with so many gun-control issues, and I voiced my concerns about that. I originally wanted to call it “Beating My Drum.” Unfortunately, I didn’t have control. My instinct proved correct later. There was a horrible tragedy in our country, the Sandy Hook shooting, and that solidified my fears that this song was in fact as inappropriately titled as I had felt. I love how much joy it brings to other people. I really pride myself in integrity and creating joyous safe spaces. But having a song of mine even be in the same conversation as a school shooting was so fucking painful.
.
The Bet
At this point in my career, there was not a collaborative process for choosing singles. It’s difficult when you’re at odds with an image of you being put together that’s not led by you, and you’re not consulted about any of it. It’s a really complicated thing, because I love my songs. My songs are my children. Putting out singles or making pop records should be fun. The sick, twisted irony of it being so unpleasant is deranged and unnecessary. I didn’t really talk about the song because I wanted fans to have the music, have the fun, and enjoy it and enjoy my spirit. I don’t want to kill anybody’s buzz with a song that they love. But there was all this other shit going on.
.
The Payoff
I’m always happy when I provide joy to other people. I think it’s a really important and overlooked emotion. But because of what happened at Sandy Hook, I’d always just felt like there’s a heaviness around “Die Young.” I couldn’t tell you where it fell on the charts. For me, as someone whose main principle of doing anything in this life is integrity and safety, it still feels really at odds with me.
🎵
“Praying,” Rainbow (2017)
.
The Song
My life since “Tik Tok” came out had been so big, extraordinary, beautiful, and heartbreaking. But it had also been very public. I write songs and they lead me to my truth. So with the world already knowing what I was going through, it only made sense to write a song about it. That’s where “Praying” was born from. Ryan Lewis is an incredible producer and has become such a good friend. He helped me find my voice in a way that I’d never found before — literally. I remember working with him and my voice opened up an extra octave just by working with a man like that — someone who was kind and gave me so much support. Writing it was cathartic. I tried to alchemize what I was going through into something beautiful. “Praying” led me to a deeper version and deeper understanding of myself. I was definitely influenced by gospel music. It almost felt like a beg to God when we were writing it. But I mostly wanted people to hear me. Before this song, there was a lot of Auto-Tune. Which, yes, was fun to do. But I was dealing with a more serious topic, so I wanted to really sing and let people see me and hear me for real.
.
The Bet
This was the first album I got to executive-produce, so this was the first time I got to pick the songs that went onto the album. I felt so free in the writing process because I knew I was going to be in control of what went out to the public and what it was titled. I felt like “Praying” was an accurate representation of what I wanted to show about myself.
.
The Payoff
I genuinely have never looked at the charts, because I believe once I put out the music, it doesn’t belong to me anymore. I feel like obsessing about a chart is obsessing about something that’s out of my control, and art is not something we can control. Maybe it’s a flaw that I don’t chase that type of thing, but it is what it is. I didn’t make that album for chart success, I made it because I had to. I ended up singing at the Grammys and it was the first time I was ever nominated. I credit “Praying” for those experiences. It helped me step into my strength, my power, and my vulnerability all at once.
🎵
“Raising Hell,” High Road (2019)
.
The Song
I don’t know what the point of life is if you don’t do some dumb shit sometimes. I think it’s healthy for people to get a little freaky — I like being in a place where people feel comfortable to come be their freaky little selves. Working with Big Freedia, we’re both really good at getting people to move their bodies. We definitely wanted to make a song that you had no choice but to shake your ass to.I wanted “Raising Hell” to be an amalgamation of all of my influences. I grew up going to church and studying different religions, so I’ve always been spiritually inclined. And then I love to be a wild animal, so I wanted all of those things encapsulated into one song.
.
The Bet
This was really a reclaiming of my joy. I didn’t get my artistic freedom until March 6, 2024, so while still being in this legal battle, I wanted to find that self-expression. It was important to me that the first single on this album really stood for that — getting back in touch with my playful love of pop.
.
The Payoff
People were really happy to see me be happy again. My fans appreciated that. But again, going back to my life being very public, they were also well aware that I wasn’t yet in the space where I was completely free of all the things I was dealing with behind the scenes. The general consensus I’ve gotten is people were really happy to see that I was still able to be in touch with my joy.
🎵
“Eat the Acid,” Gag Order (2023)
.
The Song
Rick Rubin is an angel sent from God. He provided this really safe masculine space where I could fall into the weirdest, darkest, and most vulnerable parts of myself that I didn’t even know existed. The whole experience felt like an acid trip, and I’ve never done acid. While I was writing this record, it was during the COVID era and we were watching people go through so much pain in the world. Then in my personal life, we’re going on year seven and eight of my own litigation. It felt almost like when you’re swimming underwater and you’re not sure if you’re going to make it to the surface. That’s where I was emotionally. I was testing my limits of what a human has the capacity to deal with. And in that terror, I had a really beautiful, spiritual experience where I quite literally talked to my higher power. I’m well aware of how insane that sounds. I was so afraid to be honest about that to anyone, let alone tell the world this.
So the morning after I had this insane spiritual experience, I wrote “Eat the Acid” on Zoom with my mom and one of my longtime collaborators, Stuart Crichton. It felt like I had discovered the next dimension. All of my songs are my babies, but this one is one of the most special pieces of music I’ve ever made. My mom told me to never take acid because she saw everything. The night I had my spiritual experience, I felt like I met God and saw everything. Once you see something, you can’t unsee it. So it forces you into a reincarnation of yourself and your perspective, and that’s uncomfortable. That growth can be really terrifying to see the world in a different way. So as the world was going through that with the pandemic, I was going through that internally.
.
The Bet
Sometimes when you listen to a song too many times, you get sick of it. This is a song I never got sick of. It was this beautiful reminder of the fact that I believe there’s something or someone with me and to never give up hope and that there’s maybe a meaning behind all the madness. That’s really why I wanted to put this song out as the lead single, and I’m just so proud of it.
.
The Payoff
My fans always go on the ride with me and that’s why I fucking love my animals. They never know what they’re going to get and they’re always here for it. I believe that when creating art, I’m not a product. So if I’m an artist, I have to allow space for all of those incarnations of me to exist. They knew what I was going through. It wasn’t an easy time for very many of us.
🎵
“Joy Ride,” Untitled Studio Album (2024)
.
The Song
I knew what I was feeling and I wanted to make that feeling last forever. So I went into the studio, fresh off my freedom and a monthlong stay at this naked hippie commune where I was playing accordion. I wanted to make that feeling eternal. So I went into the studio and was like, Okay, we need an accordion, but I need you to chop it up like it’s a synth and I need you to flip it and reverse it. And I want to sing like a spooky dom. I’ve earned the right to be as fucking crazy as I want to be. So I will be, and no one can give me shit. Or you can try to, but I’m driving too fast to hear you, so fuck right off.
.
The Bet
I recently found out that my name means “innocent joy.” Since the beginning of my very naïve introduction to the music business, music has been my lover, my best friend, my partner, and my higher power. I’ve always wanted my joy to come through the music, which I feel like has been the case going back to “Tik Tok.” But if people take advantage of your joy and it gets off track, this song is a beautiful representation that it’s never really gone. I really wanted to remind myself who the fuck I am and release this song.
.
The Payoff
People might know my name and they might be familiar with certain songs of mine, and they all have a piece of me in them. But this is the first single I’m putting out 100 percent as myself. There’s no one else telling me what I can or can’t do, what I can or can’t look like, what songs they think should make the record, or, quite frankly, what songs are going to start playing on the radio without my consent. This is the first time I get to really represent myself the way I want to be represented with my art, with my voice, with my pen game, and with my production. Everything is mine. So the fact that people are responding well to this song is so fucking healing.
In 2013, Kesha accused Dr. Luke of sexual assault. The duo reached a settlement in June 2023. Though the terms of it were not made public, it likely means Kesha can only speak about her history and trial with Dr. Luke in nonspecific terms.
The school shooting occurred more than two months after “Die Young” was released on September 25, 2012. The song was subsequently removed from many radio stations after the shooting, due to perceived inappropriate lyrical content.
It reached No. 2 on the Hot 100.
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();
// ]]