import{__assign as n}from"./node_modules/tslib/tslib.es6.js";import{SupportedLanguages as r}from"./components/Bloc/BlocTypes.js";function e(e,t,o){return{propsGenerator:function(r,i,c){c=c.replace(/_/g,"-"),r||(r=e);var a=n({},i);return a=t.reduce((function(e,t){var a,s,l="object"==typeof r[t]?r[t]:{};if(l instanceof Array){var u=i[t]||[];return e[t]=u.map((function(r){var e=o.map((function(n,e){return{value:r[n],key:n,existing:l[e]&&l[e][n]instanceof Object?l[e][n]:{}}})).filter((function(n){return n.value})).reduce((function(r,e){var t;return r[e.key]=n(n({},e.existing),((t={})[c]=e.value,t)),r}),{});return n(n({},r),e)})),e}var f=Object.assign({},l,((a={})[c]=i[t],a));return n(n({},e),((s={})[t]=f,s))}),a)},propsParser:function(e,i,c){void 0===e&&(e={}),void 0===i&&(i={});var a={};null==i&&(i={}),t.forEach((function(t){var s,l=e[t]||"",u=i&&i[t]?i[t]:"";if(l instanceof Array||u instanceof Array){l instanceof Array||(l=[]),u instanceof Array||(u=[]);var f=l.length>=u.length?r.English:r.Thai,h=f===r.English?r.Thai:r.English,g=f===r.English?l:u,v=h===r.English?l:u;try{a[t]=g.map((function(r,e){var t=o.map((function(n){var t,o;return(t={})[n]=((o={})[f]=r[n]||"",o[h]=v[e]?v[e][n]:"",o),t})).reduce((function(r,e){return n(n({},r),e)}),{});return n(n({},r),t)}))}catch(n){console.log(g),console.log(v),console.log(c)}}else l instanceof Object||u instanceof Object?o.forEach((function(n){var e,o,i;a[t]?a[t][n]=((e={})[r.English]=l[n]||"",e[r.Thai]=u[n]||"",e):a[t]=((o={})[n]=((i={})[r.English]=l[n]||"",i[r.Thai]=u[n]||"",i),o)})):a[t]=((s={})[r.English]=l||"",s[r.Thai]=u||"",s)}));try{return Object.keys(i).forEach((function(n){if(i[n]&&!e[n])throw"Property "+n+" in english is missing for bloc: "+c})),n(n(n({},i),e),a)}catch(r){return console.warn(r),console.warn("hence thai will take precedence over english"),n(n(n({},e),i),a)}}}}export{e as PropsGeneratorForGivenComponent};
//# sourceMappingURL=prop-utils.js.map
