Liferay.Loader.define("commerce-organization-web@5.0.37/js/utils/paint",["module","exports","require","frontend-taglib-chart$d3","./constants","./index"],(function(t,a,e){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.appendIcon=o,a.appendCircle=i,a.createAddActionButton=s,a.fillAddButtons=function(t,a,e){const n=t.append("g").attr("class","actions-wrapper"),r=n.append("g").attr("class","open-actions-wrapper").on("mousedown",(t=>{"account"===t.parent.data.type?e(t.parent.data,"user"):n.node().classList.toggle("menu-open")}));i(r,36,"action-circle"),o(r,"".concat(a,"#plus"),18,"action-icon"),s(n,"account",e,a),s(n,"organization",e,a),s(n,"user",e,a)},a.printDescription=d,a.fillEntityNode=function(t,a,e){t.append("rect").attr("width",(t=>r.RECT_SIZES[t.data.type].width)).attr("height",(t=>r.RECT_SIZES[t.data.type].height)).attr("transform",(t=>"translate(0, ".concat(-.5*r.RECT_SIZES[t.data.type].height,")"))).attr("rx",(t=>r.RECT_SIZES[t.data.type].height/2)).attr("class","chart-rect");const i=t.append("g").attr("class","icon-wrapper");i.append("circle").attr("class","icon-circle"),o(i,(t=>"".concat(a,"#").concat(r.SYMBOLS_MAP[t.data.type])),16,"node-type-icon");const s=t.append("g").attr("class","chart-item-info");s.append("text").attr("class","node-title").text(c.formatItemName),s.each(((t,e,n)=>d(t,n[e],a)));const p=t.filter((t=>!(!t.parent||"fakeRoot"===t.parent.data.type)&&(0,c.hasPermissions)(t.data,[r.ACTION_KEYS[t.data.type].REMOVE,r.ACTION_KEYS[t.data.type].DELETE]))).append("g").attr("class","node-menu-wrapper").attr("transform",(t=>{const a=r.RECT_SIZES[t.data.type].width-r.NODE_BUTTON_WIDTH-r.NODE_PADDING;return"translate(".concat(a,", -14)")})).on("mousedown",(t=>{var a;n.event.stopPropagation(),e(n.event.currentTarget,t.data,null===(a=t.parent)||void 0===a?void 0:a.data)}));p.append("rect").attr("class","node-menu-btn"),o(p,"".concat(a,"#ellipsis-v"),16,"node-menu-icon")},a.getLinkDiagonal=void 0;var n=e("frontend-taglib-chart$d3"),r=e("./constants"),c=e("./index");function o(t,a,e,n){return t.append("use").attr("class",n).attr("width",e).attr("height",e).attr("href",a)}const t=(0,n.linkHorizontal)().source((({source:t},a,e)=>{let n=a.data.type?r.RECT_SIZES[a.data.type].width:0;switch(e){case"enter":return[n+a.y0,a.x0];case"exit":return[n+a.y,a.x];default:return n=t.data.type?r.RECT_SIZES[t.data.type].width:0,[n+t.y,t.x]}})).target((({target:t},a,e)=>{const n=a.data.type?r.RECT_SIZES[a.data.type].width:0;switch(e){case"enter":return[n+a.y0,a.x0];case"exit":return[n+a.y,a.x];default:return[t.y,t.x]}}));function i(t,a,e){return t.append("circle").attr("r",a).attr("class",e)}function s(t,a,e,n){const c=t.append("g").attr("class","add-action-wrapper ".concat(a)).on("mousedown",(t=>{e(t.parent.data,a)}));i(c,16,"action-circle"),o(c,"".concat(n,"#").concat(r.SYMBOLS_MAP[a]),16,"action-icon")}function d(t,a,e){const i=(0,n.select)(a).append("g").attr("class","node-description");if("user"===t.data.type)return void i.append("text").attr("class","node-description-content").text(c.formatUserDescription);("organization"===t.data.type?["organization","account","user"]:["user"]).reduce(((a,n)=>{const c=i.append("g").attr("class","".concat(n,"-wrapper")).attr("transform","translate(".concat(a,", 5)"));o(c,"".concat(e,"#").concat(r.SYMBOLS_MAP[n]),12,"entity-icon");const s=c.append("text").attr("class","entity-description").attr("x",18).attr("y",10).text(t.data[r.COUNTER_KEYS_MAP[n]]);"organization"!==n&&"account"!==t.data.type&&c.append("line").attr("class","entity-divider").attr("x1",-7).attr("x2",-7).attr("y1",-2).attr("y2",12);const d=s.node();let p=0;return d.getBBox&&(p=d.getBBox().width),a+p+32}),64)}a.getLinkDiagonal=t}}));
//# sourceMappingURL=paint.js.map