{"version":3,"file":"media_container_controller-B7dK1rvo.js","sources":["../../../app/javascript/controllers/compose/media_container_controller.js"],"sourcesContent":["import Application from '../application_controller'\n\nexport default class extends Application {\n static targets = ['list', 'attachment']\n\n initialize() {\n super.initialize()\n this.attachmentsMutationObserver = new MutationObserver(this.attachmentsChanged.bind(this))\n }\n\n connect() {\n super.connect()\n this.attachmentsMutationObserver.observe(this.listTarget, {childList: true})\n }\n\n disconnect() {\n this.attachmentsMutationObserver.disconnect()\n super.disconnect()\n }\n\n attachmentsChanged() {\n if (this.listTarget.children.length === 0) {\n this.addClass(this.element, 'hidden')\n } else {\n this.removeClass(this.element, 'hidden')\n }\n }\n\n enable() {\n this.attachmentTargets.forEach((attachment) => {\n this.removeClass(attachment, 'opacity-40')\n })\n }\n\n disable() {\n this.attachmentTargets.forEach((attachment) => {\n this.addClass(attachment, 'opacity-40')\n })\n }\n}\n"],"names":["media_container_controller","Application","attachment","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAY,CAGvC,YAAa,CACX,MAAM,WAAU,EAChB,KAAK,4BAA8B,IAAI,iBAAiB,KAAK,mBAAmB,KAAK,IAAI,CAAC,CAC9F,CAEE,SAAU,CACR,MAAM,QAAO,EACb,KAAK,4BAA4B,QAAQ,KAAK,WAAY,CAAC,UAAW,EAAI,CAAC,CAC/E,CAEE,YAAa,CACX,KAAK,4BAA4B,WAAU,EAC3C,MAAM,WAAU,CACpB,CAEE,oBAAqB,CACf,KAAK,WAAW,SAAS,SAAW,EACtC,KAAK,SAAS,KAAK,QAAS,QAAQ,EAEpC,KAAK,YAAY,KAAK,QAAS,QAAQ,CAE7C,CAEE,QAAS,CACP,KAAK,kBAAkB,QAASC,GAAe,CAC7C,KAAK,YAAYA,EAAY,YAAY,CAC1C,CAAA,CACL,CAEE,SAAU,CACR,KAAK,kBAAkB,QAASA,GAAe,CAC7C,KAAK,SAASA,EAAY,YAAY,CACvC,CAAA,CACL,CACA,CApCEC,EADkBH,EACX,UAAU,CAAC,OAAQ,YAAY"}