import r from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import{useState as n,useEffect as s}from"react";import{getAsset as o}from"../clients/jsonApi/index.js";function i(r){return a.apply(this,arguments)}function a(){return(a=e(t.mark((function r(e){var n,s,i;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,o(e,{fields:["asset.custom_properties"]});case 3:return i=r.sent,r.abrupt("return",(null===(n=i.data.attributes)||void 0===n||null===(s=n.custom_properties)||void 0===s?void 0:s.is_asset_viewer)||!1);case 7:return r.prev=7,r.t0=r.catch(0),console.error(r.t0),r.abrupt("return",!1);case 11:case"end":return r.stop()}}),r,null,[[0,7]])})))).apply(this,arguments)}var u=function(o){var a=o.well,u=o.wells,c=n(null),p=r(c,2),l=p[0],f=p[1];return s((function(){function r(){return r=e(t.mark((function r(){var e;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.t0=f,!a){r.next=7;break}return r.next=4,i(a.asset_id);case 4:r.t1=r.sent,r.next=8;break;case 7:r.t1=null!==(e=null==u?void 0:u.some((function(r){var e;return null===(e=r.custom_properties)||void 0===e?void 0:e.is_asset_viewer})))&&void 0!==e&&e;case 8:r.t2=r.t1,(0,r.t0)(r.t2);case 10:case"end":return r.stop()}}),r)}))),r.apply(this,arguments)}!function(){r.apply(this,arguments)}()}),[a,u]),l};export{u as default};
//# sourceMappingURL=useIsAssetViewer.js.map
