import{T as t,S as e,d as s}from"./p-48f43f2a.js";import{R as c}from"./p-6eb29778.js";class i extends t{static decode(t){const s=Object.assign(Object.create(i.prototype),t);return s.space=e.decode(s.space),s}}var n,a,o;!function(t){t.comparison="comparison",t.conditionalComparison="conditionalComparison"}(n||(n={})),function(t){t.number="number",t.range="range",t.singleChoice="single-choice",t.multipleChoice="multipleChoice",t.text="text"}(a||(a={})),function(t){t.eq="eq",t.ne="ne",t.lt="lt",t.lte="lte",t.gt="gt",t.gte="gte",t.in="in",t.contain="contain",t.ncontain="ncontain",t.similar="similar",t.different="different"}(o||(o={}));class r{constructor(t,e){this.comparisons=t,this.type=e}static decode(t){return Object.assign(Object.create(r.prototype),t)}isValid(){return this.type!==n.comparison||1===this.comparisons.length&&!!this.comparisons[0].firstField&&!!this.comparisons[0].secondField&&!!this.comparisons[0].comparison}}const d=(t,e)=>t.fields.find((t=>t.type===c.type&&t.id===e)).otherCollection,l=(t,e)=>t.selection?t.selection[e]:void 0,u=(t,e)=>{let s;return Object.keys(t.selection||{}).forEach((c=>{j.decode(t.selection[c]).roleNameToSelect===e&&(s=t.selection[c])})),s};class b extends t{static decode(t){const c=Object.assign(Object.create(b.prototype),t);return c.fields=s(c.fields),c.space=e.decode(c.space),Object.keys(c.selection||{}).forEach((t=>{c.selection[t]=j.decode(c.selection[t])})),c.structure&&(c.structure=i.decode(c.structure)),c.actionPermissions=c.actionPermissions||{},c}}class j{static decode(t){var e;const s=Object.assign(Object.create(j.prototype),t);return s.rules=null===(e=s.rules)||void 0===e?void 0:e.map((t=>r.decode(t))),s}isActive(){return"active"===this.status}}export{o as C,i as M,b as P,r as R,n as a,l as b,u as c,d as g}