Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/hooks/useData",["module","exports","require","@frontend-taglib-clay$clayui/data-provider","frontend-js-web"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.useData=function({dataDefinitionId:e,dataLayoutId:t}){let a=themeDisplay.getPathContext();a&&"/"!==a||(a="");const{resource:r}=(0,n.useResource)({fetch:f({defaultData:p,id:e,parse:d}),fetchPolicy:"cache-first",fetchRetry:{attempts:0},link:"".concat(window.location.origin).concat(a,"/o/data-engine/v2.0/data-definitions/").concat(e)}),{resource:o}=(0,n.useResource)({fetch:f({defaultData:y,id:t,parse:u}),fetchPolicy:"cache-first",fetchRetry:{attempts:0},link:"".concat(window.location.origin).concat(a,"/o/data-engine/v2.0/data-layouts/").concat(t)});return{dataDefinition:r,dataLayout:o}};var n=a("@frontend-taglib-clay$clayui/data-provider"),r=a("frontend-js-web");function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function c(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e=(e,t)=>{const a=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){c(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},e);return t.forEach((e=>{delete a[e]})),a},u=t=>{const a=e(t,["dataRules","dataLayoutPages","description","name"]),{paginationMode:n}=a;return{dataLayout:o(a,["paginationMode"]),paginationMode:n}},d=t=>{const a=e(t,["defaultLanguageId","defaultDataLayout"]),{availableLanguageIds:n,description:r,name:i}=a;return{availableLanguageIds:n,dataDefinition:o(a,["availableLanguageIds","description","name"]),description:r,name:i}},s="0",l=404,f=({defaultData:e,id:t,parse:a})=>async(n,o)=>{if(t===s)return e;const i=await(0,r.fetch)(n,o);if(i.ok)return a(await i.json());if(i.status===l)return e;throw i},p={dataDefinition:{dataDefinitionFields:[]}},y={dataLayoutFields:{},dataLayoutPages:[],dataRules:[],paginationMode:"single-page"}}}));
//# sourceMappingURL=useData.js.map