{"version":3,"file":"list_controller-BoIiqAhS.js","sources":["../../../app/javascript/controllers/audience/list_controller.js"],"sourcesContent":["import { get } from \"@rails/request.js\"\n\nimport ApplicationController from \"../application_controller\"\nimport { Current } from \"../models/current\"\n\nexport default class extends ApplicationController {\n static values = {\n path: String,\n navigate: { type: Boolean, default: false },\n creatorId: String\n }\n\n static targets = [\"link\", \"editLink\", \"spinner\", \"editButton\", 'pane']\n\n initialize() {\n super.initialize()\n }\n\n connect() {\n if(Current.user.role.agent) {\n this.editButtonTarget.remove()\n }\n\n if(this.navigateValue && this.creatorIdValue === Current.user.id) {\n this.element.removeAttribute('data-audience--list-navigate-value')\n this.nextTick(() => this.linkTarget.click())\n }\n\n if(window.location.href.includes(this.pathValue)) {\n this.markAsActive()\n }\n\n super.connect()\n }\n\n disconnect() {\n this.element.removeAttribute('data-audience--list-navigate-value')\n super.disconnect()\n }\n\n markAsActive() {\n document.querySelector('.audience--link.active')?.classList?.remove('active')\n this.addClass(this.linkTarget, 'active')\n }\n\n paneTargetConnected() {\n this.removeClass(this.editLinkTarget, 'group-hover:flex')\n }\n\n paneTargetDisconnected() {\n this.addClass(this.editLinkTarget, 'group-hover:flex')\n }\n}\n"],"names":["list_controller","ApplicationController","Current","_b","_a","__publicField"],"mappings":"8NAKe,MAAKA,UAASC,CAAsB,CASjD,YAAa,CACX,MAAM,WAAU,CACpB,CAEE,SAAU,CACLC,EAAQ,KAAK,KAAK,OACnB,KAAK,iBAAiB,OAAM,EAG3B,KAAK,eAAiB,KAAK,iBAAmBA,EAAQ,KAAK,KAC5D,KAAK,QAAQ,gBAAgB,oCAAoC,EACjE,KAAK,SAAS,IAAM,KAAK,WAAW,MAAO,CAAA,GAG1C,OAAO,SAAS,KAAK,SAAS,KAAK,SAAS,GAC7C,KAAK,aAAY,EAGnB,MAAM,QAAO,CACjB,CAEE,YAAa,CACX,KAAK,QAAQ,gBAAgB,oCAAoC,EACjE,MAAM,WAAU,CACpB,CAEE,cAAe,UACbC,GAAAC,EAAA,SAAS,cAAc,wBAAwB,IAA/C,YAAAA,EAAkD,YAAlD,MAAAD,EAA6D,OAAO,UACpE,KAAK,SAAS,KAAK,WAAY,QAAQ,CAC3C,CAEE,qBAAsB,CACpB,KAAK,YAAY,KAAK,eAAgB,kBAAkB,CAC5D,CAEE,wBAAyB,CACvB,KAAK,SAAS,KAAK,eAAgB,kBAAkB,CACzD,CACA,CA9CEE,EADkBL,EACX,SAAS,CACd,KAAM,OACN,SAAU,CAAE,KAAM,QAAS,QAAS,EAAO,EAC3C,UAAW,MACf,GAEEK,EAPkBL,EAOX,UAAU,CAAC,OAAQ,WAAY,UAAW,aAAc,MAAM"}