1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fbe31708-83ee-405d-bc8e-a825e45510a8",e._sentryDebugIdIdentifier="sentry-dbid-fbe31708-83ee-405d-bc8e-a825e45510a8")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3068],{42066:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("ampersand",[["path",{d:"M17.5 12c0 4.4-3.6 8-8 8A4.5 4.5 0 0 1 5 15.5c0-6 8-4 8-8.5a3 3 0 1 0-6 0c0 3 2.5 8.5 12 13",key:"1o9ehi"}],["path",{d:"M16 12h3",key:"4uvgyw"}]])},61108:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},48757:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("cloud-download",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]])},26987:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("equal-not",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}],["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}]])},71353:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},9910:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]])},58606:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("list-filter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]])},42297:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},39892:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("separator-vertical",[["line",{x1:"12",x2:"12",y1:"3",y2:"21",key:"1efggb"}],["polyline",{points:"8 8 4 12 8 16",key:"bnfmv4"}],["polyline",{points:"16 16 20 12 16 8",key:"u90052"}]])},54463:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},46795:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("sliders-horizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]])},28214:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var s=r(91373);let n=(0,s.Z)("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]])},41358:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/[orgId]/sett
1ings/integrations/zoho-projects",function(){return r(80787)}])},33250:function(e,t,r){"use strict";r.d(t,{Cd:function(){return o},X:function(){return c},bZ:function(){return d}});var s=r(85893),n=r(67294),a=r(45139),i=r(60119);let l=(0,a.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),d=n.forwardRef((e,t)=>{let{className:r,variant:n,...a}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,i.cn)(l({variant:n}),r),...a})});d.displayName="Alert";let o=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("h5",{ref:t,className:(0,i.cn)("mb-1 font-medium leading-none tracking-tight",r),...n})});o.displayName="AlertTitle";let c=n.forwardRef((e,t)=>{let{className:r,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,i.cn)("text-sm [&_p]:leading-relaxed",r),...n})});c.displayName="AlertDescription"},48975:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var s=r(85893),n=r(67294),a=r(12780),i=r(60119);let l=n.forwardRef((e,t)=>{let{className:r,orientation:n="horizontal",decorative:l=!0,...d}=e;return(0,s.jsx)(a.f,{ref:t,decorative:l,orientation:n,className:(0,i.cn)("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",r),...d})});l.displayName=a.f.displayName},80787:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return es}});var s=r(85893),n=r(68692),a=r(14640),i=r(11163),l=r(7009),d=r(73510),o=r(85594),c=r(61108),u=r(36316),_=r(67294),O=r(33250),m=r(78888),h=r(43484),x=r(12587),S=r(73213),E=r(32798),p=r(100),v=r(48975),N=r(65995);let R={all:["integrations","zoho-projects"],organization:e=>[...R.all,e],provider:e=>[...R.organization(e),"provider"],credential:e=>[...R.organization(e),"credential"],sessions:e=>[...R.organization(e),"sessions"],session:(e,t)=>[...R.sessions(e),t],mutation:(e,t)=>[...R.organization(e),"mutation",t]};var T=r(30202),f=r(98029),C=r(92600);class j extends Error{constructor({code:e,message:t,status:r}){super(t),this.name="ZohoProjectsIntegrationError",this.code=e,this.status=r}}function y(e){return"object"==typeof e&&null!==e}async function g(e,t){try{let r=await (0,C.n)("/api/integrations/zoho-projects",(function(e){if(!Number.isSafeInteger(e)||e<=0)throw new j({code:"invalid_organization_id",message:"A valid organization is required."})}(e),{...t,params:{...t.params,organization_id:e},useExplicitOrganization:!0})),s=r.data;if(!y(s)||"SUCCESS"!==s.status||!("data"in s)||null===s.data||void 0===s.data)throw new j({code:"invalid_api_response",message:"Zoho Projects returned an invalid API response."});return s.data}catch(e){throw function(e){if(e instanceof j)return e;let t=y(e)?e:void 0,r=null==t?void 0:t.response,s=y(r)?r:t,n=null==s?void 0:s.data,a=y(n)?n:void 0,i="number"==typeof(null==s?void 0:s.status)?s.status:void 0;return new j({code:"string"==typeof(null==a?void 0:a.error)?a.error:void 0,message:"string"==typeof(null==a?void 0:a.message)?a.message:"Zoho Projects integration request failed.",status:i&&i>=400?i:"number"==typeof(null==a?void 0:a.code)?a.code:i})}(e)}}let I=/^[a-f0-9]{32}$/i,P=new Set(["CSV_IMPORT","SYNC","USER_IMPORT"]),Z=new Set(["CSV_IMPORT","SYNC"]);function A(e){if(!y(e)||"zoho-projects"!==e.provider)throw new j({code:"invalid_provider_response",message:"Zoho Projects returned an invalid provider response."})}function b(e){if(!I.test(e))throw new j({code:"invalid_session_id",message:"A valid import session is required."});return"/imports/".concat(e)}function w(e,t){if(A(e),!I.test(e.id)||!Z.has(e.capability)||void 0!==t&&e.capability!==t)throw new j({code:"invalid_session_response",message:"Zoho Projects returned an invalid import session."});return e}let H={getProviderInfo:async e=>(function(e){if(A(e),!Array.isArray(e.capabilities)||0===e.capabilities.length||e.capabilities.some(e=>"string"!=typeof e||!P.has(e))||new Set(e.capabilities).size!==e.capabilities.length)throw new j({code:"invalid_provider_response",message:"Zoho Projects returned invali
1d provider capabilities."});return e})(await g(e,{method:"GET",url:"/provider"})),async getCredentialStatus(e){let t=await g(e,{method:"GET",url:"/credentials"});return A(t),t},async startAuthorization(e,t){let r=function(e){if(void 0===e)return;let t=e.trim();if(!t||t.length>256||!/^[1-9]\d*$/.test(t))throw new j({code:"invalid_target_account_id",message:"A valid Zoho Projects portal ID is required."});return t}(t),s=await g(e,{method:"GET",url:"/oauth/authorize",...r?{params:{targetAccountId:r}}:{}});return function(e){let t;A(e);try{t=new URL("string"==typeof e.authorizationUrl?e.authorizationUrl:"")}catch(e){throw new j({code:"invalid_oauth_response",message:"Zoho Projects returned an invalid authorization URL."})}if("https://accounts.zoho.com"!==t.origin||"/oauth/v2/auth"!==t.pathname||t.username||t.password||t.hash||"string"!=typeof e.state||0===e.state.length||1!==t.searchParams.getAll("state").length||t.searchParams.get("state")!==e.state)throw new j({code:"invalid_oauth_response",message:"Zoho Projects returned an invalid authorization URL."});return t.toString()}(s)},async verifyCredential(e){let t=await g(e,{method:"POST",url:"/credentials/verify"});return A(t),t},async deleteCredential(e){let t=await g(e,{method:"DELETE",url:"/credentials"});return A(t),t},async createCsvSession(e,t){let r=new FormData;return r.append("file",t),w(await g(e,{method:"POST",url:"/imports/csv",data:r}),"CSV_IMPORT")},createSyncSession:async e=>w(await g(e,{method:"POST",url:"/imports/sync"}),"SYNC"),getSession:async(e,t)=>w(await g(e,{method:"GET",url:b(t)})),updateMappings:async(e,t,r)=>w(await g(e,{method:"PATCH",url:"".concat(b(t),"/mappings"),data:r})),async updateTaskEntry(e,t,r,s){if(!Number.isSafeInteger(r)||r<0)throw new j({code:"invalid_task_index",message:"A valid task entry is required."});return w(await g(e,{method:"PATCH",url:"".concat(b(t),"/task-entries/").concat(r),data:s}))}};function J(e,t,r){e.setQueryData(R.session(t,r.id),r)}var L=r(78551);function k(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>0}function M(e){if(Array.isArray(e)||!e||!/^\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:void 0}function D(e){if(!e)return"ZOHO_PROJECTS__ERROR__GENERIC";switch(e.code){case"invalid_credential":return"ZOHO_PROJECTS__ERROR__INVALID_CREDENTIAL";case"credential_not_found":return"ZOHO_PROJECTS__ERROR__CREDENTIAL_NOT_FOUND";case"invalid_csv_format":case"invalid_template":case"invalid_header":return"ZOHO_PROJECTS__ERROR__INVALID_CSV";case"projection_errors_remain":return"ZOHO_PROJECTS__ERROR__PROJECTION_ERRORS";case"invalid_organization_id":return"ZOHO_PROJECTS__ERROR__INVALID_ORGANIZATION";case"invalid_oauth_response":return"ZOHO_PROJECTS__ERROR__OAUTH_RESPONSE";case"invalid_target_account_id":return"ZOHO_PROJECTS__OAUTH__PORTAL_ERROR";case"oauth_not_configured":case"oauth_provider_not_configured":return"ZOHO_PROJECTS__ERROR__OAUTH_NOT_CONFIGURED";case"invalid_oauth_state":case"invalid_oauth_callback":case"oauth_authorization_failed":case"oauth_exchange_failed":case"oauth_token_exchange_failed":return"ZOHO_PROJECTS__ERROR__OAUTH_FAILED";case"unsupported_provider":case"provider_not_found":case"unknown_provider":case"invalid_provider_response":return"ZOHO_PROJECTS__ERROR__UNAVAILABLE";default:if(401===e.status)return"ZOHO_PROJECTS__ERROR__AUTHENTICATION";if(403===e.status)return"ZOHO_PROJECTS__ERROR__PERMISSION";if(404===e.status)return"ZOHO_PROJECTS__ERROR__NOT_FOUND";if(409===e.status)return"ZOHO_PROJECTS__ERROR__PROJECTION_ERRORS";return"ZOHO_PROJECTS__ERROR__GENERIC"}}function z(e){let{error:t}=e,r=(0,a.useTranslations)();return t?(0,s.jsxs)(O.bZ,{variant:"destructive",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:r("ZOHO_PROJECTS__ERROR__TITLE")}),(0,s.jsx)(O.X,{children:r(D(t))})]}):null}function U(e){let{session:t}=e,r=(0,a.useTranslations)();return"CONFIRMED"===t.status?(0,s.jsxs)(m.C,{className:"gap-1 bg-emerald-600 hover:bg-emerald-600",children:[(0,s.jsx)(o.Z,{className:"h-3 w-3"}),r("ZOHO_PROJECTS__SESSION__STATUS__CONFIRMED")]}):"PROJECTION_ERRORS"===t.status?(0,s.jsxs)(m.C,{variant:"destructive",className:"gap-1",children:[(0,s.jsx)(c.Z,{className:"h-3 w-3"}),r("ZOHO_PROJECTS__SESSION__STATUS__NEEDS_CHANGES")]}):(0,s.jsx)(m.C,{variant:"secondary",children:r("ZOHO_PROJECTS__SESSION__STATUS__REVIEW")})}function V(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function F(e){var t,r,n,i,l,o,c,x,p,v,R,T,f,C;let{sessionId:j,entry:y,disabled:g,onDirtyChange:I,onSave:P}=e,Z=(0,a.useTranslations)(),A=(0,_.useMemo)(()=>{var e,t,r,s,n,a,i,l;return{...null!==(s=y.projected)&&void 0!==s?s:{},title:null!==(n=null===(e=y.projected)||void 0===e?void 0:e.title)&&void 0!==n?n:y.normalized.title,type:null!==(a=null===(t=y.projected)||void 0===t?void 0:t.type)&&void 0!==a?a:"TASK",description:null!==(l=null!==(i=null===(r=y.projected)||void 0===r?void 0:r.description)&&void 0!==i?i:y.normalized.description)&&void 0!==l?l:null}},[y]),b=(0,_.useMemo)(()=>(function(e){var t;let r=null===(t=e.projected)||void 0===t?void 0:t.descriptionJson;if(!V(r))return[];let s=r.customColumns;return V(s)?Object.entries(s).flatMap(e=>{let[t,r]=e;return"string"==typeof r||"number"==typeof r||"boolean"==typeof r?[[t,String(r)]]:[]}):[]})(y),[y]),w=(0,_.useRef)(j),H=(0,_.useRef)(j);H.current=j;let[J,L]=(0,_.useState)(A),[k,M]=(0,_.useState)(!1),[D,z]=(0,_.useState)(!1);(0,_.useEffect)(()=>(I(y.index,k),()=>I(y.index,!1)),[k,y.index,I]),(0,_.useEffect)(()=>
1{if(w.current!==j){w.current=j,L(A),M(!1);return}k||L(A)},[k,A,j]);let U=e=>{L(t=>({...t,...e})),M(!0)},F=async e=>{if(e.preventDefault(),!J.title.trim()||!J.type.trim())return;let t={...J,title:J.title.trim(),type:J.type.trim()};z(!0);try{await P(t),H.current===j&&(L(t),M(!1))}catch(e){}finally{z(!1)}};return(0,s.jsxs)("details",{className:"rounded-lg border bg-background",children:[(0,s.jsx)("summary",{className:"cursor-pointer list-none px-4 py-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium",children:null!==(v=null===(t=y.projected)||void 0===t?void 0:t.title)&&void 0!==v?v:y.normalized.title}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:y.metadata.identifier})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-wrap justify-end gap-2",children:[Boolean(null===(r=y.projectionErrors)||void 0===r?void 0:r.length)&&(0,s.jsx)(m.C,{variant:"destructive",children:Z("ZOHO_PROJECTS__SESSION__ERROR_COUNT",{count:null!==(R=null===(n=y.projectionErrors)||void 0===n?void 0:n.length)&&void 0!==R?R:0})}),Boolean(null===(i=y.mappingNotes)||void 0===i?void 0:i.length)&&(0,s.jsx)(m.C,{variant:"outline",children:Z("ZOHO_PROJECTS__SESSION__NOTE_COUNT",{count:null!==(T=null===(l=y.mappingNotes)||void 0===l?void 0:l.length)&&void 0!==T?T:0})})]})]})}),(0,s.jsxs)("div",{className:"space-y-4 border-t p-4",children:[Boolean(null===(o=y.projectionErrors)||void 0===o?void 0:o.length)&&(0,s.jsxs)(O.bZ,{variant:"destructive",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:Z("ZOHO_PROJECTS__SESSION__PROJECTION_ERRORS")}),(0,s.jsx)(O.X,{children:(0,s.jsx)("ul",{className:"list-disc space-y-1 pl-4",children:null===(c=y.projectionErrors)||void 0===c?void 0:c.map(e=>(0,s.jsx)("li",{children:e},e))})})]}),Boolean(null===(x=y.mappingNotes)||void 0===x?void 0:x.length)&&(0,s.jsxs)(O.bZ,{children:[(0,s.jsx)(d.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:Z("ZOHO_PROJECTS__SESSION__MAPPING_NOTES")}),(0,s.jsx)(O.X,{children:(0,s.jsx)("ul",{className:"list-disc space-y-1 pl-4",children:null===(p=y.mappingNotes)||void 0===p?void 0:p.map(e=>(0,s.jsx)("li",{children:e},e))})})]}),b.length>0&&(0,s.jsxs)("section",{className:"space-y-2 rounded-lg border bg-muted/30 p-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:Z("ZOHO_PROJECTS__SESSION__CUSTOM_COLUMNS_TITLE")}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:Z("ZOHO_PROJECTS__SESSION__CUSTOM_COLUMNS_DESCRIPTION")})]}),(0,s.jsx)("dl",{className:"grid gap-2 sm:grid-cols-2",children:b.map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{className:"min-w-0 rounded-md border bg-background p-2",children:[(0,s.jsx)("dt",{className:"break-words text-xs font-medium",children:t}),(0,s.jsx)("dd",{className:"mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words text-xs text-muted-foreground",children:r})]},t)})})]}),(0,s.jsxs)("form",{onSubmit:F,className:"grid gap-4 md:grid-cols-2",children:[(0,s.jsxs)("div",{className:"space-y-2 md:col-span-2",children:[(0,s.jsx)(E._,{htmlFor:"zoho-projects-task-title-".concat(y.index),children:Z("ZOHO_PROJECTS__SESSION__TASK_TITLE")}),(0,s.jsx)(S.I,{id:"zoho-projects-task-title-".concat(y.index),value:J.title,disabled:g,onChange:e=>U({title:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(E._,{htmlFor:"zoho-projects-task-type-".concat(y.index),children:Z("ZOHO_PROJECTS__SESSION__TASK_TYPE")}),(0,s.jsx)(S.I,{id:"zoho-projects-task-type-".concat(y.index),value:J.type,disabled:g,onChange:e=>U({type:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(E._,{htmlFor:"zoho-projects-task-priority-".concat(y.index),children:Z("ZOHO_PROJECTS__SESSION__TASK_PRIORITY")}),(0,s.jsx)(S.I,{id:"zoho-projects-task-priority-".concat(y.index),value:null!==(f=J.priority)&&void 0!==f?f:"",disabled:g,onChange:e=>U({priority:e.target.value||null})})]}),(0,s.jsxs)("div",{className:"space-y-2 md:col-span-2",children:[(0,s.jsx)(E._,{htmlFor:"zoho-projects-task-description-".concat(y.index),children:Z("ZOHO_PROJECTS__SESSION__TASK_DESCRIPTION")}),(0,s.jsx)(N.g,{id:"zoho-projects-task-description-".concat(y.index),value:null!==(C=J.description)&&void 0!==C?C:"",disabled:g,onChange:e=>U({description:e.target.value||null})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 md:col-span-2",children:[(0,s.jsxs)(h.zx,{type:"submit",size:"sm",disabled:g||D||!k||!J.title.trim()||!J.type.trim(),children:[D&&(0,s.jsx)(u.Z,{className:"mr-2 h-4 w-4 animate-spin"}),Z("ZOHO_PROJECTS__SESSION__SAVE_TASK")]}),k&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:Z("ZOHO_PROJECTS__SESSION__UNSAVED")})]})]})]})]})}function B(e){var t,r,n,i,l,c,m,S;let{organizationId:E,session:N,members:C,membersLoading:j,membersError:y}=e,g=(0,a.useTranslations)(),I=(0,_.useRef)(N.id),P=(0,_.useRef)(N.id);P.current=N.id;let[Z,A]=(0,_.useState)(N.userMappings),[b,w]=(0,_.useState)(!1),[L,k]=(0,_.useState)(()=>new Set),M=function(e){let t=(0,T.NL)();return(0,f.D)({mutationKey:R.mutation(e,"mapping-update"),retry:!1,mutationFn:t=>{let{sessionId:r,update:s}=t;return H.updateMappings(e,r,s)},onSuccess:r=>J(t,e,r)})}(E),D=function(e){let t=(0,T.NL)();return(0,f.D)({mutationKey:R.mutation(e,"task-entry-update"),retry:!1,mutationFn:t=>{let{sessionId:r,index:s,update:n}=t;return H.updateTaskEntry(e,r,s,n)},onSuccess:r=>J(t,e,r)})}(E),V="CONFIRMED"===N.status,B=Z.length>0,K=B&&(j||y),Y=Z.some(e=>null==e.matchedUserId),q=M.isPending||D.isPending;(0,_.useEffect)(()=>
1{if(I.current!==N.id){I.current=N.id,A(N.userMappings),w(!1),k(new Set);return}b||A(N.userMappings)},[b,N.id,N.updatedAt,N.userMappings]);let G=(e,t)=>{A(r=>r.map((r,s)=>{var n,a,i,l,d,o;if(s!==e)return r;if("unmapped"===t)return{...r,matchedUserId:null,matchedEmail:null,matchedName:null,method:"NONE",confidence:null};let c=C.find(e=>{var r;return(null===(r=e.user)||void 0===r?void 0:r.id)===Number(t)});return{...r,matchedUserId:null!==(l=null==c?void 0:null===(n=c.user)||void 0===n?void 0:n.id)&&void 0!==l?l:null,matchedEmail:null!==(d=null==c?void 0:null===(a=c.user)||void 0===a?void 0:a.email)&&void 0!==d?d:null,matchedName:null!==(o=null==c?void 0:null===(i=c.user)||void 0===i?void 0:i.fullName)&&void 0!==o?o:null,method:c?"MANUAL":"NONE",confidence:c?1:null}})),w(!0)},X=(0,_.useCallback)((e,t)=>{k(r=>{let s=r.has(e);if(s===t)return r;let n=new Set(r);return t?n.add(e):n.delete(e),n})},[]),W=async e=>{if(K||e&&Y)return;let t=N.id;try{await M.mutateAsync({sessionId:N.id,update:{userMappings:Z,confirm:e}}),P.current===t&&w(!1)}catch(e){}};return(0,s.jsxs)(x.Zb,{children:[(0,s.jsxs)(x.Ol,{className:"gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col justify-between gap-3 sm:flex-row sm:items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(x.ll,{className:"text-xl",children:g("ZOHO_PROJECTS__SESSION__TITLE")}),(0,s.jsx)(U,{session:N})]}),(0,s.jsx)(x.SZ,{className:"mt-2",children:N.filename?g("ZOHO_PROJECTS__SESSION__CSV_SOURCE",{filename:N.filename}):g("ZOHO_PROJECTS__SESSION__SYNC_SOURCE")})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__UPDATED",{date:new Date(N.updatedAt).toLocaleString()})})]}),V&&(0,s.jsxs)(O.bZ,{className:"border-emerald-200 bg-emerald-50 text-emerald-950 dark:border-emerald-900 dark:bg-emerald-950/30 dark:text-emerald-100",children:[(0,s.jsx)(o.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:g("ZOHO_PROJECTS__SESSION__CONFIRMED_TITLE")}),(0,s.jsx)(O.X,{children:g("ZOHO_PROJECTS__SESSION__CONFIRMED_DESCRIPTION")})]})]}),(0,s.jsxs)(x.aY,{className:"space-y-6",children:[(0,s.jsx)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-5",children:[["TASKS",N.summary.taskCount],["USERS",N.summary.userCount],["ROW_ERRORS",N.summary.errorCount],["BLOCKERS",N.summary.projectionErrorCount],["NOTES",N.summary.mappingNoteCount]].map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-3",children:[(0,s.jsx)("p",{className:"text-2xl font-semibold",children:r}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__SUMMARY__".concat(t))})]},t)})}),N.rowErrors.length>0&&(0,s.jsxs)(O.bZ,{variant:"destructive",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:g("ZOHO_PROJECTS__SESSION__ROW_ERRORS_TITLE")}),(0,s.jsx)(O.X,{children:(0,s.jsx)("ul",{className:"max-h-40 list-disc space-y-1 overflow-auto pl-4",children:N.rowErrors.map(e=>(0,s.jsx)("li",{children:g("ZOHO_PROJECTS__SESSION__ROW_ERROR",{row:e.rowNumber,message:e.error})},"".concat(e.rowNumber,"-").concat(e.identifier)))})})]}),(0,s.jsxs)("section",{className:"space-y-3","aria-labelledby":"zoho-projects-mappings-title",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{id:"zoho-projects-mappings-title",className:"font-semibold",children:g("ZOHO_PROJECTS__SESSION__MAPPINGS_TITLE")}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__MAPPINGS_DESCRIPTION")})]}),y&&B&&(0,s.jsxs)(O.bZ,{variant:"destructive",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:g("ZOHO_PROJECTS__SESSION__MEMBERS_ERROR_TITLE")}),(0,s.jsx)(O.X,{children:g("ZOHO_PROJECTS__SESSION__MEMBERS_ERROR_DESCRIPTION")})]}),0===Z.length?(0,s.jsx)("p",{className:"rounded-lg border border-dashed p-4 text-sm text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__NO_MAPPINGS")}):(0,s.jsxs)("div",{className:"space-y-3",children:[Z.map((e,a)=>{var d;return(0,s.jsxs)("div",{className:"grid gap-3 rounded-lg border p-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-center",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm font-medium",children:null!==(n=null!==(r=null!==(t=e.sourceName)&&void 0!==t?t:e.sourceEmail)&&void 0!==r?r:e.sourceAccountId)&&void 0!==n?n:g("ZOHO_PROJECTS__SESSION__UNKNOWN_USER")}),e.sourceEmail&&(0,s.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e.sourceEmail})]}),(0,s.jsxs)(p.Ph,{value:null!==(i=null===(d=e.matchedUserId)||void 0===d?void 0:d.toString())&&void 0!==i?i:"unmapped",disabled:V||K||q,onValueChange:e=>G(a,e),children:[(0,s.jsx)(p.i4,{"aria-label":g("ZOHO_PROJECTS__SESSION__SELECT_MEMBER"),children:(0,s.jsx)(p.ki,{placeholder:g("ZOHO_PROJECTS__SESSION__SELECT_MEMBER")})}),(0,s.jsxs)(p.Bw,{children:[(0,s.jsx)(p.Ql,{value:"unmapped",children:g("ZOHO_PROJECTS__SESSION__UNMAPPED")}),C.map(e=>{var t;return(null===(t=e.user)||void 0===t?void 0:t.id)?(0,s.jsx)(p.Ql,{value:e.user.id.toString(),children:null!==(l=e.user.fullName)&&void 0!==l?l:e.user.email},e.user.id):null})]})]})]},"".concat(null!==(m=null!==(c=e.sourceAccountId)&&void 0!==c?c:e.sourceEmail)&&void 0!==m?m:e.sourceName,"-").concat(a))}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsxs)(h.zx,{variant:"outline",disabled:V||!b||K||q,onClick:()=>W(!1),children:[M.isPending&&(0,s.jsx)(u.Z,{className:"mr-2 h-4 w-4 animate-spin"}),g("ZOHO_PROJECTS__SESSION__SAVE_MAPPINGS")]}),b&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__UNSAVED")})]})]})]}),(0,s.jsx)(v.Z,{}),(0,s.jsxs)("section",{className:"space-y-3","aria-labelledby":"zoho-projects-tasks-title",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{id:"zoho-projects-tasks-title",className:"font-semibold",children:g("ZOHO_PROJECTS__SESSION__TASKS_TITLE")}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__TASKS_DESCRIPTION")})]}),0===N.taskEntries.length?(0,s.jsx)("p",{className:"rounded-lg border border-dashed p-4 text-sm text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__NO_TASKS")}):(0,s.jsx)("div",{className:"space-y-3",children:N.taskEntries.map(e=>(0,s.jsx)(F,{sessionId:N.id,entry:e,disabled:V||q,onDirtyChange:X,onSave:async t=>{var r;await D.mutateAsync({sessionId:N.id,index:e.index,update:{projected:t,projectionErrors:[],mappingNotes:null!==(r=e.mappingNotes)&&void 0!==r?r:[]}})}},e.index))})]}),(0,s.jsx)(z,{error:null!==(S=M.error)&&void 0!==S?S:D.error}),(0,s.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-4",children:[(0,s.jsxs)("div",{className:"flex flex-col justify-between gap-4 sm:flex-row sm:items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:g("ZOHO_PROJECTS__SESSION__CONFIRM_TITLE")}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:g("ZOHO_PROJECTS__SESSION__CONFIRM_DESCRIPTION")})]}),(0,s.jsxs)(h.zx,{disabled:V||q||K||Y||N.summary.projectionErrorCount>0||L.size>0,onClick:()=>W(!0),children:[M.isPending&&(0,s.jsx)(u.Z,{className:"mr-2 h-4 w-4 animate-spin"}),V?g("ZOHO_PROJECTS__SESSION__STATUS__CONFIRMED"):g("ZOHO_PROJECTS__SESSION__CONFIRM")]})]}),N.summary.projectionErrorCount>0&&(0,s.jsx)("p",{className:"mt-3 text-sm text-destructive",children:g("ZOHO_PROJECTS__SESSION__CONFIRM_BLOCKED")}),K&&(0,s.jsx)("p",{className:"mt-3 text-sm text-destructive",children:g("ZOHO_PROJECTS__SESSION__CONFIRM_MEMBERS_BLOCKED")}),Y&&(0,s.jsx)("p",{className:"mt-3 text-sm text-destructive",children:g("ZOHO_PROJECTS__SESSION__CONFIRM_MAPPINGS_BLOCKED")}),L.size>0&&(0,s.jsx)("p",{className:"mt-3 text-sm text-destructive",children:g("ZOHO_PROJECTS__SESSION__CONFIRM_TASKS_BLOCKED")})]})]})]})}var K=r(42297),Y=r(18814),q=r(54463),G=r(13718),X=r(48757),W=r(5019),Q=r(81685),$=r(39628);function ee(e){var t,r,l,c,p,N,C,y,g,I;let{organizationId:P}=e,Z=(0,a.useTranslations)(),A=(0,i.useRouter)(),b=(0,T.NL)(),w=(0,_.useRef)(!1),U=(0,_.useRef)(P),V=(0,_.useRef)(null),F=(0,_.useRef)(),ee=(0,_.useRef)(null),et=(0,_.useRef)(null),[er,es]=(0,_.useState)(!1),[en,ea]=(0,_.useState)(""),[ei,el]=(0,_.useState)(),[ed,eo]=(0,_.useState)(null),[ec,eu]=(0,_.useState)(),[e_,eO]=(0,_.useState)(),em=function(e){let{organizationId:t,enabled:r=!0}=e;return(0,L.a)({queryKey:R.provider(t),queryFn:()=>H.getProviderInfo(t),enabled:r&&k(t),staleTime:3e5,retry:!1})}({organizationId:P}),eh=function(e){let{organizationId:t,enabled:r=!0,refetchInterval:s=!1}=e;return(0,L.a)({queryKey:R.credential(t),queryFn:()=>H.getCredentialStatus(t),enabled:r&&k(t),refetchInterval:s,staleTime:s?0:3e4,retry:!1})}({organizationId:P}),ex="string"==typeof A.query.sessionId?A.query.sessionId:void 0,eS=function(e){let{organizationId:t,sessionId:r,enabled:s=!0}=e;return(0,L.a)({queryKey:R.session(t,r),queryFn:()=>H.getSession(t,r),enabled:s&&k(t)&&Boolean(null==r?void 0:r.trim()),staleTime:1e4,retry:!1})}({organizationId:P,sessionId:ex}),eE=function(e){let t=(0,T.NL)(),r=R.mutation(e,"oauth-authorize"),s=(0,f.D)({mutationKey:r,retry:!1,gcTime:0,mutationFn:t=>H.startAuthorization(e,t)});return{...s,reset:()=>{s.reset(),t.getMutationCache().findAll({exact:!0,mutationKey:r}
1).forEach(e=>t.getMutationCache().remove(e))}}}(P),ep=(0,f.D)({mutationKey:R.mutation(P,"credential-verify"),retry:!1,mutationFn:()=>H.verifyCredential(P)}),ev=function(e){let t=(0,T.NL)();return(0,f.D)({mutationKey:R.mutation(e,"credential-delete"),retry:!1,mutationFn:()=>H.deleteCredential(e),onSuccess:r=>{t.setQueryData(R.credential(e),r),t.removeQueries({queryKey:R.sessions(e)})}})}(P),eN=function(e){let{organizationId:t,fileRef:r}=e,s=(0,T.NL)();return(0,f.D)({mutationKey:R.mutation(t,"csv-import"),retry:!1,gcTime:0,mutationFn:()=>{let e=r.current;return e?H.createCsvSession(t,e):Promise.reject(new j({code:"missing_csv",message:"Choose a Zoho Projects CSV export first."}))},onSuccess:e=>{r.current=null,J(s,t,e)}})}({organizationId:P,fileRef:ee}),eR=function(e){let t=(0,T.NL)();return(0,f.D)({mutationKey:R.mutation(e,"sync-import"),retry:!1,mutationFn:()=>H.createSyncSession(e),onSuccess:r=>J(t,e,r)})}(P),eT=(0,$.to)({pageSize:100,organizationId:P,sortBy:"username",enabled:Boolean(null===(t=eS.data)||void 0===t?void 0:t.userMappings.length)}),{fetchNextPage:ef,hasNextPage:eC,isFetchingNextPage:ej}=eT,ey=(0,_.useCallback)(e=>{void 0!==F.current&&(window.clearTimeout(F.current),F.current=void 0),e&&V.current&&!V.current.closed&&V.current.close(),V.current=null},[]);(0,_.useEffect)(()=>(w.current=!0,()=>{w.current=!1,ey(!0),ee.current=null,function(e,t){let r=R.organization(t);e.cancelQueries({queryKey:r}),e.removeQueries({queryKey:r}),e.getMutationCache().findAll({mutationKey:r}).forEach(t=>e.getMutationCache().remove(t))}(b,P)}),[ey,P,b]),(0,_.useEffect)(()=>{U.current=P,ey(!0),ee.current=null,eo(null),eu(void 0),et.current&&(et.current.value=""),es(!1),ea(""),el(void 0),eO(void 0)},[ey,P]),(0,_.useEffect)(()=>{eC&&!ej&&ef()},[ef,eC,ej]);let eg=(0,_.useMemo)(()=>{var e;return null!==(y=null===(e=eT.data)||void 0===e?void 0:e.pages.flatMap(e=>null!==(C=e.content)&&void 0!==C?C:[]))&&void 0!==y?y:[]},[eT.data]),eI=(null===(r=eh.data)||void 0===r?void 0:r.configured)===!0,eP=(null===(l=em.data)||void 0===l?void 0:l.capabilities.includes("CSV_IMPORT"))===!0,eZ=(null===(c=em.data)||void 0===c?void 0:c.capabilities.includes("SYNC"))===!0,eA=(null===(p=em.data)||void 0===p?void 0:p.capabilities.includes("USER_IMPORT"))===!0,eb=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P;return w.current&&U.current===e&&M(A.query.orgId)===e},ew=async e=>{eb()&&await A.replace({pathname:A.pathname,query:{orgId:P.toString(),sessionId:e.id}},void 0,{shallow:!0})},eH=(e,t,r)=>{ey(r),eb(e)&&(es(!1),eO(t))},eJ=async()=>{var e,t;eO(void 0),el(void 0);let r=function(e){let t=e.trim();return t?t.length>256||!/^[1-9]\d*$/.test(t)?{valid:!1}:{valid:!0,portalId:t}:{valid:!0}}(en);if(!r.valid){el("ZOHO_PROJECTS__OAUTH__PORTAL_ERROR");return}let s=window.open("","teamboost-zoho-projects-oauth","popup=yes,width=640,height=760");if(!s){eO({key:"ZOHO_PROJECTS__OAUTH__POPUP_BLOCKED",tone:"error"});return}let n=null!==(t=null===(e=eh.data)||void 0===e?void 0:e.updatedAt)&&void 0!==t?t:null,a=Date.now()+12e4;V.current=s,es(!0);try{let e=await eE.mutateAsync(r.portalId);if(!eb(P)){ey(!0);return}s.opener=null,s.location.href=e,eE.reset();let t=async()=>{var e;if(!eb(P)){ey(!0);return}let r=await eh.refetch();if(!eb(P)){ey(!0);return}let s=r.data,i=!eI||Boolean((null==s?void 0:s.updatedAt)&&s.updatedAt!==n);if((null==s?void 0:s.configured)&&i){eH(P,{key:"ZOHO_PROJECTS__OAUTH__CONNECTED",tone:"success"},!0);return}if(null===(e=V.current)||void 0===e?void 0:e.closed){eH(P,{key:"ZOHO_PROJECTS__OAUTH__POPUP_CLOSED",tone:"error"},!1);return}if(Date.now()>=a){eH(P,{key:"ZOHO_PROJECTS__OAUTH__TIMEOUT",tone:"error"},!0);return}F.current=window.setTimeout(()=>void t(),1500)};t()}catch(e){eH(P,{key:D(e),tone:"error"},!0)}finally{eE.reset()}},eL=async()=>{eO(void 0);try{let e=await ep.mutateAsync();if(!eb())return;eO({key:e.valid?"ZOHO_PROJECTS__CREDENTIAL__VERIFY_SUCCESS":"ZOHO_PROJECTS__CREDENTIAL__VERIFY_INVALID",tone:e.valid?"success":"error"})}catch(e){}},ek=async()=>{eO(void 0);try{if(await ev.mutateAsync(),!eb())return;ey(!0),es(!1),await A.replace({pathname:A.pathname,query:{orgId:P.toString()}},void 0,{shallow:!0}),eb()&&eO({key:"ZOHO_PROJECTS__CREDENTIAL__REMOVE_SUCCESS",tone:"success"})}catch(e){}},eM=e=>{var t,r;let s=null!==(r=null===(t=e.target.files)||void 0===t?void 0:t[0])&&void 0!==r?r:null;if(eu(void 0),!s){ee.current=null,eo(null);return}let n=function(e){let t=e.name.toLowerCase().endsWith(".csv"),r=!e.type||"text/csv"===e.type||"application/csv"
1===e.type||"application/vnd.ms-excel"===e.type;return t&&r?e.size>4194304?{valid:!1,key:"SIZE"}:{valid:!0}:{valid:!1,key:"TYPE"}}(s);if(!n.valid){ee.current=null,eo(null),eu("ZOHO_PROJECTS__IMPORT__FILE_ERROR__".concat(n.key)),e.target.value="";return}ee.current=s,eo(s)},eD=async()=>{eO(void 0);try{let e=await eN.mutateAsync();if(!eb())return;eo(null),et.current&&(et.current.value=""),await ew(e)}catch(e){}},ez=async()=>{eO(void 0);try{let e=await eR.mutateAsync();await ew(e)}catch(e){}};return em.isLoading?(0,s.jsx)("div",{className:"flex min-h-[320px] items-center justify-center",children:(0,s.jsxs)("div",{className:"space-y-3 text-center",children:[(0,s.jsx)(u.Z,{className:"mx-auto h-8 w-8 animate-spin text-primary"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:Z("ZOHO_PROJECTS__LOADING")})]})}):em.isError?(0,s.jsxs)("div",{className:"mx-auto max-w-2xl py-10",children:[(0,s.jsxs)(O.bZ,{variant:"destructive",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:Z("ZOHO_PROJECTS__UNAVAILABLE__TITLE")}),(0,s.jsx)(O.X,{children:Z(D(em.error))})]}),(0,s.jsxs)(h.zx,{variant:"outline",className:"mt-4",onClick:()=>em.refetch(),children:[(0,s.jsx)(K.Z,{className:"mr-2 h-4 w-4"}),Z("ZOHO_PROJECTS__RETRY")]})]}):(0,s.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6",children:[(0,s.jsx)("section",{className:"overflow-hidden rounded-2xl border bg-gradient-to-br from-blue-50 via-background to-emerald-50 p-6 dark:from-blue-950/30 dark:to-emerald-950/20 sm:p-8",children:(0,s.jsxs)("div",{className:"flex flex-col justify-between gap-6 lg:flex-row lg:items-center",children:[(0,s.jsxs)("div",{className:"max-w-2xl space-y-3",children:[(0,s.jsx)(m.C,{variant:"outline",className:"bg-background/80",children:Z("ZOHO_PROJECTS__EYEBROW")}),(0,s.jsx)("h1",{className:"text-2xl font-semibold tracking-tight sm:text-3xl",children:Z("ZOHO_PROJECTS__HERO_TITLE")}),(0,s.jsx)("p",{className:"text-sm leading-6 text-muted-foreground sm:text-base",children:Z("ZOHO_PROJECTS__HERO_DESCRIPTION")}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2","aria-label":Z("ZOHO_PROJECTS__CAPABILITIES__TITLE"),children:[(0,s.jsx)(m.C,{variant:eP?"secondary":"outline",children:Z(eP?"ZOHO_PROJECTS__CAPABILITIES__CSV_AVAILABLE":"ZOHO_PROJECTS__CAPABILITIES__CSV_UNAVAILABLE")}),(0,s.jsx)(m.C,{variant:eZ?"secondary":"outline",children:Z(eZ?"ZOHO_PROJECTS__CAPABILITIES__SYNC_AVAILABLE":"ZOHO_PROJECTS__CAPABILITIES__SYNC_UNAVAILABLE")}),(0,s.jsx)(m.C,{variant:eA?"secondary":"outline",children:Z(eA?"ZOHO_PROJECTS__CAPABILITIES__USERS_AVAILABLE":"ZOHO_PROJECTS__CAPABILITIES__USERS_UNAVAILABLE")})]})]}),(0,s.jsx)("div",{className:"flex h-20 w-20 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-600 to-emerald-600 text-white shadow-lg shadow-blue-500/20",children:(0,s.jsx)(n.Z,{className:"h-10 w-10","aria-hidden":"true"})})]})}),(0,s.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,s.jsxs)(x.Zb,{children:[(0,s.jsx)(x.Ol,{children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)(x.ll,{className:"flex items-center gap-2 text-lg",children:[(0,s.jsx)(Y.Z,{className:"h-5 w-5 text-blue-600"}),Z("ZOHO_PROJECTS__CREDENTIAL__TITLE")]}),(0,s.jsx)(x.SZ,{children:Z("ZOHO_PROJECTS__CREDENTIAL__DESCRIPTION")})]}),eh.isLoading?(0,s.jsx)(m.C,{variant:"outline",children:Z("ZOHO_PROJECTS__STATUS__CHECKING")}):eI?(0,s.jsxs)(m.C,{className:"gap-1 bg-emerald-600 hover:bg-emerald-600",children:[(0,s.jsx)(o.Z,{className:"h-3 w-3"}),Z("ZOHO_PROJECTS__STATUS__CONNECTED")]}):(0,s.jsx)(m.C,{variant:"secondary",children:Z("ZOHO_PROJECTS__STATUS__NOT_CONNECTED")})]})}),(0,s.jsxs)(x.aY,{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(E._,{htmlFor:"zoho-projects-portal-id",children:Z("ZOHO_PROJECTS__OAUTH__PORTAL_LABEL")}),(0,s.jsx)(S.I,{id:"zoho-projects-portal-id",value:en,inputMode:"numeric",autoComplete:"off",placeholder:Z("ZOHO_PROJECTS__OAUTH__PORTAL_PLACEHOLDER"),disabled:eh.isLoading||er,onChange:e=>{ea(e.target.value),el(void 0)}}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:Z("ZOHO_PROJECTS__OAUTH__PORTAL_HELP")}),ei&&(0,s.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:Z(ei)})]}),er&&(0,s.jsxs)(O.bZ,{children:[(0,s.jsx)(u.Z,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(O.Cd,{children:Z("ZOHO_PROJECTS__OAUTH__WAITING_TITLE")}),(0,s.jsx)(O.X,{children:Z("ZOHO_PROJECTS__OAUTH__WAITING_DESCRIPTION")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)(h.zx,{disabled:eh.isLoading||er,onClick:eJ,children:[er?(0,s.jsx)(u.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(Y.Z,{className:"mr-2 h-4 w-4"}),Z(eI?"ZOHO_PROJECTS__CREDENTIAL__RECONNECT":"ZOHO_PROJECTS__CREDENTIAL__CONNECT")]}),eI&&(0,s.jsxs)(h.zx,{variant:"outline",disabled:ep.isPending||er,onClick:eL,children:[ep.isPending?(0,s.jsx)(u.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(q.Z,{className:"mr-2 h-4 w-4"}),Z("ZOHO_PROJECTS__CREDENTIAL__VERIFY")]})]}),eI&&(null===(N=eh.data)||void 0===N?void 0:N.updatedAt)&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:Z("ZOHO_PROJECTS__CREDENTIAL__UPDATED",{date:new Date(eh.data.updatedAt).toLocaleStr
1ing()})}),eI&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.Z,{}),(0,s.jsxs)(Q.aR,{children:[(0,s.jsx)(Q.vW,{asChild:!0,children:(0,s.jsxs)(h.zx,{variant:"destructive",disabled:er,children:[(0,s.jsx)(G.Z,{className:"mr-2 h-4 w-4"}),Z("ZOHO_PROJECTS__CREDENTIAL__REMOVE")]})}),(0,s.jsxs)(Q._T,{children:[(0,s.jsxs)(Q.fY,{children:[(0,s.jsx)(Q.f$,{children:Z("ZOHO_PROJECTS__CREDENTIAL__REMOVE_TITLE")}),(0,s.jsx)(Q.yT,{children:Z("ZOHO_PROJECTS__CREDENTIAL__REMOVE_DESCRIPTION")})]}),(0,s.jsxs)(Q.xo,{children:[(0,s.jsx)(Q.le,{children:Z("ZOHO_PROJECTS__CREDENTIAL__REMOVE_CANCEL")}),(0,s.jsx)(Q.OL,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:ek,children:Z("ZOHO_PROJECTS__CREDENTIAL__REMOVE_CONFIRM")})]})]})]})]}),e_&&(0,s.jsx)("p",{role:"status",className:"success"===e_.tone?"text-sm text-emerald-700 dark:text-emerald-400":"text-sm text-destructive",children:Z(e_.key)}),(0,s.jsx)(z,{error:null!==(I=null!==(g=eh.error)&&void 0!==g?g:ep.error)&&void 0!==I?I:ev.error})]})]}),(0,s.jsxs)(x.Zb,{children:[(0,s.jsxs)(x.Ol,{children:[(0,s.jsxs)(x.ll,{className:"flex items-center gap-2 text-lg",children:[(0,s.jsx)(X.Z,{className:"h-5 w-5 text-emerald-600"}),Z("ZOHO_PROJECTS__IMPORT__TITLE")]}),(0,s.jsx)(x.SZ,{children:Z("ZOHO_PROJECTS__IMPORT__DESCRIPTION")})]}),(0,s.jsxs)(x.aY,{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(W.Z,{className:"mt-0.5 h-5 w-5 text-muted-foreground"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:Z("ZOHO_PROJECTS__IMPORT__CSV_TITLE")}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:Z("ZOHO_PROJECTS__IMPORT__CSV_DESCRIPTION")})]})]}),(0,s.jsxs)(O.bZ,{children:[(0,s.jsx)(W.Z,{className:"h-4 w-4"}),(0,s.jsx)(O.Cd,{children:Z("ZOHO_PROJECTS__IMPORT__COLUMNS_TITLE")}),(0,s.jsx)(O.X,{children:Z("ZOHO_PROJECTS__IMPORT__COLUMNS_DESCRIPTION")})]}),(0,s.jsx)(S.I,{ref:et,type:"file",accept:".csv,text/csv","aria-label":Z("ZOHO_PROJECTS__IMPORT__CSV_LABEL"),disabled:!eP||eN.isPending,onChange:eM}),ed&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:Z("ZOHO_PROJECTS__IMPORT__SELECTED_FILE",{filename:ed.name})}),ec&&(0,s.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:Z(ec)}),(0,s.jsxs)(h.zx,{variant:"outline",disabled:!eP||!ed||eN.isPending,onClick:eD,children:[eN.isPending&&(0,s.jsx)(u.Z,{className:"mr-2 h-4 w-4 animate-spin"}),Z("ZOHO_PROJECTS__IMPORT__CSV_ACTION")]}),(0,s.jsx)(z,{error:eN.error})]}),(0,s.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,s.jsx)("p",{className:"font-medium",children:Z("ZOHO_PROJECTS__IMPORT__SYNC_TITLE")}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:Z("ZOHO_PROJECTS__IMPORT__SYNC_DESCRIPTION")}),!eI&&(0,s.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:Z("ZOHO_PROJECTS__IMPORT__SYNC_REQUIRES_CREDENTIAL")}),(0,s.jsxs)(h.zx,{disabled:!eZ||!eA||!eI||eR.isPending,onClick:ez,children:[eR.isPending&&(0,s.jsx)(u.Z,{className:"mr-2 h-4 w-4 animate-spin"}),Z("ZOHO_PROJECTS__IMPORT__SYNC_ACTION")]}),(0,s.jsx)(z,{error:eR.error})]}),(!eP||!eZ)&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:Z("ZOHO_PROJECTS__IMPORT__CAPABILITY_NOTE")})]})]})]}),ex&&eS.isLoading&&(0,s.jsx)(x.Zb,{children:(0,s.jsxs)(x.aY,{className:"flex items-center justify-center gap-3 py-12",children:[(0,s.jsx)(u.Z,{className:"h-5 w-5 animate-spin"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:Z("ZOHO_PROJECTS__SESSION__LOADING")})]})}),ex&&eS.isError&&(0,s.jsx)(x.Zb,{children:(0,s.jsxs)(x.aY,{className:"space-y-4 py-6",children:[(0,s.jsx)(z,{error:eS.error}),(0,s.jsxs)(h.zx,{variant:"outline",onClick:()=>eS.refetch(),children:[(0,s.jsx)(K.Z,{className:"mr-2 h-4 w-4"}),Z("ZOHO_PROJECTS__RETRY")]})]})}),eS.data&&(0,s.jsx)(B,{organizationId:P,session:eS.data,members:eg,membersLoading:eT.isLoading||eT.isFetchingNextPage,membersError:eT.isError})]})}var et=r(55869);let er=()=>{let e=(0,a.useTranslations)(),t=(0,i.useRouter)(),r=M(t.query.orgId);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.pQ,{title:e("ZOHO_PROJECTS__SEO_TITLE")}
1),(0,s.jsx)(et.Z,{titleI18nKey:"APP__SIDEBAR__ZOHO_PROJECTS_INTEGRATION",Icon:n.Z,isLoading:!t.isReady,isError:t.isReady&&!r,errorMessage:e("ZOHO_PROJECTS__ERROR__INVALID_ORGANIZATION"),children:r?(0,s.jsx)(ee,{organizationId:r},r):null})]})};var es=er},12780:function(e,t,r){"use strict";r.d(t,{f:function(){return o}});var s=r(67294),n=r(75320),a=r(85893),i="horizontal",l=["horizontal","vertical"],d=s.forwardRef((e,t)=>{let{decorative:r,orientation:s=i,...d}=e,o=l.includes(s)?s:i;return(0,a.jsx)(n.WV.div,{"data-orientation":o,...r?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"},...d,ref:t})});d.displayName="Separator";var o=d}},function(e){e.O(0,[7409,9405,7240,5858,6597,8749,673,6929,5869,9774,2888,179],function(){return e(e.s=41358)}),_N_E=e.O()}]);
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.