useOCDevManageWorldsInventoryDownloadCreatableAssets",["fbt","$InternalEnum","GeoToast.react","OCDevManageWorldsInventoryCreationFlowUtils","Promise","RelayHooks","asyncToGeneratorRuntime","jszip","react","useGeoToaster","useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery.graphql"],(function(t,n,r,o,a,i,l,s){"use strict";var e,u,c,d=c||(c=o("react")),m=c.useRef,p=e!==void 0?e:e=n("useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery.graphql"),_=n("$InternalEnum").Mirrored(["TEXTURE","USDZ"]),f=Array.from(_.members()).reduce(function(e,t){return e[t]=!0,e},{});function g(){var e=o("RelayHooks").useRelayEnvironment(),t=r("useGeoToaster")(),a=m(null),i=function(n,r){return a.current!=null&&t.remove(a.current),a.current=t.add(n,r),a.current},l=function(){a.current!=null&&t.remove(a.current),a.current=null};return(function(){var t=n("asyncToGeneratorRuntime").asyncToGenerator(function*(t,a){if(a===void 0&&(a=f),Object.values(a).every(function(e){return!e})){i(d.jsx(r("GeoToast.react"),{description:s._(/*BTDS*/"Please select at least one asset to download"),heading:s._(/*BTDS*/"No assets selected for download"),status:"error"}),{duration:"standard"});return}try{var c,m,g;i(d.jsx(r("GeoToast.react"),{heading:s._(/*BTDS*/"Downloading..."),status:"indeterminate"}),{duration:"sticky"});var h=yield o("RelayHooks").fetchQuery(e,p,{creatable_id:t,include_texture:(c=a[_.TEXTURE])!=null?c:!1,include_usdz:(m=a[_.USDZ])!=null?m:!1}).toPromise(),y=h==null?void 0:h.xfb_digigoods_creatable_info;if(y==null)return;var C=[].concat(((g=y.original_retexturing_texture_list)!=null?g:[]).map(function(e,t){return["texture"+t+".png",e]}),[y.usdz_source_uri!=null?["model.usdz",y.usdz_source_uri]:null]).filter(Boolean),b=C.map(function(e){var t=e[0],r=e[1];return window.fetch(r).then((function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(e){return[t,yield e.blob()]});return function(t){return e.apply(this,arguments)}})())}),v=yield(u||(u=n("Promise"))).all(b);if(v.length===1){var S=v[0],R=S[0],L=S[1];o("OCDevManageWorldsInventoryCreationFlowUtils").saveFile(L,R)}else{var E=new(r("jszip"));v.forEach(function(e){var t=e[0],n=e[1];E.file(t,n,{binary:!0})});var k=yield E.generateAsync({type:"blob"}),I=y.digigoods_name!=null?y.digigoods_name+".zip":"download.zip";o("OCDevManageWorldsInventoryCreationFlowUtils").saveFile(k,I)}l()}catch(e){throw i(d.jsx(r("GeoToast.react"),{description:s._(/*BTDS*/"Unable to download selected assets"),heading:s._(/*BTDS*/"Download failed"),status:"error"}),{duration:"sticky"}),e}});return function(e,n){return t.apply(this,arguments)}})()}function h(e){return Object.keys(e).filter(function(t){var n=_.cast(t);return n==null?!1:e[n]===!0})}l.DownloadableAssetType=_,l.DEFAULT_ASSETS_TO_DOWNLOAD=f,l.useOCDevManageWorldsInventoryDownloadCreatableAssets=g,l.getFileTypesSelected=h}),226);
-----
useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery.graphql",[],(function(t,n,r,o,a,i){"use strict";var e=(function(){var e={defaultValue:null,kind:"LocalArgument",name:"creatable_id"},t={defaultValue:!1,kind:"LocalArgument",name:"include_texture"},n={defaultValue:!1,kind:"LocalArgument",name:"include_usdz"},r=[{kind:"Variable",name:"creatable_id",variableName:"creatable_id"}],o={alias:null,args:null,kind:"ScalarField",name:"digigoods_name",storageKey:null},a={condition:"include_usdz",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"usdz_source_uri",storageKey:null}]},i={condition:"include_texture",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"original_retexturing_texture_list",storageKey:null}]};return{fragment:{argumentDefinitions:[e,t,n],kind:"Fragment",metadata:{throwOnFieldError:!0},name:"useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery",selections:[{alias:null,args:r,concreteType:"XFBDigiGoodsCreatableResponseObject",kind:"LinkedField",name:"xfb_digigoods_creatable_info",plural:!1,selections:[o,a,i],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[e,n,t],kind:"Operation",name:"useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery",selections:[{alias:null,args:r,concreteType:"XFBDigiGoodsCreatableResponseObject",kind:"LinkedField",name:"xfb_digigoods_creatable_info",plural:!1,selections:[o,a,i,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{id:"25111424875185022",metadata:{},name:"useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery",operationKind:"query",text:null}}})();a.exports=e}),null);
-----
-----
useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery.graphql",[],(function(t,n,r,o,a,i){"use strict";var e=(function(){var e={defaultValue:null,kind:"LocalArgument",name:"creatable_id"},t={defaultValue:!1,kind:"LocalArgument",name:"include_texture"},n={defaultValue:!1,kind:"LocalArgument",name:"include_usdz"},r=[{kind:"Variable",name:"creatable_id",variableName:"creatable_id"}],o={alias:null,args:null,kind:"ScalarField",name:"digigoods_name",storageKey:null},a={condition:"include_usdz",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"usdz_source_uri",storageKey:null}]},i={condition:"include_texture",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"original_retexturing_texture_list",storageKey:null}]};return{fragment:{argumentDefinitions:[e,t,n],kind:"Fragment",metadata:{throwOnFieldError:!0},name:"useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery",selections:[{alias:null,args:r,concreteType:"XFBDigiGoodsCreatableResponseObject",kind:"LinkedField",name:"xfb_digigoods_creatable_info",plural:!1,selections:[o,a,i],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[e,n,t],kind:"Operation",name:"useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery",selections:[{alias:null,args:r,concreteType:"XFBDigiGoodsCreatableResponseObject",kind:"LinkedField",name:"xfb_digigoods_creatable_info",plural:!1,selections:[o,a,i,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{id:"25111424875185022",metadata:{},name:"useOCDevManageWorldsInventoryDownloadCreatableAssetsQuery",operationKind:"query",text:null}}})();a.exports=e}),null);
-----