Liferay.Loader.define("data-engine-js-components-web@1.0.75/js/utils/visitors.es",["module","exports","require"],(function(e,s,t){window;{function r(e,s){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);s&&(r=r.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),t.push.apply(t,r)}return t}function n(e){for(var s=1;s<arguments.length;s++){var t=null!=arguments[s]?arguments[s]:{};s%2?r(Object(t),!0).forEach((function(s){i(e,s,t[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))}))}return e}function i(e,s,t){return s in e?Object.defineProperty(e,s,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[s]=t,e}Object.defineProperty(s,"__esModule",{value:!0}),s.RulesVisitor=s.PagesVisitor=void 0;const e=e=>e;class t{constructor(e){this.setPages(e)}dispose(){this._pages=null}containsField(e){return!!this.findField((s=>s.fieldName===e))}findField(e){let s;return this.visitFields((t=>!!e(t)&&(s=t,!0))),s}mapColumns(s){return this._map(e,e,s,e)}mapFields(s,t=!0,r=!1){const i=(e,...o)=>e.map(((e,a)=>{const l=n(n({},t?e:null),s(e,a,...o)),u=l.nestedFields;return r&&u&&(l.nestedFields=i(u,...o,l)),l}));return this._map(e,e,e,i)}mapPages(s){return this._map(s,e,e,e)}mapRows(s){return this._map(e,s,e,e)}setPages(e){this._pages=[...e]}visitFields(e){const s=t=>{var r,n;return!!t&&(t.fieldName?e(t)||s(t.nestedFields):Array.isArray(t)?t.some((e=>s(e))):s(null!==(r=null!==(n=t.fields)&&void 0!==n?n:t.rows)&&void 0!==r?r:t.columns))};return s(this._pages)}_map(e,s,t,r){return this._pages.map(((i,o)=>{const a=n(n({},i),e(i,o));return n(n({},a),{},{rows:a.rows.map(((e,i)=>{const a=n(n({},e),s(e,i,o));return n(n({},a),{},{columns:a.columns.map(((e,s)=>{const a=n(n({},e),t(e,s,i,o));return n(n({},a),{},{fields:r(a.fields,s,i,o)})}))})}))})}))}}s.PagesVisitor=t;class o{constructor(e){this.setRules(e)}containsField(e){return this._rules.some((s=>{const t=s.actions.some((({target:s})=>s===e)),r=s.conditions.some((s=>s.operands.some((({type:s,value:t})=>"field"===s&&t===e))));return t||r}))}containsFieldExpression(e){return this._rules.some((s=>s.actions.some((({action:s,expression:t})=>"calculate"===s&&t.includes(e)))))}dispose(){this._rules=null}mapActions(e){return this._rules.map((s=>n(n({},s),{},{actions:s.actions.map(e)})))}mapConditions(e){return this._rules.map((s=>n(n({},s),{},{conditions:s.conditions.map(e)})))}setRules(e){this._rules=[...e]}}s.RulesVisitor=o}}));
//# sourceMappingURL=visitors.es.js.map