Liferay.Loader.define("depot-web@2.0.70/js/DepotRoles",["module","exports","require","frontend-js-web"],(function(e,t,o){window;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function _default({portletNamespace:e,removeDepotRoleIcon:t,searchContainerId:o,selectDepotRolesURL:n,selectEventName:c}){const l=[],s=[],d=[],i=[];Liferay.componentReady("".concat(e).concat(o)).then((o=>{const p=o.get("contentBox");o.updateDataStore(p.all(".modify-link").getData().map((e=>e.entityid)));const r=document.getElementById("".concat(e,"selectDepotRoleLink"));r&&r.addEventListener("click",(p=>{p.preventDefault(),(0,a.openSelectionModal)({onSelect:n=>{if(!n)return;const c=[];c.push('<i class="'.concat(n.iconcssclass,'"></i>').concat((0,a.escapeHTML)(n.rolename))),c.push(n.groupdescriptivename),c.push('<a class="modify-link" data-entityid="'.concat(n.entityid,'" href="javascript:void(0);">').concat(t,"</a>")),o.addRow(c,n.entityid),o.updateDataStore();const[p,r]=n.entityid.split("-");for(let e=0;e<i.length;e++)if(d[e]===p&&i[e]===r){d.splice(e,1),i.splice(e,1);break}l.push(p),s.push(r);const u=document.getElementById("".concat(e,"fm"));u&&(u["".concat(e,"addDepotGroupRolesGroupIds")].value=l.join(","),u["".concat(e,"addDepotGroupRolesRoleIds")].value=s.join(","),u["".concat(e,"deleteDepotGroupRolesGroupIds")].value=d.join(","),u["".concat(e,"deleteDepotGroupRolesRoleIds")].value=i.join(","))},selectEventName:c,selectedData:o.getData(!0),title:(0,a.sub)(Liferay.Language.get("select-x"),Liferay.Language.get("role")),url:n})})),(0,a.delegate)(p.getDOMNode(),"click",".modify-link",(t=>{const a=t.delegateTarget,n=a.closest("tr"),c=a.dataset.entityid;o.deleteRow(n,c);const[p,r]=c.split("-");((t,o)=>{for(let e=0;e<l.length;e++)if(l[e]===t&&s[e]===o){l.splice(e,1),s.splice(e,1);break}d.push(t),i.push(o);const a=document.getElementById("".concat(e,"fm"));a&&(a["".concat(e,"addDepotGroupRolesGroupIds")].value=l.join(","),a["".concat(e,"addDepotGroupRolesRoleIds")].value=s.join(","),a["".concat(e,"deleteDepotGroupRolesGroupIds")].value=d.join(","),a["".concat(e,"deleteDepotGroupRolesRoleIds")].value=i.join(","))})(p,r)}))}))};var a=o("frontend-js-web")}));
//# sourceMappingURL=DepotRoles.js.map