PageSourceSearch

https://cadbench.ai/_next/static/chunks/pages/app/workspace/ws-text-to-asm-f790768a025690c8.js

js cadbench.ai collected 2026-09-29 04:51:05 UTC 58,796 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2103],{17148:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/workspace/ws-text-to-asm",function(){return n(33968)}])},65922:function(e,t,n){"use strict";n.d(t,{n:function(){return l}});var r=n(92021),a=n.n(r),o=n(2784),i=n(55399),s=n(76801);function c(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(r,a)}var u=function(e){var t=e.plan;return e.team||t&&"basic"!==t?"allowed":"denied"},l=function(){var e=(0,o.useState)((function(){var e,t=null===(e=(0,i.M6)())||void 0===e?void 0:e.user_id;if(!t)return"allowed";var n=(0,i.pG)(t);return n?u(n):"checking"})),t=e[0],n=e[1];return(0,o.useEffect)((function(){var e,t=null===(e=(0,i.M6)())||void 0===e?void 0:e.user_id;if(t){var r=(0,i.pG)(t),o=r?u(r):"checking";if("allowed"!==o){var l,d=!1;return(l=a().mark((function e(){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,i.CS)(t,s.B,{force:"denied"===o});case 3:r=e.sent,d||n(u(r)),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),console.error("Failed to fetch user info for plan gate:",e.t0),d||n("allowed");case 11:case"end":return e.stop()}}),e,null,[[0,7]])})),function(){var e=this,t=arguments;return new Promise((function(n,r){var a=l.apply(e,t);function o(e){c(a,n,r,o,i,"next",e)}function i(e){c(a,n,r,o,i,"throw",e)}o(void 0)}))})(),function(){d=!0}}}else n("allowed")}),[]),t}},33968:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return We}});var r=n(92021),a=n.n(r),o=n(52322),i=n(2784),s=n(97729),c=n(5632),u=n(27149),l=n(24862),d=n(62197),p=n(38162),f=n(65992),m=n(49170),h=n(28049),v=n(29830),b=n(72841),x=n(21647),y=n(81714),g=n(83249),w=n(85801),_=n(45596),k=n(4615),S=n(33702),j=n(26436),T=n(98797),I=n(18876),Z=n(98691),A=n(71976),C=n(28238),B=n(8921),O=n(92096),E=n(3399),P=n(68020),z=n(34586),N=n(72154),D=n.n(N),M=n(58803),R=n(12314),L=n(55399),G=n(54764),W=n.n(G),F=n(76801),U=n(29337),V=n(21924);function Y(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(r,a)}function $(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Y(o,r,a,i,s,"next",e)}function s(e){Y(o,r,a,i,s,"throw",e)}i(void 0)}))}}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){q(e,t,n[t])}))}return e}function X(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var Q={link:M.W},J=(0,f.ZP)(O.Z)((function(e){var t=e.theme;return{border:"1px solid ".concat(t.palette.divider),boxShadow:"none"}})),K={width:160,height:120,mt:1,borderRadius:1,overflow:"hidden"},ee=function(e){var t=e.generating,n=(0,E.$)().t;return(0,o.jsxs)(l.Z,{sx:H({},K,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,backgroundColor:"action.hover",color:"text.secondary"}),children:[t?(0,o.jsx)(b.Z,{size:20}):(0,o.jsx)(B.Z,{fontSize:"small"}),(0,o.jsx)(d.Z,{variant:"caption",children:n(t?"thumbnail_generating":"thumbnail_generation_failed")})]})},te=function(e){var t=e.status,n=e.src,r=e.alt,a=(0,i.useState)(!1),s=a[0],c=a[1],u=(0,i.useState)(0),d=u[0],p=u[1],f=(0,i.useState)(!1),m=f[0],h=f[1],v=(0,i.useRef)(null);(0,i.useEffect)((function(){return function(){v.current&&clearTimeout(v.current)}}),[]);return"generating"===t?(0,o.jsx)(ee,{generating:!0}):"failed"===t||m?(0,o.jsx)(ee,{generating:!1}):"completed"===t&&n?(0,o.jsxs)(l.Z,{sx:H({position:"relative"},K),children:[!s&&(0,o.jsx)(x.Z,{variant:"rectangular",animation:"wave",sx:{position:"absolute",inset:0,width:"100%",height:"100%"}}),(0,o.jsx)(l.Z,{component:"img",src:n,alt:r||"thumbnail",loading:"lazy",onLoad:function(){return c(!0)},onError:function(){c(!1),d>=35?h(!0):v.current=setTimeout((function(){return p((function(e){return e+1}))}),4e3)},sx:{width:"100%",height:"100%",objectFit:"contain",backgroundColor:"action.hover",opacity:s?1:0,transition:"opacity 200ms ease"}},d)]}):null},ne=function(e){var t=e.title,n=e.text.split("\n").map((function(e){return e.replace(/^-+\s*/,"").trim()}
1)).filter(Boolean);return 0===n.length?null:(0,o.jsxs)(l.Z,{sx:{mt:1},children:[(0,o.jsx)(d.Z,{variant:"caption",sx:{display:"block",fontWeight:600},children:t}),n.map((function(e,t){var n=e.indexOf("="),r=-1===n?e:"".concat(e.slice(0,n).trim(),": ").concat(e.slice(n+1).trim());return(0,o.jsx)(d.Z,{variant:"caption",sx:{display:"block",color:"text.secondary"},children:r},t)}))]})};function re(e){return e?e.split("\n").map((function(e){return e.trim().startsWith("-- ")?e.replace(/^(\s*)--\s/,"$1  - "):e})).join("\n"):""}function ae(e,t){if(!e)return"";var n=e.description?re(e.description.replace(/\\n/g,"\n")):"",r=e.key_parameters?re(e.key_parameters.replace(/\\n/g,"\n")):"",a=e.conditions?re(e.conditions.replace(/\\n/g,"\n")):"",o=e.name?"# ".concat(e.name,"\n\n"):"";return n&&(o+="## Description\n\n".concat(n,"\n\n")),r&&(o+="## Key Parameters\n\n".concat(r,"\n\n")),a&&a.length>=6&&(o+="## Conditions\n\n".concat(a,"\n\n")),o}function oe(e,t){var n="------\n\n## ".concat(t("spec_validation_failed"),"\n\n");return n+="".concat(t("spec_validation_warning"),"\n\n"),n+="".concat(t("spec_validation_status"),"\n\n"),e.issues&&e.issues.length>0&&(n+="### ".concat(t("spec_validation_issues"),"\n\n"),e.issues.forEach((function(e){n+="- ".concat(e,"\n")})),n+="\n"),e.suggestions&&e.suggestions.length>0&&(n+="### ".concat(t("spec_validation_suggestions"),"\n\n"),e.suggestions.forEach((function(e){n+="- ".concat(e,"\n")})),n+="\n"),n}var ie=function(e){var t=e.onInputSubmit,n=e.onGenerateAsm,r=e.onAddMessage,s=(e.onGenerateComplete,e.showViewer),c=e.onLoadWorkspace,u=e.onResetChat,p=e.onRegisterSubmit,f=e.onWorkspaceCreated,m=(0,E.$)(),h=m.t,v=m.i18n,x=(0,U.Ds)().enqueueSnackbar,B=(0,i.useState)([]),O=B[0],N=B[1],M=(0,i.useState)(!1),G=M[0],Y=M[1],K=(0,i.useState)(""),ee=K[0],re=K[1],ie=(0,i.useRef)(null),se=(0,i.useRef)(null),ce=(0,i.useRef)(new Map),ue=(0,i.useState)(""),le=ue[0],de=ue[1],pe=(0,i.useState)(""),fe=pe[0],me=pe[1],he=(0,i.useState)({}),ve=he[0],be=he[1],xe=(0,i.useState)({}),ye=xe[0],ge=xe[1],we=(0,i.useState)({}),_e=we[0],ke=we[1],Se=(0,i.useState)({}),je=(Se[0],Se[1]),Te=(0,i.useState)({}),Ie=Te[0],Ze=Te[1],Ae=(0,L.M6)(),Ce=$(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,r={message_id:n.id,createdAt:n.createdAt,authorId:"user"===n.authorType?(null===Ae||void 0===Ae?void 0:Ae.user_id)||"unknown":"ai-assistant",body:n.body,contentType:n.contentType,attachments:[]},!0===n.displayGenerateButton&&(r.displayGenerateButton=n.displayGenerateButton),!0===n.displayViewButton&&(r.displayViewButton=n.displayViewButton),n.viewNodeName&&(r.viewNodeName=n.viewNodeName),n.nodeId&&(r.nodeId=n.nodeId),n.thumbnailUrl&&(r.thumbnailUrl=n.thumbnailUrl),n.thumbnailStatus&&(r.thumbnailStatus=n.thumbnailStatus),n.keyParameters&&(r.keyParameters=n.keyParameters),n.conditions&&(r.conditions=n.conditions),void 0!==n.isInvalidSpec&&(r.isInvalidSpec=n.isInvalidSpec),!0===n.showFeedbackIcons&&(r.showFeedbackIcons=n.showFeedbackIcons),n.user_id&&(r.user_id=n.user_id),n.task_name&&(r.task_name=n.task_name),n.user_input&&(r.user_input=n.user_input),n.normalized_input_en&&(r.normalized_input_en=n.normalized_input_en),n.task_selection_type&&(r.task_selection_type=n.task_selection_type),void 0!==n.is_generate&&(r.is_generate=n.is_generate),e.next=22,z.h.addMessage(t,r);case 22:e.next=27;break;case 24:e.prev=24,e.t0=e.catch(2),console.error("Failed to store message to workspace:",e.t0);case 27:case"end":return e.stop()}}),e,null,[[2,24]])}))),Be=$(a().mark((function e(t,n,r){var o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(le&&(null===Ae||void 0===Ae?void 0:Ae.user_id)){e.next=3;break}return console.error("Cannot submit feedback: missing workspace or user ID"),e.abrupt("return");case 3:return e.prev=3,o={feedback_type:n,feedback_comment:r,feedback_user_id:Ae.user_id,feedback_timestamp:W()().toISOString()},e.next=7,z.h.updateMessage(le,t,o);case 7:je((function(e){return H({},e,q({},t,!0))})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),console.error("Failed to submit feedback:",e.t0);case 13:case"end":return e.stop()}}),e,null,[[3,10]])}))),Oe=(0,i.useCallback)($(a().mark((function e(t){var n,r,o,i,s,c,u,l,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=7,Promise.all(null!==(r=ce.current.get(t))&&void 0!==r?r:[]);case 7:return e.next=9,z.h.getMessages(t);case 9:if(o=e.sent,i=(null===(n=o.data)||void 0===n?void 0:n.messages)||(Array.isArray(o.data)?o.data:null),200===o.status&&i&&i.length>0?(s=i.filter((function(e){return"loading"!==e.contentType})).map((function(e){var n={id:e.message_id,body:e.body,authorType:"ai-assistant"===e.authorId||"[email protected]"===e.authorId?"contact":"user",createdAt:e.createdAt,contentType:e.contentType};return void 0!==e.displayGenerateButton&&(n.displayGenerateButton=e.displayGenerateButton),void 0!==e.displayViewButton&&(n.displayViewButton=e.displayViewButton),e.viewNodeName&&(n.viewNodeName=e.viewNodeName),e.nodeId&&(n.nodeId=e.nodeId),e.thumbnailUrl&&(n.thumbnailUrl=e.thumbnailUrl),e.thumbnailStatus&&(n.thumbnailStatus=e.thumbnailStatus),e.keyParameters&&(n.keyParameters=e.keyParameters),e.conditions&&(n.conditions=e.conditions),void 0!==e.isInvalidSpec&&(n.isInvalidSpec=e.isInvalidSpec),void 0!==e.showFeedbackIcons&&(n.showFeedbackIcons=e.showFeedbackIcons),e.user_id&&(n.user_id=e.user_id),e.task_name&&(n.task_name=e.task_name),e.user_input&&(n.user_input=e.user_input),e.normalized_input_en&&(n.normalized_input_en=e.normalized_input_en),e.task_selection_type&&(n.task_selection_type=e.task_selection_type),void 0!==e.is_generate&&(n.is_generate=e.is_generate),n.workspace_id=t,n})),N(s),c={},u={},l={}
1,i.forEach((function(e){e.feedback_type&&(c[e.message_id]=e.feedback_type,l[e.message_id]=!0,e.feedback_comment&&(u[e.message_id]=e.feedback_comment))})),be(c),Ze(u),je(l)):N([]),200===o.status){e.next=14;break}return e.abrupt("return",null);case 14:return d=i||[],e.abrupt("return",{nodeIds:d.map((function(e){return e.nodeId})).filter(Boolean),legacyViewNodeNames:d.filter((function(e){return!e.nodeId&&e.viewNodeName})).map((function(e){return e.viewNodeName})),hasCompletionMessage:d.some((function(e){return!0===e.showFeedbackIcons}))});case 18:return e.prev=18,e.t0=e.catch(2),console.error("Failed to load messages from workspace:",e.t0),N([]),e.abrupt("return",null);case 23:case"end":return e.stop()}}),e,null,[[2,18]])}))),[]);(0,i.useEffect)((function(){se.current&&O.length>0&&(se.current.scrollTop=se.current.scrollHeight)}),[O]),(0,i.useEffect)((function(){var e=function(){se.current&&se.current.scrollTo({top:se.current.scrollHeight,behavior:"smooth"})};return V.YB.on("scrollChatToBottom",e),function(){V.YB.remove("scrollChatToBottom",e)}}),[]),(0,i.useEffect)((function(){if(r){var e=function(e){if(N((function(t){return X(t).concat([e])})),le&&"loading"!==e.contentType){var t,n=Ce(le,e),r=null!==(t=ce.current.get(le))&&void 0!==t?t:new Set;r.add(n),ce.current.set(le,r),n.finally((function(){return r.delete(n)}))}};e.removeMessage=function(e){N((function(t){return t.filter((function(t){return t.id!==e}))}))},e.updateThumbnails=function(e,t){var n=void 0!==t&&t;if(0!==e.length){var r=[];N((function(t){r=[];var a=!1,o=t.map((function(t){var o=e.find((function(e){return e.nodeId===t.nodeId}));if(!o)return t;var i=o.thumbnailStatus!==t.thumbnailStatus;if(n||i){var s,c=null!==(s=o.thumbnailUrl)&&void 0!==s?s:t.thumbnailUrl;return r.push({id:t.id,thumbnailStatus:o.thumbnailStatus,thumbnailUrl:c}),a=!0,H({},t,{thumbnailStatus:o.thumbnailStatus,thumbnailUrl:c})}return t}));return a?o:t})),r.length>0&&le&&r.forEach((function(e){var t=e.id,n=e.thumbnailStatus,r=e.thumbnailUrl;z.h.updateMessage(le,t,{thumbnailStatus:n,thumbnailUrl:r}).catch((function(e){console.error("Failed to persist thumbnail update:",e)}))}))}},r(e)}}),[r,le]),(0,i.useEffect)((function(){c&&c($(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return de(t),(null===Ae||void 0===Ae?void 0:Ae.user_id)&&me(Ae.user_id),e.abrupt("return",Oe(t));case 3:case"end":return e.stop()}}),e)}))))}),[c,Oe,Ae]),(0,i.useEffect)((function(){u&&u((function(){N([]),de(""),me(""),re(""),Y(!1),be({}),ge({}),ke({}),je({}),Ze({})}))}),[u]);var Ee=(0,i.useCallback)($(a().mark((function e(n){var r,o,i,s,c,u,l,d,p,m,v,b,y,g,w,_,k,S,j,T,I,Z,A,C,B,O,E,z,D,M,R,G;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.trim()){e.next=2;break}return e.abrupt("return");case 2:if(r=(0,L.M6)()){e.next=6;break}return console.error("User not found"),e.abrupt("return");case 6:return e.prev=6,e.next=9,F.B.postBalance(r.user_id);case 9:if(!(e.sent.data.balance<5)){e.next=13;break}return x(h("gnucleus_bot_no_points"),{variant:"warning"}),e.abrupt("return");case 13:e.next=20;break;case 15:return e.prev=15,e.t0=e.catch(6),console.error("Failed to check user balance:",e.t0),x("Failed to check balance. Please try again.",{variant:"error"}),e.abrupt("return");case 20:return o={id:"user-".concat(Date.now()),body:n,authorType:"user",createdAt:(new Date).toISOString(),contentType:"text"},N([o]),Y(!0),e.prev=23,c="task_other",u=!0,l=!1,d=n,p="en",m="",v="related",e.next=34,P.$.postTaskSelectV2(n,r.user_id);case 34:if(200===(b=e.sent).status){e.next=44;break}return console.error("Failed to call GenAI task API:",b.status,b.data),w=400===b.status&&(null===(y=b.data)||void 0===y||null===(g=y.message)||void 0===g?void 0:g.toLowerCase().includes("content blocked by moderation policy")),_=w?h("error_content_blocked")||"Your request was blocked by our content moderation policy. Please revise your input and try again.":h("error_task_selection_failed")||"Failed to process your request. Please try again.",k={id:"bot-error-".concat(Date.now()),body:_,authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!1},N([o,k]),Y(!1),e.abrupt("return");case 44:if(S=b.data,c=S.task_name||c,u=null!==(j=S.is_generate)&&void 0!==j?j:u,l=null!==(T=S.is_assembly)&&void 0!==T?T:l,v=S.task_selection_type||v,d=S.normalized_input_en||n,p=S.original_lang||p,m=S.shorten_input_original_lang||m,"task_other"!==c){e.next=60;break}return I={id:"bot-error-".concat(Date.now()),body:h("gnucleus_bot_other"),authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text"},N((function(e){return X(e).concat([I])})),Y(!1),e.abrupt("return");case 60:if(l){e.next=65;break}return Z={id:"bot-error-".concat(Date.now()),body:h("gnucleus_bot_not_assembly"),authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text"},N((function(e){return X(e).concat([Z])})),Y(!1),e.abrupt("return");case 65:return e.next=67,P.$.postCreateAsmSpecV2(r.user_id,v,c,n,m,d,p,u);case 67:200===(A=e.sent).status&&(null===(i=A.data)||void 0===i||null===(s=i.spec)||void 0===s?void 0:s.result)?(B="en"!==p&&A.data.spec.translated_result?A.data.spec.translated_result:A.data.spec.result,(O=null===(C=A.data.workspace)||void 0===C?void 0:C.workspace_id)&&de(O),me(r.user_id),V.YB.dispatch("consumePoint",{action:"CHAT"}),E={id:"success-".concat(Date.now()),body:h("successfully_generated_asm_spec"),authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text"},z=ae(B),B.validation&&"fail"===B.validation.status&&(z+=oe(B.validation,h)),D={id:"bot-".concat(Date.now()),body:z,authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!0,isInvalidSpec:B.validation&&"fail"===B.validation.status,workspace_id:O,task_selection_type:v,task_name:c,user_input:n,normalized_input_en:d,user_id:r.user_id,is_generate:u},M={id:"bot-follow-".concat(Date.now()+1),body:h("click_generate_or_edit"),authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!1},N([o]),O&&Ce(O,o),setTimeout((function(){N((function(e){return X(e).concat([E])})),O&&Ce(O,E)}),100),setTimeout((function(){N((function(e){return X(e).concat([D])})),O&&Ce(O,D)}),500),setTimeout((function(){N((function(e){return X(e).concat([M])})),O&&Ce(O,M),f&&f()}),1e3)):(R={id:"bot-".concat(Date.now()),body:"Failed to generate assembly specification. Please try again.",authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!1},N([o,R])),e.next=76;break;case 71:e.prev=71,e.t1=e.catch(23),console.error("Error calling APIs:",e.t1),G={id:"bot-".concat(Date.now()),body:"An error occurred while generating the assembly specification. Please try again.",authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!1},N([o,G]);case 76:return e.prev=76,Y(!1),t&&t(n,"text-assembly"),e.finish(76);case 80:case"end":return e.stop()}}),e,null,[[6,15],[23,71,76,80]])}))),[t,n,h,v,f]);(0,i.useEffect)((function(){p&&p(Ee)}),[p,Ee]);var Pe=$(a().mark((function e(){var t,n,r,o,i,s,c,u,l,d,p,f,m,v;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ee.trim()&&le&&fe){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,F.B.postBalance(fe);case 5:if(!(e.sent.data.balance<5)){e.next=9;break}return x(h("gnucleus_bot_no_points"),{variant:"warning"}),e.abrupt("return");case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(2),console.error("Failed to check user balance:",e.t0),x("Failed to check balance. Please try again.",{variant:"error"}),e.abrupt("return");case 16:return t={id:"user-edit-".concat(Date.now()),body:ee,authorType:"user",createdAt:(new Date).toISOString(),contentType:"text"},N((function(e){return X(e).concat([t])})),Ce(le,t),re(""),Y(!0),e.prev=21,e.next=25,P.$.postEditSpec(le,ee,fe);case 25:200===(o=e.sent).status&&(null===(n=o.data)||void 0===n||null===(r=n.spec)||void 0===r?void 0:r.result)?(V.YB.dispatch("consumePoint",{action:"CHAT"}),c=!!o.data.spec.translated_result,u=c?o.data.spec.translated_result:o.data.spec.result,l=ae(u),u.validation&&"fail"===u.validation.status&&(l+=oe(u.validation,h)),o.data.spec.message&&(d={id:"bot-success-".concat(Date.now()),body:o.data.spec.message,authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!1},N((function(e){return X(e).concat([d])})),Ce(le,d)),p={id:"bot-edit-".concat(Date.now()),body:l,authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!0,isInvalidSpec:u.validation&&"fail"===u.validation.status,workspace_id:le,task_selection_type:o.data.task_selection_type||"",task_name:o.data.task_name||"",user_input:ee,normalized_input_en:"",user_id:fe,is_generate:!0},f=(null===(i=o.data.workspace)||void 0===i?void 0:i.workspace_id)||le,(null===(s=o.data.workspace)||void 0===s?void 0:s.workspace_id)&&de(o.data.workspace.workspace_id),setTimeout((function(){N((function(e){return X(e).concat([p])})),Ce(f,p)}),500)):(m={id:"bot-error-".concat(Date.now()),body:"Failed to update specification. Please try again.",authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!1},N((function(e){return X(e).concat([m])}))),e.next=34;break;case 29:e.prev=29,e.t1=e.catch(21),console.error("Error calling postEditSpec:",e.t1),v={id:"bot-error-".concat(Date.now()),body:"An error occurred while updating the specification. Please try again.",authorType:"contact",createdAt:(new Date).toISOString(),contentType:"text",displayGenerateButton:!1},N((function(e){return X(e).concat([v])}));case 34:return e.prev=34,Y(!1),e.finish(34);case 37:case"end":return e.stop()}}),e,null,[[2,11],[21,29,34,37]])})));return(0,o.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"column",height:"100%",backgroundColor:"#f5f5f5",overflow:"hidden"},children:[(0,o.jsx)(l.Z,{ref:se,sx:{flex:1,overflowY:"auto",pt:4,pb:2},children:(0,o.jsxs)(l.Z,{sx:{width:s?"95%":"66%",mx:"auto",pt:1,pb:4,px:s?2:0},children:[O.map((function(e){return(0,o.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"user"===e.authorType?"row-reverse":"row",maxWidth:"user"!==e.authorType||s?"100%":560,ml:"user"===e.authorType?"auto":0,mb:s?1:2},children:[(0,o.jsx)(y.Z,{src:"user"===e.authorType?null===Ae||void 0===Ae?void 0:Ae.picture:void 0,sx:{height:32,width:32,ml:"user"===e.authorType?2:0,mr:"user"===e.authorType?0:2},children:"contact"===e.authorType?"AI":"Me"}),(0,o.jsxs)(l.Z,{sx:{flexGrow:1},children:[(0,o.jsx)(R.i,{createdAt:e.createdAt,authorType:e.authorType}),(0,o.jsx)(J,{sx:{backgroundColor:"user"===e.authorType?"#e8eaf6":"background.paper",color:(e.authorType,"text.primary")},children:"image"===e.contentType?(0,o.jsx)(l.Z,{component:"img",src:e.body,sx:{height:200,borderRadius:1,mx:1}}):(0,o.jsxs)(l.Z,{sx:{px:2,py:.5},children:["user"===e.authorType?(0,o.jsx)(d.Z,{color:"inherit",variant:"body1",sx:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:e.body}):"loading"===e.contentType?(0,o.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,o.jsx)(b.Z,{size:24}),(0,o.jsx)(d.Z,{variant:"body2",sx:{color:"text.secondary"},children:e.body})]}):(0,o.jsx)(l.Z,{component:"div",sx:{"& h1":{fontSize:"1.75rem",fontWeight:600,mb:1,mt:0},"& h2":{fontSize:"1.25rem",fontWeight:600,mt:2,mb:.5},"& h3":{fontSize:"1rem",fontWeight:600,mt:1.5,mb:.5},"& p":{mb:1,lineHeight:1.6},"& ul, & ol":{ml:1.5,mb:1},"& li":{mb:.5},whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:(0,o.jsx)(D(),{renderers:Q,children:e.body})}),e.displayGenerateButton&&(0,o.jsx)(l.Z,{sx:{mt:2},children:(0,o.jsx)(g.Z,{variant:"contained",color:e.isInvalidSpec?"warning":"primary",onClick:function(){n&&e.workspace_id&&n(e.workspace_id,{task_selection_type:e.task_selection_type,task_name:e.task_name,user_input:e.user_input,normalized_input_en:e.normalized_input_en,user_id:e.user_id,is_generate:e.is_generate})},startIcon:(0,o.jsx)(S.Z,{}),sx:e.isInvalidSpec?{position:"relative","&::before":{content:'"!"',position:"absolute",top:"-8px",right:"-8px",backgroundColor:"error.main",color:"white",borderRadius:"50%",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"bold",zIndex:1}}:{},children:h("generate")})}),(e.thumbnailStatus||e.thumbnailUrl)&&(0,o.jsx)(te,{status:e.thumbnailStatus||"completed",src:e.thumbnailUrl,alt:e.viewNodeName},"".concat(e.thumbnailStatus,"-").concat(e.thumbnailUrl||"")),e.keyParameters&&(0,o.jsx)(ne,{title:h("key_parameters"),text:e.keyParameters}),e.conditions&&e.conditions.length>=6&&(0,o.jsx)(ne,{title:h("conditions"),text:e.conditions}),e.displayViewButton&&e.viewNodeName&&(0,o.jsx)(l.Z,{sx:{mt:2},children:(0,o.jsx)(g.Z,{variant:"contained",color:"primary",onClick:$(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(le&&e.viewNodeName)try{V.YB.dispatch("loadNodeDisplay",{workspaceId:le,nodeName:e.viewNodeName})}catch(n){console.error("Error loading node display:",n)}case 1:case"end":return t.stop()}}),t)}))),startIcon:(0,o.jsx)(j.Z,{}),children:h("view")})}),e.showFeedbackIcons&&"contact"===e.authorType&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(l.Z,{sx:{mt:2,display:"flex",gap:1,alignItems:"center"},children:[(0,o.jsx)(w.Z,{size:"small",sx:{color:"up"===ve[e.id]?"success.main":"text.secondary","&:hover":{color:"success.main",backgroundColor:"action.hover"}},onClick:$(a().mark((function t(){var n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n="up"===ve[e.id],r=n?null:"up",be((function(t){return H({},t,q({},e.id,r))})),ge((function(t){return H({},t,q({},e.id,!1))})),!r){t.next=7;break}return t.next=7,Be(e.id,r);case 7:case"end":return t.stop()}}),t)}))),children:"up"===ve[e.id]?(0,o.jsx)(I.Z,{fontSize:"small"}):(0,o.jsx)(T.Z,{fontSize:"small"})}),(0,o.jsx)(w.Z,{size:"small",sx:{color:"down"===ve[e.id]?"error.main":"text.secondary","&:hover":{color:"error.main",backgroundColor:"action.hover"}},onClick:$(a().mark((function t(){var n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n="down"===ve[e.id],r=n?null:"down",be((function(t){return H({},t,q({},e.id,r))})),!r){t.next=6;break}return t.next=6,Be(e.id,r);case 6:case"end":return t.stop()}}),t)}))),children:"down"===ve[e.id]?(0,o.jsx)(A.Z,{fontSize:"small"}):(0,o.jsx)(Z.Z,{fontSize:"small"})}),(0,o.jsx)(w.Z,{size:"small",sx:{color:Ie[e.id]||ye[e.id]?"primary.main":"text.secondary",backgroundColor:Ie[e.id]?"primary.lighter":"transparent","&:hover":{color:"primary.main",backgroundColor:"action.hover"}},onClick:function(){ge((function(t){return H({},t,q({},e.id,!t[e.id]))}))},children:(0,o.jsx)(C.Z,{fontSize:"small"})})]}),Ie[e.id]&&!ye[e.id]&&(0,o.jsxs)(l.Z,{sx:{mt:2,p:2,backgroundColor:"background.default",borderRadius:1,border:"1px solid",borderColor:"divider"},children:[(0,o.jsx)(d.Z,{variant:"caption",color:"text.secondary",sx:{dis
1play:"block",mb:.5},children:"Your comment:"}),(0,o.jsx)(d.Z,{variant:"body2",color:"text.primary",children:Ie[e.id]})]}),ye[e.id]&&(0,o.jsxs)(l.Z,{sx:{mt:2},children:[(0,o.jsx)(_.Z,{fullWidth:!0,multiline:!0,rows:3,placeholder:"Add your comment...",value:_e[e.id]||"",onChange:function(t){ke((function(n){return H({},n,q({},e.id,t.target.value))}))},size:"small"}),(0,o.jsxs)(l.Z,{sx:{mt:1,display:"flex",gap:1,justifyContent:"flex-end"},children:[(0,o.jsx)(g.Z,{size:"small",onClick:function(){ge((function(t){return H({},t,q({},e.id,!1))})),ke((function(t){return H({},t,q({},e.id,""))}))},children:"Cancel"}),(0,o.jsx)(g.Z,{size:"small",variant:"contained",onClick:$(a().mark((function t(){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n=_e[e.id])||!ve[e.id]){t.next=6;break}return t.next=4,Be(e.id,ve[e.id],n);case 4:Ze((function(t){return H({},t,q({},e.id,n))})),ge((function(t){return H({},t,q({},e.id,!1))}));case 6:case"end":return t.stop()}}),t)}))),disabled:!_e[e.id]||!ve[e.id],children:"Submit"})]})]})]})]})})]})]},e.id)})),G&&(0,o.jsx)(l.Z,{sx:{display:"flex",justifyContent:"center",py:2},children:(0,o.jsx)(b.Z,{})}),(0,o.jsx)("div",{ref:ie})]})}),(0,o.jsx)(l.Z,{sx:{backgroundColor:"#f5f5f5",pt:3,pb:4,px:2,borderTop:"1px solid",borderColor:"divider",flexShrink:0},children:(0,o.jsx)(l.Z,{sx:{width:s?"95%":"66%",mx:"auto",px:0},children:(0,o.jsx)(_.Z,{fullWidth:!0,multiline:!0,minRows:3,maxRows:5,placeholder:h("edit_spec_placeholder"),value:ee,onChange:function(e){return re(e.target.value)},InputProps:{endAdornment:(0,o.jsx)(w.Z,{sx:{mr:1,color:ee.trim()?"primary.main":"action.disabled"},onClick:Pe,disabled:!ee.trim(),children:(0,o.jsx)(k.$,{fontSize:"small"})}),sx:{backgroundColor:"background.paper","& .MuiOutlinedInput-root":{backgroundColor:"background.paper","& .MuiOutlinedInput-notchedOutline":{border:"1px solid",borderColor:"grey.300"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"grey.400"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}}}})})})]})},se=n(69811),ce=n(66198),ue=n(80422),le=n(63079),de=n(93553),pe=n(70165),fe=n(64837),me=n(3451),he=n(13264),ve=n(22658),be=n(43589),xe=n(95445),ye=n(43749),ge=(0,f.ZP)(l.Z)((function(e){return{display:"flex",flexDirection:"column",height:"100%",backgroundColor:e.theme.palette.background.paper,overflow:"hidden"}})),we=((0,f.ZP)(l.Z)((function(e){var t=e.theme;return{padding:t.spacing(1.5),borderBottom:"1px solid ".concat(t.palette.divider),backgroundColor:t.palette.background.default}})),(0,f.ZP)(l.Z)({flex:1,overflow:"auto",padding:0})),_e=function(e){var t,n=e.node,r=e.level,a=(0,i.useState)(!0),s=a[0],c=a[1],u=n.children&&n.children.length>0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(se.ZP,{sx:{pl:2*r,py:.75,display:"flex",alignItems:"center",gap:0,"&:hover":{backgroundColor:"action.hover"}},children:[u?(0,o.jsx)(w.Z,{size:"small",onClick:function(){return c(!s)},sx:{p:.25,minWidth:20,minHeight:20,mr:.5},children:s?(0,o.jsx)(le.Z,{fontSize:"small",sx:{color:"text.secondary"}}):(0,o.jsx)(de.Z,{fontSize:"small",sx:{color:"text.secondary"}})}):(0,o.jsxs)(l.Z,{sx:{width:20,height:20,display:"flex",alignItems:"flex-end",justifyContent:"flex-start",position:"relative"},children:[(0,o.jsx)(l.Z,{sx:{position:"absolute",left:4,top:0,width:2,height:14,bgcolor:"text.disabled"}}),(0,o.jsx)(l.Z,{sx:{position:"absolute",left:4,bottom:6,width:10,height:2,bgcolor:"text.disabled"}})]}),(0,o.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",mr:.5},children:function(e){switch(e){case"ROOT_ASSEMBLY":return(0,o.jsx)(pe.Z,{fontSize:"small",sx:{color:"#1976d2"}});case"SUBASSEMBLY":return(0,o.jsx)(he.Z,{fontSize:"small",sx:{color:"#388e3c"}});case"PART":return(0,o.jsx)(fe.Z,{fontSize:"small",sx:{color:"#f57c00"}});default:return(0,o.jsx)(me.Z,{fontSize:"small"})}}(n.type)}),(0,o.jsx)(d.Z,{variant:"body2",sx:{flex:1,fontWeight:"ROOT_ASSEMBLY"===n.type?600:400,color:"text.primary",mr:.5},children:n.name}),(0,o.jsx)(ce.Z,{label:n.type,size:"small",sx:{height:20,fontSize:"0.7rem",fontWeight:500,color:"text.secondary",backgroundColor:"transparent",border:"none",mr:.5}}),n.hasAction&&(0,o.jsx)(w.Z,{size:"small",sx:{p:.25},children:(0,o.jsx)(ve.Z,{fontSize:"small",sx:{color:"#2196f3"}})}),n.status&&(0,o.jsxs)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",minWidth:24,minHeight:24,ml:.5},children:[("success"===n.status||"completed"===n.status)&&(0,o.jsx)(be.Z,{sx:{fontSize:18,color:"#4caf50"}}),("progress"===n.status||"in_progress"===n.status)&&(0,o.jsx)(b.Z,{size:18,sx:{color:"#2196f3"}}),("not_created"===n.status||"pending"===n.status)&&(0,o.jsx)(xe.Z,{sx:{fontSize:18,color:"#9e9e9e"}}),"queue"===n.status&&(0,o.jsx)(b.Z,{size:18,sx:{color:"#2196f3"}}),"failed"===n.status&&(0,o.jsx)(ye.Z,{sx:{fontSize:18,color:"#f44336"}})]})]}),u&&s&&(0,o.jsx)(ue.Z,{disablePadding:!0,children:null===(t=n.children)||void 0===t?void 0:t.map((function(e,t){return(0,o.jsx)(_e,{node:e,level:r+1}
1,"".concat(n.id,"-child-").concat(t,"-").concat(e.name||e.id))}))})]})},ke=function(e){e.workspaceId;var t=e.assemblyData,n=(0,i.useState)(null),r=n[0],a=n[1];return(0,i.useEffect)((function(){if(t){var e=function(e){if(!e)return null;var t=function(e,t){if(void 0!==t&&t)return"ROOT_ASSEMBLY";if(e.type&&"part"===e.type.toLowerCase())return"PART";if(e.type){var n=e.type.toUpperCase();return n.includes("PART")?"PART":(n.includes("ASSEMBLY")||n.includes("SUBASSEMBLY")||n.includes("SUB"),"SUBASSEMBLY")}return e.children&&e.children.length>0?"SUBASSEMBLY":"PART"},n=function(e){if(e.status){var t=e.status.toLowerCase();return"success"===t||t.includes("complete")||"done"===t?"success":"progress"===t||t.includes("progress")||"processing"===t?"progress":"queue"===t||t.includes("queue")?"queue":"failed"===t||t.includes("fail")||t.includes("error")?"failed":"not_created"===t||"notcreated"===t?"not_created":(t.includes("pending"),"pending")}return!0===e.is_generated?"success":!0===e.is_generating?"progress":"pending"},r=function(e,a){var o=void 0!==a&&a,i=e.type&&"part"===e.type.toLowerCase()&&e.component_name?e.component_name:e.name||e.root_name||e.component_name||e.label||"Unnamed";return{id:e.id||e.node_id||e.component_id||e.name||Math.random().toString(),name:i,type:t(e,o),status:n(e),hasAction:e.has_action||e.can_regenerate||!1,nodeId:e.node_id||e.id,children:e.children&&e.children.length>0?e.children.map((function(e){return r(e,!1)})):void 0}};return e.tree?r(e.tree,!0):e.assembly_tree?r(e.assembly_tree,!0):e.root?r(e.root,!0):e.nodes?{id:"root",name:"Root",type:"ROOT_ASSEMBLY",status:"completed",children:e.nodes.map((function(e){return r(e,!1)}))}:r(e,!0)}(t);a(e)}}),[t]),r?(0,o.jsx)(ge,{children:(0,o.jsx)(we,{children:(0,o.jsx)(ue.Z,{disablePadding:!0,sx:{px:1,py:.5},children:(0,o.jsx)(_e,{node:r,level:0},"".concat(r.id,"-").concat(r.status||"no-status"))})})}):(0,o.jsx)(ge,{children:(0,o.jsx)(l.Z,{sx:{p:3,textAlign:"center"},children:(0,o.jsx)(d.Z,{variant:"body2",color:"text.secondary",children:"No assembly data available"})})})},Se=n(86020),je=n(61877),Te=n(57760),Ie=n(76467),Ze=n(85320),Ae=n(68411),Ce=n(25819),Be=n(65922);function Oe(e,t,n,r,a,o,i){try{var s=e[o](i),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(r,a)}function Ee(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Oe(o,r,a,i,s,"next",e)}function s(e){Oe(o,r,a,i,s,"throw",e)}i(void 0)}))}}function Pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(c){a=!0,o=c}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ne(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var De,Me,Re=(0,f.ZP)("div",{shouldForwardProp:function(e){return"open"!==e&&"sidebarWidth"!==e}})((function(e){var t=e.theme,n=e.open,r=e.sidebarWidth,a=void 0===r?v.Qz:r;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Pe(e,t,n[t])}))}return e}((Pe(De={display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden"},t.breakpoints.up("md"),{marginLeft:-a}),Pe(De,"transition",t.transitions.create("margin",{easing:t.transitions.easing.sharp,duration:t.transitions.duration.leavingScreen})),De),n&&(Pe(Me={},t.breakpoints.up("md"),{marginLeft:0}),Pe(Me,"transition",t.transitions.create("margin",{easing:t.transitions.easing.easeOut,duration:t.transitions.duration.enteringScreen})),Me))})),Le=function(){var e=(0,c.useRouter)(),t=(0,Ze.I0)(),n=(0,E.$)(),r=n.i18n,f=n.t,m=(0,i.useState)(!1),h=m[0],b=m[1],x=(0,i.useState)(v.Qz),y=x[0],g=x[1],_=(0,i.useState)(!1),k=_[0],S=_[1],j=(0,i.useState)(!1),T=j[0],I=j[1],Z=(0,i.useState)(!1),A=Z[0],C=Z[1],B=(0,i.useState)(void 0),O=B[0],N=B[1],D=(0,i.useState)(!0),M=(D[0],D[1]),R=(0,i.useState)(30),G=R[0],F=R[1],U=(0,i.useState)(!1),Y=U[0],$=U[1],q=(0,i.useState)(!1),H=q[0],X=q[1],Q=(0,i.useState)(null),J=Q[0],K=Q[1],ee=(0,i.useState)(""),te=ee[0],ne=ee[1],re=(0,i.useState)(!1),ae=re[0],oe=re[1],se=(0,i.useRef)(new Map),ce=(0,i.useRef)(null),ue=(0,i.useRef)(null),le=(0,i.useRef)(0),de=(0,i.useRef)(null),pe=(0,i.useRef)(!1),fe=(0,i.useRef)(0),me=(0,i.useRef)(""),he=(0,i.useRef)(null),ve=(0,i.useRef)(null),be=(0,i.useRef)(null),xe=(0,i.useRef)(null),ye=(0,i.useRef)(null),ge=(0,u.Z)((function(e){return e.breakpoints.up("md")}),{noSsr:!0}),we=(0,L.M6)();(0,i.useEffect)((function(){var e=localStorage.getItem("preferredLanguage");e&&e!==r.language&&r.changeLanguage(e)}
1),[r]),(0,i.useEffect)((function(){V.wT.push({event:"page_view"})}),[]),(0,i.useEffect)((function(){we&&(je.ZP.event({category:"Workspace Assembly",action:"User login",label:"Login Event"}),localStorage.setItem("activeUser",JSON.stringify(we)))}),[we]),(0,i.useEffect)((function(){var e=function(){S(window.innerHeight<480&&window.innerHeight<window.innerWidth)};return window.addEventListener("resize",e),window.addEventListener("orientationchange",e),e(),function(){window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}}),[]),(0,i.useEffect)((function(){ge||b(!1)}),[ge]);var _e=(0,i.useRef)(!1);(0,i.useEffect)((function(){var e=function(e){_e.current&&!1===(null===e||void 0===e?void 0:e.message)?(C(!1),N(void 0),_e.current=!1):_e.current||(C(null===e||void 0===e?void 0:e.message),N((null===e||void 0===e?void 0:e.message)?null===e||void 0===e?void 0:e.label:void 0))},n=function(e){if(he.current){var t,n="cloud"===e.kind;if(e.success)if(n){var r=f("onshape_export_open_link")||"Open in Onshape \u2197";if(e.warning&&e.onshapeUrl)t=e.warning.split(e.onshapeUrl).join("[".concat(r,"](").concat(e.onshapeUrl,")"));else{var a=f("onshape_export_success")||"Opened in Onshape.",o=e.onshapeUrl?"\n\n[".concat(r,"](").concat(e.onshapeUrl,")"):"";t="".concat(a).concat(o)}}else t=f("download_success")||"Your model has been downloaded successfully.";else{var i=f("download_failed")||"Download failed. Please try again.";t=e.reason?"".concat(i,"\n\n").concat(e.reason):i}he.current({id:(0,L.hA)(),body:t,authorType:"contact",createdAt:W()().toISOString(),contentType:"text",displayGenerateButton:!1})}},r=Ee(a().mark((function e(n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,console.log("Loading display for node: ".concat(n.nodeName)),C(!0),I(!0),_e.current=!0,e.next=7,nt(n.workspaceId,n.nodeName);case 7:e.sent?t(Ae.Nw.setActiveModel(n.workspaceId)):(C(!1),_e.current=!1),e.next=16;break;case 11:e.prev=11,e.t0=e.catch(0),console.error("Error loading node display:",e.t0),C(!1),_e.current=!1;case 16:case"end":return e.stop()}}),e,null,[[0,11]])})));return V.YB.on("showInProcess",e),V.YB.on("downloadComplete",n),V.YB.on("loadNodeDisplay",r),function(){V.YB.remove("showInProcess",e),V.YB.remove("downloadComplete",n),V.YB.remove("loadNodeDisplay",r)}}),[f]),(0,i.useEffect)((function(){if(e.isReady&&e.query.workspaceId&&"string"===typeof e.query.workspaceId){var t=e.query.workspaceId;console.log("[ws-text-to-asm] Loading workspace from URL:",t),e.replace("/app/workspace/ws-text-to-asm",void 0,{shallow:!0}),Be(t)}}),[e.isReady,e.query.workspaceId]),(0,i.useEffect)((function(){var e=sessionStorage.getItem("pendingWorkspaceInput");e&&xe.current&&(sessionStorage.removeItem("pendingWorkspaceInput"),setTimeout(Ee(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!xe.current){t.next=3;break}return t.next=3,xe.current(e);case 3:case"end":return t.stop()}}),t)}))),100))}),[xe.current]);var Ce=function(){b((function(e){return!e}))},Be=Ee(a().mark((function e(n){var r,o,i,s,c,u,l,d,p,f,m,h,v,x,y,g,w,_,k;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=++fe.current,o=function(){return r!==fe.current},e.prev=2,C(!0),I(!1),V.YB.dispatch("createSubjectEventFromFile",{message:null,type:"gltf_json"}),ne(n),me.current=n,pe.current=!1,oe(!1),se.current=new Map,le.current=0,t(Ae.Nw.setActiveModel("")),M(!0),i=null,!ve.current){e.next=19;break}return e.next=18,ve.current(n);case 18:i=e.sent;case 19:if(!o()){e.next=21;break}return e.abrupt("return");case 21:return(null===i||void 0===i?void 0:i.hasCompletionMessage)&&(pe.current=!0),setTimeout((function(){V.YB.dispatch("scrollChatToBottom")}),300),e.next=25,z.h.getWorkspaceMetadata(n);case 25:if(s=e.sent,!o()){e.next=28;break}return e.abrupt("return");case 28:if(200===s.status&&s.data){e.next=32;break}return console.error("Failed to get workspace metadata"),C(!1),e.abrupt("return");case 32:return c=s.data.is_cad_generated,e.next=35,P.$.postGetAssemblyTreeStatusV2(n);case 35:if(u=e.sent,!o()){e.next=38;break}return e.abrupt("return");case 38:if(200!==u.status||!u.data){e.next=84;break}if(Pe(u.data),X(!0),b(!0),he.current&&(p=Xe(De(u.data)),null===(d=(l=he.current).updateThumbnails)||void 0===d||d.call(l,p,!0)),f=Fe(De(u.data)),!i){e.next=63;break}
1for(m=Ye(f,i),h=!0,v=!1,x=void 0,e.prev=47,y=$e(m,u.data.root_id)[Symbol.iterator]();!(h=(g=y.next()).done);h=!0)w=g.value.node,qe(w,u.data.root_id);e.next=55;break;case 51:e.prev=51,e.t0=e.catch(47),v=!0,x=e.t0;case 55:e.prev=55,e.prev=56,h||null==y.return||y.return();case 58:if(e.prev=58,!v){e.next=61;break}throw x;case 61:return e.finish(58);case 62:return e.finish(55);case 63:if(Le(u.data)&&!Me(u.data)&&(pe.current=!0),Le(u.data)&&Ge(u.data)?i&&Me(u.data)&&He():oe(!0),!c){e.next=81;break}if(!(_=u.data.root_name)){e.next=78;break}return I(!0),_e.current=!0,e.next=72,nt(n,_);case 72:if(k=e.sent,!o()){e.next=75;break}return e.abrupt("return");case 75:k?t(Ae.Nw.setActiveModel(n)):(console.warn("Failed to load 3D model for workspace - files may not exist:",n),I(!1),C(!1),_e.current=!1),e.next=79;break;case 78:C(!1);case 79:e.next=82;break;case 81:C(!1);case 82:e.next=85;break;case 84:C(!1);case 85:ge||b(!1),e.next=92;break;case 88:e.prev=88,e.t1=e.catch(2),console.error("Error loading workspace:",e.t1),C(!1);case 92:case"end":return e.stop()}}),e,null,[[2,88],[47,51,55,63],[56,,58,62]])}))),Oe=(Ee(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:setTimeout(Ee(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!xe.current){e.next=3;break}return e.next=3,xe.current(t);case 3:case"end":return e.stop()}}),e)}))),100);case 1:case"end":return e.stop()}}),e)}))),function(e){if(!e)return!0;var t=e.tree||e.assembly_tree||e.root;if(t){var n=t.name||t.root_name||t.component_name||t.label,r=Array.isArray(t.children)&&t.children.length>0;return!n&&!r}return!(Array.isArray(e.nodes)&&e.nodes.length>0)}),Pe=function(e){K((function(t){return Oe(e)&&!Oe(t)?t:e}))},De=function(e){return e&&(e.tree||e.assembly_tree||e.root)||null},Me=function(e){var t,n,r=null===(t=De(e))||void 0===t||null===(n=t.status)||void 0===n?void 0:n.toLowerCase();return"success"===r||"completed"===r},Le=function(e){var t=De(e);if(!t)return!1;var n=function(e,t){var r,a=void 0===t?"":t,o=null===(r=e.status)||void 0===r?void 0:r.toLowerCase(),i=e.name||e.component_name||e.root_name||"unnamed",s=a?"".concat(a," > ").concat(i):i;if(!("success"===o||"completed"===o)&&!("failed"===o||"error"===o)&&void 0!==o)return!1;if(e.children&&e.children.length>0&&!e.children.every((function(e){return n(e,s)})))return!1;return!0};return n(t)},Ge=function(e){var t=De(e);if(!t)return!1;var n=function(e){var t,r=null===(t=e.status)||void 0===t?void 0:t.toLowerCase();return(!("success"===r||"completed"===r)||!e.thumbnail_status||"completed"===e.thumbnail_status)&&(!(e.children&&e.children.length>0)||e.children.every((function(e){return n(e)})))};return n(t)},We=function(e){var t;return"assembly"===(null===(t=e.type)||void 0===t?void 0:t.toLowerCase())&&void 0!==e.component_id},Fe=function(e,t,n){var r,a=void 0===t?"":t,o=void 0===n?[]:n;if(!e)return o;var i=e.component_name,s=e.name,c=i||s,u=a?"".concat(a,"/").concat(c):c,l=null===(r=e.status)||void 0===r?void 0:r.toLowerCase(),d=se.current.get(u);return("success"===l||"completed"===l)&&("success"!==d&&"completed"!==d)&&!We(e)&&o.push({node:e}),se.current.set(u,l),e.children&&e.children.length>0&&e.children.forEach((function(e,t){Fe(e,"".concat(u,"/").concat(t),o)})),o},Ue=function(e){var t,n=null===(t=e.type)||void 0===t?void 0:t.toLowerCase();return"part"===n&&null!=e.part_id?"PART#".concat(e.part_id):"assembly"===n&&null!=e.assembly_id?"ASM#".concat(e.assembly_id):void 0},Ve=function(e){var t;return"part"===(null===(t=e.type)||void 0===t?void 0:t.toLowerCase())?e.part_name||null:e.name||null},Ye=function(e,t){var n=new Map,r=!0,a=!1,o=void 0;try{for(var i,s=t.nodeIds[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var c=i.value;n.set(c,(n.get(c)||0)+1)}}catch(b){a=!0,o=b}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}var u=new Map,l=!0,d=!1,p=void 0;try{for(var f,m=t.legacyViewNodeNames[Symbol.iterator]();!(l=(f=m.next()).done);l=!0){var h=f.value;u.set(h,(u.get(h)||0)+1)}}catch(b){d=!0,p=b}finally{try{l||null==m.return||m.return()}finally{if(d)throw p}}var v=function(e,t){if(!t)return!1;var n=e.get(t)||0;return!(n<=0)&&(e.set(t,n-1),!0)};return e.filter((function(e){var t=e.node,r=Ue(t),a=Ve(t);
1return!(!r&&!a)&&(!v(n,r)&&!v(u,a))}))},$e=function(e,t){var n=function(e){var n;return"assembly"===(null===(n=e.type)||void 0===n?void 0:n.toLowerCase())&&null!=t&&String(e.assembly_id)===String(t)};return Ne(e.filter((function(e){var t=e.node;return!n(t)}))).concat(Ne(e.filter((function(e){var t=e.node;return n(t)}))))},qe=function(e,t){var n,r=e.component_name,a=e.name,o=null===(n=e.type)||void 0===n?void 0:n.toLowerCase(),i=e.thumbnail_url||void 0,s=e.thumbnail_status||void 0,c=e.key_parameters||void 0,u=e.conditions||void 0,l=Ve(e);l||("part"===o?console.warn('Part "'.concat(r,'" completed but part_name is missing - cannot display View button')):console.warn('Assembly "'.concat(r,'" completed but node.name is missing - cannot display View button')));var d="assembly"===o&&null!=t&&String(e.assembly_id)===String(t);if("part"===o)he.current&&he.current({id:(0,L.hA)(),body:f("part_generated_success",{component_name:r}),authorType:"contact",createdAt:W()().toISOString(),contentType:"text",displayGenerateButton:!1,displayViewButton:null!==l,viewNodeName:l||void 0,nodeId:Ue(e),thumbnailUrl:i,thumbnailStatus:s,keyParameters:c,conditions:u});else{var p,m;if(d&&de.current&&he.current)null===(m=(p=he.current).removeMessage)||void 0===m||m.call(p,de.current),de.current=null;if(he.current){var h=r||a;he.current({id:(0,L.hA)(),body:f("assembly_item_generated_success",{displayName:h}),authorType:"contact",createdAt:W()().toISOString(),contentType:"text",displayGenerateButton:!1,displayViewButton:null!==l,viewNodeName:l||void 0,nodeId:Ue(e),thumbnailUrl:i,thumbnailStatus:s})}}return l},He=function(){!pe.current&&he.current&&(pe.current=!0,he.current({id:(0,L.hA)(),body:f("assembly_generated_success"),authorType:"contact",createdAt:W()().toISOString(),contentType:"text",displayGenerateButton:!1,showFeedbackIcons:!0}))},Xe=function(e,t){var n,r=void 0===t?[]:t;if(!e)return r;var a=null===(n=e.status)||void 0===n?void 0:n.toLowerCase();if(("success"===a||"completed"===a)&&e.thumbnail_status&&!We(e)){var o=Ue(e);o&&r.push({nodeId:o,thumbnailStatus:e.thumbnail_status,thumbnailUrl:e.thumbnail_url})}return e.children&&e.children.length>0&&e.children.forEach((function(e){return Xe(e,r)})),r},Qe=Ee(a().mark((function e(n){var r,o,i,s,c,u,l,d,p,m,h,v,b,x,y,g,w,_,k,S,j;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=fe.current,ue.current!==r){e.next=3;break}return e.abrupt("return");case 3:return ue.current=r,e.prev=4,e.next=7,P.$.postGetAssemblyTreeStatusV2(n);case 7:if(o=e.sent,r===fe.current){e.next=10;break}return e.abrupt("return");case 10:if(200!==o.status||!o.data){e.next=57;break}i=De(o.data),s=o.data.root_id,c=$e(Fe(i),s),he.current&&(d=Xe(i),null===(l=(u=he.current).updateThumbnails)||void 0===l||l.call(u,d)),p=!0,m=!1,h=void 0,e.prev=16,v=c[Symbol.iterator]();case 18:if(p=(b=v.next()).done){e.next=37;break}if(x=b.value.node,!(y=qe(x,s))){e.next=34;break}return e.prev=22,e.next=25,nt(n,y);case 25:if(g=e.sent,r===fe.current){e.next=28;break}return e.abrupt("return");case 28:g&&(t(Ae.Nw.setActiveModel(n)),I(!0)),e.next=34;break;case 31:e.prev=31,e.t0=e.catch(22),console.error("Error loading display file:",e.t0);case 34:p=!0,e.next=18;break;case 37:e.next=43;break;case 39:e.prev=39,e.t1=e.catch(16),m=!0,h=e.t1;case 43:e.prev=43,e.prev=44,p||null==v.return||v.return();case 46:if(e.prev=46,!m){e.next=49;break}throw h;case 49:return e.finish(46);case 50:return e.finish(43);case 51:Pe(o.data),w=Le(o.data),_=Ge(o.data),w&&!_&&(le.current+=1),k=_||le.current>=4,w&&k&&(oe(!1),de.current&&he.current&&(null===(j=(S=he.current).removeMessage)||void 0===j||j.call(S,de.current),de.current=null),ce.current&&(clearInterval(ce.current),ce.current=null),Me(o.data)?He():!pe.current&&he.current&&(pe.current=!0,he.current({id:(0,L.hA)(),body:f("assembly_generation_error"),authorType:"contact",createdAt:W()().toISOString(),contentType:"text",displayGenerateButton:!1})));case 57:e.next=63;break;case 59:e.prev=59,e.t2=e.catch(4),console.error("Error fetching assembly tree status:",e.t2),C(!1);case 63:return e.prev=63,ue.current===r&&(ue.current=null),e.finish(63);case 66:case"end":return e.stop()}}),e,null,[[4,59,63,66],[16,39,43,51],[22,31],[44,,46,50]])})));(0,i.useEffect)((function(){if(ae&&te)return ce.current=setInterval((function(){Qe(te)}),3e4),function(){ce.current&&(clearInterval(ce.current),ce.current=null)}}),[ae,te]);var Je=Ee(a().mark((function e(n,r){var o,i,s,c,u,l,d,p,m,h,v;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I(!1),b(!0),C(!0),ne(n),me.current=n,oe(!1),o=++fe.current,i=function(){return o===fe.current}
1,pe.current=!1,se.current=new Map,le.current=0,he.current&&(he.current({id:(0,L.hA)(),body:f("assembly_generating"),authorType:"contact",createdAt:W()().toISOString(),contentType:"text",displayGenerateButton:!1}),s=(0,L.hA)()+"-loading",de.current=s,he.current({id:s,body:"Generating assembly...",authorType:"contact",createdAt:W()().toISOString(),contentType:"loading",displayGenerateButton:!1})),c=function(){var e,t;de.current&&he.current&&(null===(t=(e=he.current).removeMessage)||void 0===t||t.call(e,de.current),de.current=null);he.current&&he.current({id:(0,L.hA)(),body:"Oops! Something went wrong while generating assembly. Please try again or contact support if the issue persists.",authorType:"contact",createdAt:W()().toISOString(),contentType:"text",displayGenerateButton:!1})},e.prev=13,u=(0,L.M6)(),l=(null===r||void 0===r?void 0:r.user_id)||(null===u||void 0===u?void 0:u.user_id),!((null===r||void 0===r?void 0:r.task_selection_type)&&(null===r||void 0===r?void 0:r.task_name)&&(null===r||void 0===r?void 0:r.user_input))){e.next=35;break}return e.next=19,P.$.postGenerateAsmStructureV2(n,r.task_selection_type,r.task_name,r.user_input,l,!1,r.normalized_input_en,r.is_generate);case 19:if(200===(d=e.sent).status){e.next=24;break}return console.error("Failed to generate assembly structure before nodes:",d),i()&&(c(),C(!1)),e.abrupt("return");case 24:if(!i()){e.next=35;break}return e.prev=25,e.next=28,P.$.postGetAssemblyTreeStatusV2(n);case 28:p=e.sent,i()&&200===p.status&&p.data&&(Pe(p.data),X(!0)),e.next=35;break;case 32:e.prev=32,e.t0=e.catch(25),console.error("Error loading assembly tree after structure:",e.t0);case 35:return e.next=37,P.$.postGenerateAsmNodesV2(n,l,"freecad",!0,!0,!0);case 37:if(200===(m=e.sent).status&&V.YB.dispatch("consumePoint",{action:"CHAT"}),h=function(){me.current===n&&oe(!0)},i()){e.next=43;break}return 200===m.status&&h(),e.abrupt("return");case 43:if(200!==m.status){e.next=59;break}return t(Ae.Nw.setGenerationType("assembly")),e.next=47,new Promise((function(e){return setTimeout(e,500)}));case 47:if(i()){e.next=50;break}return h(),e.abrupt("return");case 50:return e.next=52,P.$.postGetAssemblyTreeStatusV2(n);case 52:if(v=e.sent,i()){e.next=56;break}return h(),e.abrupt("return");case 56:200===v.status&&v.data&&(Pe(v.data),X(!0),oe(!0)),e.next=60;break;case 59:console.error("Failed to generate assembly nodes:",m),c();case 60:e.next=66;break;case 62:e.prev=62,e.t1=e.catch(13),console.error("Error generating assembly:",e.t1),i()&&c();case 66:return e.prev=66,i()&&C(!1),e.finish(66);case 69:case"end":return e.stop()}}),e,null,[[13,62,66,69],[25,32]])}))),Ke=Ee(a().mark((function e(){var t,n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(te){e.next=3;break}return console.warn("No workspace ID available for assembly tree"),e.abrupt("return");case 3:return t=fe.current,n=te,C(!0),e.prev=6,e.next=9,P.$.postGetAssemblyTreeStatusV2(n);case 9:if(r=e.sent,t===fe.current){e.next=12;break}return e.abrupt("return");case 12:200===r.status&&r.data?(Pe(r.data),Le(r.data)&&Ge(r.data)||(le.current=0,oe(!0))):console.error("Failed to fetch assembly tree status:",r),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(6),console.error("Error fetching assembly tree status:",e.t0);case 18:return e.prev=18,t===fe.current&&C(!1),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[6,15,18,21]])}))),et=function(e){if(Y){var t=window.innerWidth-(ge&&h?320:0),n=(window.innerWidth-e.clientX)/t*100,r=Math.max(30,Math.min(70,n));F(r)}},tt=function(e){if(Y){var t=e.touches[0],n=window.innerWidth-(ge&&h?320:0),r=(window.innerWidth-t.clientX)/n*100,a=Math.max(30,Math.min(70,r));F(a)}};(0,i.useEffect)((function(){if(Y)return window.addEventListener("mousemove",et),window.addEventListener("mouseup",(function(){return $(!1)})),window.addEventListener("touchmove",tt),window.addEventListener("touchend",(function(){return $(!1)})),function(){window.removeEventListener("mousemove",et),window.removeEventListener("touchmove",tt)}}),[Y,ge,h]);var nt=Ee(a().mark((function e(t,n){var r,o,i,s,c,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.t0=ze,e.next=4,Promise.all([P.$.downloadTicketV2(t,"".concat(n,".glb")),P.$.downloadTicketV2(t,"".concat(n,".json"))]);case 4:if(e.t1=e.sent,r=(0,e.t0)(e.t1,2),o=r[0],i=r[1],!o.file_url||!i.file_url){e.next=21;break}return e.t2=ze,e.next=12,Promise.all([fetch(o.file_url).then((function(e){return e.arrayBuffer()})),fetch(i.file_url).then((function(e){return e.json()}))]);case 12:return e.t3=e.sent,s=(0,e.t2)(e.t3,2),c=s[0],u=s[1],V.YB.dispatch("createSubjectEventFromFile",{message:{glbData:c,jsonData:u},type:"gltf_json"}),V.YB.dispatch("fitScreenEvent"),e.abrupt("return",!0);case 21:return e.abrupt("return",!1);case 22:e.next=28;break;case 24:return e.prev=24,e.t4=e.catch(0),console.error("Error in processDownloadV2:",e.t4),e.abrupt("return",!1);case 28:case"end":return e.stop()}}),e,null,[[0,24]])})));return e.isReady?we?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.default,{children:(0,o.jsx)("title",{children:"gNucleus | Assembly Workspace"})}),(0,o.jsx)(l.Z,{component:"main",sx:{position:"relative",height:"100%",width:"100%",overflow:"hidden"},children:k?(0,o.jsx)(l.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",textAlign:"center",padding:2},children:(0,o.jsx)(d.Z,{variant:"h4",children:f("screen_landscape")})}):(0,o.jsxs)(l.Z,{sx:{display:"flex",position:"absolute",top:0,right:0,bottom:0,left:0},children:[(0,o.jsx)(v.TW,{onClose:function(){b(!1)},open:h,onWorkspaceSelect:Be,onNewProduct:function(){e.push("/app/workspace/new_product")},onRegisterRefresh:function(e){ye.current=e},showAssemblyTab:H&&!!J,onAssemblyTabClick:Ke,onWidthChange:function(e){g(e)},assemblyViewerContent:(0,o.jsx)(ke,{workspaceId:te,assemblyData:J},"assembly-viewer-".concat(te))}),(0,o.jsxs)(Re,{open:h,sidebarWidth:y,children:[!T&&(0,o.jsx)(l.Z,{sx:{backgroundColor:"background.paper",borderBottomColor:"divider",borderBottomStyle:"solid",borderBottomWidth:1,display:"flex",alignItems:"center",p:0,flexShrink:0},children:(0,o.jsx)(w.Z,{onClick:Ce,children:(0,o.jsx)(Se.j,{fontSize:"small"})})}),(0,o.jsxs)(l.Z,{sx:{flexGrow:1,overflow:"hidden",display:"flex",flexDirection:"row"},children:[T&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(l.Z,{sx:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,o.jsxs)(l.Z,{sx:{backgroundColor:"background.paper",borderBottomColor:"divider",borderBottomStyle:"solid",borderBottomWidth:1,display:"flex",alignItems:"center",p:0,flexShrink:0},children:[(0,o.jsx)(w.Z,{onClick:Ce,children:(0,o.jsx)(Se.j,{fontSize:"small"})}),(0,o.jsx)(Ie.GNucleusToolbar,{})]}),A&&(0,o.jsxs)(l.Z,{sx:{width:"100%",flexShrink:0},children:[O&&(0,o.jsx)(d.Z,{variant:"caption",color:"text.secondary",sx:{px:1},children:O}),(0,o.jsx)(p.Z,{})]}),(0,o.jsx)(Ie.GNucleusViewer,{})]}),(0,o.jsx)(l.Z,{role:"separator","aria-orientation":"vertical",onMouseDown:function(e){$(!0)},onTouchStart:function(e){$(!0)},sx:{width:Y?8:4,cursor:"col-resize",position:"relative",backgroundColor:"transparent",zIndex:1,transition:"all 0.2s","&:hover":{backgroundColor:"primary.main",opacity:.3},"&::after":{content:'""',position:"absolute",left:"50%",top:0,bottom:0,width:1,backgroundColor:"divider"}}})]}),(0,o.jsx)(l.Z,{sx:{flex:T?"0 0 auto":1,width:T?"".concat(G,"%"):"100%",overflow:"hidden",display:"flex",flexDirection:"column"},children:(0,o.jsx)(ie,{onInputSubmit:function(e,t){},onGenerateAsm:Je,onAddMessage:function(e){he.current=e},onLoadWorkspace:function(e){ve.current=e},onResetChat:function(e){be.current=e},onRegisterSubmit:function(e){xe.current=e},onWorkspaceCreated:function(){ye.current&&ye.current()},showViewer:T})})]})]})]})})]}):(0,o.jsx)(Te.j,{message:"Please login firstly."}):null},Ge=function(){var e=(0,c.useRouter)(),t=(0,Be.n)();return"checking"===t?(0,o.jsx)(p.Z,{}):"denied"===t?(0,o.jsx)(Ce.z,{feature:"text-to-assembly",standalone:!0,onUpgrade:function(){return e.push("/app/pricing")}}):(0,o.jsx)(Le,{})};Ge.getLayout=function(e){return(0,o.jsx)(m.a,{children:(0,o.jsx)(h.c,{children:e})})};var We=Ge},25819:function(e,t,n){"use strict";n.d(t,{z:function(){return d}});var r=n(52322),a=n(24862),o=n(62197),i=n(83249),s=n(3399);
1function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){for(var t=arguments,n=function(n){var r=null!=t[n]?t[n]:{},a=Object.keys(r);"function"===typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),a.forEach((function(t){c(e,t,r[t])}))},r=1;r<arguments.length;r++)n(r);return e}var l={"text-to-assembly":"workspace.upgrade_assembly_description","image-to-part":"workspace.upgrade_image_to_part_description"},d=function(e){var t=e.feature,n=e.onUpgrade,c=e.standalone,d=void 0!==c&&c,p=(0,s.$)().t;return(0,r.jsxs)(a.Z,{sx:u({display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",maxWidth:600,mx:"auto",px:4},d?{justifyContent:"center",minHeight:"60vh"}:{pt:4,pb:8}),children:[(0,r.jsx)(o.Z,{variant:"h6",color:"text.primary",sx:{mb:4,fontWeight:600},children:p(l[t])}),(0,r.jsx)(i.Z,{variant:"contained",color:"primary",size:"large",onClick:n,sx:{minWidth:200,height:48},children:p("workspace.upgrade")})]})}}},function(e){e.O(0,[6975,4546,9283,186,3718,3414,4601,3497,2942,3340,8779,769,5596,7227,4032,6198,9811,5961,8834,6044,5706,6239,7275,1322,7327,8746,6981,2154,5613,5890,4424,7925,4705,1292,3725,6467,5559,9774,2888,179],(function(){return t=17148,e(e.s=t);var t}));var t=e.O();_N_E=t}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.