1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9218],{39218:function(e,t,n){n.r(t),n.d(t,{default:function(){return Ne}});var i,a,o=n(16835),r=n(50029),l=n(59499),s=n(87794),c=n.n(s),d=n(67294),u=n(19521),p=n(72587),v=(0,u.iv)(["background-color:#050607;position:fixed;width:auto;height:auto;top:5px;right:15px;z-index:210;border:1px solid black;border-radius:1em;box-shadow:5px 5px 5px #666;opacity:0.95;padding:0.5em;box-sizing:border-box;transition:width ease 0.3s;width:180px;&.is-collapsed{width:43px;.form-control > div,.nva-instant-preview__deploy-wrapper,.nva-instant-preview__login{display:none;}}.form-control{margin:0 auto;font-family:sans-serif;font-size:12pt;display:flex;box-sizing:border-box;flex-direction:column;}.nva-instant-preview__label-wrapper,.nva-instant-preview__controls-wrapper{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:8px;label{font-size:0.9em;color:#9b9b9c;font-weight:bold;white-space:nowrap;}}input{width:55px;}button{background:transparent;border:1px solid #9b9b9c;border-radius:5px;color:white;padding:5px 8px;font-size:0.9em;display:flex;align-items:center;height:34px;width:150px;justify-content:space-between;&:hover{cursor:pointer;}&.submit{width:115px;}&.edit{width:100px;}.image-container{position:static;width:auto;height:auto;}}.nva-instant-preview__env{margin:0 auto 0 0;color:#18c964;font-size:1.25rem;}.nva-instant-preview__login{display:flex;gap:8px;align-items:center;justify-content:end;margin:16px 25px 0 auto;p{color:#fff;margin:0;}button{gap:8px;width:auto;}}.nva-instant-preview__deploy-buttons-wrapper{display:flex;gap:8px;}.nva-instant-preview__deploy-button-group{position:relative;display:flex;> button:first-of-type{border-top-right-radius:0;border-bottom-right-radius:0;}> button:last-of-type{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none;}dialog{top:100%;left:unset;right:0;margin:0;padding:16px;border:1px solid #9b9b9c;border-radius:5px;box-sizing:border-box;> div{display:flex;justify-content:end;gap:8px;}p{font-size:var(--g-font-size-caption);line-height:var(--g-line-height-caption);text-align:right;color:hsl(var(--g-color-error));margin:0 0 8px;}}}.nva-instant-preview-v2__deploy-button-group{position:relative;display:flex;button:nth-last-child(n + 2):first-of-type{border-top-right-radius:0;border-bottom-right-radius:0;}button:nth-last-child(n + 2):last-of-type{border-top-left-radius:0;border-bottom-left-radius:0;border-left:none;}dialog{top:100%;left:unset;right:0;margin:0;padding:16px;border:1px solid #9b9b9c;border-radius:5px;box-sizing:border-box;> div{display:flex;justify-content:end;gap:8px;}p{font-size:var(--g-font-size-caption);line-height:var(--g-line-height-caption);text-align:right;color:hsl(var(--g-color-error));margin:0 0 8px;}}}.nva-instant-preview__deploy-buttons{display:flex;align-items:end;flex-direction:column;button{position:relative;gap:8px;width:auto;}}.nva-instant-preview__button{&.is-loading{pointer-events:none;color:transparent;&::after{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:14px;height:14px;border-radius:50%;border:2px solid #fff;border-color:#fff transparent #fff transparent;animation:turn 1.2s linear infinite;}@keyframes turn{0%{transform:translate(-50%,-50%) rotate(0deg);}100%{transform:translate(-50%,-50%) rotate(360deg);}}img{opacity:0;}}&.has-error{border-color:hsl(var(--g-color-error));color:hsl(var(--g-color-error));img{opacity:0;}picture{position:relative;display:block;&::after{content:'';display:block;width:14px;height:14px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:url(/svg/error.svg) no-repeat center;}}}&:disabled{opacity:0.5;pointer-events:none;}}.nva-instant-preview__button--dark{color:#050607;border:1px solid #050607;&.is-loading::after{border-color:#050607 transparent #050607 transparent;}}.nva-instant-preview__button--text{color:#050607;border:none;}.nva-instant-preview__deploy-datetime{width:180px;padding:7px 8px;border-radius:5px;border:1px solid #9b9b9c;margin-bottom:8px;box-sizing:border-box;}.nva-instant-preview__deploy-datetime-picker > div{pointer-events:none;}.nva-instant-preview__deploy-link{color:#35b0fd;display:flex;align-items:center;gap:4px;div{width:fit-content;}}.nva-instant-preview__deploy-wrapper{display:flex;flex-direction:column;align-items:center;}.nva-instant-preview__deploy-status{font-size:var(--g-font-size-caption);line-height:var(--g-line-height-caption);color:hsl(var(--g-color-success-300));margin:0;&.is-error{color:hsl(var(--g-color-error));}}@media (max-width:","){.nva-instant-preview__deploy-wrapper,.nva-instant-preview__login{display:none;}}@media (min-width:","){width:auto;.form-control{flex-direction:row;}.nva-instant-preview__label-wrapper,.nva-instant-preview__controls-wrapper{flex-direction:row;label{font-size:0.9em;color:#9b9b9c;font-weight:bold;}}.nva-instant-preview__info{color:white;width:100%;table{border-collapse:collapse;width:100%;}thead tr,tr:not(:last-child){border-bottom:1px solid #9b9b9c;}th,td{padding:4px;width:33.33%;vertical-align:top;}th{font-weight:700;text-align:left;}td ul{padding:0;}td li{display:flex;align-items:center;justify-content:space-between;width:100%;margin-bottom:4px;&:last-child{margin-bottom:0;}}button{border:none;padding:0;width:fit-content;height:fit-content;}}.nva-instant-preview__deploy-wrapper{display:flex;align-items:end;gap:16px;}.nva-instant-preview__deploy{display:flex;align-items:center;justify-content:flex-end;
1gap:16px;margin-top:16px;width:100%;}}"],p.dr.md,p.j$.md),g=u.ZP.div.withConfig({componentId:"sc-12tyh7p-0"})(["width:100vw;height:100vh;position:fixed;top:0;left:0;z-index:300;background:rgba(0,0,0,0.90);display:flex;justify-content:center;align-items:center;.lds-dual-ring{display:inline-block;width:80px;height:80px;&:after{content:' ';display:block;width:64px;height:64px;border-radius:50%;border:6px solid #fff;border-color:#fff transparent #fff transparent;animation:lds-dual-ring 1.2s linear infinite;}}@keyframes lds-dual-ring{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}"]),f=u.ZP.div.withConfig({componentId:"sc-12tyh7p-1"})(["border-bottom:1px solid #9b9b9c;margin:10px 0;height:0;width:100%;@media (min-width:","){border-bottom:none;border-right:1px solid #9b9b9c;display:inline;margin:0 10px;height:100%;width:0;}"],p.ZP.mobile),h=u.ZP.span.withConfig({componentId:"sc-12tyh7p-2"})(["background:transparent;border:1px solid #9b9b9c;display:inline-block;height:34px;border-radius:5px;padding:0;align-items:center;display:flex;box-sizing:border-box;& > span{color:#9b9b9c;font-size:0.9em;}& > input{background:transparent;font-size:1em;border:none;text-align:right;color:white;&:focus{outline:none;}}"]),b=u.ZP.button.withConfig({componentId:"sc-12tyh7p-3"})(["&&{border:none;margin:0;padding:0;width:auto;display:flex;justify-content:center;align-items:center;}"]),_=n(64106),m=n(11163),w="ISR_SITE",S=(i={REVALIDATE_PATH:"REVALIDATE_PATH",SYNC_APP:"SYNC_APP",PUBLISHING:"PUBLISHING",STAGING:"STAGING"},(0,l.Z)(i,"PUBLISHING","PUBLISHING"),(0,l.Z)(i,"PUBLISHING_SCHEDULED","PUBLISHING_SCHEDULED"),(0,l.Z)(i,"CREATE_STAGE","CREATE_STAGE"),i),y=(a={},(0,l.Z)(a,S.REVALIDATE_PATH,"revalidate"),(0,l.Z)(a,S.SYNC_APP,"sync"),(0,l.Z)(a,S.PUBLISHING,"publishing"),(0,l.Z)(a,S.STAGING,"staging"),(0,l.Z)(a,S.CREATE_STAGE,"createStage"),a),I={revalidate:"",sync:"",publishing:"",staging:"",createStage:""},E="",P="is-loading",N="has-error",x="STAGE",T="WIP",A="LOCKED",C=n(85854),O=n(84806),R=n(30882),L=n(34155);function k(){var e,t;return null===(e=window)||void 0===e||null===(t=e.location)||void 0===t?void 0:t.pathname.replace(/:\d*/,"").replace("//","/")}var U="America/Los_Angeles",D=new Intl.DateTimeFormat("en-US",{timeZone:U,timeZoneName:"shortGeneric",hour:"numeric",minute:"numeric",year:"numeric",month:"numeric",day:"numeric",hour12:!1});function j(e){var t=new Date(e);return D.format(t)}function H(e){var t=new Date(e.toLocaleString("en-US",{timeZone:U})),n=e.getTime()-t.getTime();return new Date(e.getTime()-n)}function V(){return(V=(0,r.Z)(c().mark((function e(t){var i,a,o,r,l,s,d,u,p,v,g,f,h,b,_,m;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.action,a=t.getSiteId,o=t.schedule,r=t.actions,l=t.getUserEmail,s=t.onSuccess,d=t.onFail,u=r.dispatchStateClasses,p=r.setMessage,v=r.setError,u({type:i,payload:P}),e.next=5,n.e(2856).then(n.bind(n,52856));case 5:return g=e.sent.default,f={siteId:a(),userEmail:l(),process:i,platform:"INSTANT_PREVIEW",triggeredAt:o},i===S.REVALIDATE_PATH&&(f.path=null===(h=window)||void 0===h||null===(b=h.location)||void 0===b?void 0:b.pathname.replace(/:\d*/,"").replace("//","/")),e.prev=8,e.next=11,g({url:"".concat(L.env.NEXT_PUBLIC_ORCHESTRATOR_API_URL,"/orchestrator"),method:"post",headers:{"Content-Type":"application/json","Ocp-Apim-Subscription-Key":L.env.NEXT_PUBLIC_ORCHESTRATOR_API_KEY},data:f});case 11:return _=e.sent,p(_.data.message),u({type:i,payload:E}),s&&s({action:i,payload:f,data:_.data}),e.abrupt("return",_);case 18:return e.prev=18,e.t0=e.catch(8),console.error("Error while applying ".concat(i," action"),e.t0),v(!0),p((null===(m=e.t0.response)||void 0===m?void 0:m.data.message)||e.t0.message),u({type:i,payload:N}),d&&d({action:i}),e.abrupt("return",e.t0);case 26:case"end":return e.stop()}}),e,null,[[8,18]])})))).apply(this,arguments)}function B(){return(B=(0,r.Z)(c().mark((function e(t){var i,a,o,r,l,s,d,u,p,v,g,f,h,b,_,m,w;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.action,a=t.getSiteId,o=t.schedule,r=t.actions,l=t.getUserEmail,s=t.onSuccess,d=t.onFail,u=t.environment,p=r.dispatchStateClasses,v=r.setMessage,g
1=r.setError,p({type:i,payload:P}),e.next=5,n.e(2856).then(n.bind(n,52856));case 5:return f=e.sent.default,h={siteId:a(),userEmail:l(),process:i,platform:"INSTANT_PREVIEW",triggeredAt:o,environment:u},i===S.REVALIDATE_PATH&&(h.path=null===(b=window)||void 0===b||null===(_=b.location)||void 0===_?void 0:_.pathname.replace(/:\d*/,"").replace("//","/")),e.prev=8,e.next=11,f({url:"".concat(L.env.NEXT_PUBLIC_ORCHESTRATOR_API_URL,"/orchestratorV2"),method:"post",headers:{"Content-Type":"application/json","Ocp-Apim-Subscription-Key":L.env.NEXT_PUBLIC_ORCHESTRATOR_API_KEY},data:h});case 11:return m=e.sent,v(m.data.message),p({type:i,payload:E}),s&&s({action:i,payload:h,data:m.data}),e.abrupt("return",m);case 18:return e.prev=18,e.t0=e.catch(8),console.error("Error while applying ".concat(i," action"),e.t0),g(!0),v((null===(w=e.t0.response)||void 0===w?void 0:w.data.message)||e.t0.message),p({type:i,payload:N}),d&&d({action:i}),e.abrupt("return",e.t0);case 26:case"end":return e.stop()}}),e,null,[[8,18]])})))).apply(this,arguments)}function Z(e){return W.apply(this,arguments)}function W(){return(W=(0,r.Z)(c().mark((function e(t){var i,a,o,r,l,s,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.id,a=t.setScheduled,o=t.onSuccess,r=t.onFail,e.next=3,n.e(2856).then(n.bind(n,52856));case 3:return l=e.sent.default,e.prev=4,e.next=7,l({url:"".concat(L.env.NEXT_PUBLIC_ORCHESTRATOR_API_URL,"/cancelScheduledProcess?id=").concat(i),method:"put",headers:{"Content-Type":"application/json","Ocp-Apim-Subscription-Key":L.env.NEXT_PUBLIC_ORCHESTRATOR_API_KEY}});case 7:e.sent,a((function(e){return e.filter((function(e){return e.Id!==i}))})),o&&o(),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("Error while cancelling scheduled process",e.t0),r&&r({message:(null===e.t0||void 0===e.t0||null===(s=e.t0.response)||void 0===s||null===(d=s.data)||void 0===d?void 0:d.message)||e.t0.message});case 16:case"end":return e.stop()}}),e,null,[[4,12]])})))).apply(this,arguments)}var G=n(27812),z=n(30120),X=d.createElement,Y=function(e){var t=e.action,n=e.stateClasses,i=e.isOpen,a=e.setIsOpen,o=e.runDeployAction,r=e.setScheduled,l=(0,d.useRef)(null),s=(0,d.useState)(""),c=s[0],u=s[1],p=function(e){var t=e.payload,n=e.data;r&&r((function(e){var i;return[].concat((0,G.Z)(e),[{Id:null===n||void 0===n||null===(i=n.result)||void 0===i?void 0:i.Id,TriggeredAt:t.triggeredAt}])})),a(!1)};return X("dialog",{open:i},X("div",null,X("input",{ref:l,className:"nva-instant-preview__deploy-datetime",type:"datetime-local",min:H(new Date).toISOString().slice(0,16)})),c&&X("p",{clasName:"nva-instant-preview__deploy-status is-error"},c),X("div",null,X("button",{className:"nva-instant-preview__button nva-instant-preview__button--text",type:"button",onClick:function(){return a(!1)}},"Close"),X("button",{className:"nva-instant-preview__button nva-instant-preview__button--dark ".concat(n[y[t]]),type:"button",onClick:function(){return function(e,n){if(!e)return n("Date is missing");var i=new Date(e);if(isNaN(i))return n("Date is invalid");var a=new Date;if(i.toISOString()<a.toISOString())return n("Date or time must be greater");n(""),o(t,i,p)}(z.ou.fromISO(l.current.value,{zone:U}).toString(),u)}},"Schedule")))},F=d.createElement,K=function(e){var t=e.name,n=e.size,i=void 0===n?20:n;return F(_.Z,{alt:"",src:"/svg/".concat(t,".svg"),width:i,height:i})},M=n(34155),$=d.createElement;function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){(0,l.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Q=S.REVALIDATE_PATH,ee=S.SYNC_APP;function te(e,t){return J(J({},e),{},(0,l.Z)({},y[t.type],t.payload))}var ne=function(e){var t,n,i,a,o=e.getSiteId,r=e.deployMode,l=e.siteInfo,s=e.loading,c=e.setSiteInfo,u=e.scheduledRevalidate,p=e.setScheduledRevalidate,v=e.scheduledSync,g=e.setScheduledSync,f=(0,d.useReducer)(te,I),h=f[0],b=f[1],_=(0,d.useState)(""),m=_[0],S=_[1],y=(0,d.useState)(!1),E=y[0],P=y[1],N=(0,d.useState)(!1),x=N[0],T=N[1],A=(0,d.useState)(!1),O
1=A[0],R=A[1],L=(null===l||void 0===l||null===(t=l.lastPath)||void 0===t?void 0:t.ExecutedAt)||(null===l||void 0===l||null===(n=l.lastPath)||void 0===n?void 0:n.CreatedAt),k={dispatchStateClasses:b,setMessage:S,setError:P},U=(0,C.Fp)().accounts,D=function(){return U.length>0?U[0].username:""},H=function(e){e.action===Q&&c(J(J({},l),{},{lastPath:{CreatedAt:(new Date).toISOString()}}))},B=function(e,t,n){return function(e){return V.apply(this,arguments)}({action:e,schedule:t,getSiteId:o,actions:k,getUserEmail:D,onSuccess:n,onFail:null})},W=function(e){return/^(?:f|ht)tps?\:\/\//.test(e)||(e="http://"+e),e};return r===w&&$("div",{className:"nva-instant-preview__deploy-wrapper"},$("div",{className:"nva-instant-preview__deploy"},M.env.NEXT_PUBLIC_ORCHESTRATOR_API_URL.includes("api-uat")&&$("p",{className:"nva-instant-preview__env"},"UAT"),M.env.NEXT_PUBLIC_ORCHESTRATOR_API_URL.includes("api-dev")&&$("p",{className:"nva-instant-preview__env"},"DEV"),(null===l||void 0===l?void 0:l.URL)&&$("a",{className:"nva-instant-preview__deploy-link",href:W(null===l||void 0===l?void 0:l.URL),target:"blank",title:W(null===l||void 0===l?void 0:l.URL)},"Go to site",$(K,{name:"open-in-new",size:16})),$("div",{className:"nva-instant-preview__deploy-buttons"},$("div",{className:"nva-instant-preview__deploy-buttons-wrapper"},$("div",{className:"nva-instant-preview__deploy-button-group"},$("button",{className:"nva-instant-preview__button ".concat(h.revalidate),onClick:function(){return B(Q,null,H)},title:"Regenarate page to see the new content (ISR)",type:"button"},$(K,{name:"revalidate"}),"Regenarate Page"),$("button",{className:"nva-instant-preview__button",onClick:function(){T(!x),R(!1)},title:"Schedule regenarate page to see the new content (ISR)",type:"button"},$(K,{name:"schedule"})),$(Y,{action:Q,stateClasses:h,isOpen:x,setIsOpen:T,runDeployAction:B,setScheduled:p})),$("div",{className:"nva-instant-preview__deploy-button-group"},$("button",{className:"nva-instant-preview__button ".concat(h.sync),onClick:function(){return B(ee)},title:"Rebuild site using the last code updates",type:"button"},$(K,{name:"sync"}),"Sync App"),$("button",{className:"nva-instant-preview__button",onClick:function(){R(!O),T(!1)},title:"Schedule rebuild site using the last code updates",type:"button"},$(K,{name:"schedule"})),$(Y,{action:ee,stateClasses:h,isOpen:O,setIsOpen:R,runDeployAction:B,setScheduled:g}))))),m&&$("p",{className:"nva-instant-preview__deploy-status ".concat(E?"is-error":"")},m),$("div",{className:"nva-instant-preview__info"},$("table",null,$("thead",null,$("tr",null,$("th",null),$("th",null,"Last"),$("th",null,"Scheduled"))),$("tbody",null,$("tr",null,$("th",null,"Regenerate Page:"),$("td",null,L>(null===l||void 0===l||null===(i=l.lastSyncApp)||void 0===i?void 0:i.CreatedAt)?j(L):""),$("td",null,$("ul",null,u.map((function(e){return $("li",{key:e.Id},j(e.TriggeredAt),$("button",{type:"button",onClick:function(){return Z({id:e.Id,setScheduled:p})}},$(K,{name:"delete",size:16})))}))))),$("tr",null,$("th",null,"Sync App:"),$("td",null,null!==l&&void 0!==l&&null!==(a=l.lastSyncApp)&&void 0!==a&&a.CreatedAt?j(l.lastSyncApp.CreatedAt):""),$("td",null,$("ul",null,v.map((function(e){return $("li",{key:e.Id},j(e.TriggeredAt),$("button",{type:"button",onClick:function(){return Z({id:e.Id,setScheduled:g})}},$(K,{name:"delete",size:16})))})))))))),s&&$("p",null,"Loading..."))},ie=n(34155),ae=d.createElement;function oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(n),!0).forEach((function(t){(0,l.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var le=S.REVALIDATE_PATH,se=S.PUBLISHING_SCHEDULED,ce=S.PUBLISHING,de=S.STAGING,ue=S.CREATE_STAGE;function pe(e,t){return re(re({},e),{},(0,l.Z)({},y[t.type],t.payload))}var ve=function(e){var t,n,i,a,o=e.getSiteId,r=e.siteInfo,l=e.loading,s=e.setSiteInfo,c=e.scheduledPublishing,u=e.setScheduledPublishing,p=(0,d.useReducer)(pe,I),v=p[0],g=p[1],f=(0,d.useState)(""),h=f[0],b=f[1],_=(0,d.useState)(!1),m=_[0],w=_[1],S=(0,d.useState)(!1),y=(S[0],S[1]),E=(0,d.useState)(!1),P=(E[0],E[1]),N=(0,d.useState)(!1),O
1=N[0],R=N[1],L=(0,d.useState)(!1),k=(L[0],L[1]),U=(0,d.useState)(0),D=U[0],H=U[1],V=(0,d.useState)(!1),W=V[0],G=V[1],z=(0,d.useState)(!1),X=z[0],F=z[1],M=((null===r||void 0===r||null===(t=r.lastPath)||void 0===t?void 0:t.ExecutedAt)||(null===r||void 0===r||null===(n=r.lastPath)||void 0===n||n.CreatedAt),{dispatchStateClasses:g,setMessage:b,setError:w}),$=(0,C.Fp)().accounts;console.log("scheduledPublishing",c);var q=function(){return $.length>0?$[0].username:""},J=function(e){e.action===le&&s(re(re({},r),{},{lastPath:{CreatedAt:(new Date).toISOString()}}))},Q=function(e,t,n){return function(e){return B.apply(this,arguments)}({action:e,schedule:t,getSiteId:o,actions:M,getUserEmail:q,onSuccess:n,onFail:null,environment:ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION})},ee=function(e){var t,n;/^(?:f|ht)tps?\:\/\//.test(e)||(e="https://"+e),e.endsWith("/")&&(e=e.slice(0,-1));var i=null===(t=window)||void 0===t||null===(n=t.location)||void 0===n?void 0:n.pathname.replace(/:\d*/,"").replace("//","/");return i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,-1)),"".concat(e,"/").concat(i)};(0,d.useEffect)((function(){te(),ne(),r&&(r.StatusLock!==A?ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION!==T||r.HasWIP?ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION!==x||r.HasStaging?b(""):b("Staging site not found. You can create one using the Stage Site button."):b("WIP site not found. Create a WIP version in the Contentful Website Record first."):b("Site is locked. Go to Contentful to unlock."))}),[r]);var te=function(){r&&(ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION!==T||r.HasWIP)&&(ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION!==x||r.HasStaging)?F(!1):F(!0)},ne=function(){r&&r.StatusLock!==A?G(!1):G(!0)},oe=function(){b("Schedule cancelled successfully"),w(!1)},ve=function(e){var t=e.message;b("Error while trying to cancel the schedule - ".concat(t)),w(!0)};return ae("div",{className:"nva-instant-preview__deploy-wrapper"},ae("div",{className:"nva-instant-preview__deploy"},ae("p",{className:"nva-instant-preview__env"},ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_ENV),ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION===T&&ae("p",{className:"nva-instant-preview__env"},T),(null===r||void 0===r?void 0:r.URL)&&ae("a",{className:"nva-instant-preview__deploy-link",href:ee(null===r||void 0===r?void 0:r.URL),target:"blank",title:ee(null===r||void 0===r?void 0:r.URL)},"Go to site",ae(K,{name:"open-in-new",size:16})),ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION===x&&(null===r||void 0===r?void 0:r.HasStaging)&&ae("a",{className:"nva-instant-preview__deploy-link",href:ee(null===r||void 0===r?void 0:r.StagingURL),target:"blank",title:ee(null===r||void 0===r?void 0:r.StagingURL)},"Go to stage site",ae(K,{name:"open-in-new",size:16})),ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION===T&&(null===r||void 0===r?void 0:r.HasWIP)&&ae("a",{className:"nva-instant-preview__deploy-link",href:ee(null===r||void 0===r?void 0:r.WipURL),target:"blank",title:ee(null===r||void 0===r?void 0:r.WipURL)},"Go to WIP site",ae(K,{name:"open-in-new",size:16})),ae("div",{className:"nva-instant-preview__deploy-buttons"},ae("div",{className:"nva-instant-preview__deploy-buttons-wrapper"},ae("div",{className:"nva-instant-preview-v2__deploy-button-group"},ae("button",{className:"nva-instant-preview__button ".concat(v.revalidate),onClick:function(){return Q(le,null,J)},title:"Regenarate page to see the new content (ISR)",disabled:X,type:"button"},ae(K,{name:"revalidate"}),"Update Page")),(ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION===T||ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION===x)&&ae("div",{className:"nva-instant-preview-v2__deploy-button-group"},ae("button",{className:"nva-instant-preview__button ".concat(X?v.createStage:v.staging),onClick:function(){Q(X?ue:de,null,J)},title:"Create stage site.",type:"button"},ae(K,{name:"stage"}),"Stage Site")),ie.env.NEXT_PUBLIC_INSTANT_PREVIEW_VERSION===x&&ae("div",{className:"nva-instant-preview-v2__deploy-button-group"},ae("button",{className:"nva-instant-preview__button ".concat(v.publishing),onClick:function(){0===D?(H(1),setTimeout((function(){return H(0)}),5e3)):Q(ce,null,J)},title:"Publish changes to production site.",disabled:W,type:"button"},ae(K,{name:"publish"}),0===D?"Publish Site":"Click again to confirm"),ae("button",{className:"nva-instant-preview__button",onClick:function(){R(!O),P(!1),y(!1),k(!1)},title:"Schedule publish changes to production site.",disabled:(null===c||void 0===c?void 0:c.length)>0||W,type:"button"},ae(K,{name:"schedule"})),ae(Y,{action:se,stateClasses:v,isOpen:O,setIsOpen:R,runDeployAction:Q,setScheduled:u}))))),h&&ae("p",{className:"nva-instant-preview__deploy-status ".concat(m?"is-error":"")},h),(null===c||void 0===c||null===(i=c[0])||void 0===i?void 0:i.TriggeredAt)&&ae("div",{className:"nva-instant-preview__info"},ae("table",null,ae("thead",null,ae("tr",null,ae("th",null),ae("th",null,"Scheduled"))),ae("tbody",null,ae("tr",null,ae("th",null,"Publishing:"),ae("td",null,ae("ul",null,ae("li",null,j(null===c||void 0===c||null===(a=c[0])||void 0===a?void 0:a.TriggeredAt),ae("button",{className:"nva-instant-preview__button",type:"button",onClick:function(){var e;return Z({id:null===c||void 0===c||null===(e=c[0])||void 0===e?void 0:e.Id,setScheduled:u,onSuccess:oe,onFail:ve})},disabled:W},ae(K,{name:"delete",size:16}
1))))))))),l&&ae("p",null,"Loading..."))},ge=n(34155),fe=d.createElement,he=S.REVALIDATE_PATH,be=S.SYNC_APP,_e=S.PUBLISHING_SCHEDULED;function me(){var e=(0,C.Fp)().instance;return fe("div",{className:"nva-instant-preview__login"},fe("p",{className:"u-caption"},"Please, make sure to permit pop-ups in your browser settings in order to login"),fe("button",{type:"button",onClick:function(){return e.loginPopup()}},fe(_.Z,{alt:"",src:"/svg/login.svg",width:20,height:20}),"Login"))}var we=function(e){var t=e.getSiteId,i=(0,d.useState)(null),a=i[0],o=i[1],l=(0,d.useState)(null),s=l[0],u=l[1],p=(0,d.useState)(!1),v=p[0],g=p[1],f=(0,d.useState)([]),h=f[0],b=f[1],_=(0,d.useState)([]),m=_[0],w=_[1],S=(0,d.useState)([]),y=S[0],I=S[1],E=(0,d.useRef)(null);if(!(""===ge.env.NEXT_PUBLIC_DEPLOY_CONTROLS_ALLOWED_SITES.trim()||ge.env.NEXT_PUBLIC_DEPLOY_CONTROLS_ALLOWED_SITES.split(",").includes(t().toString())))return null;var P={auth:{clientId:ge.env.NEXT_PUBLIC_LOGIN_CLIENT_ID,authority:ge.env.NEXT_PUBLIC_LOGIN_AUTHORITY,redirectUri:window.location.origin},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1}};return E.current=E.current||new O.L(P),(0,d.useEffect)((function(){g(!1),E.current.initialize().then((function(){var e=E.current.getAllAccounts();e.length>0&&E.current.setActiveAccount(e[0]),E.current.addEventCallback((function(e){if(e.eventType===R.t.LOGIN_SUCCESS&&e.payload.account){var t=e.payload.account;E.current.setActiveAccount(t)}}))})),(0,r.Z)(c().mark((function e(){var i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,n.e(2856).then(n.bind(n,52856));case 4:i=e.sent.default,g(!0),i({url:"".concat(ge.env.NEXT_PUBLIC_ORCHESTRATOR_API_URL,"/getSiteInfo?siteId=").concat(t(),"&lastSyncApp=true&path=").concat(k(),"&includeScheduledProcessesPending=true"),method:"get",headers:{"Ocp-Apim-Subscription-Key":ge.env.NEXT_PUBLIC_ORCHESTRATOR_API_KEY}}).then((function(e){var t,n,i,a,r,l;o(null===e||void 0===e?void 0:e.data.DeployMode),u(null===e||void 0===e?void 0:e.data),b((null===e||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.scheduledProcessPending)||void 0===n?void 0:n.filter((function(e){return e.Process===he})))||[]),w((null===e||void 0===e||null===(i=e.data)||void 0===i||null===(a=i.scheduledProcessPending)||void 0===a?void 0:a.filter((function(e){return e.Process===be})))||[]),I((null===e||void 0===e||null===(r=e.data)||void 0===r||null===(l=r.scheduledProcessPending)||void 0===l?void 0:l.filter((function(e){return e.Process===_e})))||[]),g(!1)})).catch((function(e){console.error("error while trying to get the site info",e),g(!1)}));case 7:case"end":return e.stop()}}),e)})))()}),[]),fe(C.rL,{instance:E.current},fe(C.NY,null,!ge.env.NEXT_PUBLIC_USE_ORCHESTRATOR_V2&&fe(ne,{getSiteId:t,deployMode:a,siteInfo:s,loading:v,setSiteInfo:u,scheduledRevalidate:h,scheduledSync:m,setScheduledRevalidate:b,setScheduledSync:w}),ge.env.NEXT_PUBLIC_USE_ORCHESTRATOR_V2&&fe(ve,{getSiteId:t,siteInfo:s,loading:v,setSiteInfo:u,setScheduledPublishing:I,scheduledPublishing:y})),fe(C.ae,null,fe(me,null)))},Se=n(34155),ye=d.createElement;function Ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(n),!0).forEach((function(t){(0,l.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ie(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Pe=u.ZP.section.withConfig({componentId:"sc-br6vf1-0"})(["",";"],v),Ne=(0,u.ZP)((function(){var e=(0,d.useState)({siteId:""}),t=e[0],i=e[1],a=(0,d.useState)(!0),s=a[0],u=a[1],p=(0,d.useState)(!1),v=p[0],w=p[1];(0,m.useRouter)();if("false"===new URLSearchParams(window.location.search).get("showIPcontrols"))return ye(d.Fragment,null);var S=function(e){if(e.preventDefault(),null!==t&&void 0!==t&&t.siteId){var n,a;w(!0),i((function(e){return Ee({},e)}));var o=(null===(n=window)||void 0===n||null===(a=n.location)||void 0===a?void 0:a.origin)+"/:"+(null===t||void 0===t?void 0:t.siteId);console.log("handleSubmit",o),window.location.href=o}},y=function(){var e=(0,r.Z)(c().mark((function e(t){var a,o,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),w(!0),i((function(e){return Ee({},e)})),r="/api/revalidate/?url=".concat(encodeURIComponent(null===(a=window)||void 0===a||null===(o=a.location)||void 0===o?void 0:o.pathname)),console.log("handleRefresh",r),e.next=7,n.e(2856).then(n.bind(n,52856));case 7:(0,e.sent.default)({url:r,method:"get"}).then((function(e){var t,n,i;(console.log("success",null===e||void 0===e?void 0:e.data),null!==(t=window)&&void 0!==t&&t.location)&&(null===(n=window)||void 0===n||null===(i=n.location)||void 0===i||i.reload())})).catch((function(e){console.log("fail",e)}));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),I=function(){var e,t,n,i;return null!==(e=localStorage)&&void 0!==e&&e.getItem("instantPreviewSiteId")?parseInt(null===(t=localStorage)||void 0===t?void 0:t.getItem("instantPreviewSiteId")):parseInt(null===(n=Se)||void 0===Se||null===(i=n.env)||void 0===i?void 0:"482")},E=function(){var e,t;return null!==(e=localStorage)&&void 0!==e&&e.getItem("instantPreviewEdit")?null===(t=localStorage)||void 0===t?void 0:t.getItem("instantPreviewEdit"):null},P=function(){var e,t;return null!==(e=localStorage)&&void 0!==e&&e.getItem("instantPreviewWebsite")?null===(t=localStorage)||void 0===t?void 0:t.getItem("instantPreviewWebsite"):null};return(0,d.useEffect)((function(){i({siteId:I()});var e=function(){i({siteId:I()})};window.addEventListener("instantpreview:updated",e);var t=function(e){for(var t=e.target;t&&"A"!==t.tagName;)t=t.parentElement;if(t&&"A"===t.tagName){var n=t.getAttribute("href"),i=I();if(!(!n||n.startsWith("http")||n.startsWith("#")||n.startsWith("mailto:")||n.startsWith("tel:")||n.includes(":".concat(i))||n.includes(":"))){var a=n.split("#"),r=(0,o.Z)(a,2),l=r[0],s=r[1],c=l.split("?"),d=(0,o.Z)(c,2),u=d[0],p=d[1],v=u+":"+i;p&&(v+="?"+p),s&&(v+="#"+s),e.preventDefault(),window.location.href=v}}};return document.addEventListener("click",t,!0),function(){document.removeEventListener("click",t,!0),window.removeEventListener("instantpreview:updated",e)}}),[]),ye(Pe,{className:"nva-instant-preview ".concat(s?"is-opened":"is-collapsed")},ye("form",{onSubmit:S,className:"nva-instant-preview__form"},ye("div",{className:"form-control"},ye("div",{className:"nva-instant-preview__label-wrapper"},ye("label",null,"Instant Preview"),ye(f,null)),ye("div",{className:"nva-instant-preview__controls-wrapper"},ye(h,null,ye("input",{className:"nva-instant-preview__input-site-id",type:"number",name:"siteId",placeholder:"Site ID",value:t.siteId,onChange:function(e){var t=e.target,n=t.name,a=t.value;i((function(e){return Ee(Ee({},e),{},(0,l.Z)({},n,a))}))}}
1)),ye("button",{onClick:S,type:"submit",title:"Apply the new Site ID",className:"nva-instant-preview__submit-site-id submit"},ye(_.Z,{alt:"Apply the new Site ID",src:"/svg/eye.svg",width:20,height:20}),"View Site"),ye("button",{className:"nva-instant-preview__refresh-button",onClick:y,title:"Refresh the page to see the new content"},ye(_.Z,{alt:"Refresh the page to see the new content",src:"/svg/eye.svg",width:20,height:20}),"View Changes"),ye("button",{className:"nva-instant-preview__edit-button edit",onClick:function(e){e.preventDefault();var t=E();t&&window.open(t,"_blank")},title:"Edit current entry page in Contentful"},"Edit Page"),ye("button",{className:"nva-instant-preview__edit-button edit",onClick:function(e){e.preventDefault();var t=P();t&&window.open(t,"_blank")},title:"Edit Website entry in Contentful"},"Edit Site")),ye(b,{className:"nva-instant-preview__expand-button",type:"button",onClick:function(){u((function(e){return!e}))},title:"Expand or collapse"},ye(_.Z,{alt:"Expand or collapse",src:"/svg/".concat(s?"arrow-right":"arrow-left",".svg"),width:25,height:25}))),ye(we,{getSiteId:I})),v&&ye(g,null,ye("div",{className:"lds-dual-ring"})))})).withConfig({componentId:"sc-br6vf1-1"})(["",";"],v)}}]);
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.