/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as o}from"./CY2LR44V.js";import{b as l}from"./44A5XEM4.js";import"./3QPJ2JCA.js";function c(i){return i.reduce((t,n)=>Object.entries(n.roles).reduce((e,[r,a])=>{if(a.value===l)return e;let s;return n.key==="public"?s={collaborationType:r==="authenticated"?o.authenticated:o.anonymous,collaborationId:null}:n.entityType==="group"?s={collaborationType:r==="admin"?o.groupAdmin:o.group,collaborationId:n.entityId}:n.entityType==="organization"?s={collaborationType:r==="admin"?o.orgAdmin:o.org,collaborationId:n.entityId}:n.entityType==="user"&&(s={collaborationType:o.user,collaborationId:n.entityId}),s?[...e,Object.assign(Object.assign({},s),{permission:a.value,id:a.id})]:e},t),[])}function b(i){let t=[...i.publicConfigs,...i.orgConfigs,...i.groupConfigs,...i.userConfigs];return{name:i.name,blockWords:i.blockWords.split(",").map(n=>n.trim()),allowAsAnonymous:i.allowAsAnonymous,permissions:c(t)}}export{b as transformEditorToEntity};
