Liferay.Loader.define("@liferay/commerce-channel-web@4.0.47/js/CommerceChannelSite",["module","exports","require","frontend-js-web"],(function(e,t,o){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({itemSelectorUrl:e,portletNamespace:t,removeCommerceChannelSiteIcon:o,searchContainerId:a}){Liferay.componentReady("".concat(t).concat(a)).then((a=>{const c=document.getElementById("".concat(t,"selectSite"));c&&c.addEventListener("click",(c=>{c.preventDefault(),(0,n.openSelectionModal)({onSelect:e=>{if(!e)return;const n=a.getData(),c=document.querySelector('a[data-rowid="'.concat(n,'"]'));if(c){const e=c.closest("tr");e&&a.deleteRow(e,c.dataset.rowid)}const d=[];d.push(e.name),d.push('<a class="float-right modify-link" data-rowId="'.concat(e.id,'" href="javascript:void(0);">').concat(o,"</a>"));const r=document.getElementById("".concat(t,"siteGroupId"));r&&(r.value=e.id),a.addRow(d,e.id),a.updateDataStore()},selectEventName:"sitesSelectItem",title:(0,n.sub)(Liferay.Language.get("select-x"),Liferay.Language.get("site")),url:e})}));const d=a.get("contentBox");(0,n.delegate)(d.getDOMNode(),"click",".modify-link",(e=>{const o=e.delegateTarget,n=o.closest("tr");a.deleteRow(n,o.dataset.rowid);const c=document.getElementById("".concat(t,"siteGroupId"));c&&(c.value=0)}))}))};var n=o("frontend-js-web")}));
//# sourceMappingURL=CommerceChannelSite.js.map