@e-llm-studio/requirement-ai 0.0.189 → 0.0.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),s=require("lucide-react"),i=require("../RequirementAIWrapper/RequirementAIWrapper.js"),a=require("@mui/material"),r=require("../../utils/userStoryAttachedContext.utils.js"),l=require("./AttachedContext.module.css.js"),o=function(e){return["mp4","mov","webm","mkv"].includes(e)?t.jsx(s.Video,{size:24}):["mp3","wav","ogg","m4a","aac"].includes(e)?t.jsx(s.Headphones,{size:24}):["png","jpg","jpeg","svg","webp","gif"].includes(e)?t.jsx(s.ImageIcon,{size:24}):["pdf","docx","doc","txt","rtf","pages"].includes(e)?t.jsx(s.FileText,{size:24}):t.jsx(s.FileCode,{size:24})},c=function(t,s){var a=i.useRequirementAI().apiCachingConfig,r=a.queryClient,l=a.useGetSignedUrlQuery,o=a.useGetSignedUrlMutation,c=a.getProjectFileUrl,u=null==c?void 0:c(t.path),d=["getSignedUrl",u],m=l(u,d).data,g=o(u),f=g.mutate,h=g.isPending;n.useEffect(function(){u?r.getQueryData(d)||m||f({gsUtilPath:u}):null==s||s("Please provide valid gsUtilPath.")},[u]);return{handleRedirect:function(n){return e.__awaiter(void 0,void 0,void 0,function(){var i,a,l,o,c,g,p;return e.__generator(this,function(e){switch(e.label){case 0:null==n||n.stopPropagation(),e.label=1;case 1:return e.trys.push([1,4,,5]),(i=m||r.getQueryData(d))?"json"!==t.extension.toLowerCase()?(window.open(i,"_blank"),[2]):[4,fetch(i)]:(!h&&u&&f({gsUtilPath:u}),[2]);case 2:if(!(a=e.sent()).ok)throw new Error("Failed to fetch artifact JSON");return[4,a.json()];case 3:return l=e.sent(),o=l.id,c=l.modeName,o&&c?(g="".concat(window.location.origin,"/artifact/").concat(o,"/mode/").concat(c),window.open(g,"_blank"),[3,5]):(window.open(i,"_blank"),[2]);case 4:return p=e.sent(),console.error("Redirect failed:",p),m?window.open(m,"_blank"):null==s||s("Failed to open the selected file."),[3,5];case 5:return[2]}})})},isPending:h,signedUrl:m}},u=function(i){var o=i.item,u=i.isLast,d=i.getIconByExtension,m=i.customStyles,g=n.useState(!1),f=g[0],h=g[1],p=n.useState(""),v=p[0],x=p[1],_=c(o,function(e){x(e),h(!0)}),j=_.handleRedirect,y=_.isPending,w=_.signedUrl;return t.jsxs("div",e.__assign({className:"".concat(l.default.contextItem," ").concat(u?l.default.lastItem:""),style:null==m?void 0:m.contextItem},{children:[t.jsx("div",e.__assign({className:l.default.itemIconWrapper,style:null==m?void 0:m.iconWrapper},{children:r.GetFileIcon(o.extension,o.title.toUpperCase())||d(o.extension)})),t.jsxs("div",e.__assign({className:l.default.itemContent,style:null==m?void 0:m.itemContent},{children:[t.jsx("h3",e.__assign({className:l.default.itemTitle,style:null==m?void 0:m.title},{children:o.title})),t.jsx("p",e.__assign({className:l.default.itemMeta,style:null==m?void 0:m.metadata},{children:o.metadata}))]})),t.jsx("div",e.__assign({onClick:j,className:"".concat(l.default.actionButton," ").concat(w?l.default.actionButtonReady:""),style:null==m?void 0:m.actionButton},{children:y?t.jsx(s.Loader2,{size:24,className:"animate-spin"}):t.jsx(s.ExternalLink,{size:24})})),t.jsx(a.Snackbar,e.__assign({open:f,autoHideDuration:3e3,onClose:function(){return h(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:t.jsxs(a.Alert,e.__assign({onClose:function(){return h(!1)},severity:"error",sx:{width:"100%"}},{children:[t.jsx(a.AlertTitle,{children:"Error"}),v]}))}))]}))},d=function(i){var r=i.item,o=n.useState(!1),u=o[0],d=o[1],m=n.useState(""),g=m[0],f=m[1],h=c(r,function(e){f(e),d(!0)}),p=h.handleRedirect,v=h.isPending;return t.jsxs(t.Fragment,{children:[t.jsxs("span",e.__assign({className:l.default.sourceChip,onClick:p},{children:[t.jsx("span",e.__assign({className:l.default.sourceChipLabel},{children:r.title})),v?t.jsx(s.Loader2,{size:12,className:"animate-spin"}):t.jsx(s.Eye,{size:12})]})),t.jsx(a.Snackbar,e.__assign({open:u,autoHideDuration:3e3,onClose:function(){return d(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:t.jsxs(a.Alert,e.__assign({onClose:function(){return d(!1)},severity:"error",sx:{width:"100%"}},{children:[t.jsx(a.AlertTitle,{children:"Error"}),g]}))}))]})},m=function(s){var i=s.flattenedData,a=n.useState(!1),r=a[0],o=a[1],c=r?i:i.slice(0,2);return t.jsxs("div",e.__assign({className:l.default.sourcesContainer},{children:[t.jsx("span",e.__assign({className:l.default.sourcesLabel},{children:"Sources :"})),t.jsx("div",e.__assign({className:r?l.default.sourcesScrollContainer:l.default.sourcesInlineContainer},{children:c.map(function(e){return t.jsx(d,{item:e},e.id)})})),!r&&i.length>2&&t.jsxs("span",e.__assign({className:l.default.moreChip,onClick:function(){return o(!0)}},{children:["+",i.length-2]})),r&&i.length>2&&t.jsx("span",e.__assign({className:l.default.moreChip,onClick:function(){return o(!1)}},{children:"Show Less"}))]}))};exports.default=function(a){var c=a.customStyles,d=a.variant,g=void 0===d?"dropdown":d,f=n.useState(!1),h=f[0],p=f[1],v=n.useRef(null),x=i.useRequirementAI().persistedDataFiles;n.useEffect(function(){var e=function(e){v.current&&!v.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);var _=n.useMemo(function(){var e=[];return x?(Object.entries(x).forEach(function(t){var n=t[0],s=t[1];Array.isArray(s)&&s.forEach(function(t){var s,i=t.filesFromProject;if(i){var a,l=i.name,o=(null===(s=i.type)||void 0===s?void 0:s.toLowerCase())||"",c=(a=i.uploadTime)?new Date(a).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"";e.push({id:i.url,category:n,title:l,extension:o,metadata:"".concat(c," • ").concat(r.getDisplayFileType(o,l)),path:i.url,uploadTime:i.uploadTime})}})}),e):e},[x]);return"inline"===g?0===_.length?null:t.jsx(m,{flattenedData:_}):t.jsx("div",e.__assign({className:l.default.wrapper,style:null==c?void 0:c.wrapperComponent},{children:t.jsxs("div",e.__assign({className:l.default.dropdownContainer,style:null==c?void 0:c.dropdownContainer,ref:v},{children:[t.jsxs("button",e.__assign({onClick:function(e){e.stopPropagation(),p(!h)},className:l.default.triggerButton,style:null==c?void 0:c.triggerButton},{children:[t.jsx(s.BookOpen,{size:18,className:l.default.triggerIcon,style:null==c?void 0:c.triggerIcon}),t.jsxs("span",e.__assign({className:l.default.triggerLabel,style:null==c?void 0:c.triggerLabel},{children:["Attached Context(",_.length,")"]})),h?t.jsx(s.ChevronUp,{size:18}):t.jsx(s.ChevronDown,{size:18})]})),h&&t.jsxs("div",e.__assign({className:l.default.dropdownPanel,style:null==c?void 0:c.dropdownPanel},{children:[t.jsx("div",e.__assign({className:l.default.dropdownList,style:null==c?void 0:c.dropdownList},{children:_.length>0?_.map(function(e,n){return t.jsx(u,{item:e,isLast:n===_.length-1,getIconByExtension:o,customStyles:null==c?void 0:c.contextItem},e.id)}):t.jsx("div",e.__assign({className:l.default.emptyState},{children:"No attachments found"}))})),_.length>4&&t.jsx("div",{className:l.default.fadeGradient,style:null==c?void 0:c.fadeGradient})]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),s=require("lucide-react"),i=require("../RequirementAIWrapper/RequirementAIWrapper.js"),a=require("@mui/material"),r=require("../../utils/userStoryAttachedContext.utils.js"),l=require("./AttachedContext.module.css.js"),o=function(e){return["mp4","mov","webm","mkv"].includes(e)?t.jsx(s.Video,{size:24}):["mp3","wav","ogg","m4a","aac"].includes(e)?t.jsx(s.Headphones,{size:24}):["png","jpg","jpeg","svg","webp","gif"].includes(e)?t.jsx(s.ImageIcon,{size:24}):["pdf","docx","doc","txt","rtf","pages"].includes(e)?t.jsx(s.FileText,{size:24}):t.jsx(s.FileCode,{size:24})},c=function(t,s){var a=i.useRequirementAI().apiCachingConfig,r=a.queryClient,l=a.useGetSignedUrlQuery,o=a.useGetSignedUrlMutation,c=a.getProjectFileUrl,d=null==c?void 0:c(t.path),u=["getSignedUrl",d],m=l(d,u).data,g=o(d),f=g.mutate,h=g.isPending;n.useEffect(function(){d?r.getQueryData(u)||m||f({gsUtilPath:d}):null==s||s("Please provide valid gsUtilPath.")},[d]);return{handleRedirect:function(n){return e.__awaiter(void 0,void 0,void 0,function(){var i,a,l,o,c,g,p;return e.__generator(this,function(e){switch(e.label){case 0:null==n||n.stopPropagation(),e.label=1;case 1:return e.trys.push([1,4,,5]),(i=m||r.getQueryData(u))?"json"!==t.extension.toLowerCase()?(window.open(i,"_blank"),[2]):[4,fetch(i)]:(!h&&d&&f({gsUtilPath:d}),[2]);case 2:if(!(a=e.sent()).ok)throw new Error("Failed to fetch artifact JSON");return[4,a.json()];case 3:return l=e.sent(),o=l.id,c=l.modeName,o&&c?(g="".concat(window.location.origin,"/artifact/").concat(o,"/mode/").concat(c),window.open(g,"_blank"),[3,5]):(window.open(i,"_blank"),[2]);case 4:return p=e.sent(),console.error("Redirect failed:",p),m?window.open(m,"_blank"):null==s||s("Failed to open the selected file."),[3,5];case 5:return[2]}})})},isPending:h,signedUrl:m}},d=function(i){var o=i.item,d=i.isLast,u=i.getIconByExtension,m=i.customStyles,g=n.useState(!1),f=g[0],h=g[1],p=n.useState(""),v=p[0],x=p[1],_=c(o,function(e){x(e),h(!0)}),j=_.handleRedirect,y=_.isPending,w=_.signedUrl;return t.jsxs("div",e.__assign({className:"".concat(l.default.contextItem," ").concat(d?l.default.lastItem:""),style:null==m?void 0:m.contextItem},{children:[t.jsx("div",e.__assign({className:l.default.itemIconWrapper,style:null==m?void 0:m.iconWrapper},{children:r.GetFileIcon(o.extension,o.title.toUpperCase())||u(o.extension)})),t.jsxs("div",e.__assign({className:l.default.itemContent,style:null==m?void 0:m.itemContent},{children:[t.jsx("h3",e.__assign({className:l.default.itemTitle,style:null==m?void 0:m.title},{children:o.title})),t.jsx("p",e.__assign({className:l.default.itemMeta,style:null==m?void 0:m.metadata},{children:o.metadata}))]})),t.jsx("div",e.__assign({onClick:j,className:"".concat(l.default.actionButton," ").concat(w?l.default.actionButtonReady:""),style:null==m?void 0:m.actionButton},{children:y?t.jsx(s.Loader2,{size:24,className:"animate-spin"}):t.jsx(s.ExternalLink,{size:24})})),t.jsx(a.Snackbar,e.__assign({open:f,autoHideDuration:3e3,onClose:function(){return h(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:t.jsxs(a.Alert,e.__assign({onClose:function(){return h(!1)},severity:"error",sx:{width:"100%"}},{children:[t.jsx(a.AlertTitle,{children:"Error"}),v]}))}))]}))},u=function(i){var r=i.item,o=n.useState(!1),d=o[0],u=o[1],m=n.useState(""),g=m[0],f=m[1],h=c(r,function(e){f(e),u(!0)}),p=h.handleRedirect,v=h.isPending;return t.jsxs(t.Fragment,{children:[t.jsxs("span",e.__assign({className:l.default.sourceChip,onClick:p},{children:[t.jsx("span",e.__assign({className:l.default.sourceChipLabel},{children:r.title})),v?t.jsx(s.Loader2,{size:12,className:"animate-spin"}):t.jsx(s.Eye,{size:12})]})),t.jsx(a.Snackbar,e.__assign({open:d,autoHideDuration:3e3,onClose:function(){return u(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:t.jsxs(a.Alert,e.__assign({onClose:function(){return u(!1)},severity:"error",sx:{width:"100%"}},{children:[t.jsx(a.AlertTitle,{children:"Error"}),g]}))}))]})},m=function(s){var i=s.flattenedData,a=n.useState(!1),r=a[0],o=a[1],c=r?i:i.slice(0,2);return t.jsxs("div",e.__assign({className:l.default.sourcesContainer},{children:[t.jsx("span",e.__assign({className:l.default.sourcesLabel},{children:"Sources :"})),t.jsxs("div",e.__assign({className:l.default.sourcesFilesContainer},{children:[c.map(function(e){return t.jsx(u,{item:e},e.id)}),!r&&i.length>2&&t.jsxs("span",e.__assign({className:l.default.moreChip,onClick:function(){return o(!0)}},{children:["+",i.length-2]})),r&&i.length>2&&t.jsx("span",e.__assign({className:l.default.moreChip,onClick:function(){return o(!1)}},{children:"View Less"}))]}))]}))};exports.default=function(a){var c=a.customStyles,u=a.variant,g=void 0===u?"dropdown":u,f=n.useState(!1),h=f[0],p=f[1],v=n.useRef(null),x=i.useRequirementAI().persistedDataFiles;n.useEffect(function(){var e=function(e){v.current&&!v.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);var _=n.useMemo(function(){var e=[];return x?(Object.entries(x).forEach(function(t){var n=t[0],s=t[1];Array.isArray(s)&&s.forEach(function(t){var s,i=t.filesFromProject;if(i){var a,l=i.name,o=(null===(s=i.type)||void 0===s?void 0:s.toLowerCase())||"",c=(a=i.uploadTime)?new Date(a).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"";e.push({id:i.url,category:n,title:l,extension:o,metadata:"".concat(c," • ").concat(r.getDisplayFileType(o,l)),path:i.url,uploadTime:i.uploadTime})}})}),e):e},[x]);return"inline"===g?0===_.length?null:t.jsx(m,{flattenedData:_}):t.jsx("div",e.__assign({className:l.default.wrapper,style:null==c?void 0:c.wrapperComponent},{children:t.jsxs("div",e.__assign({className:l.default.dropdownContainer,style:null==c?void 0:c.dropdownContainer,ref:v},{children:[t.jsxs("button",e.__assign({onClick:function(e){e.stopPropagation(),p(!h)},className:l.default.triggerButton,style:null==c?void 0:c.triggerButton},{children:[t.jsx(s.BookOpen,{size:18,className:l.default.triggerIcon,style:null==c?void 0:c.triggerIcon}),t.jsxs("span",e.__assign({className:l.default.triggerLabel,style:null==c?void 0:c.triggerLabel},{children:["Attached Context(",_.length,")"]})),h?t.jsx(s.ChevronUp,{size:18}):t.jsx(s.ChevronDown,{size:18})]})),h&&t.jsxs("div",e.__assign({className:l.default.dropdownPanel,style:null==c?void 0:c.dropdownPanel},{children:[t.jsx("div",e.__assign({className:l.default.dropdownList,style:null==c?void 0:c.dropdownList},{children:_.length>0?_.map(function(e,n){return t.jsx(d,{item:e,isLast:n===_.length-1,getIconByExtension:o,customStyles:null==c?void 0:c.contextItem},e.id)}):t.jsx("div",e.__assign({className:l.default.emptyState},{children:"No attachments found"}))})),_.length>4&&t.jsx("div",{className:l.default.fadeGradient,style:null==c?void 0:c.fadeGradient})]}))]}))}))};
2
2
  //# sourceMappingURL=AttachedContext.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".AttachedContext-module_wrapper__KHDIP{display:flex;flex-direction:column}.AttachedContext-module_dropdownContainer__TPFtZ{display:inline-block;position:relative;text-align:left}.AttachedContext-module_triggerButton__ZXDWZ{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 1px 2px 0 #0000000d;color:#374151;cursor:pointer;display:flex;gap:.5rem;padding:.5rem 1rem;transition:background-color .2s,border-color .2s}.AttachedContext-module_triggerButton__ZXDWZ:hover{background-color:#f9fafb}.AttachedContext-module_triggerIcon__cdeba{color:#4b5563}.AttachedContext-module_triggerLabel__7HM4O{font-weight:500}.AttachedContext-module_dropdownPanel__r-NRo{animation:AttachedContext-module_slideIn__ah8dZ .2s ease-out;background-color:#fff;border:1px solid #f3f4f6;border-radius:12px;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;left:0;margin-top:.5rem;overflow:hidden;position:absolute;width:420px;z-index:50}.AttachedContext-module_dropdownList__E-mKF{max-height:300px;overflow-y:auto;padding-bottom:.5rem;padding-top:.5rem}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar{width:6px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-track{background:#0000}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb{background:#e5e7eb;border-radius:10px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb:hover{background:#d1d5db}.AttachedContext-module_fadeGradient__ncpfP{background:linear-gradient(0deg,#f9fafb80,#0000);height:1rem;pointer-events:none}.AttachedContext-module_emptyState__WCYKW{color:#9ca3af;font-size:.875rem;padding:2rem;text-align:center}.AttachedContext-module_contextItem__I0Q9u{align-items:flex-start;border-bottom:1px solid #0000;border-radius:8px;display:flex;gap:1rem;margin-left:.5rem;margin-right:.5rem;padding:1rem;transition:background-color .15s}.AttachedContext-module_contextItem__I0Q9u:not(.AttachedContext-module_lastItem__fWT-n){border-bottom-color:#f3f4f6}.AttachedContext-module_contextItem__I0Q9u:hover{background-color:#f9fafb}.AttachedContext-module_itemIconWrapper__FjAJj{background-color:#f5f3ff;border-radius:8px;color:#8b5cf6;flex-shrink:0;margin-top:.25rem;padding:.5rem}.AttachedContext-module_itemContent__jwJwp{flex:1;min-width:0}.AttachedContext-module_itemTitle__e2hAN{color:#111827;font-size:.9375rem;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;transition:color .15s;white-space:nowrap}.AttachedContext-module_contextItem__I0Q9u:hover .AttachedContext-module_itemTitle__e2hAN{color:#7c3aed}.AttachedContext-module_itemMeta__Hw9Ct{color:#6b7280;font-size:.875rem;margin-bottom:0;margin-top:.125rem}.AttachedContext-module_actionButton__oQioa{align-self:center;background:none;border:none;border-radius:4px;color:#9ca3af;cursor:pointer;flex-shrink:0;line-height:0;padding:.5rem;transition:color .15s,background-color .15s}.AttachedContext-module_actionButton__oQioa:hover{background-color:#fff;color:#7c3aed}.AttachedContext-module_actionButtonReady__TbrP-{color:#6b7280}.AttachedContext-module_sourcesContainer__AP6PI,.AttachedContext-module_sourcesInlineContainer__DR4d8{align-items:center;display:flex;gap:8px;min-width:0}.AttachedContext-module_sourcesScrollContainer__FmVI2{-ms-overflow-style:none;align-items:center;display:flex;gap:8px;overflow-x:auto;overflow-y:hidden;padding-bottom:2px;scroll-behavior:smooth;scrollbar-width:none}.AttachedContext-module_sourcesScrollContainer__FmVI2::-webkit-scrollbar{display:none}.AttachedContext-module_sourcesLabel__VN-9Q{color:#374151;flex-shrink:0;font-size:14px;font-weight:600;line-height:20px}.AttachedContext-module_sourceChip__QsVPO{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:0;font-size:13px;font-weight:500;gap:6px;line-height:18px;padding:6px 12px;transition:background-color .15s ease,transform .15s ease}.AttachedContext-module_sourceChip__QsVPO:hover{background:#e0e7ff}.AttachedContext-module_sourceChipLabel__f29Qv{display:block;overflow:hidden;white-space:nowrap}.AttachedContext-module_moreChip__ieXRs{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:0;font-size:13px;font-weight:600;justify-content:center;line-height:18px;padding:6px 12px;transition:background-color .15s ease}.AttachedContext-module_moreChip__ieXRs:hover{background:#e0e7ff}@keyframes AttachedContext-module_slideIn__ah8dZ{0%{opacity:0;transform:translateY(-10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}(),exports.default={wrapper:"AttachedContext-module_wrapper__KHDIP",dropdownContainer:"AttachedContext-module_dropdownContainer__TPFtZ",triggerButton:"AttachedContext-module_triggerButton__ZXDWZ",triggerIcon:"AttachedContext-module_triggerIcon__cdeba",triggerLabel:"AttachedContext-module_triggerLabel__7HM4O",dropdownPanel:"AttachedContext-module_dropdownPanel__r-NRo",slideIn:"AttachedContext-module_slideIn__ah8dZ",dropdownList:"AttachedContext-module_dropdownList__E-mKF",fadeGradient:"AttachedContext-module_fadeGradient__ncpfP",emptyState:"AttachedContext-module_emptyState__WCYKW",contextItem:"AttachedContext-module_contextItem__I0Q9u",lastItem:"AttachedContext-module_lastItem__fWT-n",itemIconWrapper:"AttachedContext-module_itemIconWrapper__FjAJj",itemContent:"AttachedContext-module_itemContent__jwJwp",itemTitle:"AttachedContext-module_itemTitle__e2hAN",itemMeta:"AttachedContext-module_itemMeta__Hw9Ct",actionButton:"AttachedContext-module_actionButton__oQioa",actionButtonReady:"AttachedContext-module_actionButtonReady__TbrP-",sourcesContainer:"AttachedContext-module_sourcesContainer__AP6PI",sourcesInlineContainer:"AttachedContext-module_sourcesInlineContainer__DR4d8",sourcesScrollContainer:"AttachedContext-module_sourcesScrollContainer__FmVI2",sourcesLabel:"AttachedContext-module_sourcesLabel__VN-9Q",sourceChip:"AttachedContext-module_sourceChip__QsVPO",sourceChipLabel:"AttachedContext-module_sourceChipLabel__f29Qv",moreChip:"AttachedContext-module_moreChip__ieXRs"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".AttachedContext-module_wrapper__KHDIP{display:flex;flex-direction:column}.AttachedContext-module_dropdownContainer__TPFtZ{display:inline-block;position:relative;text-align:left}.AttachedContext-module_triggerButton__ZXDWZ{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 1px 2px 0 #0000000d;color:#374151;cursor:pointer;display:flex;gap:.5rem;padding:.5rem 1rem;transition:background-color .2s,border-color .2s}.AttachedContext-module_triggerButton__ZXDWZ:hover{background-color:#f9fafb}.AttachedContext-module_triggerIcon__cdeba{color:#4b5563}.AttachedContext-module_triggerLabel__7HM4O{font-weight:500}.AttachedContext-module_dropdownPanel__r-NRo{animation:AttachedContext-module_slideIn__ah8dZ .2s ease-out;background-color:#fff;border:1px solid #f3f4f6;border-radius:12px;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;left:0;margin-top:.5rem;overflow:hidden;position:absolute;width:420px;z-index:50}.AttachedContext-module_dropdownList__E-mKF{max-height:300px;overflow-y:auto;padding-bottom:.5rem;padding-top:.5rem}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar{width:6px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-track{background:#0000}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb{background:#e5e7eb;border-radius:10px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb:hover{background:#d1d5db}.AttachedContext-module_fadeGradient__ncpfP{background:linear-gradient(0deg,#f9fafb80,#0000);height:1rem;pointer-events:none}.AttachedContext-module_emptyState__WCYKW{color:#9ca3af;font-size:.875rem;padding:2rem;text-align:center}.AttachedContext-module_contextItem__I0Q9u{align-items:flex-start;border-bottom:1px solid #0000;border-radius:8px;display:flex;gap:1rem;margin-left:.5rem;margin-right:.5rem;padding:1rem;transition:background-color .15s}.AttachedContext-module_contextItem__I0Q9u:not(.AttachedContext-module_lastItem__fWT-n){border-bottom-color:#f3f4f6}.AttachedContext-module_contextItem__I0Q9u:hover{background-color:#f9fafb}.AttachedContext-module_itemIconWrapper__FjAJj{background-color:#f5f3ff;border-radius:8px;color:#8b5cf6;flex-shrink:0;margin-top:.25rem;padding:.5rem}.AttachedContext-module_itemContent__jwJwp{flex:1;min-width:0}.AttachedContext-module_itemTitle__e2hAN{color:#111827;font-size:.9375rem;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;transition:color .15s;white-space:nowrap}.AttachedContext-module_contextItem__I0Q9u:hover .AttachedContext-module_itemTitle__e2hAN{color:#7c3aed}.AttachedContext-module_itemMeta__Hw9Ct{color:#6b7280;font-size:.875rem;margin-bottom:0;margin-top:.125rem}.AttachedContext-module_actionButton__oQioa{align-self:center;background:none;border:none;border-radius:4px;color:#9ca3af;cursor:pointer;flex-shrink:0;line-height:0;padding:.5rem;transition:color .15s,background-color .15s}.AttachedContext-module_actionButton__oQioa:hover{background-color:#fff;color:#7c3aed}.AttachedContext-module_actionButtonReady__TbrP-{color:#6b7280}.AttachedContext-module_sourcesContainer__AP6PI{align-items:flex-start;display:flex;gap:8px;min-width:0;width:100%}.AttachedContext-module_sourcesFilesContainer__-Mnhn{align-items:center;display:flex;flex-wrap:wrap;gap:8px;min-width:0}.AttachedContext-module_sourcesLabel__VN-9Q{color:#374151;flex-shrink:0;font-size:14px;font-weight:600;line-height:20px}.AttachedContext-module_sourceChip__QsVPO{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:1;font-size:13px;font-weight:500;gap:6px;line-height:18px;min-width:0;padding:6px 12px;transition:background-color .15s ease,transform .15s ease}.AttachedContext-module_sourceChip__QsVPO:hover{background:#e0e7ff}.AttachedContext-module_sourceChipLabel__f29Qv{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AttachedContext-module_moreChip__ieXRs{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:0;font-size:13px;font-weight:600;justify-content:center;line-height:18px;padding:6px 12px;transition:background-color .15s ease}.AttachedContext-module_moreChip__ieXRs:hover{background:#e0e7ff}@keyframes AttachedContext-module_slideIn__ah8dZ{0%{opacity:0;transform:translateY(-10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}(),exports.default={wrapper:"AttachedContext-module_wrapper__KHDIP",dropdownContainer:"AttachedContext-module_dropdownContainer__TPFtZ",triggerButton:"AttachedContext-module_triggerButton__ZXDWZ",triggerIcon:"AttachedContext-module_triggerIcon__cdeba",triggerLabel:"AttachedContext-module_triggerLabel__7HM4O",dropdownPanel:"AttachedContext-module_dropdownPanel__r-NRo",slideIn:"AttachedContext-module_slideIn__ah8dZ",dropdownList:"AttachedContext-module_dropdownList__E-mKF",fadeGradient:"AttachedContext-module_fadeGradient__ncpfP",emptyState:"AttachedContext-module_emptyState__WCYKW",contextItem:"AttachedContext-module_contextItem__I0Q9u",lastItem:"AttachedContext-module_lastItem__fWT-n",itemIconWrapper:"AttachedContext-module_itemIconWrapper__FjAJj",itemContent:"AttachedContext-module_itemContent__jwJwp",itemTitle:"AttachedContext-module_itemTitle__e2hAN",itemMeta:"AttachedContext-module_itemMeta__Hw9Ct",actionButton:"AttachedContext-module_actionButton__oQioa",actionButtonReady:"AttachedContext-module_actionButtonReady__TbrP-",sourcesContainer:"AttachedContext-module_sourcesContainer__AP6PI",sourcesFilesContainer:"AttachedContext-module_sourcesFilesContainer__-Mnhn",sourcesLabel:"AttachedContext-module_sourcesLabel__VN-9Q",sourceChip:"AttachedContext-module_sourceChip__QsVPO",sourceChipLabel:"AttachedContext-module_sourceChipLabel__f29Qv",moreChip:"AttachedContext-module_moreChip__ieXRs"};
2
2
  //# sourceMappingURL=AttachedContext.module.css.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),s=require("lucide-react"),i=require("showdown"),l=require("@mui/material"),r=require("uuid"),o=require("./UserStoryCard.module.css.js"),a=require("../../utils/helpers.js"),u=require("../../utils/user-story.utils.js"),d=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),f=require("../userstory-with-citation/UserStoryWithCitation.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js"),_=require("../story-screen/BigEnoughPanel.js"),g=require("./TitleEditor/TitleEditor.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=y(i);function m(n){for(var i,o=[],a=/<learned>(.*?)<\/learned>/g,u=0,d=0;null!==(i=a.exec(n));){var c=i[1],f=i.index;f>u&&o.push(t.jsx("span",{children:n.slice(u,f)},"text-pre-".concat(d++))),o.push(t.jsx(l.Tooltip,e.__assign({title:c,placement:"top"},{children:t.jsx(s.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(r.v4()))),u=a.lastIndex}return u<(null==n?void 0:n.length)&&o.push(t.jsx("span",{children:n.slice(u)},"text-post-".concat(d++))),o}function p(t,n,s){var i;if(!t)return{};if(n)return e.__assign({},t.parentConfig);var l=e.__assign({},t.childConfig);return s&&(null===(i=t.subFeatureOverrides)||void 0===i?void 0:i[s])?e.__assign(e.__assign({},l),t.subFeatureOverrides[s]):l}var x=function(n){var i,l=n.displayName,r=v.useRequirementAI().customStyles,a=null===(i=null==r?void 0:r.userStoryCardStyles)||void 0===i?void 0:i.showDisplayName;return t.jsxs("div",e.__assign({className:o.default.displayName,style:null==a?void 0:a.wrapper},{children:[t.jsx(s.Bookmark,{className:o.default.displayNameIcon,style:null==a?void 0:a.displayNameIcon}),t.jsxs("span",e.__assign({style:null==a?void 0:a.label},{children:[l,":"]}))]}))},S=function(i){var y,C,I,j,w,b,N,B=i.isUserStoryCurrentlyUpdated,D=i.artifactId,U=i.artifactTitleId,k=i.parentUserStory,E=i.currentUserStory,M=i.onUserStoryChange,A=i.parentIndex,T=i.currentIndex,q=i.enableDownload,P=i.isDiffEditReviewMode,R=i.showUserStoryDiff,L=i.handleDownloadUserStory,H=i.handleOpenSendDialog,V=i.updateUserStoryArtifact,W=i.selectedArtifactId,z=i.isDisplayHighlightControl,O=i.elementDisplayConfig,F=i._resolvedConfig,G=i.showWrapper,Q=void 0!==G&&G,Z=i.actionItemsConfig,J=i.onDelete,K=i.contextVariant,X=v.useRequirementAI(),Y=X.searchQueryList,$=X.citations,ee=X.customStyles,te=null==ee?void 0:ee.userStoryCardStyles,ne=null===(y=null==ee?void 0:ee.userStoryCardStyles)||void 0===y?void 0:y.userStoryEditStyles,se=null===(C=null==ee?void 0:ee.userStoryScreenStyles)||void 0===C?void 0:C.userStoryContentStyles,ie=null==te?void 0:te.progressHeaderStyles,le=n.useState(e.__assign(e.__assign({},structuredClone(E)),{value:a.formatMarkdown(E.value)||""})),re=le[0],oe=le[1],ae=n.useState({userStory:!!E.isDefaultEdit}),ue=ae[0],de=ae[1],ce=n.useState(!1),fe=ce[0],ve=ce[1],_e=n.useState(null),ge=_e[0],ye=_e[1],he=v.useRequirementAI(),me=he.userStory,pe=he.customIcons,xe=n.useState(""===A||W===E.artifactId||!!E.isDefaultOpen),Se=xe[0],Ce=xe[1],Ie=n.useState(!1);Ie[0];var je=Ie[1],we=n.useState(null),be=we[0],Ne=we[1],Be=n.useState(null),De=Be[0],Ue=Be[1],ke=n.useState(!1),Ee=ke[0],Me=ke[1],Ae=n.useRef(null),Te=n.useState(!1);Te[0];var qe=Te[1],Pe=n.useRef(null);n.useEffect(function(){B&&Ce(B)},[B]),n.useEffect(function(){oe(e.__assign(e.__assign({},structuredClone(E)),{value:a.formatMarkdown(E.value)||""}))},[E]),n.useEffect(function(){Y.length>0?Ce(!0):W&&Ce(W===E.artifactId)},[Y,W,E.artifactId]);var Re=function(){Ne(null)},Le=function(){Ue(null)},He=function(){Ce(function(e){return!e})};var Ve=null!=(null==E?void 0:E.big_enough)&&!Number.isNaN(E.big_enough)&&!!(null==E?void 0:E.big_enough_decision_factors),We=""===A,ze=null!=F?F:p(O,We),Oe=!P&&!R;return n.useEffect(function(){if(ge){var e=setTimeout(function(){var e=document.getElementById("story-card-".concat(ge));null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return function(){return clearTimeout(e)}}},[ge]),n.useEffect(function(){E.isDefaultEdit&&de(function(t){return e.__assign(e.__assign({},t),{userStory:!0})})},[E.isDefaultEdit]),t.jsxs("div",e.__assign({className:o.default.card,style:null==te?void 0:te.cardStyle,id:"story-card-".concat(E.title),"data-expanded":Se},{children:[t.jsxs("div",e.__assign({className:o.default.titleSection,style:null==te?void 0:te.titleSection},{children:[t.jsxs("div",e.__assign({className:o.default.titleRow,style:null==te?void 0:te.titleRow,onClick:He},{children:[t.jsxs("div",e.__assign({className:o.default.titleLeft,style:null==te?void 0:te.titleLeft,onMouseEnter:function(){return qe(!0)},onMouseLeave:function(){return qe(!1)}},{children:[t.jsx(x,{displayName:U}),fe&&Oe?t.jsx(g.InlineTitleEditor,{title:E.title,onSave:function(t){return function(t,n){return e.__awaiter(void 0,void 0,void 0,function(){var s,i;return e.__generator(this,function(l){try{s=e.__assign({},E),E.artifactId===n?s.title=t:s.sub_features=(null===(i=E.sub_features)||void 0===i?void 0:i.map(function(s){return s.artifactId===n?e.__assign(e.__assign({},s),{title:t}):s}))||[],oe(s),M(s),ve(!1)}catch(e){console.error("Failed to save title",e)}return[2]})})}(t,E.artifactId)},onCancel:function(){ve(!1)},inputStyle:null==ne?void 0:ne.inlineTitleInput,confirmButtonStyle:null==ne?void 0:ne.inlineTitleConfirm,cancelButtonStyle:null==ne?void 0:ne.inlineTitleCancel},"inline-title-editor"):t.jsxs("div",e.__assign({className:o.default.storyTitleWrapper},{children:[t.jsx("h2",e.__assign({title:E.title,className:o.default.storyTitle,style:null==te?void 0:te.storyTitle},{children:m(E.title)}),E.artifactId),t.jsx("button",e.__assign({type:"button",className:o.default.titleEditButton,style:null==ne?void 0:ne.titleEditButton,onClick:function(e){e.stopPropagation(),ve(!0),Se||Ce(!0)},"aria-label":"Edit title",title:"Edit title"},{children:t.jsx("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:t.jsx("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),t.jsxs("div",e.__assign({className:o.default.titleActions,style:null==te?void 0:te.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[(ze.showProgressPercentage||ze.showGapBox)&&Q&&t.jsxs("div",e.__assign({className:o.default.progressHeader,style:null==ie?void 0:ie.wrapper},{children:[ze.showProgressPercentage&&t.jsxs("div",e.__assign({className:o.default.progressPercentage,style:null==ie?void 0:ie.percentage},{children:[null!==(j=null!==(I=null==E?void 0:E.confidenceScore)&&void 0!==I?I:null==ze?void 0:ze.confidenceValue)&&void 0!==j?j:"0","%"]})),ze.showGapBox&&t.jsxs("div",e.__assign({className:o.default.gapBox,style:null==ie?void 0:ie.gapBox},{children:[null!==(b=null!==(w=null==E?void 0:E.gapValue)&&void 0!==w?w:null==ze?void 0:ze.gapBoxValue)&&void 0!==b?b:"2"," ","Gaps"]}))]})),Ve&&t.jsx(_.BigEnoughPanel,{customIcons:null==pe?void 0:pe.userStoryIcons,customStyles:null==te?void 0:te.aiReasoningCitaionStyles,currentUserStory:E,panelStyles:null==te?void 0:te.BigEnoughStyles}),!ue.userStory&&t.jsxs(t.Fragment,{children:[!1!==(null==ze?void 0:ze.showShareButton)&&t.jsx("button",e.__assign({className:o.default.iconButton,style:null==te?void 0:te.iconButton,onClick:function(e){Ne(e.currentTarget)}},{children:t.jsx(s.ExternalLink,{size:16})})),t.jsxs(l.Menu,e.__assign({id:"user-story-share-menu",anchorEl:be,open:!!be,onClose:function(){return Ne(null)},style:null==te?void 0:te.userStoryShareMenu},{children:[q&&t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){switch(e.label){case 0:return je(!0),L?[4,Promise.all([L("pdf"),L("doc")])]:[2];case 1:return e.sent(),je(!1),[2]}})})}},{children:t.jsxs("div",e.__assign({ref:Ae,className:o.default.menuItemContent,style:null==te?void 0:te.menuItemContent},{children:[t.jsx(s.Download,{size:16,color:null==te?void 0:te.menuIconColor}),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:"Download"}))]}))})),t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){return t=E,k&&(t=e.__assign(e.__assign({},E),{value:"".concat(u.replaceTitleSection(null==k?void 0:k.value,E.title)," \n").concat(E.value)})),null==H||H(!0,[t],E.artifactId),Re(),[2]})})}},{children:t.jsxs("div",e.__assign({style:null==te?void 0:te.menuItemContent,className:o.default.menuItemContentPadded},{children:[t.jsx(s.Share2,{size:16,color:null==te?void 0:te.menuIconColor}),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:"Send"}))]}))})),t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n,s,i,l;return e.__generator(this,function(e){switch(e.label){case 0:t=new h.default.Converter,n=t.makeHtml(a.formatMarkdown(E.value)||E.value),s=function(e){var t=(new h.default.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(a.formatMarkdown(E.value)||E.value),i=new ClipboardItem({"text/plain":new Blob([s],{type:"text/plain"}),"text/html":new Blob([n],{type:"text/html"})}),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,navigator.clipboard.write([i])];case 2:return e.sent(),console.log("Copied User Story"),[3,5];case 3:return l=e.sent(),console.error("Failed to copy user story:",l),[3,5];case 4:return Re(),[7];case 5:return[2]}})})}},{children:t.jsxs("div",e.__assign({style:null==te?void 0:te.menuItemContent,className:o.default.menuItemContentPadded},{children:[t.jsx(s.Copy,{size:16,color:null==te?void 0:te.menuIconColor}),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:"Copy"}))]}))}))]}))]}),ue.userStory&&Se?t.jsx(d.default,{type:"outline",children:"Cancel",style:null==te?void 0:te.cancelButton,onClick:function(){var t;null===(t=Pe.current)||void 0===t||t.abort(),de(function(t){return e.__assign(e.__assign({},t),{userStory:!1})})}}):t.jsx(t.Fragment,{}),ue.userStory&&Se?t.jsx(d.default,{type:"fill",children:Ee?t.jsxs("span",e.__assign({className:o.default.savingSpinner,style:null==te?void 0:te.savingSpinner},{children:[t.jsx(s.LoaderCircle,{className:o.default.spinAnimation,style:null==te?void 0:te.spinAnimation}),t.jsx("span",{children:"Saving..."})]})):"Save",isDisable:Ee,style:Ee?null==te?void 0:te.savingButton:null==te?void 0:te.saveButton,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){switch(n.label){case 0:return Me(!0),"userStory"==="userStory"&&(M(re),console.log("I am changing RTE editor values",re)),[4,V($,me,D,null===(t=Pe.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),M(e.__assign(e.__assign({},re),{isDefaultEdit:!1})),de(function(t){return e.__assign(e.__assign({},t),{userStory:!1})}),Me(!1),[2]}})})}}):!P&&!R&&Se&&!1!==(null==ze?void 0:ze.showEditButton)&&t.jsx("button",e.__assign({className:o.default.iconButton,style:null==te?void 0:te.editButton,onClick:function(){return de(function(t){return e.__assign(e.__assign({},t),{userStory:!0})})}},{children:t.jsx(s.PencilIcon,{color:null==te?void 0:te.pencilIconColor,size:16})})),We&&Se&&!P&&!R&&!1!==(null==ze?void 0:ze.showEditButton)&&t.jsxs("button",e.__assign({type:"button",className:o.default.addSectionButton,style:null==ne?void 0:ne.addSectionButton,onClick:function(t){var n,s,i;t.stopPropagation();var l=(null!==(s=null===(n=E.sub_features)||void 0===n?void 0:n.length)&&void 0!==s?s:0)+1,o={artifactId:r.v4(),title:"New Section ".concat(l),value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a=e.__assign(e.__assign({},E),{sub_features:e.__spreadArray(e.__spreadArray([],null!==(i=E.sub_features)&&void 0!==i?i:[],!0),[o],!1)});oe(a),M(a),Ce(!0),ye(o.title)},"aria-label":"Add section",title:"Add section"},{children:[t.jsx(s.Plus,{size:14}),t.jsx("span",e.__assign({className:o.default.addSectionLabel},{children:"Add Section"}))]})),!We&&!P&&!R&&t.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),null==J||J()},className:o.default.iconButton,style:null==ne?void 0:ne.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:t.jsx(s.Trash2,{size:16})})),(null==ze?void 0:ze.actionItemsButton)&&t.jsxs(t.Fragment,{children:[t.jsx("span",e.__assign({className:o.default.actionItemBtn,style:null==te?void 0:te.actionItemBtn,onClick:function(e){e.stopPropagation(),Ue(e.currentTarget)}},{children:t.jsx(s.Ellipsis,{})})),t.jsx(l.Menu,e.__assign({id:"user-story-action-menu",anchorEl:De,open:!!De,onClose:Le,style:null==te?void 0:te.userStoryShareMenu},{children:null==Z?void 0:Z.items.map(function(n,s){return t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){n.onclick(),Le()}},{children:t.jsxs("div",e.__assign({className:o.default.menuItemContent,style:e.__assign(e.__assign({},null==te?void 0:te.menuItemContent),!n.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[t.jsx("span",e.__assign({className:o.default.menuItemIcon,style:null==te?void 0:te.menuItemIcon},{children:n.icon})),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:n.name})),t.jsx("span",{className:o.default.menuItemRight,style:null==te?void 0:te.menuItemRight})]}))}),"action-item-".concat(s,"-").concat(n.name))})}))]}),t.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),He()},style:null==te?void 0:te.chevronButton,className:o.default.chevronButton},{children:Se?t.jsx(s.ChevronUp,{className:o.default.chevronIcon,color:null==te?void 0:te.chevronIconColor}):t.jsx(s.ChevronDown,{className:o.default.chevronIcon,color:null==te?void 0:te.chevronIconColor})}))]}))]})),t.jsx("div",{className:o.default.divider,style:null==te?void 0:te.dividerStyle})]})),Se&&t.jsx("div",e.__assign({className:o.default.cardContent,style:null==te?void 0:te.cardContentStyle},{children:t.jsxs("div",e.__assign({className:o.default.contentInner,style:null==te?void 0:te.contentInner},{children:[t.jsxs("div",e.__assign({className:o.default.descriptionSection,style:null==te?void 0:te.descriptionSection},{children:[t.jsx("div",{className:o.default.justifyBetween,style:null==te?void 0:te.justifyBetween}),ue.userStory?t.jsx(c.default,{minHeight:"100%",height:"100%",type:"string",value:a.formatMarkdown(E.value)||"",handleUpdateState:function(t,n){var s=a.indentMarkdown(n);oe(function(t){return e.__assign(e.__assign({},t),{value:s||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:ue.userStory?"edit":"readOnly"}):t.jsx(f.default,{showUserStoryDiff:R,isParent:""===A,message:a.formatMarkdown(E.value)||"",artifactId:E.artifactId,customStyles:se,isDisplayHighlightControl:z,contextVariant:K})]})),null===(N=re.sub_features)||void 0===N?void 0:N.map(function(n,s){var i=p(O,!1,n.artifactId);return t.jsx(S,{artifactId:D,isUserStoryCurrentlyUpdated:B,artifactTitleId:"".concat(U,"-").concat(String.fromCharCode(65+s)),parentUserStory:E,parentIndex:"".concat(A).concat(A&&".").concat(T),currentIndex:"".concat(s+1),doNotShowBorderInViewMode:!1,currentUserStory:n,onUserStoryChange:function(t){return function(t,n){var s=e.__spreadArray([],E.sub_features||[],!0);s[t]=n,M(e.__assign(e.__assign({},E),{sub_features:s}))}(s,t)},enableDownload:!0,isDiffEditReviewMode:P,showUserStoryDiff:R,updateUserStoryArtifact:V,handleDownloadUserStory:L,handleOpenSendDialog:H,isDisplayHighlightControl:z,elementDisplayConfig:O,_resolvedConfig:i,actionItemsConfig:Z,onDelete:function(){return function(t){var n=(E.sub_features||[]).filter(function(e,n){return n!==t}),s=e.__assign(e.__assign({},E),{sub_features:n});oe(s),M(s)}(s)}},n.artifactId)})]}))}))]}))};exports.StoryCard=S,exports.UserStoryCardWrapper=function(n){var i=n.artifactTitleIDs,l=n.isDiffEditReviewMode,r=n.showUserStoryDiff,a=n.updateUserStoryArtifact,u=n.isUserStoryCurrentlyUpdated,d=n.artifactId,c=n.handleOpenSendDialog,f=n.handleDownloadUserStory,_=n.selectedArtifactId,g=n.isDisplayHighlightControl,y=n.elementDisplayConfig,h=n.showWrapper,m=n.actionItemsConfig,x=n.contextVariant,C=v.useRequirementAI(),I=C.userStory,j=C.setUserStory,w=C.customStyles,b=C.searchQueryList,N=C.currentHighlightIndex,B=C.setCurrentHighlightIndex;C.segmentComponentConfig;var D=null==w?void 0:w.userStoryCardStyles,U=0===N,k=N===b.length-1;return t.jsxs("div",e.__assign({className:o.default.userStoryCardWrapper,style:g?e.__assign(e.__assign({},null==D?void 0:D.userStoryCardWrapper),{position:"relative"}):null==D?void 0:D.userStoryCardWrapper},{children:[g&&t.jsx(t.Fragment,{children:b.length>0&&t.jsx("div",e.__assign({className:o.default.wrapper},{children:t.jsx("div",e.__assign({className:o.default.highlightNavigation},{children:t.jsxs("div",e.__assign({className:o.default.navigationContainer},{children:[t.jsxs("span",e.__assign({className:o.default.navCounter},{children:[N+1," of ",b.length]})),t.jsxs("div",e.__assign({className:o.default.navButtons},{children:[t.jsx("button",e.__assign({onClick:function(){N>0&&B(function(e){return e-1})},className:o.default.navButton,disabled:U},{children:t.jsx(s.ChevronUpIcon,{size:20,className:o.default.navIcon})})),t.jsx("button",e.__assign({onClick:function(){N<b.length-1&&B(function(e){return e+1})},className:o.default.navButton,disabled:k},{children:t.jsx(s.ChevronDownIcon,{size:20,className:o.default.navIcon})}))]}))]}))}))}))}),I.map(function(n,s){var o=p(y,!0);return t.jsx(S,{isUserStoryCurrentlyUpdated:u,artifactId:d,artifactTitleId:i[s]||"",currentUserStory:n,onUserStoryChange:function(t){j(function(n){return n[s]=t,e.__spreadArray([],n,!0)})},parentIndex:"",currentIndex:"".concat(s+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:l,showUserStoryDiff:r,updateUserStoryArtifact:a,handleOpenSendDialog:c,handleDownloadUserStory:f,selectedArtifactId:_,isDisplayHighlightControl:g,elementDisplayConfig:y,_resolvedConfig:o,showWrapper:h,actionItemsConfig:m,contextVariant:x},n.artifactId)})]}))},exports.default=S,exports.replaceLearnedTagsWithInfo=m;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),s=require("lucide-react"),i=require("showdown"),l=require("@mui/material"),r=require("uuid"),o=require("./UserStoryCard.module.css.js"),a=require("../../utils/helpers.js"),u=require("../../utils/user-story.utils.js"),d=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),f=require("../userstory-with-citation/UserStoryWithCitation.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js"),_=require("../story-screen/BigEnoughPanel.js"),g=require("./TitleEditor/TitleEditor.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=y(i);function m(n){for(var i,o=[],a=/<learned>(.*?)<\/learned>/g,u=0,d=0;null!==(i=a.exec(n));){var c=i[1],f=i.index;f>u&&o.push(t.jsx("span",{children:n.slice(u,f)},"text-pre-".concat(d++))),o.push(t.jsx(l.Tooltip,e.__assign({title:c,placement:"top"},{children:t.jsx(s.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(r.v4()))),u=a.lastIndex}return u<(null==n?void 0:n.length)&&o.push(t.jsx("span",{children:n.slice(u)},"text-post-".concat(d++))),o}function p(t,n,s){var i;if(!t)return{};if(n)return e.__assign({},t.parentConfig);var l=e.__assign({},t.childConfig);return s&&(null===(i=t.subFeatureOverrides)||void 0===i?void 0:i[s])?e.__assign(e.__assign({},l),t.subFeatureOverrides[s]):l}var x=function(n){var i,l=n.displayName,r=v.useRequirementAI().customStyles,a=null===(i=null==r?void 0:r.userStoryCardStyles)||void 0===i?void 0:i.showDisplayName;return t.jsxs("div",e.__assign({className:o.default.displayName,style:null==a?void 0:a.wrapper},{children:[t.jsx(s.Bookmark,{className:o.default.displayNameIcon,style:null==a?void 0:a.displayNameIcon}),t.jsxs("span",e.__assign({style:null==a?void 0:a.label},{children:[l,":"]}))]}))},S=function(i){var y,C,I,j,w,b,N,B=i.isUserStoryCurrentlyUpdated,D=i.artifactId,U=i.artifactTitleId,k=i.parentUserStory,E=i.currentUserStory,M=i.onUserStoryChange,A=i.parentIndex,T=i.currentIndex,q=i.enableDownload,P=i.isDiffEditReviewMode,R=i.showUserStoryDiff,L=i.handleDownloadUserStory,H=i.handleOpenSendDialog,V=i.updateUserStoryArtifact,W=i.selectedArtifactId,z=i.isDisplayHighlightControl,O=i.elementDisplayConfig,F=i._resolvedConfig,G=i.showWrapper,Q=void 0!==G&&G,Z=i.actionItemsConfig,J=i.onDelete,K=i.contextVariant,X=v.useRequirementAI(),Y=X.searchQueryList,$=X.citations,ee=X.customStyles,te=null==ee?void 0:ee.userStoryCardStyles,ne=null===(y=null==ee?void 0:ee.userStoryCardStyles)||void 0===y?void 0:y.userStoryEditStyles,se=null===(C=null==ee?void 0:ee.userStoryScreenStyles)||void 0===C?void 0:C.userStoryContentStyles,ie=null==te?void 0:te.progressHeaderStyles,le=n.useState(e.__assign(e.__assign({},structuredClone(E)),{value:a.formatMarkdown(E.value)||""})),re=le[0],oe=le[1],ae=n.useState({userStory:!!E.isDefaultEdit}),ue=ae[0],de=ae[1],ce=n.useState(!1),fe=ce[0],ve=ce[1],_e=n.useState(null),ge=_e[0],ye=_e[1],he=v.useRequirementAI(),me=he.userStory,pe=he.customIcons,xe=n.useState(""===A||W===E.artifactId||!!E.isDefaultOpen),Se=xe[0],Ce=xe[1],Ie=n.useState(!1);Ie[0];var je=Ie[1],we=n.useState(null),be=we[0],Ne=we[1],Be=n.useState(null),De=Be[0],Ue=Be[1],ke=n.useState(!1),Ee=ke[0],Me=ke[1],Ae=n.useRef(null),Te=n.useState(!1);Te[0];var qe=Te[1],Pe=n.useRef(null);n.useEffect(function(){B&&Ce(B)},[B]),n.useEffect(function(){oe(e.__assign(e.__assign({},structuredClone(E)),{value:a.formatMarkdown(E.value)||""}))},[E]),n.useEffect(function(){Y.length>0?Ce(!0):W&&Ce(W===E.artifactId)},[Y,W,E.artifactId]);var Re=function(){Ne(null)},Le=function(){Ue(null)},He=function(){Ce(function(e){return!e})};var Ve=null!=(null==E?void 0:E.big_enough)&&!Number.isNaN(E.big_enough)&&!!(null==E?void 0:E.big_enough_decision_factors),We=""===A,ze=null!=F?F:p(O,We),Oe=!P&&!R;return n.useEffect(function(){if(ge){var e=setTimeout(function(){var e=document.getElementById("story-card-".concat(ge));null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return function(){return clearTimeout(e)}}},[ge]),n.useEffect(function(){E.isDefaultEdit&&de(function(t){return e.__assign(e.__assign({},t),{userStory:!0})})},[E.isDefaultEdit]),t.jsxs("div",e.__assign({className:o.default.card,style:null==te?void 0:te.cardStyle,id:"story-card-".concat(E.title),"data-expanded":Se},{children:[t.jsxs("div",e.__assign({className:o.default.titleSection,style:null==te?void 0:te.titleSection},{children:[t.jsxs("div",e.__assign({className:o.default.titleRow,style:null==te?void 0:te.titleRow,onClick:He},{children:[t.jsxs("div",e.__assign({className:o.default.titleLeft,style:null==te?void 0:te.titleLeft,onMouseEnter:function(){return qe(!0)},onMouseLeave:function(){return qe(!1)}},{children:[t.jsx(x,{displayName:U}),fe&&Oe?t.jsx(g.InlineTitleEditor,{title:E.title,onSave:function(t){return function(t,n){return e.__awaiter(void 0,void 0,void 0,function(){var s,i;return e.__generator(this,function(l){try{s=e.__assign({},E),E.artifactId===n?s.title=t:s.sub_features=(null===(i=E.sub_features)||void 0===i?void 0:i.map(function(s){return s.artifactId===n?e.__assign(e.__assign({},s),{title:t}):s}))||[],oe(s),M(s),ve(!1)}catch(e){console.error("Failed to save title",e)}return[2]})})}(t,E.artifactId)},onCancel:function(){ve(!1)},inputStyle:null==ne?void 0:ne.inlineTitleInput,confirmButtonStyle:null==ne?void 0:ne.inlineTitleConfirm,cancelButtonStyle:null==ne?void 0:ne.inlineTitleCancel},"inline-title-editor"):t.jsxs("div",e.__assign({className:o.default.storyTitleWrapper},{children:[t.jsx("h2",e.__assign({title:E.title,className:o.default.storyTitle,style:null==te?void 0:te.storyTitle},{children:m(E.title)}),E.artifactId),t.jsx("button",e.__assign({type:"button",className:o.default.titleEditButton,style:null==ne?void 0:ne.titleEditButton,onClick:function(e){e.stopPropagation(),ve(!0),Se||Ce(!0)},"aria-label":"Edit title",title:"Edit title"},{children:t.jsx("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:t.jsx("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),t.jsxs("div",e.__assign({className:o.default.titleActions,style:null==te?void 0:te.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[(ze.showProgressPercentage||ze.showGapBox)&&Q&&t.jsxs("div",e.__assign({className:o.default.progressHeader,style:null==ie?void 0:ie.wrapper},{children:[ze.showProgressPercentage&&t.jsxs("div",e.__assign({className:o.default.progressPercentage,style:null==ie?void 0:ie.percentage},{children:[null!==(j=null!==(I=null==E?void 0:E.confidenceScore)&&void 0!==I?I:null==ze?void 0:ze.confidenceValue)&&void 0!==j?j:"0","%"]})),ze.showGapBox&&t.jsxs("div",e.__assign({className:o.default.gapBox,style:null==ie?void 0:ie.gapBox},{children:[null!==(b=null!==(w=null==E?void 0:E.gapValue)&&void 0!==w?w:null==ze?void 0:ze.gapBoxValue)&&void 0!==b?b:"2"," ","Gaps"]}))]})),Ve&&t.jsx(_.BigEnoughPanel,{customIcons:null==pe?void 0:pe.userStoryIcons,customStyles:null==te?void 0:te.aiReasoningCitaionStyles,currentUserStory:E,panelStyles:null==te?void 0:te.BigEnoughStyles}),!ue.userStory&&t.jsxs(t.Fragment,{children:[!1!==(null==ze?void 0:ze.showShareButton)&&t.jsx("button",e.__assign({className:o.default.iconButton,style:null==te?void 0:te.iconButton,onClick:function(e){Ne(e.currentTarget)}},{children:t.jsx(s.ExternalLink,{size:16})})),t.jsxs(l.Menu,e.__assign({id:"user-story-share-menu",anchorEl:be,open:!!be,onClose:function(){return Ne(null)},style:null==te?void 0:te.userStoryShareMenu},{children:[q&&t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){switch(e.label){case 0:return je(!0),L?[4,Promise.all([L("pdf"),L("doc")])]:[2];case 1:return e.sent(),je(!1),[2]}})})}},{children:t.jsxs("div",e.__assign({ref:Ae,className:o.default.menuItemContent,style:null==te?void 0:te.menuItemContent},{children:[t.jsx(s.Download,{size:16,color:null==te?void 0:te.menuIconColor}),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:"Download"}))]}))})),t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){return t=E,k&&(t=e.__assign(e.__assign({},E),{value:"".concat(u.replaceTitleSection(null==k?void 0:k.value,E.title)," \n").concat(E.value)})),null==H||H(!0,[t],E.artifactId),Re(),[2]})})}},{children:t.jsxs("div",e.__assign({style:null==te?void 0:te.menuItemContent,className:o.default.menuItemContentPadded},{children:[t.jsx(s.Share2,{size:16,color:null==te?void 0:te.menuIconColor}),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:"Send"}))]}))})),t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n,s,i,l;return e.__generator(this,function(e){switch(e.label){case 0:t=new h.default.Converter,n=t.makeHtml(a.formatMarkdown(E.value)||E.value),s=function(e){var t=(new h.default.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(a.formatMarkdown(E.value)||E.value),i=new ClipboardItem({"text/plain":new Blob([s],{type:"text/plain"}),"text/html":new Blob([n],{type:"text/html"})}),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,navigator.clipboard.write([i])];case 2:return e.sent(),console.log("Copied User Story"),[3,5];case 3:return l=e.sent(),console.error("Failed to copy user story:",l),[3,5];case 4:return Re(),[7];case 5:return[2]}})})}},{children:t.jsxs("div",e.__assign({style:null==te?void 0:te.menuItemContent,className:o.default.menuItemContentPadded},{children:[t.jsx(s.Copy,{size:16,color:null==te?void 0:te.menuIconColor}),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:"Copy"}))]}))}))]}))]}),ue.userStory&&Se?t.jsx(d.default,{type:"outline",children:"Cancel",style:null==te?void 0:te.cancelButton,onClick:function(){var t;null===(t=Pe.current)||void 0===t||t.abort(),de(function(t){return e.__assign(e.__assign({},t),{userStory:!1})})}}):t.jsx(t.Fragment,{}),ue.userStory&&Se?t.jsx(d.default,{type:"fill",children:Ee?t.jsxs("span",e.__assign({className:o.default.savingSpinner,style:null==te?void 0:te.savingSpinner},{children:[t.jsx(s.LoaderCircle,{className:o.default.spinAnimation,style:null==te?void 0:te.spinAnimation}),t.jsx("span",{children:"Saving..."})]})):"Save",isDisable:Ee,style:Ee?null==te?void 0:te.savingButton:null==te?void 0:te.saveButton,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){switch(n.label){case 0:return Me(!0),"userStory"==="userStory"&&(M(re),console.log("I am changing RTE editor values",re)),[4,V($,me,D,null===(t=Pe.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),M(e.__assign(e.__assign({},re),{isDefaultEdit:!1})),de(function(t){return e.__assign(e.__assign({},t),{userStory:!1})}),Me(!1),[2]}})})}}):!P&&!R&&Se&&!1!==(null==ze?void 0:ze.showEditButton)&&t.jsx("button",e.__assign({className:o.default.iconButton,style:null==te?void 0:te.editButton,onClick:function(){return de(function(t){return e.__assign(e.__assign({},t),{userStory:!0})})}},{children:t.jsx(s.PencilIcon,{color:null==te?void 0:te.pencilIconColor,size:16})})),We&&Se&&!P&&!R&&!1!==(null==ze?void 0:ze.showEditButton)&&t.jsxs("button",e.__assign({type:"button",className:o.default.addSectionButton,style:null==ne?void 0:ne.addSectionButton,onClick:function(t){var n,s,i;t.stopPropagation();var l=(null!==(s=null===(n=E.sub_features)||void 0===n?void 0:n.length)&&void 0!==s?s:0)+1,o={artifactId:r.v4(),title:"New Section ".concat(l),value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a=e.__assign(e.__assign({},E),{sub_features:e.__spreadArray(e.__spreadArray([],null!==(i=E.sub_features)&&void 0!==i?i:[],!0),[o],!1)});oe(a),M(a),Ce(!0),ye(o.title)},"aria-label":"Add section",title:"Add section"},{children:[t.jsx(s.Plus,{size:14}),t.jsx("span",e.__assign({className:o.default.addSectionLabel},{children:"Add Section"}))]})),!We&&!P&&!R&&t.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),null==J||J()},className:o.default.iconButton,style:null==ne?void 0:ne.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:t.jsx(s.Trash2,{size:16})})),(null==ze?void 0:ze.actionItemsButton)&&t.jsxs(t.Fragment,{children:[t.jsx("span",e.__assign({className:o.default.actionItemBtn,style:null==te?void 0:te.actionItemBtn,onClick:function(e){e.stopPropagation(),Ue(e.currentTarget)}},{children:t.jsx(s.Ellipsis,{})})),t.jsx(l.Menu,e.__assign({id:"user-story-action-menu",anchorEl:De,open:!!De,onClose:Le,style:null==te?void 0:te.userStoryShareMenu},{children:null==Z?void 0:Z.items.map(function(n,s){return t.jsx(l.MenuItem,e.__assign({style:null==te?void 0:te.userStoryMenuItem,onClick:function(){n.onclick(E),Le()}},{children:t.jsxs("div",e.__assign({className:o.default.menuItemContent,style:e.__assign(e.__assign({},null==te?void 0:te.menuItemContent),!n.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[t.jsx("span",e.__assign({className:o.default.menuItemIcon,style:null==te?void 0:te.menuItemIcon},{children:n.icon})),t.jsx("p",e.__assign({style:null==te?void 0:te.menuLabel},{children:n.name})),t.jsx("span",{className:o.default.menuItemRight,style:null==te?void 0:te.menuItemRight})]}))}),"action-item-".concat(s,"-").concat(n.name))})}))]}),t.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),He()},style:null==te?void 0:te.chevronButton,className:o.default.chevronButton},{children:Se?t.jsx(s.ChevronUp,{className:o.default.chevronIcon,color:null==te?void 0:te.chevronIconColor}):t.jsx(s.ChevronDown,{className:o.default.chevronIcon,color:null==te?void 0:te.chevronIconColor})}))]}))]})),t.jsx("div",{className:o.default.divider,style:null==te?void 0:te.dividerStyle})]})),Se&&t.jsx("div",e.__assign({className:o.default.cardContent,style:null==te?void 0:te.cardContentStyle},{children:t.jsxs("div",e.__assign({className:o.default.contentInner,style:null==te?void 0:te.contentInner},{children:[t.jsxs("div",e.__assign({className:o.default.descriptionSection,style:null==te?void 0:te.descriptionSection},{children:[t.jsx("div",{className:o.default.justifyBetween,style:null==te?void 0:te.justifyBetween}),ue.userStory?t.jsx(c.default,{minHeight:"100%",height:"100%",type:"string",value:a.formatMarkdown(E.value)||"",handleUpdateState:function(t,n){var s=a.indentMarkdown(n);oe(function(t){return e.__assign(e.__assign({},t),{value:s||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:ue.userStory?"edit":"readOnly"}):t.jsx(f.default,{showUserStoryDiff:R,isParent:""===A,message:a.formatMarkdown(E.value)||"",artifactId:E.artifactId,customStyles:se,isDisplayHighlightControl:z,contextVariant:K})]})),null===(N=re.sub_features)||void 0===N?void 0:N.map(function(n,s){var i=p(O,!1,n.artifactId);return t.jsx(S,{artifactId:D,isUserStoryCurrentlyUpdated:B,artifactTitleId:"".concat(U,"-").concat(String.fromCharCode(65+s)),parentUserStory:E,parentIndex:"".concat(A).concat(A&&".").concat(T),currentIndex:"".concat(s+1),doNotShowBorderInViewMode:!1,currentUserStory:n,onUserStoryChange:function(t){return function(t,n){var s=e.__spreadArray([],E.sub_features||[],!0);s[t]=n,M(e.__assign(e.__assign({},E),{sub_features:s}))}(s,t)},enableDownload:!0,isDiffEditReviewMode:P,showUserStoryDiff:R,updateUserStoryArtifact:V,handleDownloadUserStory:L,handleOpenSendDialog:H,isDisplayHighlightControl:z,elementDisplayConfig:O,_resolvedConfig:i,actionItemsConfig:Z,onDelete:function(){return function(t){var n=(E.sub_features||[]).filter(function(e,n){return n!==t}),s=e.__assign(e.__assign({},E),{sub_features:n});oe(s),M(s)}(s)}},n.artifactId)})]}))}))]}))};exports.StoryCard=S,exports.UserStoryCardWrapper=function(n){var i=n.artifactTitleIDs,l=n.isDiffEditReviewMode,r=n.showUserStoryDiff,a=n.updateUserStoryArtifact,u=n.isUserStoryCurrentlyUpdated,d=n.artifactId,c=n.handleOpenSendDialog,f=n.handleDownloadUserStory,_=n.selectedArtifactId,g=n.isDisplayHighlightControl,y=n.elementDisplayConfig,h=n.showWrapper,m=n.actionItemsConfig,x=n.contextVariant,C=v.useRequirementAI(),I=C.userStory,j=C.setUserStory,w=C.customStyles,b=C.searchQueryList,N=C.currentHighlightIndex,B=C.setCurrentHighlightIndex;C.segmentComponentConfig;var D=null==w?void 0:w.userStoryCardStyles,U=0===N,k=N===b.length-1;return t.jsxs("div",e.__assign({className:o.default.userStoryCardWrapper,style:g?e.__assign(e.__assign({},null==D?void 0:D.userStoryCardWrapper),{position:"relative"}):null==D?void 0:D.userStoryCardWrapper},{children:[g&&t.jsx(t.Fragment,{children:b.length>0&&t.jsx("div",e.__assign({className:o.default.wrapper},{children:t.jsx("div",e.__assign({className:o.default.highlightNavigation},{children:t.jsxs("div",e.__assign({className:o.default.navigationContainer},{children:[t.jsxs("span",e.__assign({className:o.default.navCounter},{children:[N+1," of ",b.length]})),t.jsxs("div",e.__assign({className:o.default.navButtons},{children:[t.jsx("button",e.__assign({onClick:function(){N>0&&B(function(e){return e-1})},className:o.default.navButton,disabled:U},{children:t.jsx(s.ChevronUpIcon,{size:20,className:o.default.navIcon})})),t.jsx("button",e.__assign({onClick:function(){N<b.length-1&&B(function(e){return e+1})},className:o.default.navButton,disabled:k},{children:t.jsx(s.ChevronDownIcon,{size:20,className:o.default.navIcon})}))]}))]}))}))}))}),I.map(function(n,s){var o=p(y,!0);return t.jsx(S,{isUserStoryCurrentlyUpdated:u,artifactId:d,artifactTitleId:i[s]||"",currentUserStory:n,onUserStoryChange:function(t){j(function(n){return n[s]=t,e.__spreadArray([],n,!0)})},parentIndex:"",currentIndex:"".concat(s+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:l,showUserStoryDiff:r,updateUserStoryArtifact:a,handleOpenSendDialog:c,handleDownloadUserStory:f,selectedArtifactId:_,isDisplayHighlightControl:g,elementDisplayConfig:y,_resolvedConfig:o,showWrapper:h,actionItemsConfig:m,contextVariant:x},n.artifactId)})]}))},exports.default=S,exports.replaceLearnedTagsWithInfo=m;
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsx as i,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as s,useMemo as c}from"react";import{BookOpen as d,ChevronUp as u,ChevronDown as m,Video as p,Headphones as h,ImageIcon as v,FileText as g,FileCode as f,Loader2 as y,ExternalLink as w,Eye as C}from"lucide-react";import{useRequirementAI as N}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{Snackbar as x,Alert as b,AlertTitle as L}from"@mui/material";import{getDisplayFileType as P,GetFileIcon as z}from"../../utils/userStoryAttachedContext.utils.js";import S from"./AttachedContext.module.css.js";var I=function(e){return["mp4","mov","webm","mkv"].includes(e)?i(p,{size:24}):["mp3","wav","ogg","m4a","aac"].includes(e)?i(h,{size:24}):["png","jpg","jpeg","svg","webp","gif"].includes(e)?i(v,{size:24}):["pdf","docx","doc","txt","rtf","pages"].includes(e)?i(g,{size:24}):i(f,{size:24})},j=function(e,i){var r=N().apiCachingConfig,o=r.queryClient,a=r.useGetSignedUrlQuery,l=r.useGetSignedUrlMutation,c=r.getProjectFileUrl,d=null==c?void 0:c(e.path),u=["getSignedUrl",d],m=a(d,u).data,p=l(d),h=p.mutate,v=p.isPending;s(function(){d?o.getQueryData(u)||m||h({gsUtilPath:d}):null==i||i("Please provide valid gsUtilPath.")},[d]);return{handleRedirect:function(r){return t(void 0,void 0,void 0,function(){var t,a,l,s,c,p,g;return n(this,function(n){switch(n.label){case 0:null==r||r.stopPropagation(),n.label=1;case 1:return n.trys.push([1,4,,5]),(t=m||o.getQueryData(u))?"json"!==e.extension.toLowerCase()?(window.open(t,"_blank"),[2]):[4,fetch(t)]:(!v&&d&&h({gsUtilPath:d}),[2]);case 2:if(!(a=n.sent()).ok)throw new Error("Failed to fetch artifact JSON");return[4,a.json()];case 3:return l=n.sent(),s=l.id,c=l.modeName,s&&c?(p="".concat(window.location.origin,"/artifact/").concat(s,"/mode/").concat(c),window.open(p,"_blank"),[3,5]):(window.open(t,"_blank"),[2]);case 4:return g=n.sent(),console.error("Redirect failed:",g),m?window.open(m,"_blank"):null==i||i("Failed to open the selected file."),[3,5];case 5:return[2]}})})},isPending:v,signedUrl:m}},k=function(t){var n=t.item,o=t.isLast,l=t.getIconByExtension,s=t.customStyles,c=a(!1),d=c[0],u=c[1],m=a(""),p=m[0],h=m[1],v=j(n,function(e){h(e),u(!0)}),g=v.handleRedirect,f=v.isPending,C=v.signedUrl;return r("div",e({className:"".concat(S.contextItem," ").concat(o?S.lastItem:""),style:null==s?void 0:s.contextItem},{children:[i("div",e({className:S.itemIconWrapper,style:null==s?void 0:s.iconWrapper},{children:z(n.extension,n.title.toUpperCase())||l(n.extension)})),r("div",e({className:S.itemContent,style:null==s?void 0:s.itemContent},{children:[i("h3",e({className:S.itemTitle,style:null==s?void 0:s.title},{children:n.title})),i("p",e({className:S.itemMeta,style:null==s?void 0:s.metadata},{children:n.metadata}))]})),i("div",e({onClick:g,className:"".concat(S.actionButton," ").concat(C?S.actionButtonReady:""),style:null==s?void 0:s.actionButton},{children:f?i(y,{size:24,className:"animate-spin"}):i(w,{size:24})})),i(x,e({open:d,autoHideDuration:3e3,onClose:function(){return u(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:r(b,e({onClose:function(){return u(!1)},severity:"error",sx:{width:"100%"}},{children:[i(L,{children:"Error"}),p]}))}))]}))},U=function(t){var n=t.item,l=a(!1),s=l[0],c=l[1],d=a(""),u=d[0],m=d[1],p=j(n,function(e){m(e),c(!0)}),h=p.handleRedirect,v=p.isPending;return r(o,{children:[r("span",e({className:S.sourceChip,onClick:h},{children:[i("span",e({className:S.sourceChipLabel},{children:n.title})),v?i(y,{size:12,className:"animate-spin"}):i(C,{size:12})]})),i(x,e({open:s,autoHideDuration:3e3,onClose:function(){return c(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:r(b,e({onClose:function(){return c(!1)},severity:"error",sx:{width:"100%"}},{children:[i(L,{children:"Error"}),u]}))}))]})},D=function(t){var n=t.flattenedData,o=a(!1),l=o[0],s=o[1],c=l?n:n.slice(0,2);return r("div",e({className:S.sourcesContainer},{children:[i("span",e({className:S.sourcesLabel},{children:"Sources :"})),i("div",e({className:l?S.sourcesScrollContainer:S.sourcesInlineContainer},{children:c.map(function(e){return i(U,{item:e},e.id)})})),!l&&n.length>2&&r("span",e({className:S.moreChip,onClick:function(){return s(!0)}},{children:["+",n.length-2]})),l&&n.length>2&&i("span",e({className:S.moreChip,onClick:function(){return s(!1)}},{children:"Show Less"}))]}))},E=function(t){var n=t.customStyles,o=t.variant,p=void 0===o?"dropdown":o,h=a(!1),v=h[0],g=h[1],f=l(null),y=N().persistedDataFiles;s(function(){var e=function(e){f.current&&!f.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);var w=c(function(){var e=[];return y?(Object.entries(y).forEach(function(t){var n=t[0],i=t[1];Array.isArray(i)&&i.forEach(function(t){var i,r=t.filesFromProject;if(r){var o,a=r.name,l=(null===(i=r.type)||void 0===i?void 0:i.toLowerCase())||"",s=(o=r.uploadTime)?new Date(o).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"";e.push({id:r.url,category:n,title:a,extension:l,metadata:"".concat(s," • ").concat(P(l,a)),path:r.url,uploadTime:r.uploadTime})}})}),e):e},[y]);return"inline"===p?0===w.length?null:i(D,{flattenedData:w}):i("div",e({className:S.wrapper,style:null==n?void 0:n.wrapperComponent},{children:r("div",e({className:S.dropdownContainer,style:null==n?void 0:n.dropdownContainer,ref:f},{children:[r("button",e({onClick:function(e){e.stopPropagation(),g(!v)},className:S.triggerButton,style:null==n?void 0:n.triggerButton},{children:[i(d,{size:18,className:S.triggerIcon,style:null==n?void 0:n.triggerIcon}),r("span",e({className:S.triggerLabel,style:null==n?void 0:n.triggerLabel},{children:["Attached Context(",w.length,")"]})),i(v?u:m,{size:18})]})),v&&r("div",e({className:S.dropdownPanel,style:null==n?void 0:n.dropdownPanel},{children:[i("div",e({className:S.dropdownList,style:null==n?void 0:n.dropdownList},{children:w.length>0?w.map(function(e,t){return i(k,{item:e,isLast:t===w.length-1,getIconByExtension:I,customStyles:null==n?void 0:n.contextItem},e.id)}):i("div",e({className:S.emptyState},{children:"No attachments found"}))})),w.length>4&&i("div",{className:S.fadeGradient,style:null==n?void 0:n.fadeGradient})]}))]}))}))};export{E as default};
1
+ import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsx as i,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as s,useMemo as c}from"react";import{BookOpen as d,ChevronUp as u,ChevronDown as m,Video as p,Headphones as h,ImageIcon as v,FileText as g,FileCode as f,Loader2 as y,ExternalLink as w,Eye as C}from"lucide-react";import{useRequirementAI as N}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{Snackbar as x,Alert as b,AlertTitle as L}from"@mui/material";import{getDisplayFileType as P,GetFileIcon as z}from"../../utils/userStoryAttachedContext.utils.js";import j from"./AttachedContext.module.css.js";var k=function(e){return["mp4","mov","webm","mkv"].includes(e)?i(p,{size:24}):["mp3","wav","ogg","m4a","aac"].includes(e)?i(h,{size:24}):["png","jpg","jpeg","svg","webp","gif"].includes(e)?i(v,{size:24}):["pdf","docx","doc","txt","rtf","pages"].includes(e)?i(g,{size:24}):i(f,{size:24})},I=function(e,i){var r=N().apiCachingConfig,o=r.queryClient,a=r.useGetSignedUrlQuery,l=r.useGetSignedUrlMutation,c=r.getProjectFileUrl,d=null==c?void 0:c(e.path),u=["getSignedUrl",d],m=a(d,u).data,p=l(d),h=p.mutate,v=p.isPending;s(function(){d?o.getQueryData(u)||m||h({gsUtilPath:d}):null==i||i("Please provide valid gsUtilPath.")},[d]);return{handleRedirect:function(r){return t(void 0,void 0,void 0,function(){var t,a,l,s,c,p,g;return n(this,function(n){switch(n.label){case 0:null==r||r.stopPropagation(),n.label=1;case 1:return n.trys.push([1,4,,5]),(t=m||o.getQueryData(u))?"json"!==e.extension.toLowerCase()?(window.open(t,"_blank"),[2]):[4,fetch(t)]:(!v&&d&&h({gsUtilPath:d}),[2]);case 2:if(!(a=n.sent()).ok)throw new Error("Failed to fetch artifact JSON");return[4,a.json()];case 3:return l=n.sent(),s=l.id,c=l.modeName,s&&c?(p="".concat(window.location.origin,"/artifact/").concat(s,"/mode/").concat(c),window.open(p,"_blank"),[3,5]):(window.open(t,"_blank"),[2]);case 4:return g=n.sent(),console.error("Redirect failed:",g),m?window.open(m,"_blank"):null==i||i("Failed to open the selected file."),[3,5];case 5:return[2]}})})},isPending:v,signedUrl:m}},S=function(t){var n=t.item,o=t.isLast,l=t.getIconByExtension,s=t.customStyles,c=a(!1),d=c[0],u=c[1],m=a(""),p=m[0],h=m[1],v=I(n,function(e){h(e),u(!0)}),g=v.handleRedirect,f=v.isPending,C=v.signedUrl;return r("div",e({className:"".concat(j.contextItem," ").concat(o?j.lastItem:""),style:null==s?void 0:s.contextItem},{children:[i("div",e({className:j.itemIconWrapper,style:null==s?void 0:s.iconWrapper},{children:z(n.extension,n.title.toUpperCase())||l(n.extension)})),r("div",e({className:j.itemContent,style:null==s?void 0:s.itemContent},{children:[i("h3",e({className:j.itemTitle,style:null==s?void 0:s.title},{children:n.title})),i("p",e({className:j.itemMeta,style:null==s?void 0:s.metadata},{children:n.metadata}))]})),i("div",e({onClick:g,className:"".concat(j.actionButton," ").concat(C?j.actionButtonReady:""),style:null==s?void 0:s.actionButton},{children:f?i(y,{size:24,className:"animate-spin"}):i(w,{size:24})})),i(x,e({open:d,autoHideDuration:3e3,onClose:function(){return u(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:r(b,e({onClose:function(){return u(!1)},severity:"error",sx:{width:"100%"}},{children:[i(L,{children:"Error"}),p]}))}))]}))},U=function(t){var n=t.item,l=a(!1),s=l[0],c=l[1],d=a(""),u=d[0],m=d[1],p=I(n,function(e){m(e),c(!0)}),h=p.handleRedirect,v=p.isPending;return r(o,{children:[r("span",e({className:j.sourceChip,onClick:h},{children:[i("span",e({className:j.sourceChipLabel},{children:n.title})),v?i(y,{size:12,className:"animate-spin"}):i(C,{size:12})]})),i(x,e({open:s,autoHideDuration:3e3,onClose:function(){return c(!1)},anchorOrigin:{vertical:"bottom",horizontal:"right"}},{children:r(b,e({onClose:function(){return c(!1)},severity:"error",sx:{width:"100%"}},{children:[i(L,{children:"Error"}),u]}))}))]})},D=function(t){var n=t.flattenedData,o=a(!1),l=o[0],s=o[1],c=l?n:n.slice(0,2);return r("div",e({className:j.sourcesContainer},{children:[i("span",e({className:j.sourcesLabel},{children:"Sources :"})),r("div",e({className:j.sourcesFilesContainer},{children:[c.map(function(e){return i(U,{item:e},e.id)}),!l&&n.length>2&&r("span",e({className:j.moreChip,onClick:function(){return s(!0)}},{children:["+",n.length-2]})),l&&n.length>2&&i("span",e({className:j.moreChip,onClick:function(){return s(!1)}},{children:"View Less"}))]}))]}))},E=function(t){var n=t.customStyles,o=t.variant,p=void 0===o?"dropdown":o,h=a(!1),v=h[0],g=h[1],f=l(null),y=N().persistedDataFiles;s(function(){var e=function(e){f.current&&!f.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);var w=c(function(){var e=[];return y?(Object.entries(y).forEach(function(t){var n=t[0],i=t[1];Array.isArray(i)&&i.forEach(function(t){var i,r=t.filesFromProject;if(r){var o,a=r.name,l=(null===(i=r.type)||void 0===i?void 0:i.toLowerCase())||"",s=(o=r.uploadTime)?new Date(o).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"";e.push({id:r.url,category:n,title:a,extension:l,metadata:"".concat(s," • ").concat(P(l,a)),path:r.url,uploadTime:r.uploadTime})}})}),e):e},[y]);return"inline"===p?0===w.length?null:i(D,{flattenedData:w}):i("div",e({className:j.wrapper,style:null==n?void 0:n.wrapperComponent},{children:r("div",e({className:j.dropdownContainer,style:null==n?void 0:n.dropdownContainer,ref:f},{children:[r("button",e({onClick:function(e){e.stopPropagation(),g(!v)},className:j.triggerButton,style:null==n?void 0:n.triggerButton},{children:[i(d,{size:18,className:j.triggerIcon,style:null==n?void 0:n.triggerIcon}),r("span",e({className:j.triggerLabel,style:null==n?void 0:n.triggerLabel},{children:["Attached Context(",w.length,")"]})),i(v?u:m,{size:18})]})),v&&r("div",e({className:j.dropdownPanel,style:null==n?void 0:n.dropdownPanel},{children:[i("div",e({className:j.dropdownList,style:null==n?void 0:n.dropdownList},{children:w.length>0?w.map(function(e,t){return i(S,{item:e,isLast:t===w.length-1,getIconByExtension:k,customStyles:null==n?void 0:n.contextItem},e.id)}):i("div",e({className:j.emptyState},{children:"No attachments found"}))})),w.length>4&&i("div",{className:j.fadeGradient,style:null==n?void 0:n.fadeGradient})]}))]}))}))};export{E as default};
2
2
  //# sourceMappingURL=AttachedContext.js.map
@@ -1,2 +1,2 @@
1
- var e={wrapper:"AttachedContext-module_wrapper__KHDIP",dropdownContainer:"AttachedContext-module_dropdownContainer__TPFtZ",triggerButton:"AttachedContext-module_triggerButton__ZXDWZ",triggerIcon:"AttachedContext-module_triggerIcon__cdeba",triggerLabel:"AttachedContext-module_triggerLabel__7HM4O",dropdownPanel:"AttachedContext-module_dropdownPanel__r-NRo",slideIn:"AttachedContext-module_slideIn__ah8dZ",dropdownList:"AttachedContext-module_dropdownList__E-mKF",fadeGradient:"AttachedContext-module_fadeGradient__ncpfP",emptyState:"AttachedContext-module_emptyState__WCYKW",contextItem:"AttachedContext-module_contextItem__I0Q9u",lastItem:"AttachedContext-module_lastItem__fWT-n",itemIconWrapper:"AttachedContext-module_itemIconWrapper__FjAJj",itemContent:"AttachedContext-module_itemContent__jwJwp",itemTitle:"AttachedContext-module_itemTitle__e2hAN",itemMeta:"AttachedContext-module_itemMeta__Hw9Ct",actionButton:"AttachedContext-module_actionButton__oQioa",actionButtonReady:"AttachedContext-module_actionButtonReady__TbrP-",sourcesContainer:"AttachedContext-module_sourcesContainer__AP6PI",sourcesInlineContainer:"AttachedContext-module_sourcesInlineContainer__DR4d8",sourcesScrollContainer:"AttachedContext-module_sourcesScrollContainer__FmVI2",sourcesLabel:"AttachedContext-module_sourcesLabel__VN-9Q",sourceChip:"AttachedContext-module_sourceChip__QsVPO",sourceChipLabel:"AttachedContext-module_sourceChipLabel__f29Qv",moreChip:"AttachedContext-module_moreChip__ieXRs"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".AttachedContext-module_wrapper__KHDIP{display:flex;flex-direction:column}.AttachedContext-module_dropdownContainer__TPFtZ{display:inline-block;position:relative;text-align:left}.AttachedContext-module_triggerButton__ZXDWZ{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 1px 2px 0 #0000000d;color:#374151;cursor:pointer;display:flex;gap:.5rem;padding:.5rem 1rem;transition:background-color .2s,border-color .2s}.AttachedContext-module_triggerButton__ZXDWZ:hover{background-color:#f9fafb}.AttachedContext-module_triggerIcon__cdeba{color:#4b5563}.AttachedContext-module_triggerLabel__7HM4O{font-weight:500}.AttachedContext-module_dropdownPanel__r-NRo{animation:AttachedContext-module_slideIn__ah8dZ .2s ease-out;background-color:#fff;border:1px solid #f3f4f6;border-radius:12px;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;left:0;margin-top:.5rem;overflow:hidden;position:absolute;width:420px;z-index:50}.AttachedContext-module_dropdownList__E-mKF{max-height:300px;overflow-y:auto;padding-bottom:.5rem;padding-top:.5rem}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar{width:6px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-track{background:#0000}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb{background:#e5e7eb;border-radius:10px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb:hover{background:#d1d5db}.AttachedContext-module_fadeGradient__ncpfP{background:linear-gradient(0deg,#f9fafb80,#0000);height:1rem;pointer-events:none}.AttachedContext-module_emptyState__WCYKW{color:#9ca3af;font-size:.875rem;padding:2rem;text-align:center}.AttachedContext-module_contextItem__I0Q9u{align-items:flex-start;border-bottom:1px solid #0000;border-radius:8px;display:flex;gap:1rem;margin-left:.5rem;margin-right:.5rem;padding:1rem;transition:background-color .15s}.AttachedContext-module_contextItem__I0Q9u:not(.AttachedContext-module_lastItem__fWT-n){border-bottom-color:#f3f4f6}.AttachedContext-module_contextItem__I0Q9u:hover{background-color:#f9fafb}.AttachedContext-module_itemIconWrapper__FjAJj{background-color:#f5f3ff;border-radius:8px;color:#8b5cf6;flex-shrink:0;margin-top:.25rem;padding:.5rem}.AttachedContext-module_itemContent__jwJwp{flex:1;min-width:0}.AttachedContext-module_itemTitle__e2hAN{color:#111827;font-size:.9375rem;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;transition:color .15s;white-space:nowrap}.AttachedContext-module_contextItem__I0Q9u:hover .AttachedContext-module_itemTitle__e2hAN{color:#7c3aed}.AttachedContext-module_itemMeta__Hw9Ct{color:#6b7280;font-size:.875rem;margin-bottom:0;margin-top:.125rem}.AttachedContext-module_actionButton__oQioa{align-self:center;background:none;border:none;border-radius:4px;color:#9ca3af;cursor:pointer;flex-shrink:0;line-height:0;padding:.5rem;transition:color .15s,background-color .15s}.AttachedContext-module_actionButton__oQioa:hover{background-color:#fff;color:#7c3aed}.AttachedContext-module_actionButtonReady__TbrP-{color:#6b7280}.AttachedContext-module_sourcesContainer__AP6PI,.AttachedContext-module_sourcesInlineContainer__DR4d8{align-items:center;display:flex;gap:8px;min-width:0}.AttachedContext-module_sourcesScrollContainer__FmVI2{-ms-overflow-style:none;align-items:center;display:flex;gap:8px;overflow-x:auto;overflow-y:hidden;padding-bottom:2px;scroll-behavior:smooth;scrollbar-width:none}.AttachedContext-module_sourcesScrollContainer__FmVI2::-webkit-scrollbar{display:none}.AttachedContext-module_sourcesLabel__VN-9Q{color:#374151;flex-shrink:0;font-size:14px;font-weight:600;line-height:20px}.AttachedContext-module_sourceChip__QsVPO{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:0;font-size:13px;font-weight:500;gap:6px;line-height:18px;padding:6px 12px;transition:background-color .15s ease,transform .15s ease}.AttachedContext-module_sourceChip__QsVPO:hover{background:#e0e7ff}.AttachedContext-module_sourceChipLabel__f29Qv{display:block;overflow:hidden;white-space:nowrap}.AttachedContext-module_moreChip__ieXRs{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:0;font-size:13px;font-weight:600;justify-content:center;line-height:18px;padding:6px 12px;transition:background-color .15s ease}.AttachedContext-module_moreChip__ieXRs:hover{background:#e0e7ff}@keyframes AttachedContext-module_slideIn__ah8dZ{0%{opacity:0;transform:translateY(-10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}();export{e as default};
1
+ var e={wrapper:"AttachedContext-module_wrapper__KHDIP",dropdownContainer:"AttachedContext-module_dropdownContainer__TPFtZ",triggerButton:"AttachedContext-module_triggerButton__ZXDWZ",triggerIcon:"AttachedContext-module_triggerIcon__cdeba",triggerLabel:"AttachedContext-module_triggerLabel__7HM4O",dropdownPanel:"AttachedContext-module_dropdownPanel__r-NRo",slideIn:"AttachedContext-module_slideIn__ah8dZ",dropdownList:"AttachedContext-module_dropdownList__E-mKF",fadeGradient:"AttachedContext-module_fadeGradient__ncpfP",emptyState:"AttachedContext-module_emptyState__WCYKW",contextItem:"AttachedContext-module_contextItem__I0Q9u",lastItem:"AttachedContext-module_lastItem__fWT-n",itemIconWrapper:"AttachedContext-module_itemIconWrapper__FjAJj",itemContent:"AttachedContext-module_itemContent__jwJwp",itemTitle:"AttachedContext-module_itemTitle__e2hAN",itemMeta:"AttachedContext-module_itemMeta__Hw9Ct",actionButton:"AttachedContext-module_actionButton__oQioa",actionButtonReady:"AttachedContext-module_actionButtonReady__TbrP-",sourcesContainer:"AttachedContext-module_sourcesContainer__AP6PI",sourcesFilesContainer:"AttachedContext-module_sourcesFilesContainer__-Mnhn",sourcesLabel:"AttachedContext-module_sourcesLabel__VN-9Q",sourceChip:"AttachedContext-module_sourceChip__QsVPO",sourceChipLabel:"AttachedContext-module_sourceChipLabel__f29Qv",moreChip:"AttachedContext-module_moreChip__ieXRs"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".AttachedContext-module_wrapper__KHDIP{display:flex;flex-direction:column}.AttachedContext-module_dropdownContainer__TPFtZ{display:inline-block;position:relative;text-align:left}.AttachedContext-module_triggerButton__ZXDWZ{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 1px 2px 0 #0000000d;color:#374151;cursor:pointer;display:flex;gap:.5rem;padding:.5rem 1rem;transition:background-color .2s,border-color .2s}.AttachedContext-module_triggerButton__ZXDWZ:hover{background-color:#f9fafb}.AttachedContext-module_triggerIcon__cdeba{color:#4b5563}.AttachedContext-module_triggerLabel__7HM4O{font-weight:500}.AttachedContext-module_dropdownPanel__r-NRo{animation:AttachedContext-module_slideIn__ah8dZ .2s ease-out;background-color:#fff;border:1px solid #f3f4f6;border-radius:12px;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;left:0;margin-top:.5rem;overflow:hidden;position:absolute;width:420px;z-index:50}.AttachedContext-module_dropdownList__E-mKF{max-height:300px;overflow-y:auto;padding-bottom:.5rem;padding-top:.5rem}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar{width:6px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-track{background:#0000}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb{background:#e5e7eb;border-radius:10px}.AttachedContext-module_dropdownList__E-mKF::-webkit-scrollbar-thumb:hover{background:#d1d5db}.AttachedContext-module_fadeGradient__ncpfP{background:linear-gradient(0deg,#f9fafb80,#0000);height:1rem;pointer-events:none}.AttachedContext-module_emptyState__WCYKW{color:#9ca3af;font-size:.875rem;padding:2rem;text-align:center}.AttachedContext-module_contextItem__I0Q9u{align-items:flex-start;border-bottom:1px solid #0000;border-radius:8px;display:flex;gap:1rem;margin-left:.5rem;margin-right:.5rem;padding:1rem;transition:background-color .15s}.AttachedContext-module_contextItem__I0Q9u:not(.AttachedContext-module_lastItem__fWT-n){border-bottom-color:#f3f4f6}.AttachedContext-module_contextItem__I0Q9u:hover{background-color:#f9fafb}.AttachedContext-module_itemIconWrapper__FjAJj{background-color:#f5f3ff;border-radius:8px;color:#8b5cf6;flex-shrink:0;margin-top:.25rem;padding:.5rem}.AttachedContext-module_itemContent__jwJwp{flex:1;min-width:0}.AttachedContext-module_itemTitle__e2hAN{color:#111827;font-size:.9375rem;font-weight:600;margin:0;overflow:hidden;text-overflow:ellipsis;transition:color .15s;white-space:nowrap}.AttachedContext-module_contextItem__I0Q9u:hover .AttachedContext-module_itemTitle__e2hAN{color:#7c3aed}.AttachedContext-module_itemMeta__Hw9Ct{color:#6b7280;font-size:.875rem;margin-bottom:0;margin-top:.125rem}.AttachedContext-module_actionButton__oQioa{align-self:center;background:none;border:none;border-radius:4px;color:#9ca3af;cursor:pointer;flex-shrink:0;line-height:0;padding:.5rem;transition:color .15s,background-color .15s}.AttachedContext-module_actionButton__oQioa:hover{background-color:#fff;color:#7c3aed}.AttachedContext-module_actionButtonReady__TbrP-{color:#6b7280}.AttachedContext-module_sourcesContainer__AP6PI{align-items:flex-start;display:flex;gap:8px;min-width:0;width:100%}.AttachedContext-module_sourcesFilesContainer__-Mnhn{align-items:center;display:flex;flex-wrap:wrap;gap:8px;min-width:0}.AttachedContext-module_sourcesLabel__VN-9Q{color:#374151;flex-shrink:0;font-size:14px;font-weight:600;line-height:20px}.AttachedContext-module_sourceChip__QsVPO{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:1;font-size:13px;font-weight:500;gap:6px;line-height:18px;min-width:0;padding:6px 12px;transition:background-color .15s ease,transform .15s ease}.AttachedContext-module_sourceChip__QsVPO:hover{background:#e0e7ff}.AttachedContext-module_sourceChipLabel__f29Qv{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.AttachedContext-module_moreChip__ieXRs{align-items:center;background:#eef2ff;border-radius:10px;color:#6366f1;cursor:pointer;display:inline-flex;flex-shrink:0;font-size:13px;font-weight:600;justify-content:center;line-height:18px;padding:6px 12px;transition:background-color .15s ease}.AttachedContext-module_moreChip__ieXRs:hover{background:#e0e7ff}@keyframes AttachedContext-module_slideIn__ah8dZ{0%{opacity:0;transform:translateY(-10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}();export{e as default};
2
2
  //# sourceMappingURL=AttachedContext.module.css.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as t,__generator as n,__spreadArray as o}from"tslib";import{jsxs as i,jsx as l,Fragment as r}from"react/jsx-runtime";import{useState as a,useRef as s,useEffect as u}from"react";import{ExternalLink as c,Download as d,Share2 as v,Copy as f,LoaderCircle as m,PencilIcon as y,Plus as h,Trash2 as p,Ellipsis as S,ChevronUp as g,ChevronDown as C,ChevronUpIcon as I,ChevronDownIcon as w,Info as b,Bookmark as N}from"lucide-react";import B from"showdown";import{Menu as D,MenuItem as x,Tooltip as U}from"@mui/material";import{v4 as E}from"uuid";import k from"./UserStoryCard.module.css.js";import{formatMarkdown as T,indentMarkdown as A}from"../../utils/helpers.js";import{replaceTitleSection as M}from"../../utils/user-story.utils.js";import _ from"../../shared/AtomicButton.js";import P from"../RichTextEditor/RichTextEditor.js";import H from"../userstory-with-citation/UserStoryWithCitation.js";import{useRequirementAI as R}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as j}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as L}from"./TitleEditor/TitleEditor.js";function V(t){for(var n,o=[],i=/<learned>(.*?)<\/learned>/g,r=0,a=0;null!==(n=i.exec(t));){var s=n[1],u=n.index;u>r&&o.push(l("span",{children:t.slice(r,u)},"text-pre-".concat(a++))),o.push(l(U,e({title:s,placement:"top"},{children:l(b,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(E()))),r=i.lastIndex}return r<(null==t?void 0:t.length)&&o.push(l("span",{children:t.slice(r)},"text-post-".concat(a++))),o}function z(t,n,o){var i;if(!t)return{};if(n)return e({},t.parentConfig);var l=e({},t.childConfig);return o&&(null===(i=t.subFeatureOverrides)||void 0===i?void 0:i[o])?e(e({},l),t.subFeatureOverrides[o]):l}var W=function(t){var n,o=t.displayName,r=R().customStyles,a=null===(n=null==r?void 0:r.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return i("div",e({className:k.displayName,style:null==a?void 0:a.wrapper},{children:[l(N,{className:k.displayNameIcon,style:null==a?void 0:a.displayNameIcon}),i("span",e({style:null==a?void 0:a.label},{children:[o,":"]}))]}))},O=function(I){var w,b,N,U,F,G,q,Q=I.isUserStoryCurrentlyUpdated,Z=I.artifactId,J=I.artifactTitleId,K=I.parentUserStory,X=I.currentUserStory,Y=I.onUserStoryChange,$=I.parentIndex,ee=I.currentIndex,te=I.enableDownload,ne=I.isDiffEditReviewMode,oe=I.showUserStoryDiff,ie=I.handleDownloadUserStory,le=I.handleOpenSendDialog,re=I.updateUserStoryArtifact,ae=I.selectedArtifactId,se=I.isDisplayHighlightControl,ue=I.elementDisplayConfig,ce=I._resolvedConfig,de=I.showWrapper,ve=void 0!==de&&de,fe=I.actionItemsConfig,me=I.onDelete,ye=I.contextVariant,he=R(),pe=he.searchQueryList,Se=he.citations,ge=he.customStyles,Ce=null==ge?void 0:ge.userStoryCardStyles,Ie=null===(w=null==ge?void 0:ge.userStoryCardStyles)||void 0===w?void 0:w.userStoryEditStyles,we=null===(b=null==ge?void 0:ge.userStoryScreenStyles)||void 0===b?void 0:b.userStoryContentStyles,be=null==Ce?void 0:Ce.progressHeaderStyles,Ne=a(e(e({},structuredClone(X)),{value:T(X.value)||""})),Be=Ne[0],De=Ne[1],xe=a({userStory:!!X.isDefaultEdit}),Ue=xe[0],Ee=xe[1],ke=a(!1),Te=ke[0],Ae=ke[1],Me=a(null),_e=Me[0],Pe=Me[1],He=R(),Re=He.userStory,je=He.customIcons,Le=a(""===$||ae===X.artifactId||!!X.isDefaultOpen),Ve=Le[0],ze=Le[1],We=a(!1);We[0];var Oe=We[1],Fe=a(null),Ge=Fe[0],qe=Fe[1],Qe=a(null),Ze=Qe[0],Je=Qe[1],Ke=a(!1),Xe=Ke[0],Ye=Ke[1],$e=s(null),et=a(!1);et[0];var tt=et[1],nt=s(null);u(function(){Q&&ze(Q)},[Q]),u(function(){De(e(e({},structuredClone(X)),{value:T(X.value)||""}))},[X]),u(function(){pe.length>0?ze(!0):ae&&ze(ae===X.artifactId)},[pe,ae,X.artifactId]);var ot=function(){qe(null)},it=function(){Je(null)},lt=function(){ze(function(e){return!e})};var rt=null!=(null==X?void 0:X.big_enough)&&!Number.isNaN(X.big_enough)&&!!(null==X?void 0:X.big_enough_decision_factors),at=""===$,st=null!=ce?ce:z(ue,at),ut=!ne&&!oe;return u(function(){if(_e){var e=setTimeout(function(){var e=document.getElementById("story-card-".concat(_e));null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return function(){return clearTimeout(e)}}},[_e]),u(function(){X.isDefaultEdit&&Ee(function(t){return e(e({},t),{userStory:!0})})},[X.isDefaultEdit]),i("div",e({className:k.card,style:null==Ce?void 0:Ce.cardStyle,id:"story-card-".concat(X.title),"data-expanded":Ve},{children:[i("div",e({className:k.titleSection,style:null==Ce?void 0:Ce.titleSection},{children:[i("div",e({className:k.titleRow,style:null==Ce?void 0:Ce.titleRow,onClick:lt},{children:[i("div",e({className:k.titleLeft,style:null==Ce?void 0:Ce.titleLeft,onMouseEnter:function(){return tt(!0)},onMouseLeave:function(){return tt(!1)}},{children:[l(W,{displayName:J}),Te&&ut?l(L,{title:X.title,onSave:function(o){return function(o,i){return t(void 0,void 0,void 0,function(){var t,l;return n(this,function(n){try{t=e({},X),X.artifactId===i?t.title=o:t.sub_features=(null===(l=X.sub_features)||void 0===l?void 0:l.map(function(t){return t.artifactId===i?e(e({},t),{title:o}):t}))||[],De(t),Y(t),Ae(!1)}catch(e){console.error("Failed to save title",e)}return[2]})})}(o,X.artifactId)},onCancel:function(){Ae(!1)},inputStyle:null==Ie?void 0:Ie.inlineTitleInput,confirmButtonStyle:null==Ie?void 0:Ie.inlineTitleConfirm,cancelButtonStyle:null==Ie?void 0:Ie.inlineTitleCancel},"inline-title-editor"):i("div",e({className:k.storyTitleWrapper},{children:[l("h2",e({title:X.title,className:k.storyTitle,style:null==Ce?void 0:Ce.storyTitle},{children:V(X.title)}),X.artifactId),l("button",e({type:"button",className:k.titleEditButton,style:null==Ie?void 0:Ie.titleEditButton,onClick:function(e){e.stopPropagation(),Ae(!0),Ve||ze(!0)},"aria-label":"Edit title",title:"Edit title"},{children:l("svg",e({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:l("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),i("div",e({className:k.titleActions,style:null==Ce?void 0:Ce.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[(st.showProgressPercentage||st.showGapBox)&&ve&&i("div",e({className:k.progressHeader,style:null==be?void 0:be.wrapper},{children:[st.showProgressPercentage&&i("div",e({className:k.progressPercentage,style:null==be?void 0:be.percentage},{children:[null!==(U=null!==(N=null==X?void 0:X.confidenceScore)&&void 0!==N?N:null==st?void 0:st.confidenceValue)&&void 0!==U?U:"0","%"]})),st.showGapBox&&i("div",e({className:k.gapBox,style:null==be?void 0:be.gapBox},{children:[null!==(G=null!==(F=null==X?void 0:X.gapValue)&&void 0!==F?F:null==st?void 0:st.gapBoxValue)&&void 0!==G?G:"2"," ","Gaps"]}))]})),rt&&l(j,{customIcons:null==je?void 0:je.userStoryIcons,customStyles:null==Ce?void 0:Ce.aiReasoningCitaionStyles,currentUserStory:X,panelStyles:null==Ce?void 0:Ce.BigEnoughStyles}),!Ue.userStory&&i(r,{children:[!1!==(null==st?void 0:st.showShareButton)&&l("button",e({className:k.iconButton,style:null==Ce?void 0:Ce.iconButton,onClick:function(e){qe(e.currentTarget)}},{children:l(c,{size:16})})),i(D,e({id:"user-story-share-menu",anchorEl:Ge,open:!!Ge,onClose:function(){return qe(null)},style:null==Ce?void 0:Ce.userStoryShareMenu},{children:[te&&l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){return t(void 0,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return Oe(!0),ie?[4,Promise.all([ie("pdf"),ie("doc")])]:[2];case 1:return e.sent(),Oe(!1),[2]}})})}},{children:i("div",e({ref:$e,className:k.menuItemContent,style:null==Ce?void 0:Ce.menuItemContent},{children:[l(d,{size:16,color:null==Ce?void 0:Ce.menuIconColor}),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:"Download"}))]}))})),l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){return t(void 0,void 0,void 0,function(){var t;return n(this,function(n){return t=X,K&&(t=e(e({},X),{value:"".concat(M(null==K?void 0:K.value,X.title)," \n").concat(X.value)})),null==le||le(!0,[t],X.artifactId),ot(),[2]})})}},{children:i("div",e({style:null==Ce?void 0:Ce.menuItemContent,className:k.menuItemContentPadded},{children:[l(v,{size:16,color:null==Ce?void 0:Ce.menuIconColor}),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:"Send"}))]}))})),l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){return t(void 0,void 0,void 0,function(){var e,t,o,i,l;return n(this,function(n){switch(n.label){case 0:e=new B.Converter,t=e.makeHtml(T(X.value)||X.value),o=function(e){var t=(new B.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(T(X.value)||X.value),i=new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})}),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,navigator.clipboard.write([i])];case 2:return n.sent(),console.log("Copied User Story"),[3,5];case 3:return l=n.sent(),console.error("Failed to copy user story:",l),[3,5];case 4:return ot(),[7];case 5:return[2]}})})}},{children:i("div",e({style:null==Ce?void 0:Ce.menuItemContent,className:k.menuItemContentPadded},{children:[l(f,{size:16,color:null==Ce?void 0:Ce.menuIconColor}),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:"Copy"}))]}))}))]}))]}),Ue.userStory&&Ve?l(_,{type:"outline",children:"Cancel",style:null==Ce?void 0:Ce.cancelButton,onClick:function(){var t;null===(t=nt.current)||void 0===t||t.abort(),Ee(function(t){return e(e({},t),{userStory:!1})})}}):l(r,{}),Ue.userStory&&Ve?l(_,{type:"fill",children:Xe?i("span",e({className:k.savingSpinner,style:null==Ce?void 0:Ce.savingSpinner},{children:[l(m,{className:k.spinAnimation,style:null==Ce?void 0:Ce.spinAnimation}),l("span",{children:"Saving..."})]})):"Save",isDisable:Xe,style:Xe?null==Ce?void 0:Ce.savingButton:null==Ce?void 0:Ce.saveButton,onClick:function(){return t(void 0,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return Ye(!0),"userStory"==="userStory"&&(Y(Be),console.log("I am changing RTE editor values",Be)),[4,re(Se,Re,Z,null===(t=nt.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),Y(e(e({},Be),{isDefaultEdit:!1})),Ee(function(t){return e(e({},t),{userStory:!1})}),Ye(!1),[2]}})})}}):!ne&&!oe&&Ve&&!1!==(null==st?void 0:st.showEditButton)&&l("button",e({className:k.iconButton,style:null==Ce?void 0:Ce.editButton,onClick:function(){return Ee(function(t){return e(e({},t),{userStory:!0})})}},{children:l(y,{color:null==Ce?void 0:Ce.pencilIconColor,size:16})})),at&&Ve&&!ne&&!oe&&!1!==(null==st?void 0:st.showEditButton)&&i("button",e({type:"button",className:k.addSectionButton,style:null==Ie?void 0:Ie.addSectionButton,onClick:function(t){var n,i,l;t.stopPropagation();var r=(null!==(i=null===(n=X.sub_features)||void 0===n?void 0:n.length)&&void 0!==i?i:0)+1,a={artifactId:E(),title:"New Section ".concat(r),value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},s=e(e({},X),{sub_features:o(o([],null!==(l=X.sub_features)&&void 0!==l?l:[],!0),[a],!1)});De(s),Y(s),ze(!0),Pe(a.title)},"aria-label":"Add section",title:"Add section"},{children:[l(h,{size:14}),l("span",e({className:k.addSectionLabel},{children:"Add Section"}))]})),!at&&!ne&&!oe&&l("button",e({type:"button",onClick:function(e){e.stopPropagation(),null==me||me()},className:k.iconButton,style:null==Ie?void 0:Ie.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:l(p,{size:16})})),(null==st?void 0:st.actionItemsButton)&&i(r,{children:[l("span",e({className:k.actionItemBtn,style:null==Ce?void 0:Ce.actionItemBtn,onClick:function(e){e.stopPropagation(),Je(e.currentTarget)}},{children:l(S,{})})),l(D,e({id:"user-story-action-menu",anchorEl:Ze,open:!!Ze,onClose:it,style:null==Ce?void 0:Ce.userStoryShareMenu},{children:null==fe?void 0:fe.items.map(function(t,n){return l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){t.onclick(),it()}},{children:i("div",e({className:k.menuItemContent,style:e(e({},null==Ce?void 0:Ce.menuItemContent),!t.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[l("span",e({className:k.menuItemIcon,style:null==Ce?void 0:Ce.menuItemIcon},{children:t.icon})),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:t.name})),l("span",{className:k.menuItemRight,style:null==Ce?void 0:Ce.menuItemRight})]}))}),"action-item-".concat(n,"-").concat(t.name))})}))]}),l("button",e({type:"button",onClick:function(e){e.stopPropagation(),lt()},style:null==Ce?void 0:Ce.chevronButton,className:k.chevronButton},{children:l(Ve?g:C,{className:k.chevronIcon,color:null==Ce?void 0:Ce.chevronIconColor})}))]}))]})),l("div",{className:k.divider,style:null==Ce?void 0:Ce.dividerStyle})]})),Ve&&l("div",e({className:k.cardContent,style:null==Ce?void 0:Ce.cardContentStyle},{children:i("div",e({className:k.contentInner,style:null==Ce?void 0:Ce.contentInner},{children:[i("div",e({className:k.descriptionSection,style:null==Ce?void 0:Ce.descriptionSection},{children:[l("div",{className:k.justifyBetween,style:null==Ce?void 0:Ce.justifyBetween}),Ue.userStory?l(P,{minHeight:"100%",height:"100%",type:"string",value:T(X.value)||"",handleUpdateState:function(t,n){var o=A(n);De(function(t){return e(e({},t),{value:o||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:Ue.userStory?"edit":"readOnly"}):l(H,{showUserStoryDiff:oe,isParent:""===$,message:T(X.value)||"",artifactId:X.artifactId,customStyles:we,isDisplayHighlightControl:se,contextVariant:ye})]})),null===(q=Be.sub_features)||void 0===q?void 0:q.map(function(t,n){var i=z(ue,!1,t.artifactId);return l(O,{artifactId:Z,isUserStoryCurrentlyUpdated:Q,artifactTitleId:"".concat(J,"-").concat(String.fromCharCode(65+n)),parentUserStory:X,parentIndex:"".concat($).concat($&&".").concat(ee),currentIndex:"".concat(n+1),doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:function(t){return function(t,n){var i=o([],X.sub_features||[],!0);i[t]=n,Y(e(e({},X),{sub_features:i}))}(n,t)},enableDownload:!0,isDiffEditReviewMode:ne,showUserStoryDiff:oe,updateUserStoryArtifact:re,handleDownloadUserStory:ie,handleOpenSendDialog:le,isDisplayHighlightControl:se,elementDisplayConfig:ue,_resolvedConfig:i,actionItemsConfig:fe,onDelete:function(){return function(t){var n=(X.sub_features||[]).filter(function(e,n){return n!==t}),o=e(e({},X),{sub_features:n});De(o),Y(o)}(n)}},t.artifactId)})]}))}))]}))},F=function(t){var n=t.artifactTitleIDs,a=t.isDiffEditReviewMode,s=t.showUserStoryDiff,u=t.updateUserStoryArtifact,c=t.isUserStoryCurrentlyUpdated,d=t.artifactId,v=t.handleOpenSendDialog,f=t.handleDownloadUserStory,m=t.selectedArtifactId,y=t.isDisplayHighlightControl,h=t.elementDisplayConfig,p=t.showWrapper,S=t.actionItemsConfig,g=t.contextVariant,C=R(),b=C.userStory,N=C.setUserStory,B=C.customStyles,D=C.searchQueryList,x=C.currentHighlightIndex,U=C.setCurrentHighlightIndex;C.segmentComponentConfig;var E=null==B?void 0:B.userStoryCardStyles,T=0===x,A=x===D.length-1;return i("div",e({className:k.userStoryCardWrapper,style:y?e(e({},null==E?void 0:E.userStoryCardWrapper),{position:"relative"}):null==E?void 0:E.userStoryCardWrapper},{children:[y&&l(r,{children:D.length>0&&l("div",e({className:k.wrapper},{children:l("div",e({className:k.highlightNavigation},{children:i("div",e({className:k.navigationContainer},{children:[i("span",e({className:k.navCounter},{children:[x+1," of ",D.length]})),i("div",e({className:k.navButtons},{children:[l("button",e({onClick:function(){x>0&&U(function(e){return e-1})},className:k.navButton,disabled:T},{children:l(I,{size:20,className:k.navIcon})})),l("button",e({onClick:function(){x<D.length-1&&U(function(e){return e+1})},className:k.navButton,disabled:A},{children:l(w,{size:20,className:k.navIcon})}))]}))]}))}))}))}),b.map(function(e,t){var i=z(h,!0);return l(O,{isUserStoryCurrentlyUpdated:c,artifactId:d,artifactTitleId:n[t]||"",currentUserStory:e,onUserStoryChange:function(e){N(function(n){return n[t]=e,o([],n,!0)})},parentIndex:"",currentIndex:"".concat(t+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:u,handleOpenSendDialog:v,handleDownloadUserStory:f,selectedArtifactId:m,isDisplayHighlightControl:y,elementDisplayConfig:h,_resolvedConfig:i,showWrapper:p,actionItemsConfig:S,contextVariant:g},e.artifactId)})]}))};export{O as StoryCard,F as UserStoryCardWrapper,O as default,V as replaceLearnedTagsWithInfo};
1
+ import{__assign as e,__awaiter as t,__generator as n,__spreadArray as o}from"tslib";import{jsxs as i,jsx as l,Fragment as r}from"react/jsx-runtime";import{useState as a,useRef as s,useEffect as u}from"react";import{ExternalLink as c,Download as d,Share2 as v,Copy as f,LoaderCircle as m,PencilIcon as y,Plus as h,Trash2 as p,Ellipsis as S,ChevronUp as g,ChevronDown as C,ChevronUpIcon as I,ChevronDownIcon as w,Info as b,Bookmark as N}from"lucide-react";import B from"showdown";import{Menu as D,MenuItem as x,Tooltip as U}from"@mui/material";import{v4 as E}from"uuid";import k from"./UserStoryCard.module.css.js";import{formatMarkdown as T,indentMarkdown as A}from"../../utils/helpers.js";import{replaceTitleSection as M}from"../../utils/user-story.utils.js";import _ from"../../shared/AtomicButton.js";import P from"../RichTextEditor/RichTextEditor.js";import H from"../userstory-with-citation/UserStoryWithCitation.js";import{useRequirementAI as R}from"../RequirementAIWrapper/RequirementAIWrapper.js";import{BigEnoughPanel as j}from"../story-screen/BigEnoughPanel.js";import{InlineTitleEditor as L}from"./TitleEditor/TitleEditor.js";function V(t){for(var n,o=[],i=/<learned>(.*?)<\/learned>/g,r=0,a=0;null!==(n=i.exec(t));){var s=n[1],u=n.index;u>r&&o.push(l("span",{children:t.slice(r,u)},"text-pre-".concat(a++))),o.push(l(U,e({title:s,placement:"top"},{children:l(b,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(E()))),r=i.lastIndex}return r<(null==t?void 0:t.length)&&o.push(l("span",{children:t.slice(r)},"text-post-".concat(a++))),o}function z(t,n,o){var i;if(!t)return{};if(n)return e({},t.parentConfig);var l=e({},t.childConfig);return o&&(null===(i=t.subFeatureOverrides)||void 0===i?void 0:i[o])?e(e({},l),t.subFeatureOverrides[o]):l}var W=function(t){var n,o=t.displayName,r=R().customStyles,a=null===(n=null==r?void 0:r.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return i("div",e({className:k.displayName,style:null==a?void 0:a.wrapper},{children:[l(N,{className:k.displayNameIcon,style:null==a?void 0:a.displayNameIcon}),i("span",e({style:null==a?void 0:a.label},{children:[o,":"]}))]}))},O=function(I){var w,b,N,U,F,G,q,Q=I.isUserStoryCurrentlyUpdated,Z=I.artifactId,J=I.artifactTitleId,K=I.parentUserStory,X=I.currentUserStory,Y=I.onUserStoryChange,$=I.parentIndex,ee=I.currentIndex,te=I.enableDownload,ne=I.isDiffEditReviewMode,oe=I.showUserStoryDiff,ie=I.handleDownloadUserStory,le=I.handleOpenSendDialog,re=I.updateUserStoryArtifact,ae=I.selectedArtifactId,se=I.isDisplayHighlightControl,ue=I.elementDisplayConfig,ce=I._resolvedConfig,de=I.showWrapper,ve=void 0!==de&&de,fe=I.actionItemsConfig,me=I.onDelete,ye=I.contextVariant,he=R(),pe=he.searchQueryList,Se=he.citations,ge=he.customStyles,Ce=null==ge?void 0:ge.userStoryCardStyles,Ie=null===(w=null==ge?void 0:ge.userStoryCardStyles)||void 0===w?void 0:w.userStoryEditStyles,we=null===(b=null==ge?void 0:ge.userStoryScreenStyles)||void 0===b?void 0:b.userStoryContentStyles,be=null==Ce?void 0:Ce.progressHeaderStyles,Ne=a(e(e({},structuredClone(X)),{value:T(X.value)||""})),Be=Ne[0],De=Ne[1],xe=a({userStory:!!X.isDefaultEdit}),Ue=xe[0],Ee=xe[1],ke=a(!1),Te=ke[0],Ae=ke[1],Me=a(null),_e=Me[0],Pe=Me[1],He=R(),Re=He.userStory,je=He.customIcons,Le=a(""===$||ae===X.artifactId||!!X.isDefaultOpen),Ve=Le[0],ze=Le[1],We=a(!1);We[0];var Oe=We[1],Fe=a(null),Ge=Fe[0],qe=Fe[1],Qe=a(null),Ze=Qe[0],Je=Qe[1],Ke=a(!1),Xe=Ke[0],Ye=Ke[1],$e=s(null),et=a(!1);et[0];var tt=et[1],nt=s(null);u(function(){Q&&ze(Q)},[Q]),u(function(){De(e(e({},structuredClone(X)),{value:T(X.value)||""}))},[X]),u(function(){pe.length>0?ze(!0):ae&&ze(ae===X.artifactId)},[pe,ae,X.artifactId]);var ot=function(){qe(null)},it=function(){Je(null)},lt=function(){ze(function(e){return!e})};var rt=null!=(null==X?void 0:X.big_enough)&&!Number.isNaN(X.big_enough)&&!!(null==X?void 0:X.big_enough_decision_factors),at=""===$,st=null!=ce?ce:z(ue,at),ut=!ne&&!oe;return u(function(){if(_e){var e=setTimeout(function(){var e=document.getElementById("story-card-".concat(_e));null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return function(){return clearTimeout(e)}}},[_e]),u(function(){X.isDefaultEdit&&Ee(function(t){return e(e({},t),{userStory:!0})})},[X.isDefaultEdit]),i("div",e({className:k.card,style:null==Ce?void 0:Ce.cardStyle,id:"story-card-".concat(X.title),"data-expanded":Ve},{children:[i("div",e({className:k.titleSection,style:null==Ce?void 0:Ce.titleSection},{children:[i("div",e({className:k.titleRow,style:null==Ce?void 0:Ce.titleRow,onClick:lt},{children:[i("div",e({className:k.titleLeft,style:null==Ce?void 0:Ce.titleLeft,onMouseEnter:function(){return tt(!0)},onMouseLeave:function(){return tt(!1)}},{children:[l(W,{displayName:J}),Te&&ut?l(L,{title:X.title,onSave:function(o){return function(o,i){return t(void 0,void 0,void 0,function(){var t,l;return n(this,function(n){try{t=e({},X),X.artifactId===i?t.title=o:t.sub_features=(null===(l=X.sub_features)||void 0===l?void 0:l.map(function(t){return t.artifactId===i?e(e({},t),{title:o}):t}))||[],De(t),Y(t),Ae(!1)}catch(e){console.error("Failed to save title",e)}return[2]})})}(o,X.artifactId)},onCancel:function(){Ae(!1)},inputStyle:null==Ie?void 0:Ie.inlineTitleInput,confirmButtonStyle:null==Ie?void 0:Ie.inlineTitleConfirm,cancelButtonStyle:null==Ie?void 0:Ie.inlineTitleCancel},"inline-title-editor"):i("div",e({className:k.storyTitleWrapper},{children:[l("h2",e({title:X.title,className:k.storyTitle,style:null==Ce?void 0:Ce.storyTitle},{children:V(X.title)}),X.artifactId),l("button",e({type:"button",className:k.titleEditButton,style:null==Ie?void 0:Ie.titleEditButton,onClick:function(e){e.stopPropagation(),Ae(!0),Ve||ze(!0)},"aria-label":"Edit title",title:"Edit title"},{children:l("svg",e({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:l("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})}))}))]}))]})),i("div",e({className:k.titleActions,style:null==Ce?void 0:Ce.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[(st.showProgressPercentage||st.showGapBox)&&ve&&i("div",e({className:k.progressHeader,style:null==be?void 0:be.wrapper},{children:[st.showProgressPercentage&&i("div",e({className:k.progressPercentage,style:null==be?void 0:be.percentage},{children:[null!==(U=null!==(N=null==X?void 0:X.confidenceScore)&&void 0!==N?N:null==st?void 0:st.confidenceValue)&&void 0!==U?U:"0","%"]})),st.showGapBox&&i("div",e({className:k.gapBox,style:null==be?void 0:be.gapBox},{children:[null!==(G=null!==(F=null==X?void 0:X.gapValue)&&void 0!==F?F:null==st?void 0:st.gapBoxValue)&&void 0!==G?G:"2"," ","Gaps"]}))]})),rt&&l(j,{customIcons:null==je?void 0:je.userStoryIcons,customStyles:null==Ce?void 0:Ce.aiReasoningCitaionStyles,currentUserStory:X,panelStyles:null==Ce?void 0:Ce.BigEnoughStyles}),!Ue.userStory&&i(r,{children:[!1!==(null==st?void 0:st.showShareButton)&&l("button",e({className:k.iconButton,style:null==Ce?void 0:Ce.iconButton,onClick:function(e){qe(e.currentTarget)}},{children:l(c,{size:16})})),i(D,e({id:"user-story-share-menu",anchorEl:Ge,open:!!Ge,onClose:function(){return qe(null)},style:null==Ce?void 0:Ce.userStoryShareMenu},{children:[te&&l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){return t(void 0,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return Oe(!0),ie?[4,Promise.all([ie("pdf"),ie("doc")])]:[2];case 1:return e.sent(),Oe(!1),[2]}})})}},{children:i("div",e({ref:$e,className:k.menuItemContent,style:null==Ce?void 0:Ce.menuItemContent},{children:[l(d,{size:16,color:null==Ce?void 0:Ce.menuIconColor}),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:"Download"}))]}))})),l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){return t(void 0,void 0,void 0,function(){var t;return n(this,function(n){return t=X,K&&(t=e(e({},X),{value:"".concat(M(null==K?void 0:K.value,X.title)," \n").concat(X.value)})),null==le||le(!0,[t],X.artifactId),ot(),[2]})})}},{children:i("div",e({style:null==Ce?void 0:Ce.menuItemContent,className:k.menuItemContentPadded},{children:[l(v,{size:16,color:null==Ce?void 0:Ce.menuIconColor}),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:"Send"}))]}))})),l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){return t(void 0,void 0,void 0,function(){var e,t,o,i,l;return n(this,function(n){switch(n.label){case 0:e=new B.Converter,t=e.makeHtml(T(X.value)||X.value),o=function(e){var t=(new B.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(T(X.value)||X.value),i=new ClipboardItem({"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})}),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,navigator.clipboard.write([i])];case 2:return n.sent(),console.log("Copied User Story"),[3,5];case 3:return l=n.sent(),console.error("Failed to copy user story:",l),[3,5];case 4:return ot(),[7];case 5:return[2]}})})}},{children:i("div",e({style:null==Ce?void 0:Ce.menuItemContent,className:k.menuItemContentPadded},{children:[l(f,{size:16,color:null==Ce?void 0:Ce.menuIconColor}),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:"Copy"}))]}))}))]}))]}),Ue.userStory&&Ve?l(_,{type:"outline",children:"Cancel",style:null==Ce?void 0:Ce.cancelButton,onClick:function(){var t;null===(t=nt.current)||void 0===t||t.abort(),Ee(function(t){return e(e({},t),{userStory:!1})})}}):l(r,{}),Ue.userStory&&Ve?l(_,{type:"fill",children:Xe?i("span",e({className:k.savingSpinner,style:null==Ce?void 0:Ce.savingSpinner},{children:[l(m,{className:k.spinAnimation,style:null==Ce?void 0:Ce.spinAnimation}),l("span",{children:"Saving..."})]})):"Save",isDisable:Xe,style:Xe?null==Ce?void 0:Ce.savingButton:null==Ce?void 0:Ce.saveButton,onClick:function(){return t(void 0,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return Ye(!0),"userStory"==="userStory"&&(Y(Be),console.log("I am changing RTE editor values",Be)),[4,re(Se,Re,Z,null===(t=nt.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),Y(e(e({},Be),{isDefaultEdit:!1})),Ee(function(t){return e(e({},t),{userStory:!1})}),Ye(!1),[2]}})})}}):!ne&&!oe&&Ve&&!1!==(null==st?void 0:st.showEditButton)&&l("button",e({className:k.iconButton,style:null==Ce?void 0:Ce.editButton,onClick:function(){return Ee(function(t){return e(e({},t),{userStory:!0})})}},{children:l(y,{color:null==Ce?void 0:Ce.pencilIconColor,size:16})})),at&&Ve&&!ne&&!oe&&!1!==(null==st?void 0:st.showEditButton)&&i("button",e({type:"button",className:k.addSectionButton,style:null==Ie?void 0:Ie.addSectionButton,onClick:function(t){var n,i,l;t.stopPropagation();var r=(null!==(i=null===(n=X.sub_features)||void 0===n?void 0:n.length)&&void 0!==i?i:0)+1,a={artifactId:E(),title:"New Section ".concat(r),value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},s=e(e({},X),{sub_features:o(o([],null!==(l=X.sub_features)&&void 0!==l?l:[],!0),[a],!1)});De(s),Y(s),ze(!0),Pe(a.title)},"aria-label":"Add section",title:"Add section"},{children:[l(h,{size:14}),l("span",e({className:k.addSectionLabel},{children:"Add Section"}))]})),!at&&!ne&&!oe&&l("button",e({type:"button",onClick:function(e){e.stopPropagation(),null==me||me()},className:k.iconButton,style:null==Ie?void 0:Ie.deleteButton,"aria-label":"Delete section",title:"Delete section"},{children:l(p,{size:16})})),(null==st?void 0:st.actionItemsButton)&&i(r,{children:[l("span",e({className:k.actionItemBtn,style:null==Ce?void 0:Ce.actionItemBtn,onClick:function(e){e.stopPropagation(),Je(e.currentTarget)}},{children:l(S,{})})),l(D,e({id:"user-story-action-menu",anchorEl:Ze,open:!!Ze,onClose:it,style:null==Ce?void 0:Ce.userStoryShareMenu},{children:null==fe?void 0:fe.items.map(function(t,n){return l(x,e({style:null==Ce?void 0:Ce.userStoryMenuItem,onClick:function(){t.onclick(X),it()}},{children:i("div",e({className:k.menuItemContent,style:e(e({},null==Ce?void 0:Ce.menuItemContent),!t.isActive&&{cursor:"not-allowed",opacity:.5})},{children:[l("span",e({className:k.menuItemIcon,style:null==Ce?void 0:Ce.menuItemIcon},{children:t.icon})),l("p",e({style:null==Ce?void 0:Ce.menuLabel},{children:t.name})),l("span",{className:k.menuItemRight,style:null==Ce?void 0:Ce.menuItemRight})]}))}),"action-item-".concat(n,"-").concat(t.name))})}))]}),l("button",e({type:"button",onClick:function(e){e.stopPropagation(),lt()},style:null==Ce?void 0:Ce.chevronButton,className:k.chevronButton},{children:l(Ve?g:C,{className:k.chevronIcon,color:null==Ce?void 0:Ce.chevronIconColor})}))]}))]})),l("div",{className:k.divider,style:null==Ce?void 0:Ce.dividerStyle})]})),Ve&&l("div",e({className:k.cardContent,style:null==Ce?void 0:Ce.cardContentStyle},{children:i("div",e({className:k.contentInner,style:null==Ce?void 0:Ce.contentInner},{children:[i("div",e({className:k.descriptionSection,style:null==Ce?void 0:Ce.descriptionSection},{children:[l("div",{className:k.justifyBetween,style:null==Ce?void 0:Ce.justifyBetween}),Ue.userStory?l(P,{minHeight:"100%",height:"100%",type:"string",value:T(X.value)||"",handleUpdateState:function(t,n){var o=A(n);De(function(t){return e(e({},t),{value:o||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:Ue.userStory?"edit":"readOnly"}):l(H,{showUserStoryDiff:oe,isParent:""===$,message:T(X.value)||"",artifactId:X.artifactId,customStyles:we,isDisplayHighlightControl:se,contextVariant:ye})]})),null===(q=Be.sub_features)||void 0===q?void 0:q.map(function(t,n){var i=z(ue,!1,t.artifactId);return l(O,{artifactId:Z,isUserStoryCurrentlyUpdated:Q,artifactTitleId:"".concat(J,"-").concat(String.fromCharCode(65+n)),parentUserStory:X,parentIndex:"".concat($).concat($&&".").concat(ee),currentIndex:"".concat(n+1),doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:function(t){return function(t,n){var i=o([],X.sub_features||[],!0);i[t]=n,Y(e(e({},X),{sub_features:i}))}(n,t)},enableDownload:!0,isDiffEditReviewMode:ne,showUserStoryDiff:oe,updateUserStoryArtifact:re,handleDownloadUserStory:ie,handleOpenSendDialog:le,isDisplayHighlightControl:se,elementDisplayConfig:ue,_resolvedConfig:i,actionItemsConfig:fe,onDelete:function(){return function(t){var n=(X.sub_features||[]).filter(function(e,n){return n!==t}),o=e(e({},X),{sub_features:n});De(o),Y(o)}(n)}},t.artifactId)})]}))}))]}))},F=function(t){var n=t.artifactTitleIDs,a=t.isDiffEditReviewMode,s=t.showUserStoryDiff,u=t.updateUserStoryArtifact,c=t.isUserStoryCurrentlyUpdated,d=t.artifactId,v=t.handleOpenSendDialog,f=t.handleDownloadUserStory,m=t.selectedArtifactId,y=t.isDisplayHighlightControl,h=t.elementDisplayConfig,p=t.showWrapper,S=t.actionItemsConfig,g=t.contextVariant,C=R(),b=C.userStory,N=C.setUserStory,B=C.customStyles,D=C.searchQueryList,x=C.currentHighlightIndex,U=C.setCurrentHighlightIndex;C.segmentComponentConfig;var E=null==B?void 0:B.userStoryCardStyles,T=0===x,A=x===D.length-1;return i("div",e({className:k.userStoryCardWrapper,style:y?e(e({},null==E?void 0:E.userStoryCardWrapper),{position:"relative"}):null==E?void 0:E.userStoryCardWrapper},{children:[y&&l(r,{children:D.length>0&&l("div",e({className:k.wrapper},{children:l("div",e({className:k.highlightNavigation},{children:i("div",e({className:k.navigationContainer},{children:[i("span",e({className:k.navCounter},{children:[x+1," of ",D.length]})),i("div",e({className:k.navButtons},{children:[l("button",e({onClick:function(){x>0&&U(function(e){return e-1})},className:k.navButton,disabled:T},{children:l(I,{size:20,className:k.navIcon})})),l("button",e({onClick:function(){x<D.length-1&&U(function(e){return e+1})},className:k.navButton,disabled:A},{children:l(w,{size:20,className:k.navIcon})}))]}))]}))}))}))}),b.map(function(e,t){var i=z(h,!0);return l(O,{isUserStoryCurrentlyUpdated:c,artifactId:d,artifactTitleId:n[t]||"",currentUserStory:e,onUserStoryChange:function(e){N(function(n){return n[t]=e,o([],n,!0)})},parentIndex:"",currentIndex:"".concat(t+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:u,handleOpenSendDialog:v,handleDownloadUserStory:f,selectedArtifactId:m,isDisplayHighlightControl:y,elementDisplayConfig:h,_resolvedConfig:i,showWrapper:p,actionItemsConfig:S,contextVariant:g},e.artifactId)})]}))};export{O as StoryCard,F as UserStoryCardWrapper,O as default,V as replaceLearnedTagsWithInfo};
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -17,7 +17,7 @@ export interface ElementDisplayConfig {
17
17
  }
18
18
  export interface ActionItem {
19
19
  name: string;
20
- onclick: () => void;
20
+ onclick: (currentUserStory: IUserStory) => void;
21
21
  icon: ReactNode;
22
22
  isActive: boolean;
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UserStoryCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/UserStoryCard/UserStoryCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AAwB/D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAOlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AASzE,UAAU,iBAAiB;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAElC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACjC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC3D;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,UAAU,cAAc;IACpB,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,gBAAgB,EAAE,UAAU,CAAC;IAC7B,iBAAiB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAEpD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB,EAAE,OAAO,CAAC;IACnC,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,2CAA2C;IAC3C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,uBAAuB,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,oBAAoB,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrK,uBAAuB,EAAE,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI,EAAE,sBAAsB,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACnK,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,eAAe,CAAC,EAAE,iBAAiB,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,CAAC,EAAC,UAAU,GAAG,QAAQ,CAAC;CACzC;AAID,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAwC7E;AA+CD,eAAO,MAAM,SAAS,maAuBnB,cAAc,4CAwnBhB,CAAC;AAEF,UAAU,MAAM;IACZ,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,uBAAuB,EAAE,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI,EAAE,sBAAsB,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAG,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACpK,oBAAoB,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrK,uBAAuB,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,cAAc,CAAC,EAAC,UAAU,GAAG,QAAQ,CAAC;CACzC;AAED,eAAO,MAAM,oBAAoB,wSAAyS,MAAM,4CAgG/U,CAAA;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"UserStoryCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/RequirementAI/components/UserStoryCard/UserStoryCard.tsx"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/requirement-ai",
3
- "version": "0.0.189",
3
+ "version": "0.0.191",
4
4
  "author": "Saptyadeep Bhattacharjee",
5
5
  "description": "",
6
6
  "license": "MIT",