/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{i as d,j as i}from"./N22MFQSQ.js";import{a as c}from"./43LVFNMF.js";import{a as p}from"./KOIDWEP3.js";import{a as s}from"./AJZDBHB6.js";function f(r){let e=!1;return r&&(e=!(r.typeKeywords||[]).includes(c)),e}function w(r,e){let o=(r||[]).filter(t=>t!==c);return e||o.push(c),o}var y=class{constructor(e){this.mappings=e}storeToEntity(e,o){let t=S(e,o,this.mappings);if(s(e,"item")){let n=s(e,"item");i("canEdit",["admin","update"].includes(n.itemControl),t),i("canDelete",n.itemControl==="admin",t),i("canRecycle",n.canRecycle||!1,t),i("protected",n.protected,t)}return t}entityToStore(e,o){return C(e,o,this.mappings)}};function C(r,e,o){if(s(e,"item")){let t=s(e,"item");t.typeKeywords&&(t.typeKeywords=s(r,"isDiscussable")?t.typeKeywords.filter(n=>n!==c):[...t.typeKeywords,c],i("item.typeKeywords",t.typeKeywords,e))}return m(r,"entityKey",e,"storeKey",o)}function S(r,e,o){if(s(r,"item")){let t=s(r,"item");i("isDiscussable",f(t),e)}return m(r,"storeKey",e,"entityKey",o)}function m(r,e,o,t,n){let u=p(o);return n.forEach(l=>{let g=s(l,e),A=s(l,t),a=s(r,g);a!=null&&d(u,A,a,!0)}),u}export{f as a,w as b,y as c,C as d,S as e};
