1import{c as e,j as s,R as t,u as i,e as r,f as a,b as o,dJ as n,B as l,T as c,dK as d,O as p,b$ as u,dA as h,c0 as x,dL as m,h as g,t as j,ax as f,a_ as v,P as y,bM as b,bN as w,bO as P,aF as C,bA as k,bB as S,bC as I,a6 as W,C as M,bQ as T,c4 as z,dM as D,by as R,G as A,S as F,dN as G,cq as $,a$ as E,b0 as H,b1 as V,b2 as O,dO as B,b3 as N,I as L,dP as U,bU as K,dD as q,l as J,k as Q,aW as _,dl as X}from"./index-BLQwV_Zw.js";import{F as Y}from"./react-pdf.browser-FqoK964s.js";import{F as Z}from"./FormGroup-B_ZivgDO.js";const ee=e(s.jsx("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7m2.85 11.1-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1"}),"LightbulbOutlined"),se=e(s.jsx("path",{d:"M14.67 5v14H9.33V5zm1 14H21V5h-5.33zm-7.34 0V5H3v14z"}),"ViewColumn"),te=e(s.jsx("path",{fillRule:"evenodd",d:"M14 6V4h-4v2zM4 8v11h16V8zm16-2c1.11 0 2 .89 2 2v11c0 1.11-.89 2-2 2H4c-1.11 0-2-.89-2-2l.01-11c0-1.11.88-2 1.99-2h4V4c0-1.11.89-2 2-2h4c1.11 0 2 .89 2 2v2z"}),"WorkOutline"),ie=e(s.jsx("path",{d:"M6 15c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0-2c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4m6-8c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0-2C9.8 3 8 4.8 8 7s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4m6 12c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0-2c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4"}),"WorkspacesOutlined");Y.register({family:"Roboto",fonts:[{src:"https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-light-webfont.ttf",fontWeight:300},{src:"https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-regular-webfont.ttf",fontWeight:400},{src:"https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-medium-webfont.ttf",fontWeight:500},{src:"https://cdnjs.cloudflare.com/ajax/libs/ink/3.1.10/fonts/Roboto/roboto-bold-webfont.ttf",fontWeight:700}]});const re=[{label:"Propositions",description:"Manage your business propositions"},{label:"Products and Services",description:"Manage individual products and services in your portfolio"}],ae=({columns:e,visibleColumns:t,onToggle:i})=>{const[r,a]=o.useState(null),n=Boolean(r),c=n?"column-selector-popover":void 0;return s.jsxs(s.Fragment,{children:[s.jsx(j,{"aria-describedby":c,variant:"outlined",onClick:e=>{a(e.currentTarget)},startIcon:s.jsx(se,{}),size:"small",children:"Columns"}),s.jsx(G,{id:c,open:n,anchorEl:r,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:s.jsx(l,{sx:{p:2},children:s.jsx(Z,{children:Object.keys(e).map(e=>s.jsx(z,{control:s.jsx(D,{checked:t[e],onChange:()=>i(e),size:"small"}),label:e.charAt(0).toUpperCase()+e.slice(1)},e))})})})]})},oe=t.memo(()=>{const{selectedWorkspace:e}=i(),t=r(),G=a(),[_,X]=o.useState([]),[Y,se]=o.useState([]),[ie,oe]=o.useState(!1),[ne,le]=o.useState(null),[ce,de]=o.useState(!1),[pe,ue]=o.useState(0),[he,xe]=o.useState("portfolioItem");o.useState(!0);const[me,ge]=o.useState({open:!1,message:"",severity:"info"}),[je,fe]=o.useState({open:!1,content:"",title:""}),[ve,ye]=o.useState({name:!0,description:!0,parentProposition:!0,associatedProducts:!0,associatedServices:!0,whatItIs:!1,howItWorks:!1,whyItMatters:!1}),[be,we]=o.useState({name:!0,description:!0,category:!0,associatedPropositions:!0,type:!1,deliveryType:!1,marketShare:!1,plcStage:!1}),[Pe,Ce]=o.useState(!1),[ke,Se]=o.useState(!0),[Ie,We]=o.useState({rowId:null,column:null});o.useState({open:!1,item:null});const[Me,Te]=o.useState({key:"name",direction:"ascending"}),[ze,De]=o.useState(null),Re=o.useCallback(async()=>{try{const s=await n.getPropositions(e?.id);X(s)}catch(s){De(s.message),ge({open:!0,message:"Failed to fetch propositions",severity:"error"})}},[e]),Ae=o.useCallback(async()=>{try{const s=await n.getPortfolioItems(e?.id);se(s)}catch(s){De(s.message),ge({open:!0,message:"Failed to fetch portfolio items",severity:"error"})}},[e]);o.useEffect(()=>{e?(Se(!0),Promise.all([Re(),Ae()]).finally(()=>Se(!1))):(X([]),se([]),Se(!1))},[e,Re,Ae]);const Fe=()=>{oe(!1),le(null),de(!1)},Ge=(e,s)=>{"clickaway"!==s&&ge({...me,open:!1})},$e=(e,s=50)=>e?e.length<=s?e:e.substr(0,s)+"...":"",Ee=()=>{fe({open:!1,content:"",title:""})},He=(e,s)=>{s?ye(s=>({...s,[e]:!s[e]})):we(s=>({...s,[e]:!s[e]}))},Ve=()=>s.jsxs(l,{children:[s.jsxs(A,{container:!0,spacing:3,children:[s.jsx(A,{item:!0,xs:12,md:6,children:s.jsx(F,{variant:"rectangular",width:"100%",height:200,sx:{borderRadius:2}})}),s.jsx(A,{item:!0,xs:12,md:6,children:s.jsx(F,{variant:"rectangular",width:"100%",height:200,sx:{borderRadius:2}})})]}),s.jsx(F,{variant:"rectangular",width:"100%",height:400,sx:{mt:3,borderRadius:2}})]}),Oe=async()=>{try{0===pe?(await n.updateProposition(e?.id,ne.id,ne),Re()):(await n.updatePortfolioItem(e?.id,ne.id,ne),Ae()),We({rowId:null,column:null}),ge({open:!0,message:"Item updated successfully",severity:"success"})}catch(s){J.error("Error updating item:",s),ge({open:!0,message:`Error updating item: ${s.message}`,severity:"error"})}},Be=e=>{const s=[...e];return s.sort((e,s)=>e[Me.key]<s[Me.key]?"ascending"===Me.direction?-1:1:e[Me.key]>s[Me.key]?"ascending"===Me.direction?1:-1:0),s},Ne=e=>({name:"Name",description:"Description",category:"Category",type:"Type",deliveryType:"Delivery Type",plcStage:"PLC Stage",whatItIs:"What It Is",howItWorks:"How It Works",whyItMatters:"Why It Matters",marketShare:"Market Share",marketGrowth:"Market Growth",parentProposition:"Parent Proposition",associatedProducts:"Associated Products",associatedServices:"Associated Services",associatedPropositions:"Associated Propositions"}[e]||e.charAt(0).toUpperCase()+e.slice(1)),Le=(e,t)=>{const i={fullWidth:!0,value:ne[e]||"",onChange:s=>{le({...ne,[e]:s.target.value})},onBlur:Oe,onKeyPress:e=>{"Enter"===e.key&&Oe()},autoFocus:!0,sx:{minWidth:"200px"}};switch(e){case"name":case"description":case"category":case"type":case"deliveryType":case"whatItIs":case"howItWorks":case"whyItMatters":return s.jsx(C,{...i,multiline:"description"===e});case"marketShare":case"marketGrowth":return s.jsx(C,{...i,type:"number"});case"plcStage":return s.jsxs(I,{...i,children:[s.jsx(W,{value:"Introduction",children:"Introduction"}),s.jsx(W,{value:"Growth",children:"Growth"}),s.jsx(W,{value:"Maturity",children:"Maturity"}),s.jsx(W,{value:"Decline",children:"Decline"})]});case"parentProposition":return s.jsxs(I,{...i,value:ne.parentPropositionId||"",children:[s.jsx(W,{value:"",children:s.jsx("em",{children:"None"})}),_.filter(e=>e.id!==t.id).map(e=>s.jsx(W,{value:e.id,children:e.name},e.id))]});case"associatedProducts":case"associatedServices":return s.jsxs(k,{fullWidth:!0,children:[s.jsx(S,{children:Ne(e)}),s.jsx(I,{...i,multiple:!0,renderValue:t=>s.jsx(l,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:t.map(t=>{const i=Y.find(e=>e.id===t);return i?s.jsx(M,{label:i.name,onDelete:()=>{const s=ne[e].filter(e=>e!==t);le({...ne,[e]:s})},onMouseDown:e=>{e.stopPropagation()}},t):null})}),children:Y.filter(s=>s.category===("associatedProducts"===e?"Product":"Service")).map(e=>s.jsx(W,{value:e.id,children:e.name},e.id))})]});case"associatedPropositions":const r=_.filter(e=>e.associatedProducts?.includes(t.id)||e.associatedServices?.includes(t.id));return s.jsxs(k,{fullWidth:!0,children:[s.jsx(S,{children:Ne(e)}),s.jsx(I,{...i,multiple:!0,value:r.map(e=>e.id),onChange:e=>{const s={...ne,associatedPropositions:e.target.value};le(s),Ue(s)},renderValue:e=>s.jsx(l,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map(t=>{const i=_.find(e=>e.id===t);return i?s.jsx(M,{label:i.name,onDelete:()=>{const s=e.filter(e=>e!==t),i={...ne,associatedPropositions:s};le(i),Ue(i)},onMouseDown:e=>{e.stopPropagation()}},t):null})}),children:_.map(e=>s.jsx(W,{value:e.id,children:e.name},e.id))})]});default:return null}},Ue=async s=>{try{await n.updatePortfolioItem(e?.id,s.id,s);const t=[..._];for(const i of s.associatedPropositions){const r=t.find(e=>e.id===i);if(r){const a={...r,associatedProducts:"Product"===s.category?[...new Set([...r.associatedProducts||[],s.id])]:r.associatedProducts,associatedServices:"Service"===s.category?[...new Set([...r.associatedServices||[],s.id])]:r.associatedServices};await n.updateProposition(e?.id,i,a);const o=t.findIndex(e=>e.id===i);t[o]=a}}for(const i of t)if(!s.associatedPropositions.includes(i.id)){const r={...i,associatedProducts:i.associatedProducts?.filter(e=>e!==s.id)||[],associatedServices:i.associatedServices?.filter(e=>e!==s.id)||[]};if(r.associatedProducts!==i.associatedProducts||r.associatedServices!==i.associatedServices){await n.updateProposition(e?.id,i.id,r);const s=t.findIndex(e=>e.id===i.id);t[s]=r}}X(t),se(e=>e.map(e=>e.id===s.id?s:e)),ge({open:!0,message:"Associated propositions updated successfully",severity:"success"})}catch(t){J.error("Error updating associated propositions:",t),ge({open:!0,message:`Error updating associated propositions: ${t.message}`,severity:"error"})}},Ke=(e,t)=>{const i=e[t];switch(t){case"name":case"description":case"category":case"type":case"deliveryType":case"plcStage":case"whatItIs":case"howItWorks":case"whyItMatters":return s.jsx(Q,{title:i,children:s.jsx("span",{children:i?$e(i,50):"Click to add"})});case"marketShare":case"marketGrowth":return i?`${i}%`:"Click to add";case"parentProposition":const t=(r=e.parentPropositionId,_.find(e=>e.id===r));return t?s.jsx(Q,{title:t.name,children:s.jsx("span",{children:$e(t.name,50)})}):"Click to add";case"associatedProducts":case"associatedServices":return i&&0!==i.length?s.jsxs(l,{children:[i.slice(0,2).map(e=>{const t=Y.find(s=>
1s.id===e);return t?s.jsx(Q,{title:t.name,children:s.jsx(M,{label:$e(t.name,15),size:"small",sx:{m:.5}})},e):null}),i.length>2&&s.jsx(M,{label:`+${i.length-2} more`,size:"small",sx:{m:.5}})]}):s.jsx("span",{children:"Click to add"});case"associatedPropositions":const a=_.filter(s=>s.associatedProducts?.includes(e.id)||s.associatedServices?.includes(e.id));return s.jsxs(l,{children:[a.slice(0,2).map(e=>s.jsx(Q,{title:e.name,children:s.jsx(M,{label:$e(e.name,15),size:"small",sx:{m:.5}})},e.id)),a.length>2&&s.jsx(M,{label:`+${a.length-2} more`,size:"small",sx:{m:.5}}),0===a.length&&s.jsx("span",{children:"Click to add"})]});default:return i||"Click to add"}var r},qe=(e,s)=>{G(`/portfolio/${s}/${e.id}`)},Je=o.useMemo(()=>Be(0===pe?_:Y),[pe,_,Y,Me]),Qe=o.useMemo(()=>0===pe?ve:be,[pe,ve,be]);return e?ke?s.jsx(d,{in:!0,style:{transitionDelay:"300ms"},children:s.jsx("div",{children:Ve()})}):s.jsxs(l,{sx:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,overflow:"hidden"},children:[ze&&s.jsx(p,{severity:"error",sx:{mx:2,mt:2,mb:1.5,borderRadius:1},children:ze}),ke?Ve():s.jsxs(s.Fragment,{children:[s.jsx(l,{sx:{borderBottom:1,borderColor:"divider",backgroundColor:g(t.palette.background.paper,.6),flex:"none"},children:s.jsx(u,{value:pe,onChange:(e,s)=>{ue(s)},sx:h,children:re.map((e,t)=>s.jsx(x,{label:e.label,sx:m},t))})}),s.jsxs(l,{sx:{py:1.5,px:2,display:"flex",flexDirection:{xs:"column",sm:"row"},justifyContent:{sm:"space-between"},alignItems:{xs:"stretch",sm:"center"},gap:{xs:1,sm:2},borderBottom:`1px solid ${g(t.palette.divider,.1)}`,backgroundColor:g(t.palette.background.paper,.3),flex:"none"},children:[s.jsxs(j,{variant:"contained",startIcon:s.jsx(f,{}),onClick:()=>((e=null,s="portfolioItem")=>{le(e||("proposition"===s?{name:"",description:"",whatItIs:"",howItWorks:"",whyItMatters:"",associatedServices:[],associatedProducts:[]}:{name:"",description:"",category:"",type:"",deliveryType:"Internal",thirdPartyProvider:"",marketShare:0,marketGrowth:0,plcStage:"Introduction",pricing:"",features:[],benefits:[],technicalSpecifications:""})),de(!!e),xe(s),oe(!0)})(null,0===pe?"proposition":"portfolioItem"),size:"small",fullWidth:!1,sx:{borderRadius:1,textTransform:"none",px:2,py:.75,fontSize:"0.875rem",fontWeight:500,width:{xs:"100%",sm:"auto"}},children:["Add ",0===pe?"Proposition":"Portfolio Item"]}),s.jsx(l,{sx:{display:"flex",justifyContent:{xs:"flex-end",sm:"flex-start"}},children:s.jsx(ae,{columns:Qe,visibleColumns:Qe,onToggle:e=>He(e,0===pe)})})]}),s.jsx(l,{sx:{flex:1,minHeight:0,overflow:"auto",p:2},children:s.jsx(v,{component:y,elevation:0,sx:{borderRadius:1,border:`1px solid ${g(t.palette.divider,.1)}`,height:"100%","& .MuiTableCell-root":{borderColor:g(t.palette.divider,.1),py:1.5,px:2,fontSize:"0.875rem",lineHeight:1.5},"& .MuiTableCell-head":{backgroundColor:g(t.palette.primary.main,.04),color:t.palette.text.primary,fontWeight:500,position:"sticky",top:0,zIndex:1},"& .MuiTableBody-root .MuiTableRow-root:hover":{backgroundColor:g(t.palette.primary.main,.02)}},children:((i,r,a)=>{const o=Be(i),c="proposition"===a;return 0===o.length?s.jsx($,{icon:c?s.jsx(ee,{}):s.jsx(te,{}),title:c?"No propositions yet":"No portfolio items yet",description:c?"Add your first proposition to define your products, services, or offerings.":"Add your first portfolio item to start building your portfolio.",action:{label:c?"Add Proposition":"Add Portfolio Item",onClick:()=>{xe(c?"proposition":"portfolioItem"),oe(!0)},icon:s.jsx(f,{}),variant:"contained"}}):s.jsx(v,{component:y,elevation:0,sx:q(t),children:s.jsxs(E,{children:[s.jsx(H,{children:s.jsxs(V,{children:[Object.entries(r).map(([e,t])=>t&&s.jsx(O,{children:s.jsx(B,{active:Me.key===e,direction:Me.key===e?"ascending"===Me.direction?"asc":"desc":"asc",onClick:()=>(e=>{let s="ascending";Me.key===e&&"ascending"===Me.direction&&(s="descending"),Te({key:e,direction:s})})(e),children:Ne(e)})},e)),s.jsx(O,{sx:{width:"120px"},children:"Actions"})]})}),s.jsx(N,{children:o.map(i=>s.jsxs(V,{onClick:()=>qe(i,a),sx:{cursor:"pointer","&:last-child td":{borderBottom:0}},children:[Object.entries(r).map(([e,r])=>r&&s.jsx(O,{sx:{fontSize:"0.875rem",color:t.palette.text.primary},children:Ie.rowId===i.id&&Ie.column===e?Le(e,i):s.jsx(l,{onClick:s=>{s.stopPropagation(),((e,s)=>{We({rowId:e,column:s});const t=0===pe?_.find(s=>
1s.id===e):Y.find(s=>s.id===e);le({...t})})(i.id,e)},sx:{cursor:"text","&:hover":{backgroundColor:g(t.palette.primary.main,.08),borderRadius:1},minHeight:"24px",padding:"4px 8px",transition:"all 0.2s"},children:Ke(i,e)})},e)),s.jsx(O,{onClick:e=>e.stopPropagation(),children:s.jsxs(l,{sx:{display:"flex",gap:1},children:[s.jsx(L,{"aria-label":"View item",onClick:()=>qe(i,a),size:"small",sx:{color:t.palette.primary.main,"&:hover":{backgroundColor:g(t.palette.primary.main,.1)}},children:s.jsx(U,{fontSize:"small"})}),s.jsx(L,{"aria-label":"Delete item",onClick:()=>(async(s,t)=>{try{"proposition"===t?(await n.deleteProposition(e?.id,s),Re()):(await n.deletePortfolioItem(e?.id,s),Ae()),ge({open:!0,message:"Item deleted successfully",severity:"success"})}catch(i){J.error("Error deleting item:",i),ge({open:!0,message:`Error deleting item: ${i.message}`,severity:"error"})}})(i.id,a),size:"small",sx:{color:t.palette.error.main,"&:hover":{backgroundColor:g(t.palette.error.main,.1)}},children:s.jsx(K,{fontSize:"small"})})]})})]},i.id))})]})})})(Je,Qe,0===pe?"proposition":"portfolioItem")})})]}),s.jsxs(b,{open:ie,onClose:Fe,fullWidth:!0,maxWidth:"md",PaperProps:{sx:{borderRadius:2,overflow:"hidden"}},children:[s.jsx(w,{sx:{backgroundColor:g(t.palette.primary.main,.1),color:t.palette.text.primary,fontWeight:600,py:2},children:ce?"Edit "+("proposition"===he?"Proposition":"Portfolio Item"):"Add New "+("proposition"===he?"Proposition":"Portfolio Item")}),s.jsxs(P,{sx:{p:3},children:[s.jsx(C,{autoFocus:!0,margin:"dense",label:"Name",fullWidth:!0,value:ne?.name||"",onChange:e=>le({...ne,name:e.target.value}),sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"Description",fullWidth:!0,multiline:!0,rows:4,value:ne?.description||"",onChange:e=>le({...ne,description:e.target.value}),sx:{mb:t.spacing(2)}}),"proposition"===he&&s.jsxs(s.Fragment,{children:[s.jsxs(k,{fullWidth:!0,margin:"dense",sx:{mb:t.spacing(2)},children:[s.jsx(S,{children:"Parent Proposition"}),s.jsxs(I,{value:ne?.parentPropositionId||"",onChange:e=>le({...ne,parentPropositionId:e.target.value}),children:[s.jsx(W,{value:"",children:s.jsx("em",{children:"None"})}),_.filter(e=>e.id!==ne?.id).map(e=>s.jsx(W,{value:e.id,children:e.name},e.id))]})]}),s.jsx(C,{margin:"dense",label:"What It Is",fullWidth:!0,multiline:!0,rows:4,value:ne?.whatItIs||"",onChange:e=>le({...ne,whatItIs:e.target.value}),sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"How It Works",fullWidth:!0,multiline:!0,rows:4,value:ne?.howItWorks||"",onChange:e=>le({...ne,howItWorks:e.target.value}),sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"Why It Matters",fullWidth:!0,multiline:!0,rows:4,value:ne?.whyItMatters||"",onChange:e=>le({...ne,whyItMatters:e.target.value}),sx:{mb:t.spacing(2)}}),s.jsxs(k,{fullWidth:!0,margin:"dense",sx:{mb:t.spacing(2)},children:[s.jsx(S,{children:"Associated Services"}),s.jsxs(I,{multiple:!0,value:ne?.associatedServices||[],onChange:e=>le({...ne,associatedServices:e.target.value}),renderValue:e=>s.jsx(l,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map(e=>s.jsx(M,{label:e},e))}),children:[s.jsx(W,{value:"Service 1",children:"Service 1"}),s.jsx(W,{value:"Service 2",children:"Service 2"}),s.jsx(W,{value:"Service 3",children:"Service 3"})]})]}),s.jsxs(k,{fullWidth:!0,margin:"dense",sx:{mb:t.spacing(2)},children:[s.jsx(S,{children:"Associated Products"}),s.jsx(I,{multiple:!0,value:ne?.associatedProducts||[],onChange:e=>le({...ne,associatedProducts:e.target.value}),renderValue:e=>s.jsx(l,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map(e=>{const t=Y.find(s=>s.id===e);return t?s.jsx(M,{label:t.name},e):null})}),children:Y.map(e=>s.jsx(W,{value:e.id,children:e.name},e.id))})]})]}),"portfolioItem"===he&&s.jsxs(s.Fragment,{children:[s.jsxs(k,{fullWidth:!0,margin:"dense",sx:{mb:t.spacing(2)},children:[s.jsx(S,{children:"Category"}),s.jsxs(I,{value:ne?.category||"",onChange:e=>le({...ne,category:e.target.value}),children:[s.jsx(W,{value:"Product",children:"Product"}),s.jsx(W,{value:"Service",children:"Service"})]})]}),s.jsxs(k,{fullWidth:!0,margin:"dense",sx:{mb:t.spacing(2)},children:[s.jsx(S,{children:"Type"}),s.jsxs(I,{value:ne?.type||"",onChange:e=>le({...ne,type:e.target.value}),children:[s.jsx(W,{value:"Software",children:"Software"}),s.jsx(W,{value:"Hardware",children:"Hardware"}),s.jsx(W,{value:"Consulting",children:"Consulting"})]})]}),s.jsxs(k,{fullWidth:!0,margin:"dense",sx:{mb:t.spacing(2)},children:[s.jsx(S,{children:"Delivery Type"}),s.jsxs(I,{value:ne?.deliveryType||"Internal",onChange:e=>le({...ne,deliveryType:e.target.value}),children:[s.jsx(W,{value:"Internal",children:"Internal"}),s.jsx(W,{value:"Third Party",children:"Third Party"})]})]}),"Third Party"===ne?.deliveryType&&s.jsx(C,{margin:"dense",label:"Third Party Provider",fullWidth:!0,value:ne?.thirdPartyProvider||"",onChange:e=>le({...ne,thirdPartyProvider:e.target.value}),sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"Market Share (%)",fullWidth:!0,type:"number",value:ne?.marketShare||"",onChange:e=>le({...ne,marketShare:parseFloat(e.target.value)}),sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"Market Growth (%)",fullWidth:!0,type:"number",value:ne?.marketGrowth||"",onChange:e=>le({...ne,marketGrowth:parseFloat(e.target.value)}),sx:{mb:t.spacing(2)}}),s.jsxs(k,{fullWidth:!0,margin:"dense",sx:{mb:t.spacing(2)},children:[s.jsx(S,{children:"PLC Stage"}),s.jsxs(I,{value:ne?.plcStage||"Introduction",onChange:e=>le({...ne,plcStage:e.target.value}),children:[s.jsx(W,{value:"Introduction",children:"Introduction"}),s.jsx(W,{value:"Growth",children:"Growth"}),s.jsx(W,{value:"Maturity",children:"Maturity"}),s.jsx(W,{value:"Decline",children:"Decline"})]})]}),s.jsx(C,{margin:"dense",label:"Pricing",fullWidth:!0,value:ne?.pricing||"",onChange:e=>le({...ne,pricing:e.target.value}),sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"Features",fullWidth:!0,multiline:!0,rows:4,value:ne?.features?.join("\n")||"",onChange:e=>le({...ne,features:e.target.value.split("\n").map(e=>e.trim())}),helperText:"Enter each feature on a new line",sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"Benefits",fullWidth:!0,multiline:!0,rows:4,value:ne?.benefits?.join("\n")||"",onChange:e=>le({...ne,benefits:e.target.value.split("\n").map(e=>e.trim())}),helperText:"Enter each benefit on a new line",sx:{mb:t.spacing(2)}}),s.jsx(C,{margin:"dense",label:"Technical Specifications",fullWidth:!0,multiline:!0,rows:4,value:ne?.technicalSpecifications||"",onChange:e=>le({...ne,technicalSpecifications:e.target.value}),sx:{mb:t.spacing(2)}})]})]}),s.jsxs(T,{sx:{px:3,py:2,borderTop:`1px solid ${t.palette.divider}`},children:[s.jsx(j,{onClick:Fe,sx:{color:t.palette.text.secondary,"&:hover":{backgroundColor:g(t.palette.text.secondary,.1)}},children:"Cancel"}),s.jsx(j,{onClick:async()=>{try{"proposition"===he?(ce?await n.updateProposition(e?.id,ne.id,ne):await n.createProposition(e?.id,ne),Re()):(ce?await n.updatePortfolioItem(e?.id,ne.id,ne):await n.createPortfolioItem(e?.id,ne),Ae()),Fe(),ge({open:!0,message:"Item saved successfully",severity:"success"})}catch(s){J.error("Error saving item:",s),ge({open:!0,message:`Error saving item: ${s.message}`,severity:"error"})}},variant:"contained",sx:{borderRadius:1,textTransform:"none",px:3},children:ce?"Save Changes":"Create"})]})]}),s.jsxs(b,{open:Pe,onClose:()=>Ce(!1),PaperProps:{sx:{borderRadius:2,overflow:"hidden"}},children:[s.jsx(w,{sx:{backgroundColor:g(t.palette.primary.main,.1),color:t.palette.text.primary,fontWeight:600,py:2},children:"Customize Columns"}),s.jsx(P,{sx:{p:3},children:s.jsx(Z,{children:Object.entries(Qe).map(([e,i])=>s.jsx(z,{control:s.jsx(D,{checked:i,onChange:()=>He(e,0===pe),sx:{"&.Mui-checked":{color:t.palette.primary.main}}}),label:Ne(e)},e))})}),s.jsx(T,{sx:{px:3,py:2,borderTop:`1px solid ${t.palette.divider}`},children:s.jsx(j,{onClick:()=>
1Ce(!1),sx:{color:t.palette.text.secondary,"&:hover":{backgroundColor:g(t.palette.text.secondary,.1)}},children:"Close"})})]}),s.jsx(R,{open:me.open,autoHideDuration:6e3,onClose:Ge,children:s.jsx(p,{onClose:Ge,severity:me.severity,sx:{width:"100%"},children:me.message})}),s.jsxs(b,{open:je.open,onClose:Ee,maxWidth:"md",fullWidth:!0,children:[s.jsx(w,{children:je.title}),s.jsx(P,{children:s.jsx(c,{children:je.content})}),s.jsx(T,{children:s.jsx(j,{onClick:Ee,children:"Close"})})]})]}):s.jsx(l,{children:s.jsx(c,{variant:"h6",color:"text.secondary",children:"Please select an Workspace to view and manage its portfolio."})})}),ne=()=>{const e=r(),{selectedWorkspace:t}=i(),[a,n]=o.useState(null);return t?.id?s.jsx(_,{children:s.jsxs(l,{sx:{display:"flex",flexDirection:"column",gap:3,height:"100%"},children:[s.jsx(X,{title:"Portfolio & Propositions",subtitle:"Manage your portfolio of products, services, and business propositions",icon:ie,color:"warning"}),s.jsxs(y,{elevation:0,sx:{flex:1,display:"flex",flexDirection:"column",border:1,borderColor:"divider",borderRadius:2,overflow:"hidden",bgcolor:e.palette.background.paper},children:[a&&s.jsx(p,{severity:"error",sx:{m:2},onClose:()=>n(null),children:a}),s.jsx(l,{sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",p:2},children:s.jsx(oe,{})})]})]})}):s.jsx(l,{sx:{display:"flex",flexDirection:"column",gap:2,height:"100%",justifyContent:"center",alignItems:"center"},children:s.jsx(p,{severity:"warning",children:"Please select a Workspace to view your portfolio."})})};export{ne as default};
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.