1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[976],{22245(e,t,n){n.d(t,{A:()=>h});var r=n(67136),i=n(49555),a=n(58160),o=n(14041),c=n(74890);const s={Banner:"Banner2qY-Hhfqm_Gx",Banner_md:"Banner_md3gfmP6WvLxyy",Banner_sm:"Banner_smUPcJRlth4_Dl",Banner_xs:"Banner_xs1V3kPVsh40hS",Banner_secondary:"Banner_secondary1reFai47T0j4",Banner_secondary_muted:"Banner_secondary_mutedAK-AAp2XBnoH",Banner_primary:"Banner_primary2XsRmFJh0WNk",Banner_primary_muted:"Banner_primary_muted1IdQfSVDo4kz",Banner_warn:"Banner_warn2mXPeLXtaCnJ",Banner_warn_muted:"Banner_warn_muteduTbe5icPPf41",Banner_alert:"Banner_alert28druE7Pw9n0",Banner_alert_muted:"Banner_alert_muted1G8aihZRh0bM",Banner_success:"Banner_success1wdutZyaXdmT",Banner_success_muted:"Banner_success_muted1y2dhR2GsIxD",Banner_fixed:"Banner_fixeda1mFpjcc1TJ6",Banner_dismissible:"Banner_dismissible3EORPSrPvj-V","Banner-Dismiss":"Banner-Dismiss7HAnthajjRfa"};var l=n(31085),d=["children","className","dismissible","icon","isFixed","isMuted","kind","onDismiss","size","style"];function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){(0,r.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const h=function(e){var t=e.children,n=e.className,r=e.dismissible,u=void 0!==r&&r,h=e.icon,g=void 0===h?"icon-alert-circle":h,p=e.isFixed,f=void 0===p||p,y=e.isMuted,S=void 0!==y&&y,b=e.kind,M=void 0===b?"secondary":b,T=e.onDismiss,j=e.size,x=void 0===j?"sm":j,v=e.style,D=(0,a.A)(e,d),w=(0,o.useState)(!1),_=(0,i.A)(w,2),O=_[0],A=_[1],C=(0,o.useCallback)(function(){u&&(null==T||T(),A(!0))},[u,T]),B=(0,o.useCallback)(function(e){u&&"Enter"===e.key&&C()},[C,u]);return O?null:(0,l.jsxs)("div",m(m({},D),{},{className:(0,c.Ay)(n,s.Banner,s["Banner_".concat(M)],S&&s["Banner_".concat(M,"_muted")],s["Banner_".concat(x)],f&&s.Banner_fixed,u&&s.Banner_dismissible),style:v,children:[!!g&&(0,l.jsx)("i",{className:g}),t,!!u&&(0,l.jsx)("i",{"aria-label":"Dismiss",className:(0,c.Ay)(s["Banner-Dismiss"],"icon-x-circle"),onClick:C,onKeyPress:B,role:"button",tabIndex:0})]}))}},42088(e,t,n){n.r(t),n.d(t,{default:()=>F});var r=n(67136),i=n(86090),a=n(73894),o=n(64442),c=n(73289),s=n(9519),l=n(21484),d=n(32816),u=n(49555),m=n(92207),h=n.n(m),g=n(14041),p=n(34334),f=n(91378),y=n(20224),S=n(53117),b=n(96961),M=n(69627),T=n(43933);const j={"MigrationScheduler-content":"MigrationScheduler-contentcUoL14a_Te8S","MigrationScheduler-content-container":"MigrationScheduler-content-container6kt645Cyx3c2","MigrationScheduler-banner":"MigrationScheduler-banner2BJve6wW6A9c","MigrationScheduler-banner-content":"MigrationScheduler-banner-content3s5-MLVJdboX","MigrationScheduler-banner-text":"MigrationScheduler-banner-text2oJqcGYglZcn","MigrationScheduler-banner-spacer":"MigrationScheduler-banner-spacer9AmSPxgQ61pp","MigrationScheduler-banner-actions":"MigrationScheduler-banner-actions24Whr9ii1QQG","MigrationScheduler-banner_completed":"MigrationScheduler-banner_completed2nFT8urrlir2","MigrationScheduler-banner_scheduled":"MigrationScheduler-banner_scheduled38lfpyrGuQOK","MigrationScheduler-banner_noScheduled":"MigrationScheduler-banner_noScheduled1U5FEk3HkumM","MigrationScheduler-form-group":"MigrationScheduler-form-group33m89g89QsTX","MigrationScheduler-label":"MigrationScheduler-labellsqL-qae0CVH","MigrationScheduler-input":"MigrationScheduler-inputiHmO3tYjJnDs","MigrationScheduler-actions":"MigrationScheduler-actions2EVo9nDUjQTA","MigrationScheduler-modal-content":"MigrationScheduler-modal-content3zCh_NNVTTM4","MigrationScheduler-modal-title":"MigrationScheduler-modal-title3McufU2OmUBn","MigrationScheduler-modal-message":"MigrationScheduler-modal-messageteyZKMYlCc7x","MigrationScheduler-modal-actions":"MigrationScheduler-modal-actionsUP2B8VTBmo6B"};var x=n(31085);const v=function(e){var t=e.onClose,n=e.onConfirm,r=e.title,i=e.message,o=e.confirmText,c=e.cancelText,s=e.confirmKind,l=void 0===s?"primary":s,d=e.modalTarget,u=e.modalRef,m=(0,a.A)(j,"MigrationScheduler");return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T.Ay,{ref:u,className:m("-modal"),noDismiss:!0,size:"md",target:"#".concat(d),verticalCenter:!0,children:(0,x.jsxs)("div",{className:m("-modal-content"),children:[(0,x.jsx)("h2",{className:m("-modal-title"),children:r}),(0,x.jsx)("p",{className:m("-modal-message"),children:i}),(0,x.jsxs)("div",{className:m("-modal-actions"),children:[(0,x.jsx)(y.A,{kind:"secondary",onClick:t,children:c}),(0,x.jsx)(y.A,{kind:l,onClick:n,children:o})]})]})}),(0,x.jsx)("div",{className:"ModalWrapper",id:d})]})};
1var D=n(22245),w=n(91628),_="America/New_York",O=function(e){if(!e)return"";var t=e.split("T"),n=(0,u.A)(t,2),r=n[0],i=n[1],a=r.split("-").map(Number),o=(0,u.A)(a,3),c=o[0],s=o[1],l=o[2],d=i.split(":").map(Number),m=(0,u.A)(d,2),h=m[0],g=m[1];return new Date(new w.BB(c,s-1,l,h,g,0,0,_)).toISOString()},A=function(e){if(!e||!(e instanceof Date)||Number.isNaN(e.getTime()))return"";try{return e.toLocaleString("en-US",{timeZone:_,year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"})}catch(e){return"Invalid date"}};const C=function(e){var t=e.gitMigrationStatus,n=e.handleCancelClick,r=e.migrationStarted,i=e.scheduledMigrationAt,o=e.scheduledMigrationInitiatedBy,c=(0,a.A)(j,"MigrationScheduler"),s=function(e){var t=A(new Date(i)),r=o?"by ".concat(o):"";return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(S.A,{align:"center",className:c("-banner-content"),gap:"sm",justify:"between",children:(0,x.jsxs)("span",{className:c("-banner-text"),children:[(0,x.jsx)("b",{children:"Preview Mode"})," ",e?"migration was scheduled for":"migration scheduled for"," ",(0,x.jsx)("b",{children:t}),e?" but has not started. You can cancel the scheduled migration.":" ".concat(r)]})}),(0,x.jsx)("div",{className:c("-banner-spacer")}),(0,x.jsx)(S.A,{className:c("-banner-actions"),justify:"end",children:(0,x.jsx)(y.A,{kind:"secondary",onClick:n,size:"sm",children:"Cancel"})})]})};switch("migrated"===t?"migrated":function(){if(!i||r)return!1;var e=new Date(i).getTime()+6e4;return(new Date).getTime()>=e}()?"pastScheduled":i?"scheduled":"noScheduled"){case"migrated":return(0,x.jsx)(D.A,{className:c("-banner","-banner_completed"),kind:"warn",children:(0,x.jsxs)("span",{className:c("-banner-text"),children:["This project has already been migrated to Git. View the preview or revert to mongo to schedule another migration.",(0,x.jsx)("a",{href:"./settings",children:"Back to God Mode Settings"})]})});case"noScheduled":return(0,x.jsx)(D.A,{className:c("-banner","-banner_noScheduled"),icon:"icon-calendar",children:"No migration scheduled yet"});case"pastScheduled":return(0,x.jsx)(D.A,{className:c("-banner","-banner_pastScheduled"),icon:"icon-calendar",kind:"alert",children:s(!0)});case"scheduled":return(0,x.jsx)(D.A,{className:c("-banner","-banner_scheduled"),icon:"icon-calendar",kind:"primary",children:s(!1)});default:return null}};var B={update:{title:"Update Migration Schedule",confirmText:"Update",cancelText:"Keep Current",message:function(e){return"Are you sure you want to update the Preview Mode migration schedule to ".concat(e,"?")}},schedule:{title:"Schedule Migration",confirmText:"Schedule",cancelText:"No",message:function(e){return"Are you sure you want to schedule a Preview Mode migration at ".concat(e,"?")}},cancel:{title:"Cancel Migration",confirmText:"Cancel",cancelText:"Keep Schedule",message:"Are you sure you want to cancel the scheduled migration? This action cannot be undone."}},N=function(e,t,n){var r=B["update"===e?t?"update":"schedule":"cancel"],i=A(new Date(O(n)));return{cancelText:r.cancelText,confirmKind:"update"===e?"primary":"destructive",confirmText:r.confirmText,message:"function"==typeof r.message?r.message(i):r.message,title:r.title}};function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach(function(t){(0,r.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const k=function(e){var t=e.hasMigrationJobStarted,n=e.initialMigrationAt,r=e.initialMigrationInitiatedBy,o=e.mutateMigrationData,c=(0,a.A)(j,"MigrationScheduler"),s=(0,i.g)().subdomain,l=(0,g.useContext)(p.vz).project,m=n?new Date(n).toLocaleString("sv-SE",{timeZone:_}).replace(" ","T"):"",T=(0,g.useState)(function(){return m}),D=(0,u.A)(T,2),w=D[0],B=D[1],P=(0,g.useState)({updateButton:!1,cancelButton:!1}),k=(0,u.A)(P,2),Z=k[0],E=k[1],F=(0,g.useState)(!0),L=(0,u.A)(F,2),z=L[0],H=L[1],$=(0,g.useState)("update"),I=(0,u.A)($,2),J=I[0],G=I[1],K=(0,g.createRef)(),R=(0,g.useCallback)(function(){var e;
1return null===(e=K.current)||void 0===e?void 0:e.toggle()},[K]),V=c("confirmation-modal"),Y=(0,g.useCallback)((0,d.A)(h().mark(function e(){var t,r;return h().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(E(function(e){return U(U({},e),{},{updateButton:!0})}),R(),e.prev=2,t=O(w),n){e.next=9;break}return e.next=7,(0,f.A)("/".concat(s,"/api-next/v2/admin/sync_project"),{method:"POST",body:JSON.stringify({scheduledAt:t,type:"preview"})});case 7:e.next=11;break;case 9:return e.next=11,(0,f.A)("/".concat(s,"/api-next/v2/admin/scheduled_migration"),{method:"PUT",body:JSON.stringify({scheduledAt:t})});case 11:o({scheduledAt:t,migrationPreview:!0}),r="Preview Mode migration schedule ".concat(n?"updated":"created"," for ").concat(A(new Date(t)),"!"),(0,M.P0)((0,x.jsx)(M.Ay,{kind:"success",title:r})),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(2),(0,M.P0)((0,x.jsx)(M.Ay,{kind:"error",title:"Failed to update migration schedule"}));case 20:return e.prev=20,E(function(e){return U(U({},e),{},{updateButton:!1})}),e.finish(20);case 23:case"end":return e.stop()}},e,null,[[2,17,20,23]])})),[w,o,s,n,R]),Q=(0,g.useCallback)((0,d.A)(h().mark(function e(){return h().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return E(function(e){return U(U({},e),{},{cancelButton:!0})}),R(),e.prev=2,e.next=5,(0,f.A)("/".concat(s,"/api-next/v2/admin/scheduled_migration"),{method:"DELETE"});case 5:o({scheduledAt:void 0,migrationPreview:void 0}),B(""),(0,M.P0)((0,x.jsx)(M.Ay,{kind:"success",title:"Migration schedule cancelled"})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),(0,M.P0)((0,x.jsx)(M.Ay,{kind:"error",title:"Failed to cancel scheduled migration"}));case 13:return e.prev=13,E(function(e){return U(U({},e),{},{cancelButton:!1})}),e.finish(13);case 16:case"end":return e.stop()}},e,null,[[2,10,13,16]])})),[s,o,R]),X=(0,g.useCallback)(function(){G("update"),R()},[R]),W=(0,g.useCallback)(function(){G("cancel"),R()},[R]),q=(0,g.useCallback)(function(){R()},[R]);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(C,{gitMigrationStatus:l.gitMigrationStatus,handleCancelClick:W,migrationStarted:t,scheduledMigrationAt:n,scheduledMigrationInitiatedBy:r}),(0,x.jsxs)("div",{className:c("-content"),children:[(0,x.jsxs)("div",{className:c("-form-group"),children:[(0,x.jsx)("label",{className:c("-label"),htmlFor:"migration-date",children:"Select Date & Time (EST/EDT)"}),(0,x.jsx)(b.A,{className:c("-input"),disabled:"migrated"===l.gitMigrationStatus,id:"migration-date",min:(new Date).toLocaleString("sv-SE",{timeZone:_}).replace(" ","T").slice(0,16),onChange:function(e){B(e.target.value),H(e.target.validity.valid)},type:"datetime-local",value:w})]}),(0,x.jsx)(S.A,{className:c("-actions"),gap:"sm",justify:"end",children:(0,x.jsx)(y.A,{disabled:""===w||w===m||!z,loading:Z.updateButton,onClick:X,children:n?"Update Schedule":"Schedule"})})]}),(0,x.jsx)(v,U(U({},N(J,!!n,w)),{},{modalRef:K,modalTarget:V,onClose:q,onConfirm:"update"===J?Y:Q}))]})};function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){(0,r.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const F=function(){var e=(0,a.A)(j,"MigrationScheduler"),t=(0,i.g)().subdomain,n=(0,o.Hg)("/".concat(t,"/api-next/v2/admin/scheduled_migration"),{swr:{revalidateOnFocus:!0,shouldRetryOnError:!0}}),r=n.data,d=n.mutate;return n.isLoading?(0,x.jsx)(l.A,{}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s.A,{description:"Schedule your Preview migration to Git",icon:"icon-calendar",size:"lg",title:"Migration Scheduler"}),(0,x.jsx)(c.A,{className:e("-content-container"),size:"lg",children:(0,x.jsx)(k,{hasMigrationJobStarted:null!==(null==r?void 0:r.processedOn),initialMigrationAt:null==r?void 0:r.data.scheduledAt,initialMigrationInitiatedBy:null==r?void 0:r.data.initiatedBy,mutateMigrationData:function(e){r&&d(E(E({},r),{},{data:E(E({},r.data),e)}),!1)}})})]})}},91628(e,t,n){n.d(t,{BB:()=>m});Symbol.for("constructDateFrom");const r={},i={};function a(e,t){try{const n=(r[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return n in i?i[n]:c(n,n.split(":"))}catch{if(e in i)return i[e];const t=e?.match(o);return t?c(e,t.slice(1)):NaN}}const o=/([+-]\d\d):?(\d\d)?/;function c(e,t){const n=+(t[0]||0),r=+(t[1]||0),a=+(t[2]||0)/60;return i[e]=60*n+r>0?60*n+r+a:60*n-r-a}class s extends Date{constructor(...e){super(),e.length>1&&"string"==typeof e[e.length-1]&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(a(this.timeZone,this))?this.setTime(NaN):e.length?"number"==typeof e[0]&&(1===e.length||2===e.length&&"number"!=typeof e[1])?this.setTime(e[0]):"string"==typeof e[0]?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),u(this),d(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new s(...t,e):new s(Date.now(),e)}withTimeZone(e){return new s(+this,e)}getTimezoneOffset(){const e=-a(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),d(this),+this}[Symbol.for("constructDateFrom")](e){return new s(+new Date(e),this.timeZone)}}const l=/^(get|set)(?!UTC)/;function d(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(60*-a(e.timeZone,e)))}function u(e){const t=a(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const i=-new Date(+e).getTimezoneOffset(),o=i- -new Date(+r).getTimezoneOffset(),c=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&c&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);const l=new Date(+e);l.setUTCSeconds(0);const d=i>0?l.getSeconds():(l.getSeconds()-60)%60,u=Math.round(-60*a(e.timeZone,e))%60;(u||d)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+d));const m=a(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-h-s;if(h!==n&&g){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+g);const t=a(e.timeZone,e),n=h-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}
1Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!l.test(e))return;const t=e.replace(l,"$1UTC");s.prototype[t]&&(e.startsWith("get")?s.prototype[e]=function(){return this.internal[t]()}:(s.prototype[e]=function(){var e;return Date.prototype[t].apply(this.internal,arguments),e=this,Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),u(e),+this},s.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),d(this),+this}))});class m extends s{static tz(e,...t){return t.length?new m(...t,e):new m(Date.now(),e)}toISOString(){const[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,n,r]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${function(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset();return[e>0?"-":"+",String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),String(Math.abs(e)%60).padStart(2,"0")]}withTimeZone(e){return new m(+this,e)}[Symbol.for("constructDateFrom")](e){return new m(+new Date(e),this.timeZone)}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.