{"version":3,"file":"order_controller-Dp3bHO5i.js","sources":["../../../app/javascript/controllers/artifact/order_controller.js"],"sourcesContent":["import ApplicationController from '@/controllers/application_controller'\n\nexport default class extends ApplicationController {\n static targets = [\n 'item',\n 'itemTemplate',\n 'main',\n ]\n\n addNewItem() {\n const item = this.itemTemplateTarget.cloneNode(true)\n\n item.setAttribute('data-controller', 'artifact--entity--item')\n item.setAttribute('data-artifact--order-target', 'item')\n\n item.classList.remove('hidden')\n\n this.mainTarget.appendChild(item)\n }\n\n removeItem({ currentTarget }) {\n this.itemTargets.find(item => item.contains(currentTarget)).remove()\n }\n\n itemTargetConnected() {\n this.show(this.mainTarget)\n }\n\n itemTargetDisconnected() {\n if(this.itemTargets.length === 0) {\n this.hide(this.mainTarget)\n }\n }\n}\n"],"names":["order_controller","ApplicationController","item","currentTarget","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAOjD,YAAa,CACX,MAAMC,EAAO,KAAK,mBAAmB,UAAU,EAAI,EAEnDA,EAAK,aAAa,kBAAmB,wBAAwB,EAC7DA,EAAK,aAAa,8BAA+B,MAAM,EAEvDA,EAAK,UAAU,OAAO,QAAQ,EAE9B,KAAK,WAAW,YAAYA,CAAI,CACpC,CAEE,WAAW,CAAE,cAAAC,GAAiB,CAC5B,KAAK,YAAY,KAAKD,GAAQA,EAAK,SAASC,CAAa,CAAC,EAAE,OAAM,CACtE,CAEE,qBAAsB,CACpB,KAAK,KAAK,KAAK,UAAU,CAC7B,CAEE,wBAAyB,CACpB,KAAK,YAAY,SAAW,GAC7B,KAAK,KAAK,KAAK,UAAU,CAE/B,CACA,CA9BEC,EADkBJ,EACX,UAAU,CACf,OACA,eACA,MACJ"}