DeveloperInstantGamesVideoUploadCard.react",["fbt","ix","AsyncRequest","DeveloperInstantGamesSaveSpinnerOverlay.react","DeveloperInstantGamesVideoUploadCard_DeleteMutation.graphql","GeoButton.react","GeoCancelButton.react","GeoCardFooter.react","GeoFileSelector.react","GeoHStack.react","GeoIcon.react","GeoImageTile.react","GeoImageTileGroup.react","GeoModalFooter.react","GeoModalHeader.react","GeoModal_DEPRECATED.react","GeoPillWithPopover.react","GeoProgressBar.react","GeoSection.react","GeoText.react","GeoTooltip.react","GeoVStack.react","Image.react","Promise","RelayHooks","VideoUploadFile","VideoUploader","asyncToGeneratorRuntime","err","fbicon","lodash","react"],(function(t,n,r,o,a,i,l,s,u){"use strict";var e,c,d,m=d||(d=o("react")),p=d,_=p.useRef,f=p.useState;function g(e){var t={APP_GAMEPLAY_VIDEO_PORTRAIT:{ratio:.5625,description:"9:16"},APP_PROMO_VIDEO_PORTRAIT:{ratio:.5625,description:"9:16"},APP_GAMEPLAY_VIDEO_LANDSCAPE:{ratio:1.7777777777777777,description:"16:9"},APP_PROMO_VIDEO_LANDSCAPE:{ratio:1.7777777777777777,description:"16:9"},APP_GAMEPLAY_VIDEO_SQUARE:{ratio:1,description:"1:1"},APP_PROMO_VIDEO_SQUARE:{ratio:1,description:"1:1"}};return t[e]||null}var h=e!==void 0?e:e=n("DeveloperInstantGamesVideoUploadCard_DeleteMutation.graphql");function y(e){var t=e._isDisabled,a=t===void 0?!1:t,l=e._name,d=e.appId,p=e.isFallback,y=p===void 0?!1:p,C=e.isPrimaryLocale,b=e.isRequired,v=b===void 0?!1:b,S=e.locale,R=e.onUploadSuccess,L=e.orientation,E=e.sourceType,k=e.title,I=e.videoThumbnailUrl,T=e.videoUrl,D=f(!1),x=D[0],$=D[1],P=f(!1),N=P[0],M=P[1],w=f([]),A=w[0],F=w[1],O=f(null),B=O[0],W=O[1],q=f(!1),U=q[0],V=q[1],H=f(0),G=H[0],z=H[1],j=f(!1),K=j[0],Q=j[1],X=f(null),Y=X[0],J=X[1],Z=f(!1),ee=Z[0],te=Z[1],ne=f(!1),re=ne[0],oe=ne[1],ae=f(!1),ie=ae[0],le=ae[1],se=f(!1),ue=se[0],ce=se[1],de=f(null),me=de[0],pe=de[1],_e=f(!1),fe=_e[0],ge=_e[1],he=_(null),ye=I,Ce=T,be=o("RelayHooks").useMutation(h),ve=be[0],Se=f(!1),Re=Se[0],Le=Se[1],Ee=function(){le(!1),ce(!1),pe(null),ve({variables:{input:{app_id:parseInt(d,10),locale:S,source:String(E==null?void 0:E.toLowerCase())}},onCompleted:function(t){var e=t.xfb_instant_games_video_delete;if(Le(!1),!e)ce(!0),pe("The response was null");else if(e.success===!0)le(!0),window.setTimeout(function(){Te(),R()},1500);else if(e.error!==null){var n=e.error;ce(!0),pe(n!=null?n:"Unknown error occurred the request was not successful")}else ce(!0),pe("Unknown error has occurred. The request was not successful")},onError:function(t){ce(!0),pe(t.message)}})},ke=function(t,r){return new(c||(c=n("Promise")))(function(e){var n=document.createElement("video"),o=URL.createObjectURL(t);n.onloadedmetadata=function(){var t=n.videoWidth,a=n.videoHeight,i=t/a;URL.revokeObjectURL(o);var l=g(r);if(l==null){e({isValid:!1,error:"Unknown video type for validation"});return}var s=.01,u=Math.abs(i-l.ratio)0){V(!0);var t=r("lodash").first(e);try{if(E==null||E===""){W("Video type is required for validation");return}var n=yield ke(t,E);n.isValid||W(n.error)}catch(e){W("Error validating video file")}finally{V(!1)}}});return function(n){return e.apply(this,arguments)}})(),Te=function(){ge(!1),le(!1),ce(!1),pe(null),Le(!1)},De=function(){he.current&&(he.current.cancel(),he.current=null),M(!1),F([]),W(null),J(null),z(0),Q(!1),te(!1),oe(!1),Q(!1)},xe=function(){return new(c||(c=n("Promise")))(function(e,t){var n={app_id:String(d),app_locale:S,source:String(E==null?void 0:E.toLowerCase()),preview_id:"video_upload",target:"instant_games"},o=window.location.hostname,a=o.replace("developers","upload"),i="https://"+a+"/ajax/apps/video/upload/info/",l=new(r("AsyncRequest"))().setAllowCrossOrigin(!0).setURI(i).setMethod("POST").setData(n).setReadOnly(!1).setHandler(function(t){e(t.getPayload())}).setErrorHandler(function(e){t(e)});l.send()})},$e=(function(){var e=n("asyncToGeneratorRuntime").asyncToGenerator(function*(){if(A.length!==0){var e=r("lodash").first(A);Q(!0),J(null),z(0);try{var t=yield xe();if(!t)throw r("err")("Failed to get upload configuration from server");var n=new(r("VideoUploader"))(t);he.current=n,n.subscribe("upload-finished",function(t,r){z(90),n.post(babelHelpers.extends({},r,{title:e.name,place_name:S}))}),n.subscribe("upload-failed",function(e,t){Q(!1),oe(!0),J("Upload failed! Please try again"),he.current=null}),n.subscribe("post-finished",function(e,t){z(99),window.setTimeout(function(){z(100),Q(!1),te(!0),window.setTimeout(function(){R(),De()},1500)},3e3),he.current=null}),n.subscribe("post-failed",function(e,t){Q(!1),J(String(t)||"Failed to start upload"),oe(!0),he.current=null});var o=r("VideoUploadFile").fromFile(e);z(10),n.upload(o)}catch(e){Q(!1),J(String(e)||"Failed to start upload"),he.current=null}}});return function(){return e.apply(this,arguments)}})(),Pe=A.length===0||B!=null||U,Ne=function(){Ce!=null&&Ce!==""?$(!0):I!==null&&R()},Me=ye!=null&&ye!==""?m.jsx(r("Image.react"),{src:ye}):m.jsx(r("GeoIcon.react"),{icon:o("fbicon")._(u("567274"),16)}),we=E!=null?g(E):null,Ae=we!=null?we.description:null,Fe=Ae!=null?s._(/*BTDS*/"Upload {title} ({aspectRatio})",[s._param("title",k),s._param("aspectRatio",Ae)]):s._(/*BTDS*/"Upload {title}",[s._param("title",k)]),Oe=Ae!=null?s._(/*BTDS*/"You can upload an MP4, MOV, or AVI file. The aspect ratio must be {aspectRatio}. File size limit 50 MB.",[s._param("aspectRatio",Ae)]):s._(/*BTDS*/"Select a video file (MP4, MOV, or AVI). Maximum file size: 50MB.");return m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"relative"},children:m.jsx(r("GeoImageTileGroup.react"),{ratio:L,size:144,children:m.jsx(r("GeoImageTile.react"),{content:m.jsxs(r("GeoVStack.react"),{children:[y&&ye!==null&&ye!==""&&m.jsx(r("GeoPillWithPopover.react"),{hasIcon:!0,label:"",status:"warning",tooltip:s._(/*BTDS*/"This is a placeholder video from your primary locale, shown when no locale-specific video is available."),value:s._(/*BTDS*/"Default Video")}),!y&&v&&C&&(ye===null||ye==="")?m.jsx("div",{style:{width:"100%"},children:m.jsx(r("GeoPillWithPopover.react"),{hasIcon:!0,label:"",status:"error",tooltip:s._(/*BTDS*/"This version of the preview video is required for your game. Please upload a video."),value:s._(/*BTDS*/"Required Video")})}):null,m.jsxs(r("GeoHStack.react"),{children:[m.jsx(r("GeoButton.react"),{grow:"fill",label:ye!=null&&ye!==""?s._(/*BTDS*/"Edit"):s._(/*BTDS*/"Upload Video"),onClick:function(){return M(!0)}}),ye!=null&&ye!==""?m.jsx(r("GeoButton.react"),{icon:o("fbicon")._(u("483828"),16),isDisabled:y,label:"",onClick:function(){ge(!0)},tooltip:y?m.jsx(r("GeoTooltip.react"),{content:s._(/*BTDS*/"Switch to the primary locale to delete this video.")}):void 0}):null]})]}),description:Ae!=null?s._(/*BTDS*/"{aspectRatio}",[s._param("aspectRatio",Ae)]):void 0,heading:s._(/*BTDS*/"{title}",[s._param("title",k)]),isBordered:!1,isHeaderHidden:!1,media:Me,onPress:Ne})})}),m.jsx(r("GeoModal_DEPRECATED.react"),{footer:m.jsx(r("GeoCardFooter.react"),{}),header:m.jsx(r("GeoModalHeader.react"),{heading:Ae!=null?s._(/*BTDS*/"{title} ({aspectRatio})",[s._param("title",k),s._param("aspectRatio",Ae)]):s._(/*BTDS*/"{title}",[s._param("title",k)])}),isShown:x,onHide:function(){return $(!1)},children:Ce!=null&&Ce!==""&&m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"70vh",padding:"0"},children:m.jsx("video",{controls:!0,src:Ce,style:{width:"100%",height:"100%",objectFit:"contain"}})})}),m.jsx(r("GeoModal_DEPRECATED.react"),{footer:m.jsx(r("GeoModalFooter.react"),{primaryButton:m.jsx(r("GeoButton.react"),{isDisabled:Pe||K||ee,label:s._(/*BTDS*/"Upload"),onClick:$e}),secondaryButton:m.jsx(r("GeoCancelButton.react"),{isDisabled:K,onClick:De}),startContent:K?m.jsxs("div",{children:[m.jsx(r("GeoText.react"),{textAlign:"center",children:s._(/*BTDS*/"Uploading... {progress}u0025",[s._param("progress",Math.round(G))])}),m.jsx(r("GeoProgressBar.react"),{progress:G,status:"loading",loggingName:i.id})]}):s._(/*BTDS*/"By uploading this file, you certify that you have the right to distribute this video and that it is not pornographic.")}),header:m.jsx(r("GeoModalHeader.react"),{heading:Fe}),isShown:N,onHide:De,children:m.jsxs(r("GeoSection.react"),{children:[m.jsx(r("GeoFileSelector.react"),{allowMultiple:!1,description:Oe,errorMessage:B!=null?B:void 0,fileTypes:["video/mp4","video/mov","video/avi"],label:s._(/*BTDS*/"Choose Video File"),maxFileSize:50*1024*1024,onChange:Ie,value:A,warningMessage:U?s._(/*BTDS*/"Validating video dimensions..."):null}),m.jsx(r("DeveloperInstantGamesSaveSpinnerOverlay.react"),{borderRadius:8,bottomMargin:0,errorMessage:Y,saveError:re,saveSuccess:ee,savedMessage:s._(/*BTDS*/"Video uploaded successfully!"),saving:K})]})}),m.jsx(r("GeoModal_DEPRECATED.react"),{footer:m.jsx(r("GeoModalFooter.react"),{primaryButton:m.jsx(r("GeoButton.react"),{isDisabled:Re||ie,label:s._(/*BTDS*/"Delete"),onClick:function(){Le(!0),Ee()}}),secondaryButton:m.jsx(r("GeoCancelButton.react"),{isDisabled:Re||ie,onClick:function(){return Te}})}),header:m.jsx(r("GeoModalHeader.react"),{heading:s._(/*BTDS*/"Confirm {title} Deletion",[s._param("title",k)])}),isShown:fe,onHide:Te,children:m.jsxs(r("GeoSection.react"),{children:[m.jsx(r("GeoText.react"),{children:s._(/*BTDS*/"Are you sure you want to delete this video? This action cannot be undone.")}),m.jsx(r("DeveloperInstantGamesSaveSpinnerOverlay.react"),{borderRadius:8,bottomMargin:0,errorMessage:me,saveError:ue,saveSuccess:ie,savedMessage:s._(/*BTDS*/"Video deleted successfully"),saving:Re})]})})]})}y.displayName=y.name+" [from "+i.id+"]",l.default=y}),226);
-----
DeveloperInstantGamesVideoUploadCard_DeleteMutation.graphql",["DeveloperInstantGamesVideoUploadCard_DeleteMutation_facebookRelayOperation"],(function(t,n,r,o,a,i){"use strict";var e=(function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],t=[{alias:null,args:[{kind:"Variable",name:"data",variableName:"input"}],concreteType:"XFBInstantGamesVideoDeleteResponsePayload",kind:"LinkedField",name:"xfb_instant_games_video_delete",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"success",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"DeveloperInstantGamesVideoUploadCard_DeleteMutation",selections:t,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"DeveloperInstantGamesVideoUploadCard_DeleteMutation",selections:t},params:{id:n("DeveloperInstantGamesVideoUploadCard_DeleteMutation_facebookRelayOperation"),metadata:{},name:"DeveloperInstantGamesVideoUploadCard_DeleteMutation",operationKind:"mutation",text:null}}})();a.exports=e}),null);
-----
DeveloperInstantGamesVideoUploadCard_DeleteMutation_facebookRelayOperation",[],(function(t,n,r,o,a,i){a.exports="24110192128653219"}),null);
-----