PageSourceSearch

https://thinkvelocity.ai/_next/static/chunks/6011.f187f08804cd2a67.js

js thinkvelocity.ai collected 2026-10-02 00:45:12 UTC 144,311 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2818,6011],{2818:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var r=n(95155);function i(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:"\n            @keyframes test-bg-grid-drift {\n              0% { transform: translate(0, 0); }\n              100% { transform: translate(80px, 80px); }\n            }\n            @keyframes test-bg-orb-a {\n              0%, 100% { transform: translate(0, 0) scale(1); }\n              50% { transform: translate(12%,%) scale(1.12); }\n            }\n            @keyframes test-bg-orb-b {\n              0%, 100% { transform: translate(0, 0) scale(1); }\n              50% { transform: translate(-10%, 12%) scale(1.08); }\n            }\n            @keyframes test-bg-orb-c {\n              0%, 100% { transform: translate(0, 0) scale(1); }\n              50% { transform: translate(5%, 18%) scale(0.92); }\n            }\n            @keyframes test-bg-shimmer {\n              0% { opacity: 0.35; transform: translateX(-100%) skewX(-12deg); }\n              100% { opacity: 0.55; transform: translateX(200%) skewX(-12deg); }\n            }\n            .test-bg-root {\n              background:\n                radial-gradient(ellipse 100% 70% at 50% 0%, rgba(26, 218, 243, 0.05), transparent 55%),\n                radial-gradient(ellipse 80% 60% at 100% 20%, rgba(88, 245, 255, 0.03), transparent 50%),\n                radial-gradient(ellipse 60% 50% at 0% 90%, rgba(26, 218, 243, 0.02), transparent 45%),\n                #030305;\n            }\n            .test-bg-grid {\n              position: absolute;\n              inset: 0;\n              background-image:\n                linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),\n                linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);\n              background-size: 80px 80px;\n              mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, black 0%, transparent 75%);\n              animation: test-bg-grid-drift 100s linear infinite;\n            }\n            .test-bg-orb {\n              position: absolute;\n              border-radius: 50%;\n              filter: blur(100px);\n              pointer-events: none;\n            }\n            .test-bg-orb-a {\n              width: min(100vw, 560px);\n              height: min(100vw, 560px);\n              left: 0%;\n              top: 5%;\n              background: rgba(26, 218, 243, 0.06);\n              animation: test-bg-orb-a 22s ease-in-out infinite;\n            }\n            .test-bg-orb-b {\n              width: min(90vw, 480px);\n              height: min(90vw, 480px);\n              right: 0%;\n              top: 25%;\n              background: rgba(88, 245, 255, 0.04);\n              animation: test-bg-orb-b 28s ease-in-out infinite;\n            }\n            .test-bg-orb-c {\n              width: min(85vw, 420px);\n              height: min(85vw, 420px);\n              left: 20%;\n              bottom: 0%;\n              background: rgba(26, 218, 243, 0.03);\n              animation: test-bg-orb-c 32s ease-in-out infinite;\n            }\n            .test-bg-vignette {\n              position: absolute;\n              inset: 0;\n              background: radial-gradient(ellipse 100% 100% at 50% 50%, transparent 38%, rgba(0,0,0,0.85) 100%);\n              pointer-events: none;\n            }\n            .test-bg-shimmer {\n              position: absolute;\n              top: 0;\n              left: 0;\n              width: 45%;\n              height: 100%;\n              background: linear-gradient(105deg, transparent, rgba(26, 218, 243,0.02), transparent);\n              animation: test-bg-shimmer 14s ease-in-out infinite;\n              pointer-events: none;\n            }\n            @media (prefers-reduced-motion: reduce) {\n              .test-bg-grid, .test-bg-orb-a, .test-bg-orb-b, .test-bg-orb-c, .test-bg-shimmer {\n                animation: none !important;\n              }\n            }\n          "}}),(0,r.jsxs)("div",{className:"test-bg-root pointer-events-none fixed inset-0 -z-10 overflow-hidden","aria-hidden":"true",children:[(0,r.jsx)("div",{className:"test-bg-grid"}),(0,r.jsx)("div",{className:"test-bg-orb test-bg-orb-a"}),(0,r.jsx)("div",{className:"test-bg-orb test-bg-orb-b"}),(0,r.jsx)("div",{className:"test-bg-orb test-bg-orb-c"}),(0,r.jsx)("div",{className:"test-bg-shimmer"}),(0,r.jsx)("div",{className:"test-bg-vignette"})]})]})}},4782:(e,t,n)=>{n.d(t,{b:()=>s});var r=n(67904),i={chatgpt:{iosScheme:"chatgpt://",package:"com.openai.chatgpt",host:"chatgpt.com",defaultWebUrl:"https://chatgpt.com"},claude:{iosScheme:"claude://",package:"com.anthropic.claude",host:"claude.ai",defaultWebUrl:"https://claude.ai"},perplexity:{iosScheme:"perplexity://",package:"ai.perplexity.app",host:"www.perplexity.ai",defaultWebUrl:"https://www.perplexity.ai"},gemini:{iosScheme:"googleapp://",package:"com.google.android.apps.bard",host:"gemini.google.com",defaultWebUrl:"https://gemini.google.com"},grok:{iosScheme:"grok://",package:"ai.x.grok",host:"grok.com",defaultWebUrl:"https://grok.com"},replit:{iosScheme:"replit://",package:"com.replit.app",host:"replit.com",defaultWebUrl:"https://replit.com"}};function s(e){var t=e.platform,n=e.text,s=e.webUrl;if((0,r.f5)(),n&&navigator.clipboard)try{navigator.clipboard.writeText(n).then(function(){return(0,r.xy)()}).catch(function(){})}catch(e){}var a=String(t||"").toLowerCase().trim(),o=i[a]||{iosScheme:"".concat(a,"://"),defaultWebUrl:s||"https://".concat(a,".com")},l=s||o.defaultWebUrl,c=navigator.userAgent||"",u=/Android/i.test(c),d=/iPhone|iPad|iPod/i.test(c)||"undefined"!=typeof navigator&&"MacIntel"===navigator.platform&&(navigator.maxTouchPoints||0)>1;
1if(!u&&!d)return void window.open(l,"_blank","noopener,noreferrer");if(u&&o.package){var p=encodeURIComponent(l),x="intent://".concat(o.host||"open","/#Intent;scheme=https;package=").concat(o.package,";S.browser_fallback_url=").concat(p,";end");window.location.href=x;return}if(d){var f=o.iosScheme||"".concat(a,"://"),m=!1,h=function(){m=!0};window.addEventListener("pagehide",h,{once:!0}),window.addEventListener("blur",h,{once:!0}),window.addEventListener("visibilitychange",function(){document.hidden&&(m=!0)},{once:!0}),window.location.href=f,setTimeout(function(){window.removeEventListener("pagehide",h),window.removeEventListener("blur",h),m||document.hidden||window.open(l,"_blank","noopener,noreferrer")},1200);return}window.open(l,"_blank","noopener,noreferrer")}},26011:(e,t,n)=>{n.r(t),n.d(t,{default:()=>eY});var r=n(61975),i=n(87922),s=n(82732),a=n(45849),o=n(22043),l=n(45377),c=n(80971),u=n(71450),d=n(95155),p=n(53730),x=n(12115),f=n(26497),m=n(39498),h=n(35299),g=n(66630),b=n(59847),v=n(77931),_=n(90799),y=n(6191),w=n(24033),j=n(5917),k=n(75426),N=n(20017),A=n(60235),S=n(17181),E=n(56154),F=n(42529),C=n(90368),D=n(27937),P=n(39142),I=n(65229),L=n(4782),T=n(46888),R=n(4431);n(81158);var q=n(16896),z=n(66563),O=n(66059),B=n(67909),M=n(76066),H=n(11074),U=n(84591),Y=n(62340),$=n(47650),W=["Prompt","Requirements","Output Format","Output","Success Criteria","Success","Tone","Role","Context","Industry Context","Methodology","Constraints","Goal","Instructions","Task","Background","Format","Examples","Notes","Steps"].map(function(e){return RegExp("([^\\n])\\s+(".concat(e,"\\s*:)"),"gi")});function G(e){if(!e)return"";var t="string"==typeof e?e:String(e);return t=(t=(t=(t=(t=(t=t.replace(/\u00A0/g," ")).replace(/[\u2012\u2013\u2014\u2015\u2212\uFE58\uFE63\uFF0D]/g,"-")).replace(/\s*\|\s+(\*\*[^*]+\*\*\s*:)/g,"\n\n$1")).replace(/\s+-\s+(\*\*[^*]+\*\*\s*:)/g,"\n\n$1")).replace(/([^\n])\s*-\s+(\*\*[^*]+\*\*\s*:)/g,"$1\n\n$2")).replace(/([^\n])\s+(\*\*[^*]+\*\*\s*:)/g,"$1\n\n$2"),W.forEach(function(e){t=t.replace(e,"$1\n\n$2")}),J((t=(t=(t=(t=t.replace(/(\S)\s+(\d+)\.\s+\*\*/g,"$1\n\n$2. **")).replace(/(\S)\s+(\d+)\.\s+/g,"$1\n\n$2. ")).replace(/(\S)\s+([•\-\*])\s+/g,"$1\n\n$2 ")).replace(/\n{3,}/g,"\n\n")).trim())}function Q(e){if("string"!=typeof e||!e)return e;var t=e.match(/\(\d+\)/g);return!t||t.length<2?e:e.replace(/(.+?)\s+(?=\(\d+\)\s)/g,"$1\n").split("\n").map(function(e){return e.replace(/^(?:and\s+|[,;]\s*)/i,"").trim()}).filter(function(e){return e.length>0}).join("\n")}function J(e){return e?e.split("\n").map(function(e){var t=e.match(/\(\d+\)/g);return!t||t.length<2?e:Q(e).split("\n").map(function(e){return e.replace(/^\((\d+)\)\s+/,"$1. ")}).join("\n")}).join("\n"):""}function V(e){if(!e)return null;for(var t,n=[],r=0,i=/\*\*([^*]+)\*\*/g;null!==(t=i.exec(e));)t.index>r&&n.push(e.substring(r,t.index)),n.push((0,d.jsx)("strong",{className:"text-current font-semibold",children:t[1]},"b-".concat(t.index))),r=t.index+t[0].length;return r<e.length&&n.push(e.substring(r)),n.length>0?n:e}var Z=x.memo(function(e){var t=e.content,n=e.className;if(!t)return null;var r=G(t).split("\n"),i=[],s=[],a=function(){0!==s.length&&(i.push((0,d.jsx)("p",{className:"mb-3 leading-relaxed text-current text-justify [text-justify:inter-word] [text-align-last:left]",style:{textAlign:"justify",textJustify:"inter-word",textAlignLast:"left"},children:V(s.join(" "))},"p-".concat(i.length))),s=[])};return r.forEach(function(e,t){var n=e;e=e.trim();var r=n.match(/^(\s+)/),o=r?Math.floor(r[1].length/2):0,l=e.match(/^(\d+)\.\s+(.+)$/);if(l){a(),i.push((0,d.jsxs)("div",{className:"mb-2.5 flex gap-3 items-start text-current",style:{marginLeft:"".concat(1.5*o,"rem")},children:[(0,d.jsxs)("span",{className:"font-bold text-[#1ADAF3] flex-shrink-0 mt-0.5 min-w-[1.25rem] text-sm",children:[l[1],"."]}),(0,d.jsx)("span",{className:"flex-1 leading-relaxed text-justify sm:text-justify [text-justify:inter-word]",children:V(l[2])})]},"num-".concat(t)));return}var c=e.match(/^[•\-\*]\s+(.+)$/);if(c){a(),i.push((0,d.jsxs)("div",{className:"mb-2 flex gap-3 items-start text-current",style:{marginLeft:"".concat(1.5*o,"rem")},children:[(0,d.jsx)("span",{className:"".concat(o>0?"text-[#1ADAF3]/60":"text-[#1ADAF3]"," flex-shrink-0 mt-1.5 text-[8px]"),children:"●"}),(0,d.jsx)("span",{className:"flex-1 leading-relaxed text-justify sm:text-justify [text-justify:inter-word]",children:V(c[1])})]},"bullet-".concat(t)));return}var u=e.match(/^\*\*([^*]+)\*\*:?\s*(.*)$/);if(u){a();var p,x=u[1],f=null==(p=u[2])?void 0:p.trim();i.push((0,d.jsx)("div",{className:"mt-5 mb-1.5 first:mt-0",children:(0,d.jsx)("span",{className:"text-[#1ADAF3] font-bold text-sm uppercase tracking-wide",children:x})},"header-".concat(t))),f&&i.push((0,d.jsx)("p",{className:"mb-3 leading-relaxed text-current text-ju
1stify [text-justify:inter-word] [text-align-last:left]",style:{textAlign:"justify",textJustify:"inter-word",textAlignLast:"left"},children:V(f)},"header-body-".concat(t)));return}if(""===e)return void a();s.push(e)}),a(),(0,d.jsx)("div",{className:"formatted-content text-current text-justify [text-justify:inter-word] [text-align-last:left] ".concat(void 0===n?"":n).trim(),style:{textAlign:"justify",textJustify:"inter-word",textAlignLast:"left"},children:i})}),X=new Set(["indigo","sky","amber","emerald","rose","violet","purple","red","orange","teal","pink","cyan","lime","slate","blue","fuchsia","green"]),K={indigo:{underline:"#8B7DFF",hover:"rgba(139, 125, 255, 0.2)"},sky:{underline:"#7DD3FC",hover:"rgba(125, 211, 252, 0.2)"},amber:{underline:"#FFB86B",hover:"rgba(255, 184, 107, 0.2)"},emerald:{underline:"#4ADE80",hover:"rgba(74, 222, 128, 0.2)"},rose:{underline:"#FFB86B",hover:"rgba(255, 184, 107, 0.2)"},violet:{underline:"#8B7DFF",hover:"rgba(139, 125, 255, 0.2)"},purple:{underline:"#8B7DFF",hover:"rgba(139, 125, 255, 0.2)"},red:{underline:"#FFB86B",hover:"rgba(255, 184, 107, 0.2)"},orange:{underline:"#FFB86B",hover:"rgba(255, 184, 107, 0.2)"},teal:{underline:"#3DD9FF",hover:"rgba(61, 217, 255, 0.2)"},pink:{underline:"#8B7DFF",hover:"rgba(139, 125, 255, 0.2)"},cyan:{underline:"#3DD9FF",hover:"rgba(61, 217, 255, 0.2)"},lime:{underline:"#4ADE80",hover:"rgba(74, 222, 128, 0.2)"},slate:{underline:"#7DD3FC",hover:"rgba(125, 211, 252, 0.2)"},blue:{underline:"#7DD3FC",hover:"rgba(125, 211, 252, 0.2)"},fuchsia:{underline:"#8B7DFF",hover:"rgba(139, 125, 255, 0.2)"},green:{underline:"#4ADE80",hover:"rgba(74, 222, 128, 0.2)"}},ee=/^(\d+)\.\s+(.+)$/,et=/^\((\d+)\)\s+(.+)$/,en=/^[•\-\*]\s+(.+)$/,er=/^\*\*([^*]+)\*\*:?\s*(.*)$/;function ei(e){var t=e.text,n=e.highlighted,r=String(t||"").split("\n").map(Q).join("\n").split("\n"),i=[],s=[],a=function(){s.length&&(i.push((0,d.jsx)("span",{className:"block leading-relaxed text-justify [text-justify:inter-word] [text-align-last:left]",style:{textAlign:"justify",textJustify:"inter-word",textAlignLast:"left"},children:V(s.join(" "))},"p-".concat(i.length))),s=[])};return r.forEach(function(e,t){var r=e.trim(),o=e.match(/^(\s+)/),l=o?Math.floor(o[1].length/2):0,c=l?{marginLeft:"".concat(1.2*l,"rem")}:void 0,u=r.match(ee)||r.match(et);if(u){a(),i.push((0,d.jsxs)("span",{className:"my-1 flex items-baseline gap-2",style:c,children:[(0,d.jsxs)("span",{className:"flex-shrink-0 font-bold ".concat(n?"text-current":"text-[#1ADAF3]"),children:[u[1],"."]}),(0,d.jsx)("span",{className:"flex-1 leading-relaxed text-justify sm:text-justify [text-justify:inter-word]",children:V(u[2])})]},"n-".concat(t)));return}var p=r.match(en);if(p){a(),i.push((0,d.jsxs)("span",{className:"my-1 flex items-baseline gap-2",style:c,children:[(0,d.jsx)("span",{className:"flex-shrink-0 text-[10px] ".concat(n?"text-current":"text-[#1ADAF3]"),children:"●"}),(0,d.jsx)("span",{className:"flex-1 leading-relaxed",children:V(p[1])})]},"b-".concat(t)));return}var x=r.match(er);if(x){a();var f=x[2]&&x[2].trim();i.push((0,d.jsx)("span",{className:"mt-2 mb-1 block text-sm font-bold uppercase tracking-wide first:mt-0 ".concat(n?"text-current":"text-[#1ADAF3]"),children:x[1]},"h-".concat(t))),f&&i.push((0,d.jsx)("span",{className:"block leading-relaxed text-justify sm:text-justify [text-justify:inter-word]",children:V(f)},"hb-".concat(t)));return}if(""===r)return void a();s.push(r)}),a(),(0,d.jsx)(d.Fragment,{children:i})}function es(e){var t,n,r=e.segment,i=e.onHoverShow,l=e.onHoverHide,c="string"==typeof(null==r?void 0:r.text)?r.text:"";if(!c)return null;var u=!0===r.is_original||"string"==typeof r.type&&"original"===r.type.toLowerCase(),p=function(e){var t=String(e||"");if(!t)return!1;var n=t.split("\n");if(n.length>1){for(var r=0;r<n.length;r+=1)if(""!==n[r].trim())return!0;return!1}if(function(e){if("string"!=typeof e)return!1;var t=e.trim();return!!t&&(ee.test(t)||et.test(t)||en.test(t)||er.test(t))}(n[0]))return!0;var i=n[0].match(/\(\d+\)/g);return!!(i&&i.length>=2)}(c);if(u)return p?(0,d.jsx)("span",{className:"my-1 block whitespace-normal leading-relaxed text-white/85 text-justify sm:text-justify [text-justify:inter-word]",children:(0,d.jsx)(ei,{text:c,highlighted:!1})}):(0,d.jsx)("span",{className:"text-white/85",children:V(c)});var f=K[n="string"==typeof(t=r.color_key)?t.trim().toLowerCase():"",X.has(n)?n:"slate"]||K.slate,m=r.technique_label||r.technique||"",h=r.reason||"",g=!!(m||h),b=(0,o._)((0,x.useState)(!1),2),v=b[0],_=b[1],y=function(){return _(!0)},w=function(){return _(!1)},j={onMouseEnter:g?function(e){y(),i(e.currentTarget,m,h)}:y,onMouseLeave:g?function(){w(),l()}:w,onFocus:g?function(e){y(),i(e.currentTarget,m,h)}:y,onBlur:g?function(){w(),l()}:w,tabIndex:g?0:-1},k={backgroundColor:v?f.hover:"transparent",color:"inherit",curs
1or:g?"help":"default",textDecorationLine:"underline",textDecorationStyle:"solid",textDecorationColor:f.underline,textDecorationThickness:"1px",textUnderlineOffset:"3px",textDecorationSkipInk:"auto",borderRadius:p?"12px":"6px",transition:"background-color 140ms ease-out, color 140ms ease-out, text-decoration-color 140ms ease-out, box-shadow 140ms ease-out"};return p?(0,d.jsx)("span",(0,a._)((0,s._)({},j),{className:"my-2 block whitespace-normal rounded-xl px-3 py-2 leading-relaxed focus-visible:outline-none text-justify sm:text-justify [text-justify:inter-word]",style:k,children:(0,d.jsx)(ei,{text:c,highlighted:v})})):(0,d.jsx)("span",(0,a._)((0,s._)({},j),{className:"inline rounded-md px-1 py-0.5 focus-visible:outline-none",style:k,children:V(c)}))}function ea(e){var t=e.data,n=(0,x.useRef)(null);return((0,x.useEffect)(function(){if(t&&n.current){var e=n.current;e.style.visibility="hidden",e.style.top="0px",e.style.left="0px";var r=e.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight,a=t.anchorTop-r.height-8;a<8&&(a=t.anchorBottom+8),a+r.height+8>s&&(a=Math.max(8,s-r.height-8));var o=t.anchorCenterX-r.width/2;o<8&&(o=8),o+r.width+8>i&&(o=i-r.width-8),e.style.top="".concat(Math.round(a),"px"),e.style.left="".concat(Math.round(o),"px"),e.style.visibility="visible"}},[t]),t&&"undefined"!=typeof document)?(0,$.createPortal)((0,d.jsxs)("div",{ref:n,role:"tooltip",className:"fixed z-[2147483646] max-w-[320px] rounded-2xl border border-white/15 bg-[#131f26]/95 backdrop-blur-xl px-4 py-3 text-xs leading-relaxed text-white/95 shadow-[0_12px_40px_rgba(0,0,0,0.6),0_0_20px_rgba(88,245,255,0.15)] pointer-events-none transition-opacity duration-150",style:{to
1p:0,left:0,visibility:"hidden"},children:[t.label&&(0,d.jsx)("div",{className:"mb-1.5 text-[11px] font-bold uppercase tracking-[0.08em] text-[#58f5ff]",children:t.label}),t.reason&&(0,d.jsx)("div",{className:"text-white/85 leading-relaxed font-space-grotesk",children:t.reason})]}),document.body):null}var eo=x.memo(function(e){var t=e.segments,n=e.className,r=(0,o._)((0,x.useState)(null),2),i=r[0],s=r[1],a=function(e,t,n){if(!e||!t&&!n)return void s(null);var r=e.getBoundingClientRect();s({label:t,reason:n,anchorTop:r.top,anchorBottom:r.bottom,anchorCenterX:r.left+r.width/2})},l=function(){return s(null)};return Array.isArray(t)&&0!==t.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"formatted-content whitespace-normal leading-relaxed text-current text-justify [text-justify:inter-word] [text-align-last:left] ".concat(void 0===n?"":n).trim(),style:{textAlign:"justify",textJustify:"inter-word",textAlignLast:"left"},children:t.map(function(e,t){return(0,d.jsx)(es,{segment:e,onHoverShow:a,onHoverHide:l},t)})}),(0,d.jsx)(ea,{data:i})]}):null});function el(e){return String(e||"").replace(/\u00A0/g," ").replace(/[\u2012\u2013\u2014\u2015\u2212\uFE58\uFE63\uFF0D]/g,"-")}var ec=x.memo(function(e){var t=e.content,n=e.segments,r=e.className,i=void 0===r?"":r,o=function(e,t){var n="string"==typeof e?e:"";if(!n||!Array.isArray(t)||0===t.length)return[];var r=t.filter(function(e){return e&&(void 0===e?"undefined":(0,c._)(e))==="object"&&"string"==typeof e.text&&e.text});if(0===r.length)return[];for(var i=el(J(G(n))),o=function(e){for(var t="",n=[],r=!1,i=0;i<e.length;i+=1)/\s/.test(e[i])?(!r&&t.length>0&&(t+=" ",n.push(i)),r=!0):(t+=e[i],n.push(i),r=!1);return{norm:t,map:n}}(i),l=o.norm,u=o.map,d=[],p=0,x=0,f=0;f<r.length;f+=1){var m=r[f],h=el(m.text).replace(/\s+/g," ").trim();if(h){var g=l.indexOf(h,p);if(-1!==g){var b=u[g],v=u[g+h.length-1]+1;b>x&&d.push({text:i.slice(x,b),is_original:!0}),d.push((0,a._)((0,s._)({},m),{text:i.slice(b,v)})),p=g+h.length,x=v}}}return 0===d.length?[]:(x<i.length&&d.push({text:i.slice(x),is_original:!0}),d)}(t,n);return o.some(function(e){return e&&(void 0===e?"undefined":(0,c._)(e))==="object"&&"string"==typeof e.text&&e.text})?(0,d.jsx)(eo,{segments:o,className:i}):(0,d.jsx)(Z,{content:t,className:i})}),eu=n(2818);n(34826);var ed=n(75980),ep=n(9076),ex=n(49983),ef=n(86239),em=["Understanding your intent...","Gathering conversation context...","Analyzing your request...","Improving structure & clarity...","Generating enhanced prompt..."],eh=["Understanding your intent...","Gathering conversation context...","Applying memory & personalization...","Optimizing using Pro intelligence...","Generating enhanced prompt..."],eg={free:{glow:"rgba(26, 218, 243, 0.38)",filter:"brightness(0) saturate(100%) invert(77%) sepia(68%) saturate(554%) hue-rotate(137deg) brightness(101%) contrast(101%)"},protrial:{glow:"rgba(245, 200, 66, 0.42)",filter:"brightness(0) saturate(100%) invert(88%) sepia(68%) saturate(890%) hue-rotate(331deg) brightness(101%) contrast(93%)"},pro:{glow:"rgba(245, 158, 11, 0.45)",filter:"brightness(0) saturate(100%) invert(70%) sepia(91%) saturate(752%) hue-rotate(351deg) brightness(99%) contrast(94%)"}};function eb(e){var t=e.active,n=void 0===t||t,r=e.plan,i=void 0===r?"free":r,s=e.customSteps,a=e.headline,l=void 0===a?null:a,c=eg[i]||eg.free,u=((void 0===s?null:s)||("pro"===i||"protrial"===i?eh:em)).map(function(e){return"string"==typeof e?e:(null==e?void 0:e.label)||"Processing..."}),p=(0,o._)((0,x.useState)(0),2),h=p[0],g=p[1];if((0,x.useEffect)(function(){if(!n)return void g(0);var e=!0,t=setInterval(function(){e&&g(function(e){return e<u.length-1?e+1:e})},2e3);return function(){e=!1,t&&clearInterval(t)}},[n,u.length]),!n)return null;var b=u[h];return(0,d.jsx)("div",{className:"flex w-full items-center justify-center py-12 sm:py-24",children:(0,d.jsxs)(m.P.div,{initial:{opacity:0,scale:.92},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.92},transition:{duration:.4,ease:[.16,1,.3,1]},className:"flex flex-col items-center justify-center text-center max-w-xl mx-auto px-4 py-4 bg-transparent",children:[(0,d.jsxs)("div",{className:"relative mb-6 flex h-28 w-28 items-center justify-center sm:mb-8",children:[(0,d.jsx)("div",{className:"absolute inset-0 rounded-full blur-2xl",style:{backgroundColor:c.glow}}),(0,d.jsx)(ef.ThinkingOrb,{state:"solving",size:64,speed:.65,theme:"dark",style:{transform:"scale(1.2)",filter:c.filter}})]}),l&&(0,d.jsx)(f.N,{mode:"wait",children:(0,d.jsx)(m.P.h3,{initial:{opacity:0,y:-6}
1,animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{duration:.25},className:"font-dm-sans text-[22px] sm:text-[26px] font-bold text-white tracking-tight mb-2 sm:mb-3 drop-shadow-[0_2px_12px_rgba(0,0,0,0.8)]",children:l},l)}),(0,d.jsx)(f.N,{mode:"wait",children:(0,d.jsx)(m.P.p,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.25},className:"font-space-grotesk text-[15px] sm:text-[18px] font-medium text-white/70 leading-relaxed tracking-wide",children:b},b)})]})})}var ev=n(80341),e_=n(29283),ey=n(60333),ew={surface:"web",location:"prompt_studio",component:"StudioSession"},ej=n(75035),ek=n(65464),eN=n(34250),eA=n(43305),eS=function(){return(0,d.jsx)("div",{className:"flex w-full h-full min-h-[300px] items-center justify-center",children:(0,d.jsxs)("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[(0,d.jsx)(h.A,{className:"w-8 h-8 text-[#1ADAF3] animate-spin"}),(0,d.jsx)("p",{className:"text-white/40 text-[13px] font-medium tracking-wide",children:"Loading module..."})]})})},eE=(0,B.default)(function(){return n.e(5052).then(n.bind(n,95052))},{loadableGenerated:{webpack:function(){return[95052]}},ssr:!1}),eF=(0,B.default)(function(){return Promise.all([n.e(9690),n.e(4390),n.e(4124)]).then(n.bind(n,4124)).then(function(e){return e.Steps})},{loadableGenerated:{webpack:function(){return[null]}},ssr:!1}),eC=(0,B.default)(function(){return n.e(3798).then(n.bind(n,83798))},{loadableGenerated:{webpack:function(){return[83798]}},ssr:!1,loading:function(){return(0,d.jsx)(eS,{})}}),eD=(0,B.default)(function(){return n.e(8883).then(n.bind(n,88883))},{loadableGenerated:{webpack:function(){return[88883]}},ssr:!1,loading:function(){return(0,d.jsx)(eS,{})}}),eP=(0,B.default)(function(){return Promise.all([n.e(844),n.e(1349),n.e(9812),n.e(9165),n.e(5052),n.e(3139)]).then(n.bind(n,43139))},{loadableGenerated:{webpack:function(){return[43139]}},ssr:!1,loading:function(){return(0,d.jsx)(eS,{})}}),eI=(0,B.default)(function(){return Promise.all([n.e(4316),n.e(8498),n.e(4793)]).then(n.bind(n,28498))},{loadableGenerated:{webpack:function(){return[28498]}},ssr:!1,loading:function(){return(0,d.jsx)(eS,{})}}),eL=(0,B.default)(function(){return Promise.all([n.e(844),n.e(9812),n.e(9967)]).then(n.bind(n,79812))},{loadableGenerated:{webpack:function(){return[79812]}},ssr:!1}),eT={Flash:"Quick",Best:"Auto",Build:"Build",Research:"Research",Media:"Media"};function eR(e){if(null==e||"string"!=typeof e)return null;var t=e.trim();return t?t.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}):null}var eq="tv_intent_cache_v1";function ez(e,t,n){if(e)try{var r=localStorage.getItem(eq),i=r?JSON.parse(r):{};i[String(e)]={intent:t||null,domain:n||null};var s=Object.keys(i);s.length>200&&s.slice(0,s.length-200).forEach(function(e){return delete i[e]}),localStorage.setItem(eq,JSON.stringify(i))}catch(e){}}function eO(e){return null!=e&&"string"==typeof e&&/^option\s*\d+$/i.test(e.trim())}function eB(e){return eO(e)?"Other":String(e)}function eM(e){if(!e)return{text:"",segments:null};var t=e.content||e.enhanced_prompt||e.text||"",n=(0,eN.Yq)(t,[]),r=n.text,i=n.segments,s=e.annotatedSegments||e.annotated_segments||e.annotations||e.segments||e.annotated_prompt||e.annotatedPrompt||e.data&&(e.data.annotatedSegments||e.data.annotated_segments||e.data.annotations||e.data.segments)||(i&&i.length>0?i:null),a=null;return Array.isArray(s)&&s.length>0&&(a=s.filter(function(e){return e&&(void 0===e?"undefined":(0,c._)(e))==="object"&&"string"==typeof e.text})),(!a||0===a.length)&&(r||t)&&(a=function(e){if(!e||"string"!=typeof e)return[];var t=e.trim();if(!t)return[];var n=t.split(/(?=\n\s*(?:[A-Z][A-Za-z0-9\s]{2,25}:|#{1,4}\s+|[0-[#]\s+))/g).map(function(e){return e.trim()}).filter(Boolean);return 0===n.length?[{text:t,type:"instruction",label:"Enhanced Instruction",reason:"Refined prompt logic for AI model"}]:n.map(function(e){var t=e.toLowerCase(),n="instruction",r="Execution Guidance",i="Direct instruction specifying model execution steps.";return/role|persona|act as|identity|character/i.test(t)?(n="role",r="Role Definition",i="Establishes expert AI persona and operational stance."):/context|background|scenario|situation|overview/i.test(t)?(n="context",r="C
1ontext & Background",i="Provides domain context and background details."):/task|objective|goal|purpose|assignment|prompt/i.test(t)?(n="task",r="Core Task Specification",i="Defines primary objectives and target deliverables."):/constraint|rule|boundary|guideline|do not|avoid|limit|restriction/i.test(t)?(n="constraint",r="Constraints & Guardrails",i="Enforces strict operational boundaries and negative constraints."):/format|structure|output|layout|schema|json|markdown|response/i.test(t)?(n="format",r="Output Formatting",i="Specifies exact output structure and formatting rules."):/example|sample|illustration|few-shot/i.test(t)&&(n="example",r="Few-Shot Examples",i="Provides exemplary input/output patterns to guide generation."),{text:e,type:n,label:r,reason:i}})}(r||t)),{text:r||t,segments:a}}var eH=[{name:"ChatGPT",key:"chatgpt",icon:(0,p.Q$)("hugeicons_chat-gpt.png"),url:"https://chatgpt.com",supportsUrlParam:!0},{name:"Grok",key:"grok",icon:(0,p.Q$)("grok_colored.png"),url:"https://grok.com",supportsUrlParam:!0},{name:"Bolt",key:"bolt",icon:(0,p.Q$)("bolt_colored.png"),url:"https://bolt.new",supportsUrlParam:!0},{name:"Gamma",key:"gamma",icon:(0,p.Q$)("gamma_colored.png"),url:"https://gamma.app/create/generate",supportsUrlParam:!0},{name:"Claude",key:"claude",icon:(0,p.Q$)("claude_colored.png"),url:"https://claude.ai",supportsUrlParam:!1},{name:"Gemini",key:"gemini",icon:(0,p.Q$)("gemini-color.png"),url:"https://gemini.google.com",supportsUrlParam:!1},{name:"Perplexity",key:"perplexity",icon:(0,p.Q$)("perplexity_logo.png"),url:"https://perplexity.ai",supportsUrlParam:!0},{name:"Mistral",key:"mistral",icon:(0,p.Q$)("mistral_colored.png"),url:"https://chat.mistral.ai",supportsUrlParam:!1},{name:"v0",key:"v0",icon:(0,p.Q$)("v0_colored.png"),url:"https://v0.dev",supportsUrlParam:!1},{name:"Lovable",key:"lovable",icon:(0,p.Q$)("lovable_colored.png"),url:"https://lovable.dev",supportsUrlParam:!1},{name:"AppAlchemy",key:"appalchemy",icon:(0,p.Q$)("appalchemy_colored.png"),url:"https://appalchemy.ai",supp
1ortsUrlParam:!1},{name:"Flow",key:"flow",icon:(0,p.Q$)("flow_colored.png"),url:"https://flow.ai",supportsUrlParam:!1}],eU=x.memo(function(e){var t=e.content,n=e.segments,r=e.className;return(0,d.jsx)(ec,{content:t,segments:n,className:r})},function(e,t){return e.content===t.content&&e.segments===t.segments&&e.className===t.className});let eY=x.memo(function(e){var t,n,B,$,W,G,Q,J,V,Z,X,K,ee,et,en,er=e.prompt,ei=e.mode,es=void 0===ei?"Flash":ei,ea=e.onBack,eo=e.setPrompt,el=e.uploadedContextId,ec=void 0===el?null:el,ef=e.historySnapshot,em=void 0===ef?null:ef,eh=(e.onSelectHistoryChat,e.onReferFriend),eg=void 0===eh?null:eh,eS=(e.onOpenOnboarding,e.userStatusStr),eY=void 0===eS?null:eS,e$=e.userStatusRemaining,eW=void 0===e$?null:e$,eG=e.tutorialNonce,eQ=void 0===eG?0:eG,eJ=(e.onCloseMobileDrawer,e.onRequireSignupForAction),eV=void 0===eJ?null:eJ,eZ=e.onCanConsumeUsageNow,eX=void 0===eZ?null:eZ,eK=e.onConsumeUsage,e0=void 0===eK?null:eK,e1=e.onEnhanceComplete,e2=void 0===e1?null:e1,e5=e.useEnhancedMobileChrome,e3=void 0!==e5&&e5,e4=e.isSidebarOpen,e8=void 0!==e4&&e4,e6=e.setIsSidebarOpen,e7=void 0===e6?null:e6,e9=(e.conversations,e.chatHistoryLoading,e.historyDropdown,e.setHistoryDropdown,e.setMobileSidebarOpen),te=void 0===e9?null:e9,tt=x.useMemo(function(){return eY?{status:eY,remainingUsage:eW}:null},[eY,eW]),tn=localStorage.getItem("userId"),tr=x.useMemo(function(){var e=((null==tt?void 0:tt.status)||eY||"").toLowerCase();return"pro"===e||"freetrial"===e},[null==tt?void 0:tt.status,eY]),ti=tr?"#F5C842":"#53EAFD",ts=(t=(0,x.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,s._)({},ew,e);H.A.track("message_sent",t),e.is_guest&&(0,ey.yP)(ey.lZ.FIRST_PROMPT_SENT,{mode:e.mode,prompt_length:e.prompt_length,is_guest:!0})},[]),n=(0,x.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,s._)({},ew,e);(0,ey.yP)(ey.lZ.ENHANCE_REQUESTED,{mode:e.mode,prompt_length:e.prompt_length,remaining_usage_before:e.remaining_usage_before},{legacyEvents:[{name:"enhance_started",props:t}]})},[]),B=(0,x.useCallback)(function(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=(0,s._)((0,a._)((0,s._)({},ew),{success:!0}),r);(0,ey.yP)(ey.lZ.ENHANCE_SUCCEEDED,{mode:r.mode,duration_ms:null!=(e=r.latency_ms)?e:r.duration_ms,prompt_length:r.prompt_length,is_guest:!!r.is_guest},{legacyEvents:[{name:"enhance_completed",props:i}]}),r.is_guest?(0,ey.yP)(ey.lZ.FREE_PROMPT_COMPLETED,{mode:r.mode,duration_ms:null!=(t=r.latency_ms)?t:r.duration_ms,is_guest:!0},{dedupeKey:"guest_free_prompt"}):(0,ey.g5)()&&(0,ey.aW)({mode:r.mode,duration_ms:null!=(n=r.latency_ms)?n:r.duration_ms,prompt_length:r.prompt_length,is_guest:!1})},[]),$=(0,x.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,s._)((0,a._)((0,s._)({},ew),{success:!1}),e);(0,ey.yP)(ey.lZ.ENHANCE_FAILED,{mode:e.mode,stage:e.stage||"enhance",errorcode:e.error_message||e.errorcode||"unknown"},{legacyEvents:[{name:"enhance_failed",props:t}]})},[]),W=(0,x.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};H.A.track("prompt_refined",(0,s._)({},ew,e))},[]),G=(0,x.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};H.A.track("response_copied",(0,s._)({},ew,e))},[]),Q=(0,x.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};H.A.track("response_rated",(0,s._)({},ew,e))},[]),(0,x.useMemo)(function(){return{trackMessageSent:t,trackEnhanceStarted:n,trackEnhanceCompleted:B,trackEnhanceFailed:$,trackPromptRefined:W,trackResponseCopied:G,trackResponseRated:Q}},[t,n,B,$,W,G,Q])),ta=(0,x.useRef)(!1),to=(0,o._)((0,x.useState)(!1),2),tl=to[0],tc=to[1],tu=(0,o._)((0,x.useState)(!1),2),td=tu[0],tp=tu[1],tx=(0,o._)((0,x.useState)(""),2),tf=tx[0],tm=tx[1],th=(0,o._)((0,x.useState)(!1),2),tg=th[0],tb=th[1],tv=(0,o._)((0,x.useState)(""),2),t_=tv[0],ty=tv[1],tw=(0,o._)((0,x.useState)(""),2),tj=tw[0],tk=tw[1],tN=(0,o._)((0,x.useState)(es),2),tA=tN[0],tS=tN[1],tE=(0,o._)((0,x.useState)(!1),2),tF=tE[0],tC=tE[1],tD=(0,x.useRef)(null),tP=(0,o._)((0,x.useState)(!1),2),tI=tP[0],tL=tP[1],tT=(0,x.useRef)(null),tR=(0,x.useRef)(null),tq=(0,o._)((0,x.useState)({}),2),tz=tq[0],tO=tq[1];(0,x.useEffect)(function(){return function(){tD.current&&clearTimeout(tD.current),tT.current&&clearTimeout(tT.current),tR.current&&clearTimeout(tR.current)}},[]),(0,x.useEffect)(function(){tS((0,e_.P7)(es,null==tt?void 0:tt.status))},[es,null==tt?void 0:tt.status]);var tB=(0,o._)((0,x.useState)(0),2),tM=tB[0];tB[1];var tH=(0,o._)((0,x.useState)(!1),2),tU=(tH[0],tH[1]),tY=(0,o._)((0,x.useState)(!1),2),t$=tY[0],tW=tY[1],tG=(0,o._)((0,x.useState)(!1),2),tQ=tG[0],tJ=tG[1],tV=(0,o._)((0,x.useState)(!1),2),tZ=tV[0],tX=tV[1],tK=(0,o._)((0,x.useState)(!1),2),t0=tK[0],t1=tK[1],t2=(0,o._)((0,x.useState)(0),2),t5=t2[0],t3=t2[1];(0,x.useRef)(null),(0,x.useRef)(null);var t4=(0,o._)((0,x.useState)(!1),2),t8=t4[0],t6=t4[1];(0,x.useEffect)(function(){tX(t$)},[t$]);var t7=(0,x.useRef)(!1);(0,x.useEffect)(function(){t7.current&&!t$&&er&&tA&&"Flash"!==tA&&window.dispatchEvent(new CustomEvent("tri
1al-discovery-moment",{detail:{type:"PRO_MODE",mode:tA}})),t7.current=t$},[t$,tA,er]);var t9=(0,x.useRef)(!1);(0,x.useEffect)(function(){t1(tQ),t9.current&&!tQ&&window.dispatchEvent(new CustomEvent("trial-discovery-moment",{detail:{type:"REFINE_USED"}})),t9.current=tQ},[tQ]);var ne=(0,o._)((0,x.useState)(!0),2),nt=ne[0],nn=ne[1],nr=(0,o._)((0,x.useState)(!1),2),ni=nr[0],ns=nr[1],na=(0,o._)((0,x.useState)(null),2),no=na[0],nl=na[1],nc=(0,o._)((0,x.useState)({}),2),nu=nc[0],nd=nc[1],np=(0,o._)((0,x.useState)({}),2),nx=np[0],nf=np[1],nm=(0,o._)((0,x.useState)(function(){return window.innerWidth>=768}),2),nh=nm[0],ng=nm[1],nb="function"==typeof e7?e7:ng,nv=(0,o._)((0,x.useState)(!1),2),n_=nv[0],ny=nv[1],nw=(0,o._)((0,x.useState)("Open In"),2),nj=nw[0],nk=nw[1],nN=(0,o._)((0,x.useState)(!1),2),nA=nN[0],nS=nN[1],nE=(0,o._)((0,x.useState)({title:"Prompt ready!",body:"Prompt copied and injection prepared. If it doesn't auto-fill, use Ctrl+V."}),2),nF=nE[0],nC=nE[1],nD=(0,o._)((0,x.useState)(!1),2),nP=nD[0],nI=nD[1],nL=(0,o._)((0,x.useState)(null),2),nT=nL[0],nR=nL[1],nq=(0,o._)((0,x.useState)(!1),2),nz=nq[0],nO=nq[1],nB=(0,o._)((0,x.useState)(null),2),nM=nB[0],nH=nB[1],nU=(0,o._)((0,x.useState)(null),2),nY=nU[0],n$=nU[1],nW=(0,o._)((0,x.useState)("https://thinkvelocity.ai/chat"),2),nG=nW[0],nQ=nW[1],nJ=(0,o._)((0,x.useState)(!1),2),nV=nJ[0],nZ=nJ[1],nX=(0,x.useRef)(null),nK=(0,x.useRef)(null),n0=(0,x.useRef)(null),n1=(0,x.useRef)(null),n2=(0,x.useRef)(null),n5=(0,o._)((0,x.useState)(!1),2),n3=(n5[0],n5[1]),n4=(0,o._)((0,x.useState)(function(){return window.innerWidth<768}),2),n8=(n4[0],n4[1]);(0,x.useEffect)(function(){var e=function(){n8(window.innerWidth<768)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]),(0,x.useEffect)(function(){var e=function(){var e;n3((window.scrollY||document.documentElement.scrollTop||(null==(e=n2.current)?void 0:e.scrollTop)||0)>20)};window.addEventListener("scroll",e,{passive:!0});var t=n2.current;return t&&t.addEventListener("scroll",e,{passive:!0}),function(){window.removeEventListener("scroll",e),t&&t.removeEventListener("scroll",e)}},[]);var n6=(0,o._)((0,x.useState)("suggestions"),2),n7=n6[0],n9=n6[1],re=(0,o._)((0,x.useState)(!1),2),rt=re[0],rn=re[1],rr=(0,o._)((0,x.useState)(0),2),ri=rr[0],rs=rr[1],ra=(0,o._)((0,x.useState)("v1"),2),ro=ra[0],rl=ra[1],rc=(0,o._)((0,x.useState)(!1),2);rc[0],rc[1];var ru=(0,o._)((0,x.useState)(!1),2),rd=ru[0],rp=ru[1],rx=x.useMemo(function(){return er?"string"==typeof er?er:(void 0===er?"undefined":(0,c._)(er))==="object"?er.content||er.text||er.prompt||"":String(er):""},[er]),rf=(0,o._)((0,x.useState)([{id:"og",name:"Original Prompt",content:rx}]),2),rm=rf[0],rh=rf[1],rg=x.useMemo(function(){return rm.filter(function(e){return"og"!==e.id&&"v1"!==e.id}).length},[rm]),rb=x.useMemo(function(){return!!tn&&!tr&&rg>=3},[tn,tr,rg]),rv=(0,x.useRef)(null),r_=(0,x.useRef)(null),ry=(0,o._)((0,x.useState)([]),2),rw=ry[0],rj=ry[1];(0,x.useEffect)(function(){if(rw&&rw.length>0){rp(!0);var e=setTimeout(function(){rp(!1)},4e3);return function(){return clearTimeout(e)}}},[rw]);var rk=(0,o._)((0,x.useState)([]),2),rN=rk[0],rA=rk[1],rS=(0,o._)((0,x.useState)(!1),2),rE=rS[0],rF=rS[1],rC=(0,o._)((0,x.useState)({}),2),rD=rC[0],rP=rC[1],rI=(0,o._)((0,x.useState)([{question:"User Input",answer:rx}]),2),rL=rI[0],rT=rI[1],rR=(0,o._)((0,x.useState)(!1),2);rR[0],rR[1];var rq=(0,o._)((0,x.useState)(null),2),rz=rq[0],rO=rq[1],rB=(0,o._)((0,x.useState)(!1),2),rM=rB[0],rH=rB[1],rU=(0,o._)((0,x.useState)(!1),2),rY=rU[0],r$=rU[1],rW=(0,o._)((0,x.useState)(!1),2),rG=rW[0],rQ=rW[1],rJ=(0,o._)((0,x.useState)({}),2);rJ[0],rJ[1];var rV=(0,o._)((0,x.useState)(null),2),rZ=rV[0],rX=rV[1],rK=(0,o._)((0,x.useState)(null),2),r0=rK[0],r1=rK[1],r2=(0,o._)((0,x.useState)(null),2),r5=r2[0],r3=r2[1],r4=x.useMemo(function(){return(0,eN.xr)(rz)},[rz]),r8=r4.intent,r6=r4.domain,r7=x.useMemo(function(){return function(e){if(!e||(void 0===e?"undefined":(0,c._)(e))!=="object")return null;var t=(0,eN.xr)(e).intent,n=e.metadata&&"object"===(0,c._)(e.metadata)?e.metadata:{},r=null!=(g=null!=(h=null!=(m=null!=t?t:null==(p=e.intent_analysis)?void 0:p.intent)?m:null==(x=e.computed_fields)?void 0:x.intent)?h:n.intent)?g:"string"==typeof e.intent&&e.intent.trim()?e.intent:null;if(r){var i=function(e){if(!e||(void 0===e?"undefined":(0,c._)(e))!=="object")return"";var t=e.enhanced_prompt||e.content||e.result||e.text||e.user_prompt||e.originalPrompt||e.raw_prompt||"";return"string"==typeof t?t:""}(e),s=(0,eA.r0)(r,i),a=eH.find(function(e){return e.key===s});if(a)return a}var o=[e.llm_used,e.ai_type,e.suggested_platform,e.suggestedPlatform,e.recommended_platform,e.recommendedPlatform,null==(f=e.target_ai_routing)?void 0:f.suggested_target_ai,n.suggested_platform],l=!0,u=!1,d=void 0;try{for(var p,x,f,m,h,g,b,v=o[Symbol.iterator]();!(l=(b=v.next()).done);l=!0){var _=function(){var e=b.value,t=(0,eN.Kg)(e),n=eH.find(function(e){return e.key===t});if(n)return{v:n}}();if("object"===(0,c._)(_))return _.v}}catch(e){u=!0,d=e}finally{try{l||null==v.return||v.return()}finally{if(u)throw d}}return null}(rz)},[rz]),r9=x.useMemo(function(){return eH.find(function(e){return e.name===nj})||null},[nj])||r7||eH[0],ie=r9.name,it=x.useMemo(function(){var e=(0,eN.xr)(rz),t=e.intent,n=e.domain;return eT[tA],nj&&"Open In"!==nj||(null==rz?void 0:rz.target_ai)||null==rz||rz.ai_type,[{label:"Intent",value:eR(t)||"Not detected",icon:g.A,hint:"Primary action the prompt is optimized to achieve."},{label:"Domain",value:eR(n)||"Not detected",icon:b.A,hint:"Subject area this prompt is written for."}]},[rz,tA,nj]),ir=x.useCallback(function(){nO(!1),nH(null),n$(null),nQ("")},[]),ii=x.useCallback(function(e){return(0,r._)(function(){var t,n,r,i,s,a;return(0,u.YH)(this,function(o){switch(o.label){case 0:if(!e)return[2,null];nZ(!0),o.label=1;case 1:var l;return o.trys.push([1,3,4,5]),n=e.originalPrompt||e.user_prompt||er||"",r=(l
1=e.content||"")?l.replace(/\s+(Prompt:)/gi,"\n\n$1").replace(/\s+(Requirements:)/gi,"\n\n$1").replace(/\s+(Output Format:)/gi,"\n\n$1").replace(/\s+(Success Criteria:)/gi,"\n\n$1").replace(/\s+(Tone:)/gi,"\n\n$1").replace(/\s+(Role:)/gi,"\n\n$1").replace(/(\S)\s+(\d+)\.\s+\*\*/g,"$1\n\n$2. **").replace(/(\S)\s+(\d+)\.\s+/g,"$1\n\n$2. ").replace(/(\S)\s+(\*\*[^*]+\*\*:)/g,"$1\n\n$2").replace(/(\S)\s+([•\-\*])\s+/g,"$1\n\n$2 ").replace(/\n{3,}/g,"\n\n").trim():"",[4,M.A.post("/prompt/share",{enhanced_prompt_id:e.enhanced_prompt_id||null,refine_id:e.refine_id||null,user_prompt:n,enhanced_prompt:r,ai_type:e.ai_type||"chatgpt",selected_style:e.selected_style||(0,eN.sl)(tA)})];case 2:if(null==(t=(i=o.sent()).data)?void 0:t.success)return n$(s=i.data.data.share_token),nQ(a="https://thinkvelocity.ai/shared?token=".concat(encodeURIComponent(s))),[2,a];return[3,5];case 3:return console.error("Error creating share link:",o.sent()),nQ("https://thinkvelocity.ai/shared"),[2,"https://thinkvelocity.ai/shared"];case 4:return nZ(!1),[7];case 5:return[2,null]}})})()},[er,tA]);(0,x.useEffect)(function(){nz&&(null==nM?void 0:nM.message)&&!nY&&ii(nM.message)},[nz,nM,nY,ii]);var is=rm.find(function(e){return e.id===ro})||rm[0],ia=!!(null==is?void 0:is.content),io=(null==is?void 0:is.id)&&null!=(en=tz[is.id])?en:0,il=x.useCallback(function(){var e=rm.find(function(e){return e.id===ro})||rm[0],t=rm.find(function(e){return"v1"===e.id});nH({message:{content:(null==e?void 0:e.content)||"",user_prompt:er,originalPrompt:er,enhanced_prompt_id:(null==e?void 0:e.refineId)?e.enhancedPromptId||r5||(null==t?void 0:t.enhancedPromptId)||null:(null==e?void 0:e.id)==="v1"?e.enhancedPromptId||r5||null:(null==e?void 0:e.enhancedPromptId)||r5||null,refine_id:(null==e?void 0:e.refineId)||null,selected_style:(0,eN.sl)(tA),ai_type:"chatgpt"},location:"prompt_studio"}),n$(null),nQ("https://thinkvelocity.ai/chat"),nO(!0),U.Ay.trackCustomEvent("CTAClick",{location:"prompt_studio",button_text:"Share Prompt"}),Y.Ay.trackCTAClick("Share Prompt","prompt_studio",{page:"/chat"}),H.A.track("cta_clicked",{buttonName:"Share Prompt",location:"prompt_studio"})},[iq,rm,ro,er,r5,tA]),ic=(0,T.P)(rx,{intent:r8,domain:r6})||"Enhanced Prompt",iu=(0,o._)((0,x.useState)("session"),2),id=iu[0],ip=iu[1],ix=(0,o._)((0,x.useState)(null),2),im=ix[0],ih=ix[1];(0,x.useEffect)(function(){var e=new CustomEvent("toggle-help-button",{detail:{hide:!!sz}});return window.dispatchEvent(e),function(){var e=new CustomEvent("toggle-help-button",{detail:{hide:!1}});window.dispatchEvent(e)}},[sz]);var ig=(0,ed.S)({onTranscript:function(e){return tk(e)},authTokenFallback:im,maxDurationSeconds:120}),ib=ig.isRecording,iv=ig.isPaused,i_=ig.elapsedSeconds,iy=ig.maxDurationSeconds,iw=ig.pauseSupported,ij=ig.isTranscribing,ik=ig.voiceError,iN=ig.isVoiceSupported,iA=ig.analyserRef,iS=ig.startRecording,iE=ig.cancelRecording,iF=ig.confirmRecording,iC=ig.togglePauseResume,iD=ig.setVoiceError,iP=(0,o._)((0,x.useState)(null),2),iI=(iP[0],iP[1]),iL=(0,o._)((0,x.useState)(!1),2),iT=iL[0],iR=iL[1];x.useRef(!1);var iq=x.useCallback(function(e){return"function"==typeof eV&&eV(e)},[eV]),iz=x.useCallback(function(e){return(0,r._)(function(){return(0,u.YH)(this,function(t){switch(t.label){case 0:if("function"!=typeof eX)return[2,!0];return[4,eX(e)];case 1:return[2,!!t.sent()]}})})()},[eX]),iO=(0,o._)((0,x.useState)([]),2),iB=iO[0],iM=iO[1],iH=(0,o._)((0,x.useState)(!1),2),iU=iH[0],iY=iH[1],i$=(0,o._)((0,x.useState)(null),2),iW=i$[0],iG=i$[1],iQ=(0,o._)((0,x.useState)(!1),2),iJ=iQ[0],iV=iQ[1],iZ=(0,o._)((0,x.useState)(!1),2),iX=iZ[0],iK=iZ[1],i0=(0,o._)((0,x.useState)({suggestions:!0,context:!0}),2);i0[0],i0[1];var i1=(0,o._)((0,x.useState)(""),2),i2=i1[0],i5=i1[1],i3=(0,o._)((0,x.useState)(""),2),i4=i3[0],i8=i3[1],i6=(0,o._)((0,x.useState)("Work"),2),i7=i6[0],i9=i6[1],se=(0,o._)((0,x.useState)(!1),2),st=se[0],sn=se[1],sr=(0,x.useRef)(null),si=(0,x.useRef)(null),ss=(0,x.useRef)(!1),sa=(0,x.useRef)(null),so=(0,x.useRef)(!1),sl=(0,x.useRef)(null);(0,x.useEffect)(function(){"collections"===id&&ip("prompt-book")},[id]),(0,x.useEffect)(function(){su().then(function(e){return ih(e)})},[]),(0,x.useEffect)(function(){window.innerWidth<768&&n9("output")},[]),(0,x.useEffect)(function(){if(nA){var e=setTimeout(function(){return nS(!1)},"extension"===nF.type?6e3:3e3);return function(){return clearTimeout(e)}}},[nA,nF.type]),(0,x.useEffect)(function(){if(nP){var e=setTimeout(function(){nI(!1),nR(null)},2e3);return function(){return clearTimeout(e)}}},[nP]),(0,x.useEffect)(function(){var e=function(e){n0.current&&!n0.current.contains(e.target)&&ny(!1),sr.current&&!sr.current.contains(e.target)&&(iV(!1),rQ(!1))};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);var sc=function(){return(0,r._)(function(){var e,t;return(0,u.YH)(this,function(n){switch(n.label){case 0:iY(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,M.A.get("/prompt/collections?limit=50&page=1")];case 2:return(null==(e=(t=n.sent()).data)?void 0:e.success)&&iM(t.data.data.collections||[]),[3,5];case 3:return console.error("Fetch collections failed",n.sent()),[3,5];case 4:return iY(!1),[7];case 5:return[2]}})})()};(0,x.useEffect)(function(){"session"===id&&sc()},[id]),(0,x.useEffect)(function(){iJ&&sc()},[iJ]),(0,x.useEffect)(function(){iI(null)},[ro]);var su=function(){return(0,r._)(function(){var e,t;return(0,u.YH)(this,function(n){switch(n.label){case 0:if((e=(0,q.iD)())&&"string"==typeof e&&!(0,q.Hm)(e,120))return[2,e];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(0,z.M8)()];case 2:return n.sent(),[3,4];case 3:return console.error("Token refresh failed",n.sent()),[3,4];case 4:if((t=(0,q.iD)())&&"string"==typeof t&&!(0,q.Hm)(t,120))return[2,t];return[2,null]}})})()},sd=function(){return(0,r._)(function(){var e,t;return(0,u.YH)(this,function(n){switch(n.label){case 0:if(!tn)return[2,null];return[4,su()];case 1:e=n.sent(),n.label=2;case 2:return n.trys.push([2,5,,6]),[4,fetch("".concat((0,R.hY)(),"/prompt/conversation"),(0,eN.tQ)("POST",{token:e,body:{user_id:String(tn)}}))];case 3:return[4,n.sent().json()];case 4:return[2,(null==(t=n.sent().data)?void 0:t.conversation_id)||null];case 5:return console.error("Create conversation failed",n.sent()),[2,null];case 6:return[2]}})})()},sp=function(e,t){return(0,r._)(function(){var n,r;return(0,u.YH)(this,function(i){switch(i.label){case 0:if(!tn||!t)return[2,null];return[4,su()];case 1:n=i.sent(),i.label=2;case 2:return i.trys.push([2,5,,6]),[4,fetch("".concat((0,R.hY)(),"/prompt/user-prompt"),(0,eN.tQ)("POST",{token:n,body:{user_id:String(tn),user_prompt:e,conversation_id:t,source:"web",platform:"web"}}))];case 3:return[4,i.sent().json()];case 4:return[2,(null==(r=i.sent().data)?void 0:r.prompt_id)||null];case 5:return console.error("Save user prompt failed",i.sent()),[2,null];case 6:return[2]}})})()},sx=function(e,t,n,i,a){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,d=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;return(0,r._)(function(){var r,p,x,f,m;return(0,u.YH)(this,function(u){switch(u.label){case 0:return[4,su()];case 1:if(r=u.sent(),!t||!n)return[2,null];
1p="string"==typeof o&&o.trim()?o.trim():null,x="string"==typeof l&&l.trim()?l.trim():null,f=Array.isArray(d)&&d.length>0?d.filter(function(e){return e&&(void 0===e?"undefined":(0,c._)(e))==="object"&&"string"==typeof e.text}):null,u.label=2;case 2:return u.trys.push([2,5,,6]),[4,fetch("".concat((0,R.hY)(),"/prompt/enhanced-prompt"),(0,eN.tQ)("POST",{token:r,body:(0,s._)({prompt_id:t,enhanced_prompt:e,conversation_id:null!=n?String(n):null,processing_time:i||0,intent:p,llm_used:"",complexity:"medium",domain:x,mode:a||"standard",user_status:"free",source:"web"},f&&f.length>0?{annotated_segments:f}:{})}))];case 3:return[4,u.sent().json()];case 4:return[2,(null==(m=u.sent().data)?void 0:m.enhanced_prompt_id)||null];case 5:return console.error("Save enhanced prompt failed",u.sent()),[2,null];case 6:return[2]}})})()},sf=function(e,t,n,i,a,o){var l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;return(0,r._)(function(){var r,d,p,x;return(0,u.YH)(this,function(u){switch(u.label){case 0:return[4,su()];case 1:if(r=u.sent(),!t||!i)return[2,null];d=Array.isArray(l)&&l.length>0?l.filter(function(e){return e&&(void 0===e?"undefined":(0,c._)(e))==="object"&&"string"==typeof e.text}):null,u.label=2;case 2:return u.trys.push([2,5,,6]),x=(0,s._)({prompt_id:t,enhanced_prompt_id:n||null,refined_prompt:e,conversation_id:i,processing_time:o||0,source:"web"},d&&d.length>0?{annotated_segments:d}:{}),(null==a?void 0:a.length)>0&&a.forEach(function(e,t){x["refine_question_".concat(t+1)]=e.question,x["refine_answer_".concat(t+1)]=e.answer}),[4,fetch("".concat((0,R.hY)(),"/prompt/refine-prompt"),(0,eN.tQ)("POST",{token:r,body:x}))];case 3:return[4,u.sent().json()];case 4:return[2,(null==(p=u.sent().data)?void 0:p.refine_id)||null];case 5:return console.error("Save refined prompt failed",u.sent()),[2,null];case 6:return[2]}})})()},sm=x.useCallback(function(e,t){return(0,r._)(function(){var n,r,i,s;return(0,u.YH)(this,function(a){switch(a.label){case 0:return[4,su()];case 1:if(n=a.sent(),!e)return[2,!1];a.label=2;case 2:return a.trys.push([2,5,,6]),[4,fetch("".concat((0,R.hY)(),"/prompt/enhanced-prompt/feedback"),(0,eN.tQ)("POST",{token:n,body:{enhanced_prompt_id:e,feedback:t}}))];case 3:return[4,(r=a.sent()).text()];case 4:if(i=a.sent(),!r.ok)return[2,!1];s={};try{s=i?JSON.parse(i):{}}catch(e){return[2,!1]}return[2,r.ok&&!1!==s.success];case 5:return console.error("saveEnhancedPromptFeedback failed:",a.sent()),[2,!1];case 6:return[2]}})})()},[]),sh=x.useCallback(function(e,t){return(0,r._)(function(){var n,r,i,s;return(0,u.YH)(this,function(a){switch(a.label){case 0:return[4,su()];case 1:if(n=a.sent(),!e)return[2,!1];a.label=2;case 2:return a.trys.push([2,5,,6]),[4,fetch("".concat((0,R.hY)(),"/prompt/refine-prompt/feedback"),(0,eN.tQ)("POST",{token:n,body:{refine_id:e,feedback:t}}))];case 3:return[4,(r=a.sent()).text()];case 4:if(i=a.sent(),!r.ok)return[2,!1];s={};try{s=i?JSON.parse(i):{}}catch(e){return[2,!1]}return[2,r.ok&&!1!==s.success];case 5:return console.error("saveRefinedPromptFeedback failed:",a.sent()),[2,!1];case 6:return[2]}})})()},[]),sg=x.useCallback(function(){sl.current&&(clearTimeout(sl.current),sl.current=null),iR(!1),iI(null)},[]);x.useCallback(function(){sl.current&&(clearTimeout(sl.current),sl.current=null)},[]);var sb=function(){return(0,r._)(function(){var e,t,n,r,i;return(0,u.YH)(this,function(s){switch(s.label){case 0:if(!i2.trim()||iX)return[2];iK(!0),s.label=1;case 1:return s.trys.push([1,5,6,7]),[4,M.A.post("/prompt/collections",{name:i2.trim(),description:i4.trim()||"Enhanced prompt collection",tag:i7})];case 2:if(!((null==(e=(n=s.sent()).data)?void 0:e.success)&&(null==(t=n.data.data)?void 0:t.collection_id)))return[3,4];return i=n.data.data.collection_id,H.A.track("collection_created",{tag:i7,surface:"web",entry_point:"studio_session"}),i5(""),i8(""),i9("Work"),sn(!1),[4,M.A.post("/prompt/collections/".concat(i,"/prompts"),{enhanced_prompt_id:r5})];case 3:(null==(r=s.sent().data)?void 0:r.success)&&(nC({title:"Created & Added!",body:'"'.concat(i2.trim(),'" created and prompt added successfully.')}),nS(!0),iV(!1),sc(),H.A.track("collection_prompt_added",{collection_id:i,surface:"web"})),s.label=4;case 4:return[3,7];case 5:return console.error("Create and add failed",s.sent()),H.A.track("collection_created_failed",{surface:"web"}),[3,7];case 6:return iK(!1),[7];case 7:return[2]}})})()},sv=function(){return(0,r._)(function(){var e;return(0,u.YH)(this,function(t){switch(t.label){case 0:if(!tn)return[2];return[4,su()];case 1:e=t.sent(),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,fetch("".concat((0,R.hY)(),"/status/").concat(encodeURIComponent(String(tn)),"/use"),(0,eN.tQ)("POST",{token:e}))];case 3:return t.sent(),[3,5];case 4:return console.error("Use service failed",t.sent()),[3,5];case 5:return[2]}})})()},s_=function(e){var t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focu
1s(),t.select();try{var n=document.execCommand("copy");return document.body.removeChild(t),n}catch(e){return document.body.removeChild(t),!1}},sy=function(e){return(0,r._)(function(){var t,n;return(0,u.YH)(this,function(i){var s,a;switch(i.label){case 0:t=(null==is?void 0:is.content)||"",nk(e.name),ny(!1),s=e.key,(0,r._)(function(){return(0,u.YH)(this,function(e){switch(e.label){case 0:if(!tn||!r0||!s)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,M.A.patch("/prompt/user-prompt/".concat(r0,"/insertion"),{platform:s})];case 2:return e.sent(),[3,4];case 3:return console.warn("Track prompt insertion failed",e.sent()),[3,4];case 4:return[2]}})})(),i.label=1;case 1:return i.trys.push([1,3,,5]),t&&((0,O.ER)(t,e.key),(a=t,(0,r._)(function(){var e;return(0,u.YH)(this,function(t){switch(t.label){case 0:if(!a)return[2,!1];e=!1,t.label=1;case 1:if(t.trys.push([1,5,,6]),!(navigator.clipboard&&navigator.clipboard.writeText))return[3,3];return[4,navigator.clipboard.writeText(a)];case 2:return t.sent(),e=!0,[3,4];case 3:e=s_(a),t.label=4;case 4:return[3,6];case 5:return t.sent(),e=s_(a),[3,6];case 6:return e&&(nC({title:"Copied to clipboard",body:"Prompt copied successfully. Some platforms may block auto-fill, so just paste it with Ctrl/Cmd + V."}),nS(!0)),[2,e]}})})()).catch(function(){})),n=e.url,t&&("chatgpt"===e.key||"grok"===e.key?n="".concat(e.url,"?q=").concat(encodeURIComponent(t)):"gamma"===e.key||"bolt"===e.key?n="".concat(e.url,"?prompt=").concat(encodeURIComponent(t)):"perplexity"===e.key&&(n="".concat(e.url,"?q=").concat(encodeURIComponent(t)))),[4,(0,L.b)({platform:e.key,text:t||"",webUrl:n})];case 2:case 4:return i.sent(),ny(!1),[3,5];case 3:return console.error("Error opening platform:",i.sent()),[4,(0,L.b)({platform:e.key,text:t||"",webUrl:e.url})];case 5:return[2]}})})()};(0,x.useEffect)(function(){if(nK.current){nK.current.style.height="auto";var e=rw.length>0?220:no?100:72;nK.current.style.height="".concat(Math.min(nK.current.scrollHeight,e),"px")}},[tj,no,rw.length]),(0,x.useEffect)(function(){var e=function(e){nX.current&&!nX.current.contains(e.target)&&tU(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]),(0,x.useEffect)(function(){var e=!0;if((null==em?void 0:em.conversationId)&&Array.isArray(em.messages)&&em.messages.length>0&&0===t5){var t=(0,l._)(em.messages).sort(function(e,t){return(e.timestamp||0)-(t.timestamp||0)}),n=t.filter(function(e){return"user"===e.type||"user"===e.role}),i=t.filter(function(e){return"assistant"===e.type||"assistant"===e.role}),o=((null==(y=n[0])?void 0:y.content)||er||"").trim()||"",c=function(e,t){var n=[{id:"og",name:"Original Prompt",content:e||""}],r=t.filter(function(e){return!e.isRefined}),i=t.filter(function(e){return e.isRefined}),o=[];if(r.length){var c=r[r.length-1],u=eM(c),d=u.text,p=u.segments;o.push({id:"v1",name:"Enhanced",content:d||c.content||"",enhancedPromptId:c.enhancedPromptId||c.enhanced_prompt_id||null,annotated_segments:p})}if(i.forEach(function(e,t){var n=eM(e),r=n.text,i=n.segments;o.push({id:"v-ref-".concat(String(e.refineId||e.refine_id||e.id||t)),name:"Refined ".concat(t+1),content:r||e.content||"",refineId:e.refineId||e.refine_id||null,enhancedPromptId:e.enhancedPromptId||e.enhanced_prompt_id||null,annotated_segments:i})}),0===o.length)return n;var x=o.map(function(e,t){return(0,a._)((0,s._)({},e),{tag:t===o.length-1?"Latest":void 0})});return(0,l._)(x.reverse()).concat((0,l._)(n))}(o,i);rh(c);var d=c.find(function(e){return"Latest"===e.tag})||c[0];rl((null==d?void 0:d.id)||"og"),rX(em.conversationId);var p=n[n.length-1];(null==p?void 0:p.promptId)&&r1(String(p.promptId));var x=i.filter(function(e){return!e.isRefined}),f=x.length?x[x.length-1]:i[i.length-1];if(f){f.enhancedPromptId&&r3(f.enhancedPromptId);var m=(0,eN.xr)(f),h=m.intent,g=m.domain;if(!h||!g){var b=!0,v=!1,_=void 0;try{for(var y,w,j=i[Symbol.iterator]();!(b=(w=j.next()).done);b=!0){var k=w.value,N=(0,eN.xr)(k);!h&&N.intent&&(h=N.intent),!g&&N.domain&&(g=N.domain)}}catch(e){v=!0,_=e}finally{try{b||null==j.return||j.return()}finally{if(v)throw _}}}if(!h||!g){var A=(0,eN.xr)(em);
1!h&&A.intent&&(h=A.intent),!g&&A.domain&&(g=A.domain)}if(!h||!g){var S=function(e){if(!e)return{intent:null,domain:null};try{var t=localStorage.getItem(eq);if(!t)return{intent:null,domain:null};return JSON.parse(t)[String(e)]||{intent:null,domain:null}}catch(e){return{intent:null,domain:null}}}(f.enhancedPromptId||f.enhanced_prompt_id);!h&&S.intent&&(h=S.intent),!g&&S.domain&&(g=S.domain)}rO((0,a._)((0,s._)({},f),{intent:h,domain:g}))}else rO(null);var E=i.filter(function(e){return e.isRefined}),F=[{question:"User Input",answer:o}];return E.forEach(function(e){(e.qaPairs||[]).forEach(function(e){(null==e?void 0:e.question)!=null&&(null==e?void 0:e.answer)!=null&&F.push({question:e.question,answer:e.answer})})}),rT(F),rj([]),rA([]),rF(!1),nd({}),nf({}),nk("Open In"),tW(!1),tX(!1),function(){e=!1}}return!function t(){return(0,r._)(function(){var n,i,o,c,d,p,x,f,m,h,g,b,v,_,y,w,j,k,N,A,S,E,F,C,D,P,I,L,T,R,z,O,B,M,H,U,Y,$,W,G,Q,J,V,Z,X,K,ee,et,en,ei,es,ea,eo,el,eu,ed,ep,ex,ef,em,eh,eg,eb;return(0,u.YH)(this,function(ev){switch(ev.label){case 0:so.current=!1,ta.current=!1,nk("Open In"),n=Date.now(),tW(!0),tX(!0),ts.trackEnhanceStarted({mode:tA,prompt_length:(er||"").length,has_context:!!ec}),ev.label=1;case 1:return ev.trys.push([1,39,40,41]),[4,su()];case 2:return i=ev.sent(),o=(0,eN.Em)(tA),c=(0,eN.sl)(tA),d=(0,eN.ze)(tA),x=""!==(p=null!=ec?String(ec).trim():"")?p:null,m=(f=(0,eN.kD)()).endsWith("/enhance/stream"),h=i&&(!m||!(0,q.Hm)(i,0)),g=(0,eN.ob)({prompt:er,apiMode:o,mediaType:d,contextIdToSend:x,userId:tn,token:i,isDevTestStream:m}),[4,fetch(f,{method:"POST",headers:(0,s._)({"Content-Type":"application/json"},h?{Authorization:"Bearer ".concat(i)}:{}),body:JSON.stringify(g)})];case 3:if((b=ev.sent()).ok)return[3,9];v="",ev.label=4;case 4:return ev.trys.push([4,6,,8]),[4,b.json()];case 5:return v=JSON.stringify(ev.sent()),[3,8];case 6:return ev.sent(),[4,b.text()];case 7:return v=ev.sent(),[3,8];case 8:throw console.error("API Error Details:",v),_=(0,eN.hg)(v,b.status),e&&(nC({title:"Enhancement failed",body:_}),nS(!0)),Error("API error: ".concat(b.status," - ").concat(v));case 9:if(w=(y=b.headers.get("content-type")||"").includes("text/event-stream")||y.includes("text/plain"),j=er.trim(),!w)return[3,24];k=b.body.getReader(),N=new TextDecoder,A="",S="",E="",F=[],ev.label=10;case 10:ev.trys.push([10,,22,23]),ev.label=11;case 11:return[4,k.read()];case 12:if(D=(C=ev.sent()).done,P=C.value,D)return[3,21];A+=N.decode(P,{stream:!0}),A=(I=A.split("\n")).pop()||"",L=!0,T=!1,R=void 0,ev.label=13;case 13:ev.trys.push([13,18,19,20]),z=function(){var t,n,r,i,o,d,p,x,f,m,h,g,b,v,_,y;return(0,u.YH)(this,function(u){switch(u.label){case 0:if(""===(t=B.value).trim())return[2,"continue"];if(!t.startsWith("data: "))return[3,11];u.label=1;case 1:if(u.trys.push([1,10,,11]),"content"===(n=JSON.parse(t.substring(6))).type&&n.chunk&&(S+=n.chunk,rv.current=(0,eN.wk)(S)?"Enhancing…":S,r_.current||(r_.current=requestAnimationFrame(function(){r_.current=null,e&&null!==rv.current&&rh(function(e){var t=e.filter(function(e){return"v1"!==e.id});return[{id:"v1",name:"Enhanced",tag:"Latest",content:rv.current}].concat((0,l._)(t))})}))),i=(r=n&&("completed"===n.status||"complete"===n.status||"complete"===n.type||"completed"===n.type))?"string"==typeof n.enhanced_prompt&&n.enhanced_prompt||n.data&&"string"==typeof n.data.enhanced_prompt&&n.data.enhanced_prompt||((0,eN.wk)(S)?S:""):"",d=(o=(0,eN.Yq)(i,(0,eN.Av)(n))).text,!(r&&d)||(E=d,F=o.segments,!e))return[3,9];x=(p=(0,eN.xr)(n)).intent,f=p.domain,rO((0,s._)({},n,x?{intent:x}:{},f?{domain:f}:{})),rh(function(e){var t=e.filter(function(e){return"v1"!==e.id});return[{id:"v1",name:"Enhanced",tag:"Latest",content:d,annotated_segments:F}].concat((0,l._)(t))}),rl("v1"),u.label=2;case 2:return u.trys.push([2,8,,9]),m=Date.now(),[4,sd()];case 3:if(!(h=u.sent()))return[3,7];return rX(h),[4,sp(er,h)];case 4:if(!(g=u.sent()))return[3,7];return r1(g),v=(b=(0,eN.xr)(n)).intent,_=b.domain,[4,sx(d,g,h,(Date.now()-m)/1e3,c,v,_,F)];case 5:return(y=u.sent())&&(r3(y),ez(y,v,_),e&&rh(function(e){return e.map(function(e){return"v1"===e.id?(0,a._)((0,s._)({},e),{enhancedPromptId:y,intent:v,domain:_}):e})})),[4,sv()];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:return console.error("Streaming save failed:",u.sent()),[3,9];case 9:return[3,11];case 10:return u.sent(),[3,11];case 11:return[2]}})},O=I[Symbol.iterator](),ev.label=14;case 14:if(L=(B=O.next()).done)return[3,17];return[5,(0,u.Ju)(z())];case 15:ev.sent(),ev.label=16;case 16:return L=!0,[3,14];case 17:return[3,20];case 18:return M=ev.sent(),T=!0,R=M,[3,20];case 19:try{L||null==O.return||O.return()}finally{if(T)throw R}
1return[7];case 20:return[3,11];case 21:return[3,23];case 22:return k.releaseLock(),[7];case 23:return!E&&S&&(E=(H=(0,eN.Yq)(S,F)).text,(!Array.isArray(F)||0===F.length)&&Array.isArray(H.segments)&&H.segments.length&&(F=H.segments),e&&E&&(rh(function(e){var t=e.filter(function(e){return"v1"!==e.id});return[{id:"v1",name:"Enhanced",tag:"Latest",content:E,annotated_segments:F}].concat((0,l._)(t))}),rl("v1"))),j=(E||S||er).trim(),[3,34];case 24:return[4,b.json()];case 25:if(U=ev.sent(),!e)return[3,34];$=(Y=(0,eN.xr)(U)).intent,W=Y.domain,rO((0,s._)({},U,$?{intent:$}:{},W?{domain:W}:{})),G=U.enhanced_prompt||U.result||"",j=((J=(Q=(0,eN.Yq)(G,(0,eN.Av)(U))).text)||er).trim(),V=Q.segments,rh(function(e){return[{id:"v1",name:"Enhanced",tag:"Latest",content:J,annotated_segments:V}].concat((0,l._)(e.filter(function(e){return"v1"!==e.id})))}),rl("v1"),ev.label=26;case 26:return ev.trys.push([26,32,,33]),Z=Date.now(),[4,sd()];case 27:if(!(X=ev.sent()))return[3,31];return rX(X),[4,sp(er,X)];case 28:if(!(K=ev.sent()))return[3,31];return r1(K),et=(ee=(0,eN.xr)(U)).intent,en=ee.domain,[4,sx(J,K,X,(Date.now()-Z)/1e3,c,et,en,V)];case 29:return(ei=ev.sent())&&(r3(ei),ez(ei,et,en),e&&rh(function(e){return e.map(function(e){return"v1"===e.id?(0,a._)((0,s._)({},e),{enhancedPromptId:ei,intent:et,domain:en}):e})})),[4,sv()];case 30:ev.sent(),ev.label=31;case 31:return[3,33];case 32:return console.error("Initial save failed:",ev.sent()),[3,33];case 33:J&&(!Array.isArray(V)||0===V.length)&&(0,r._)(function(){var t,n,r;return(0,u.YH)(this,function(i){switch(i.label){case 0:return[4,(0,eN.re)(J,er)];case 1:if(t=i.sent(),!e||!Array.isArray(t)||0===t.length)return[2];if(n=null,rh(function(e){return e.map(function(e){return"v1"!==e.id?e:(n=e.enhancedPromptId||null,(0,a._)((0,s._)({},e),{annotated_segments:t}))})}),!n)return[3,3];return[4,su()];case 2:r=i.sent(),(0,eN.cl)({kind:"enhanced",id:n,segments:t,token:r}).catch(function(){}),i.label=3;case 3:return[2]}})})(),ev.label=34;case 34:return[4,su()];case 35:return es=ev.sent(),el=(eo=(ea=(0,eN.yS)()).startsWith(eN.ih))?(0,eN.tz)(es):!!es,[4,fetch(ea,{method:"POST",headers:(0,s._)({"Content-Type":"application/json"},el?{Authorization:"Bearer ".concat(es)}:{}),body:JSON.stringify((0,eN.nu)({promptText:j,userId:tn,token:es,isDevTest:eo}))})];case 36:if(!((eu=ev.sent()).ok&&e))return[3,38];return[4,eu.json()];case 37:ed=ev.sent(),ex=(ep=(0,eN.g6)(ed)).questions,ef=ep.options,rj(em=ex.map(function(e,t){return{question:e,options:(null==ef?void 0:ef[t])||[]}})),rP(Object.fromEntries(em.map(function(e){return[e.question,e.options||[]]}))),nd({}),nf({}),rF(!1),nl(null),ev.label=38;case 38:return ta.current||(ta.current=!0,ts.trackEnhanceCompleted({mode:tA,latency_ms:Date.now()-n,prompt_length:(er||"").length,success:!0}),null==e2||e2()),[3,41];case 39:if(console.error("Enhancement failed:",eh=ev.sent()),eg=String((null==eh?void 0:eh.message)||"").toLowerCase(),!navigator.onLine||(null==eh?void 0:eh.name)==="TypeError"||eg.includes("fetch")||eg.includes("network")||eg.includes("failed to fetch")||eg.includes("offline"))return window.dispatchEvent(new CustomEvent("velocity-offline-enhance-attempt")),e&&tW(!1),[2];return eb=(0,eN.hg)((null==eh?void 0:eh.message)||"unknown"),e&&(nC({title:"Enhancement failed",body:eb}),nS(!0),window.dispatchEvent(new CustomEvent("popup-state-open",{detail:{state:"ENHANCE_ERROR",payload:{onRetry:function(){return t()}}}}))),ts.trackEnhanceFailed({mode:tA,error_message:(null==eh?void 0:eh.message)||"unknown"}),[3,41];case 40:return e&&tW(!1),[7];case 41:return[2]}})})()}(),function(){e=!1}},[er,tA,em,ec,t5]);var sw=rm.find(function(e){return"Latest"===e.tag})||rm.find(function(e){return e.id===ro})||rm[0],sj=((null==sw?void 0:sw.content)||er||"").trim(),sk=!!(null==em?void 0:em.conversationId),sN=0===rw.length&&!t$&&sj.length>0&&(t8||sk&&!nt||!sk&&!ni);(0,x.useLayoutEffect)(function(){sa.current=null,(null==em?void 0:em.conversationId)?nn(!1):nn(!0)},[null==em?void 0:em.conversationId]),(0,x.useEffect)(function(){if(t$)return void ns(!1);(null==em?void 0:em.conversationId)||!(rw.length>0)||ns(!0)},[t$,null==em?void 0:em.conversationId,rw.length]);var sA=x.useCallback(function(){return(0,r._)(function(){var e,t,n,r,i,a,o,l,c,d,p,x;return(0,u.YH)(this,function(u){switch(u.label){case 0:if(ss.current)return[2];if(!(t=((null==(e=rm.find(function(e){return"Latest"===e.tag})||rm.find(function(e){return e.id===ro})||rm[0])?void 0:e.content)||er||"").trim())||t$)return(null==em?void 0:em.conversationId)&&nn(!0),(null==em?void 0:em.conversationId)||ns(!0),[2];ss.current=!0,t6(!0),u.label=1;case 1:return u.trys.push([1,5,6,7]),[4,su()];case 2:return n=u.sent(),a=(i=(r=(0,eN.yS)()).startsWith(eN.ih))?(0,eN.tz)(n):!!n,[4,fetch(r,{method:"POST",headers:(0,s._)({"Content-Type":"application/json"},a?{Authorization:"Bearer ".concat(n)}:{}),body:JSON.stringify((0,eN.nu)({promptText:t,userId:tn,token:n,isDevTest:i}))})];case 3:if(!(o=u.sent()).ok)return[2];return[4,o.json()];case 4:return l=u.sent(),d=(c=(0,eN.g6)(l)).questions,p=c.options,rj(x=d.map(function(e,t){return{question:e,options:(null==p?void 0:p[t])||[]}})),rP(Object.fromEntries(x.map(function(e){return[e.question,e.options||[]]}))),rA([]),nd({}),nf({}),rF(!1),nl(null),tk(""),[3,7];case 5:return console.error("refreshClarifyQuestions failed:",u.sent()),[3,7];case 6:return ss.current=!1,t6(!1),(null==em?void 0:em.conversationId)&&nn(!0),(null==em?void 0:em.conversationId)||ns(!0),[7];case 7:return[2]}})})()},[rm,er,ro,t$,null==em?void 0:em.conversationId]),sS=(null==em?void 0:em.conversationId)&&(null==em||null==(Z=em.messages)?void 0:Z.length)>0&&sj?"".concat(em.conversationId,":").concat(sj.slice(0,240)):null;(0,x.useEffect)(function(){if(sS&&sa.current!==sS){sa.current=sS;var e=window.setTimeout(function(){sA()},0);return function(){return window.clearTimeout(e)}}}
1,[sS,sA]),(0,x.useEffect)(function(){var e=si.current;if(null===e){si.current=t$;return}si.current=t$,(null==em||!em.conversationId)&&!0===e&&!1===t$&&sj.trim()&&!(rw.length>0)&&(so.current||(so.current=!0,sA()))},[t$,null==em?void 0:em.conversationId,sj,rw.length,sA]);var sE=x.useMemo(function(){var e=new Map;return rN.forEach(function(t){e.set(t.question,{question:t.question,options:rD[t.question]||[],answer:t.answer})}),rw.forEach(function(t){var n="string"==typeof t?t:t.question,r=(void 0===t?"undefined":(0,c._)(t))==="object"&&Array.isArray(t.options)?t.options:rD[n]||[];e.has(n)||e.set(n,{question:n,options:r})}),Array.from(e.values())},[rN,rw,rD]),sF=x.useMemo(function(){return no?sE.findIndex(function(e){return e.question===no.question}):-1},[no,sE]);function sC(e){if(!(e<0)&&!(e>=sE.length)){var t,n=sE[e],r=n.answer||(null==(t=rN.find(function(e){return e.question===n.question}))?void 0:t.answer)||"";r?sI({question:n.question,options:n.options,answer:r}):nl({question:n.question,options:n.options}),setTimeout(function(){var e=nK.current;if(e){e.focus();var t=e.value.length;e.setSelectionRange(t,t)}},50)}}function sD(e){return(0,r._)(function(){var t,n,i,o,c,d,p,x,f,m,h,g,b,v,_;return(0,u.YH)(this,function(y){switch(y.label){case 0:if(rb)return nS(!0),nC({title:"Improvement limit reached (3/3)",body:"Free plan allows up to 3 improvements per prompt. Start a new chat to continue."}),[2];if(tn)return[3,1];if(t=(0,ek.Vq)(),!(0,ek.sw)(t))return window.dispatchEvent(new CustomEvent("popup-state-open",{detail:{state:"GUEST_SIGNUP_NUDGE"}})),[2];return[3,3];case 1:return[4,iz("refine_prompt")];case 2:if(!y.sent())return[2];y.label=3;case 3:tJ(!0),y.label=4;case 4:return y.trys.push([4,18,19,20]),[4,su()];case 5:return i=y.sent(),o=(null==(n=rm.find(function(e){return e.id===ro}))?void 0:n.content)||er,p=(d=(c=(0,eN.vc)()).startsWith(eN.ih))?(0,eN.tz)(i):!!i,[4,fetch(c,{method:"POST",headers:(0,s._)({"Content-Type":"application/json"},p?{Authorization:"Bearer ".concat(i)}:{}),body:JSON.stringify((0,eN.Zt)({promptText:o,qaPairs:e,userId:tn,token:i,isDevTest:d}))})];case 6:if((x=y.sent()).ok)return[3,8];return[4,x.text()];case 7:throw f=y.sent(),Error("Refine error ".concat(x.status,": ").concat(f));case 8:return[4,x.json()];case 9:if(m=y.sent(),g=(h=(0,eN.Yq)(m.refined_prompt||m.result||m.enhanced_prompt,(0,eN.Av)(m))).text,b=h.segments,!g)return[3,16];tn||((0,ek.OS)({refineSubmitCount:1}),setTimeout(function(){window.dispatchEvent(new CustomEvent("popup-state-open",{detail:{state:"GUEST_SIGNUP_NUDGE"}}))},1500)),v=null,y.label=10;case 10:if(y.trys.push([10,14,,15]),!r0)return[3,13];return[4,sf(g,r0,r5,rZ,e,0,b)];case 11:return v=y.sent(),[4,sv()];case 12:y.sent(),y.label=13;case 13:return[3,15];case 14:return console.error("Q&A Refine save failed:",y.sent()),[3,15];case 15:return _="v".concat(Date.now()),rh(function(e){var t=e.filter(function(e){return"og"!==e.id}).length+1;return[(0,s._)({id:_,name:"Refined ".concat(t),tag:"Latest",content:g,annotated_segments:b},v?{refineId:v}:{},r5?{enhancedPromptId:r5}:{})].concat((0,l._)(e.map(function(e){return(0,a._)((0,s._)({},e),{tag:void 0})})))}),rl(_),Array.isArray(b)&&0!==b.length||(0,r._)(function(){var e,t;return(0,u.YH)(this,function(n){switch(n.label){case 0:return[4,(0,eN.re)(g,er)];case 1:if(!Array.isArray(e=n.sent())||0===e.length)return[2];if(rh(function(t){return t.map(function(t){return t.id===_?(0,a._)((0,s._)({},t),{annotated_segments:e}):t})}),!v)return[3,3];return[4,su()];case 2:t=n.sent(),(0,eN.cl)({kind:"refined",id:v,segments:e,token:t}).catch(function(){}),n.label=3;case 3:return[2]}})})(),[3,17];case 16:console.warn("[Q&A Refine] no refined prompt in response:",m),y.label=17;case 17:return[3,20];case 18:return console.error("[Q&A Refine] failed:",y.sent()),[3,20];case 19:return tJ(!1),[7];case 20:return[2]}})})()}function sP(e){return(0,r._)(function(e){var t,n,r,i,s,a,o,d=arguments;return(0,u.YH)(this,function(u){return n=void 0===(t=(d.length>1&&void 0!==d[1]?d[1]:{}).openNextQuestion)||t,i=new Set((r=e.map(function(e){return{question:e.question,answer:String(e.answer).trim()}})).map(function(e){return e.question})),s=(0,l._)(rL),r.forEach(function(e){var t=s.findIndex(function(t,n){return n>0&&t.question===e.question});t>=0?s[t]=e:s.push(e)}),rT(s),rA(function(e){var t=(0,l._)(e);return r.forEach(function(e){var n=t.findIndex(function(t){return t.question===e.question});n>=0?t[n]=e:t.push(e)}),t}),n&&((a=rw.filter(function(e){var t="string"==typeof e?e:e.question;return!i.has(t)})).length>0?(rF(!1),nl({question:"string"==typeof(o=a[0])?o:o.question,options:(void 0===o?"undefined":(0,c._)(o))==="object"&&o.options||[]})):(rF(!0),nl(null))),tk(""),[2]})}).apply(this,arguments)}function sI(e){var t=(null==e?void 0:e.question)||"",n=Array.isArray(null==e?void 0:e.options)?e.options:[],r=((null==e?void 0:e.answer)||"").trim();if(t)if(r){var o=r.split(";").map(function(e){return e.trim()}
1).filter(Boolean),c=n.filter(function(e){if(eO(e))return!1;var t=eB(e).trim(),n=String(e).trim();return o.some(function(e){return e===t||e===n})}),u=new Set(c.map(function(e){return eB(e).trim()})),d=o.filter(function(e){return!u.has(e)}),p=n.some(function(e){return eO(e)});nd(function(e){return(0,a._)((0,s._)({},e),(0,i._)({},t,p&&d.length>0?(0,l._)(c).concat((0,l._)(n.filter(function(e){return eO(e)}).slice(0,1))):c))}),nf(function(e){return(0,a._)((0,s._)({},e),(0,i._)({},t,p&&d.length>0?d.join("; "):""))})}else nd(function(e){return(0,a._)((0,s._)({},e),(0,i._)({},t,[]))}),nf(function(e){return(0,a._)((0,s._)({},e),(0,i._)({},t,""))});nl({question:t,options:n}),rF(!1),setTimeout(function(){var e;null==(e=n1.current)||e.scrollIntoView({behavior:"smooth",block:"end"})},60)}var sL=x.useMemo(function(){return function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],s={},a=(0,l._)(e||[]);if(r){var o="string"==typeof r?r:null==r?void 0:r.question;o&&!a.some(function(e){return("string"==typeof e?e:e.question)===o})&&a.push(r)}var c=!0,u=!1,d=void 0;try{for(var p,x=a[Symbol.iterator]();!(c=(p=x.next()).done);c=!0){var f=p.value,m="string"==typeof f?f:f.question;s[m]=function(e,t){var n=e||[],r=n.filter(function(e){return!eO(e)}).map(function(e){return eB(e)}),i=n.some(function(e){return eO(e)}),s=(t||"").trim(),a=(0,l._)(r);return(i&&s&&a.push(s),i&&!s&&0===r.length)?"":a.join("; ")}(t[m],n[m])}}catch(e){u=!0,d=e}finally{try{c||null==x.return||x.return()}finally{if(u)throw d}}var h=!0,g=!1,b=void 0;try{for(var v,_=i[Symbol.iterator]();!(h=(v=_.next()).done);h=!0){var y=v.value;y.question&&!s[y.question]&&y.answer&&(s[y.question]=y.answer)}}catch(e){g=!0,b=e}finally{try{h||null==_.return||_.return()}finally{if(g)throw b}}return s}(rw,nu,nx,no,rN)},[rw,nu,nx,no,rN]);function sT(){if(!(null==no?void 0:no.question))return null;var e=no.question,t=(sL[e]||"").trim();return t?{question:e,answer:t}:null}var sR=(sL[(null==no?void 0:no.question)||""]||"").trim().length>0,sq=rE&&0===rw.length&&!no&&rL.length>1;rw.length;var sz=!!no||rN.length>0||sq||rE,sO=sz||ib;rL.length;var sB=rN.length>0;rN.map(function(e,t){return"".concat(t+1,". ").concat(e.question,"\n").concat(e.answer)}).join("\n\n");var sM=sE.length||rN.length+rw.length,sH=x.useMemo(function(){if(no)return no;if(!rw.length)return null;var e=rw[0];return{question:"string"==typeof e?e:e.question,options:(void 0===e?"undefined":(0,c._)(e))==="object"&&e.options||[]}},[no,rw]);x.useMemo(function(){if(!(null==sH?void 0:sH.question)||!rw.length)return 0;var e=rw.findIndex(function(e){return("string"==typeof e?e:e.question)===sH.question});return e>=0?e:0},[sH,rw]),sM>0&&rN.length;var sU=sF>=0?sF+1:0;function sY(){var e,t=window.innerWidth<768;if(t&&n9("output"),null==sH?void 0:sH.question)return void(t?window.setTimeout(function(){return sI(sH)},60):sI(sH));if(rw.length>0){var n=rw[0],r={question:"string"==typeof n?n:n.question,options:(void 0===n?"undefined":(0,c._)(n))==="object"&&n.options||[]};t?window.setTimeout(function(){return sI(r)},60):sI(r);return}rF(!0),null==(e=nK.current)||e.focus()}no&&sF>=0&&rN.length;var s$=x.useMemo(function(){return rm.find(function(e){return e.id===ro})},[rm,ro]),sW=x.useMemo(function(){return s$?"og"===s$.id?"Original Prompt":"Enhanced"===s$.name?"Enhanced Prompt":s$.name:"Enhanced Prompt"},[s$]),sG=x.useMemo(function(){var e,t=(null==(e=rm.find(function(e){return"og"===e.id}))?void 0:e.content)||rx||"",n=(null==is?void 0:is.id)==="og"?(null==is?void 0:is.content)||"":t||(null==is?void 0:is.content)||"";return(0,T.P)(n,{intent:r8,domain:r6})||"Enhanced Prompt"},[null==is?void 0:is.content,null==is?void 0:is.id,rm,rx,r8,r6]);return(0,x.useEffect)(function(){rw.length&&tk("")},[rw]),(0,x.useEffect)(function(){eQ&&(ip("session"),n9("suggestions"),rs(0),rn(!1))},[eQ]),(0,x.useEffect)(function(){if(eQ&&!t$){var e=setTimeout(function(){rs(0),rn(!0)},250);return function(){return clearTimeout(e)}}},[eQ,t$]),(0,x.useEffect)(function(){n2.current&&n2.current.scrollTo({top:0,behavior:"instant"}),window.scrollTo({top:0,behavior:"instant"})},[id]),(0,x.useEffect)(function(){var e=function(e){var t;(null==(t=e.detail)?void 0:t.tab)&&n9(e.detail.tab)};return window.addEventListener("velocity-tour-tab",e),function(){return window.removeEventListener("velocity-tour-tab",e)}},[]),(0,d.jsxs)("div",{className:"fixed inset-y-0 right-0 z-[60] left-0 transition-all duration-300 flex bg-[#05070C] md:bg-[radial-gradient(120%_120%_at_8%_8%,rgba(26,218,243,0.13)_0%,rgba(6,10,18,0.97)_34%,rgba(3,6,12,1)_72%)] selection:bg-[#1ADAF3]/20 ".concat((null!=e8?e8:nh)?"md:left-[17rem] lg:left-[18.5rem] xl:left-80":"md:left-14 lg:left-16 xl:left-16"),
1children:[(0,d.jsx)(eF,{enabled:rt,steps:[{element:'[data-tutorial="session-enhanced-output"]',title:"Enhanced Prompt",intro:"This is your enhanced result generated from the original input.",position:"left"},{element:'[data-tutorial="session-refine-questions"]',title:"Refine Questions",intro:"Answer these guided questions to improve quality before refining.",position:"right"},{element:'[data-tutorial="session-refine-input"]',title:"Refine Input",intro:"Add manual refinement context here if you want additional control.",position:"top"},{element:'[data-tutorial="session-refine-send"]',title:"Refine Prompt",intro:"Submit to generate the next refined version from your answers.",position:"top"}],initialStep:ri,onExit:function(){return rn(!1)},onComplete:function(){return rn(!1)},onAfterChange:function(e){return rs(e)},options:{showStepNumbers:!0,showBullets:!0,showProgress:!0,scrollToElement:!0,exitOnOverlayClick:!1,nextLabel:"Next",prevLabel:"Back",doneLabel:"Done"}}),(0,d.jsx)("div",{className:"hidden md:block",children:(0,d.jsx)(eu.default,{})}),(0,d.jsx)("div",{ref:n2,className:"flex-1 min-h-0 overflow-y-auto flex flex-col h-full relative overscroll-contain",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:"session"===id?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"md:hidden w-full shrink-0 sticky top-0 z-50 bg-[#05070C] shadow-[0_8px_24px_rgba(0,0,0,0.95)] border-b border-white/[0.08] px-3 sm:px-4 pt-2 pb-2.5 mb-2 ".concat(e3?"space-y-1.5":"space-y-2"),children:[e3?(0,d.jsxs)("div",{className:"relative flex w-full items-center justify-between gap-2 bg-transparent py-1",children:[(0,d.jsx)("button",{type:"button","aria-label":"Open menu",onClick:function(){return null==te?void 0:te(!0)},className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-white/[0.04] backdrop-blur-md shadow-[inset_0_1px_1px_rgba(255,255,255,0.06)] text-white/75 transition-all hover:bg-white/[0.08] hover:text-white",children:(0,d.jsx)(v.A,{size:17})}),(0,d.jsx)("p",{className:"min-w-0 flex-1 truncate text-[15px] font-semibold text-white/92",children:ic})]}):(0,d.jsx)("div",{className:"flex w-full items-center gap-2 shrink-0",children:(0,d.jsx)("button",{type:"button","aria-label":"Open menu",onClick:function(){return(null==te?void 0:te(!0))||nb(!0)},className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-white/[0.04] backdrop-blur-md shadow-[inset_0_1px_1px_rgba(255,255,255,0.06)] text-white/80 transition-all hover:bg-white/[0.08] hover:text-white",children:(0,d.jsx)(v.A,{size:18})})}),(0,d.jsx)("div",{className:"flex w-full items-center justify-between gap-1.5 sm:gap-2 py-1.5 px-1 overflow-x-auto no-scrollbar",children:["output","suggestions","context","versions"].map(function(e){var t=n7===e;return(0,d.jsxs)("button",{onClick:function(){return n9(e)},className:"relative shrink-0 flex-1 sm:flex-initial inline-flex items-center justify-center gap-1.5 px-2.5 sm:px-3.5 md:px-4 h-[32px] sm:h-[34px] md:h-[36px] rounded-full font-dm-sans font-bold text-[11px] sm:text-[12px] md:text-[13px] uppercase transition-all duration-200 border-none ".concat(t?"text-black":"text-white"),style:{background:t?tr?"#F5C842":"#53EAFD":"#242424",boxShadow:t?"0px 4px 4px rgba(0, 0, 0, 0.83), inset 0px 4px 4px rgba(0, 0, 0, 0.25)":"0px 4px 4px rgba(0, 0, 0, 0.32), inset 0px 4px 4px rgba(255, 255, 255, 0.05)"},children:[(0,d.jsx)("span",{className:"whitespace-nowrap",children:e}),"suggestions"===e&&!t&&(0,d.jsxs)("span",{className:"relative flex h-2 w-2 items-center justify-center shrink-0 ml-0.5",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:ti,animationDuration:"1.8s"}}),(0,d.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full",style:{backgroundColor:ti,boxShadow:"0 0 8px ".concat(ti)}})]})]},e)})})]}),(0,d.jsxs)("main",{className:"w-full shrink-0 min-h-0 flex flex-col md:flex-row items-start ".concat(e3?"gap-2":"gap-3"," lg:gap-5 xl:gap-6 px-3 sm:px-4 md:px-6 xl:px-8 pt-0 md:pt-6 xl:pt-8 pb-3 md:pb-4 w-full min-w-0 max-w-[1720px] mx-auto"),children:[e3&&rY?(0,d.jsx)("button",{type:"button","aria-label":"Close mobile top menu",onClick:function(){return r$(!1)},className:"fixed inset-0 z-[70] md:hidden"}):null,(0,d.jsx)("aside",{className:"\n            w-full md:w-[380px] lg:w-[420px] xl:w-[460px] 2xl:w-[480px] shrink-0 min-h-0 flex flex-col self-start pb-0\n            ".concat("output"===n7?"hidden md:flex":"flex","\n          "),children:(0,d.jsxs)("div",{className:"\n              bg-[#181818] rounded-[24px] sm:rou
1nded-[32px] md:rounded-[40px] w-full min-h-0 flex flex-col overflow-hidden transition-all duration-500 border border-white/[0.08]\n              ".concat(tZ||t0||t$||tQ?"h-[460px] sm:h-[500px] md:h-[520px]":"h-auto min-h-0","\n            "),style:{boxShadow:"0px 4px 16px rgba(0, 0, 0, 0.6), inset 0px 1px 0px rgba(255, 255, 255, 0.08)"},children:[(0,d.jsx)("nav",{className:"hidden md:flex items-center gap-2 lg:gap-2.5 px-4 lg:px-5 py-3 lg:py-3.5 overflow-visible shrink-0 border-b border-white/[0.21]",children:["suggestions","context","versions"].map(function(e){var t=n7===e;return(0,d.jsxs)("button",{onClick:function(){return n9(e)},className:"inline-flex items-center justify-center gap-1.5 px-3 sm:px-4 md:px-4.5 h-[32px] sm:h-[34px] md:h-[36px] rounded-full font-dm-sans font-bold text-[11px] sm:text-[12px] md:text-[13px] uppercase transition-all duration-200 border-none ".concat(t?"text-black":"text-white"),style:{background:t?tr?"#F5C842":"#53EAFD":"#242424",boxShadow:t?"0px 4px 4px rgba(0, 0, 0, 0.83), inset 0px 4px 4px rgba(0, 0, 0, 0.25)":"0px 4px 4px rgba(0, 0, 0, 0.32), inset 0px 4px 4px rgba(255, 255, 255, 0.05)"},children:[(0,d.jsx)("span",{children:e}),"suggestions"===e&&!t&&(0,d.jsxs)("span",{className:"relative flex h-2.5 w-2.5 items-center justify-center shrink-0 ml-1",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:ti,animationDuration:"1.8s"}}),(0,d.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full",style:{backgroundColor:ti,boxShadow:"0 0 10px ".concat(ti)}})]})]},e)})}),(0,d.jsx)("div",{className:"p-4 sm:p-6 lg:p-7 flex-1 min-h-0 overflow-y-auto custom-scrollbar",children:(0,d.jsxs)(f.N,{mode:"wait",children:["suggestions"===n7&&(0,d.jsx)(m.P.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"space-y-6",children:(0,d.jsxs)("div",{className:"space-y-6",children:[(0,d.jsxs)("div",{className:"pt-0 hidden md:block",children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,d.jsx)("p",{className:"text-[16px] font-bold uppercase font-dm-sans tracking-wide",style:{color:tr?"#F5C842":"#78F7FF"},children:"ORIGINAL PROMPT"}),!!tn&&!td&&(0,d.jsxs)("button",{type:"button",onClick:function(){tm(er||""),tp(!0)},className:"flex items-center gap-1 px-3.5 py-1.5 rounded-full bg-white/[0.04] hover:bg-white/[0.08] transition-all text-[11px] font-medium text-white/70 hover:text-white group border-none backdrop-blur-md cursor-pointer",title:"Edit Prompt",children:[(0,d.jsx)(_.A,{size:13,className:"group-hover:text-white transition-colors"}),(0,d.jsx)("span",{children:"Edit"})]})]}),td?(0,d.jsxs)("div",{className:"space-y-2.5 mt-2 bg-black/40 border border-white/20 rounded-[16px] p-3.5 backdrop-blur-md",children:[(0,d.jsx)("textarea",{value:tf,onChange:function(e){return tm(e.target.value)},className:"w-full bg-[#181818] border border-white/10 rounded-xl p-3 text-[15px] font-space-grotesk text-white placeholder:text-white/30 focus:outline-none transition-all min-h-[90px] resize-none",placeholder:"Edit your prompt..."}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:function(){return tp(!1)},className:"px-3.5 py-1.5 rounded-xl text-xs font-semibold text-white/60 hover:text-white hover:bg-white/5 transition-all",children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:function(){return(0,r._)(function(){var e;return(0,u.YH)(this,function(t){switch(t.label){case 0:if(!(e=tf.trim()))return[2];if(!tn)return[3,3];if("function"!=typeof iz)return[3,2];return[4,iz("re_enhance_prompt")];case 1:if(!t.sent())return[2];t.label=2;case 2:null==e0||e0(),t.label=3;case 3:return tp(!1),n9("output"),tX(!0),tW(!0),rl("v1"),t3(function(e){return e+1}),"function"==typeof eo&&eo(e),[2]}})})()},className:"px-4 py-1.5 rounded-xl text-xs font-bold transition-all cursor-pointer",style:{backgroundColor:tr?"#F5C842":"#1ADAF3",color:"#000000"},children:"Save & Re-enhance"})]})]}):(0,d.jsx)("div",{className:"w-full p-4 sm:p-5 rounded-[16px] bg-[#181818] shadow-[inset_0px_0px_12px_rgba(0,0,0,0.84)] border border-white/[0.04]",children:(0,d.jsx)("div",{className:"overflow-y-auto pr-2 custom-scrollbar transition-all duration-300 h-auto max-h-[220px]",children:(0,d.jsx)("p",{className:"text-[14px] sm:text-[15px] leading-[1.6] font-space-grotesk text-[#E0E0E0]/85 break-words whitespace-pre-wrap",children:rx||"No prompt available"})})})]}),!(tZ||t0||t$||tQ)&&(0,d.jsx)("div",{"data-tutorial":"session-refine-questions",className:"space-y-3",children:rb?(0,d.jsxs)("div",{className:"p-5 rounded-2xl bg-[#181818] border border-white/[0.08] text-center space-y-3 my-2",children:[(0,d.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#1ADAF3]/10 flex items-center justify-center mx-auto text-[#1ADAF3]",children:(0,d.jsx)(Sparkles,{size:18})}),(0,d.jsx)("h4",{className:"text-[15px] font-bold text-white font-dm-sans",children:"Improvement limit reached (3/3)"}),(0,d.jsx)("p",{className:"text-[13px] text-white/60 font-space-grotesk max-w-[280px] mx-auto leading-relaxed",children:"Free plan allows up to 3 improvements per prompt. Start a new chat to enhance another prompt."}),(0,d.jsxs)("button",{type:"button",onClick:function(){return null==ea?void 0:ea()},className:"btn-primary-velocity inline-flex items-center justify-center gap-2 px-5 py-2.5 font-dm-sans text-xs font-bold text-[#03171d] rounded-xl cursor-pointer",children:[(0,d.jsx)(y.A,{size:15,strokeWidth:2.5}),(0,d.jsx)("span",{children:"Start New Chat"})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("h3",{className:"mt-0 text-[16px] font-bold uppercase font-dm-sans leading-tight tracking-wide",style:{color:tr?"#F5C842":"#78F7FF"},children:["REFINE YOUR PROMPT ",sM>0?"(".concat(rN.length,"/").concat(Math.max(sM,rN.length),")"):""]}),rN.length>0&&(0,d.jsx)("div",{className:"space-y-2.5",children:rN.map(function(e,t){return(0,d.jsxs)("button",{type:"button",onClick:function(){var t=rD[e.question]||[];sI({question:e.question,options:t,answer:e.answer})},className:"w-full rounded-[16px] bg-[#242424] p-5 text-left transition-all hover:bg-[#2A2A2A] shadow-[0px_4px_4px_rgba(0,0,0,0.52),inset_0px_4px_4px_rgba(224,224,224,0.06)] border-none cursor-pointer",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsx)("p",{className:"text-[15px] font-space-grotesk font-normal leading-snug text-white/90",children:e.question}),(0,d.jsx)("span",{className:"inline-flex items-center rounded-full px-3 py-1 text-[11px] font-medium",style:{backgroundColor:tr?"rgba(245, 200, 66, 0.15)":"rgba(83, 234, 253, 0.15)",color:tr?"#F5C842":"#53EAFD"},children:"Done"})]}),(0,d.jsx)("p",{className:"mt-2 line-clamp-2 text-[13px] leading-relaxed text-white/60",children:e.answer})]},"answered-".concat(t,"-").concat(e.question))})}),(0,d.jsx)(f.N,{initial:!1,children:rd?null:rw.length>0&&sH?(0,d.jsxs)(m.P.button,{type:"button",initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},exit:{opacity:0,y:-20},onClick:function(){if(!tn&&tM>=3)return void window.dispatchEvent(new CustomEvent("popup-state-open",{detail:{state:"FIRST_ENHANCE_CELEBRATION"}}));sI(sH)},className:"group w-full rounded-[16px] bg-[#242424] p-5 text-left transition-all hover:bg-[#2A2A2A] shadow-[0px_4px_4px_rgba(0,0,0,0.52),inset_0px_4px_4px_rgba(224,224,224,0.06)] border-none cursor-pointer",children:[(0,d.jsx)("div",{className:"mb-3 flex items-center justify-between",children:(0,d.jsx)("span",{className:"inline-flex items-center whitespace-nowrap rounded-[22px] bg-[#FF6060]/[0.14] px-3 py-1 text-[12px] font-space-grotesk font-normal text-[#FF6464]",children:"High Priority"})}),(0,d.jsx)("h4",{className:"text-left text-[16px] font-space-grotesk font-normal leading-[20px] text-white",children:sH.question})]},"single-q-".concat(sH.question)):sq?(0,d.jsx)(m.P.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"rounded-[16px] bg-[#242424] shadow-[0px_4px_4px_rgba(0,0,0,0.52),inset_0px_4px_4px_rgba(224,224,224,0.06)] p-5 text-center",children:(0,d.jsx)("p",{className:"text-xs text-[#ffd2ad] font-semibold",children:"All questions answered. Press send to refine the prompt."})},"qa-complete"):sN?(0,d.jsxs)(m.P.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"py-16 flex flex-col items-center justify-center gap-4 text-center",children:[(0,d.jsx)(h.A,{className:"h-8 w-8 animate-spin",style:{color:tr?"#F5C842":"#1ADAF3"},"aria-hidden":!0}),(0,d.jsx)("p",{className:"text-[11px] text-white/40 font-medium px-2",children:"Loading refine questions…"})]},"mcq-loading"):null})]})})]})},"suggestions"),"context"===n7&&(0,d.jsxs)(m.P.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"space-y-8",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-bold text-white/20 uppercase tracking-widest mb-1",children:"Domain"}),(0,d.jsx)("p",{className:"text-sm text-[#1ADAF3] font-medium capitalize",children:eR(r6)||"Not detected"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-xs font-bold text-white/20 uppercase tracking-widest mb-1",children:"Intent"}),(0,d.jsx)("p",{className:"text-sm text-white/60 font-medium capitalize",children:eR(r8)||"Not detected"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-bold uppercase tracking-[0.3em] text-white/20 mb-6 flex items-center gap-3",children:"Refinement History"}),(0,d.jsx)("div",{className:"space-y-6",children:rL.slice(-4).map(function(e,t){return(0,d.jsxs)("div",{className:"relative pl-6",children:[(0,d.jsx)("div",{className:"absolute left-0 top-1.5 w-[1px] h-full bg-white/10"}),(0,d.jsx)("div",{className:"absolute left-[-2px] top-1.5 w-1 h-1 rounded-full bg-white/20"}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[9px] font-black text-[#1ADAF3]/60 uppercase tracking-[0.2em]",children:e.question}),(0,d.jsx)("p",{className:"text-sm text-white/70 leading-relaxed font-light text-justify [text-justify:inter-word] [text-align-last:left]",children:e.answer})]})]},t)})})]})]},"context"),"versions"===n7&&(0,d.jsx)(m.P.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"space-y-3",children:rm.map(function(e,t){var n=rm.length-1-t,r="og"===e.id?"OG":"v".concat(n),i=ro===e.id,s=(e.content||"").replace(/\s+/g," ").trim();return(0,d.jsx)("div",{onClick:function(){rl(e.id),window.innerWidth<768&&n9("output")},role:"button",tabIndex:0,onKeyDown:function(t){("Enter"===t.key||" "===t.key)&&(rl(e.id),window.innerWidth<768&&n9("output"))},className:"w-full rounded-[24px] p-5 transition-all text-left group border-none cursor-pointer outline-none ".concat(i?"bg-[rgba(26,218,243,0.08)] shadow-[0_0_30px_rgba(26,218,243,0.12),inset_0_1px_1px_rgba(255,255,255,0.08)]":"bg-[linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))] hover:bg-white/[0.05] shadow-[0_10px_20px_rgba(0,0,0,0.2),inset_0_1px_0_rgba(255,255,255,0.04)]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"mt-0.5 h-9 w-9 rounded-2xl flex items-center justify-center text-[11px] font-black shrink-0 ".concat(i?"bg-[#1ADAF3] text-black":"bg-white/10 text-white/45"),children:r}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-sm font-semibold ".concat(i?"text-white":"text-white/85"),children:e.name}),e.tag?(0,d.jsx)("span",{className:"rounded-full shadow-[0_0_12px_rgba(26,218,243,0.2)] bg-[#1ADAF3]/10 px-3 py-1 text-[9px] font-bold uppercase tracking-wide text-[#1ADAF3] border-none",children:e.tag}):null]}),(0,d.jsx)("p",{className:"mt-2 text-xs leading-relaxed line-clamp-2 text-left ".concat(i?"text-white/78":"text-white/52"),children:s||"No prompt content available."})]})]})},e.id)})},"versions")]})})]})}),(0,d.jsx)("section",{"data-tutorial":"session-enhanced-output",className:"\n            w-full max-w-full shrink-0 md:flex-1 min-w-0 flex flex-col self-start rounded-[24px] sm:rou
1nded-[32px] md:rounded-[40px] overflow-visible relative transition-all duration-500 border-none\n            ".concat("output"===n7?"flex":"hidden md:flex","\n            bg-[#181818]\n            ").concat(tZ||t0||t$||tQ?"h-[460px] sm:h-[500px] md:h-[520px]":"h-auto min-h-[500px]","\n          "),style:{boxShadow:tZ||t0||t$||tQ?tr?"0px 4px 24px rgba(245,200,66,0.45), 0px 4px 4px #000000, inset 0px 4px 4px rgba(255, 255, 255, 0.13)":"0px 4px 24px rgba(88,245,255,0.42), 0px 4px 4px #000000, inset 0px 4px 4px rgba(255, 255, 255, 0.13)":tr?"0px 4px 24px rgba(245,200,66,0.38), 0px 4px 4px #000000, inset 0px 4px 4px rgba(255, 255, 255, 0.13)":"0px 4px 24px rgba(88,245,255,0.35), 0px 4px 4px #000000, inset 0px 4px 4px rgba(255, 255, 255, 0.13)"},children:tZ||t0?(0,d.jsx)("div",{className:"flex-1 flex flex-col w-full h-full p-6 sm:p-8",children:(0,d.jsx)(eb,{active:tZ||t0,plan:"pro"===(J=String((null==tt?void 0:tt.status)||"").toLowerCase())||"active"===J?"pro":["freetrial","protrial","trialing","trial"].includes(J)?"protrial":"free",headline:null,forceComplete:tZ?!t$:!tQ})}):(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)("div",{className:"flex-none overflow-visible custom-scrollbar relative flex flex-col",onCopy:function(e){return e.preventDefault()},children:[(0,d.jsxs)("div",{className:"px-4 sm:px-8 pt-4 sm:pt-5 pb-2 shrink-0",children:[(0,d.jsx)("div",{className:"mb-3",children:(0,d.jsx)("h3",{className:"text-[16px] sm:text-[18px] md:text-[20px] font-bold text-white tracking-tight leading-snug font-dm-sans",title:null==is?void 0:is.content,children:sG})}),(0,d.jsx)("div",{className:"mb-1 rounded-[1rem] bg-white/[0.02] backdrop-blur-3xl px-3.5 py-2.5 sm:px-5 sm:py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.05),0_4px_20px_rgba(0,0,0,0.25)] transition-all",children:rM?(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("div",{className:"space-y-1",children:it.map(function(e){var t=e.icon;return(0,d.jsx)("div",{className:"group rounded-xl transition-all py-1.5 px-2.5 hover:bg-white/[0.03]",children:(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-1 sm:gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"flex shrink-0 items-center justify-center text-white/40 group-hover:text-white transition-colors",children:(0,d.jsx)(t,{size:14,strokeWidth:2})}),(0,d.jsx)("span",{className:"text-[12px] font-medium text-white/50 group-hover:text-white/70 transition-colors",children:e.label})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0 pl-6 sm:pl-0",children:[(0,d.jsx)("span",{className:"truncate text-[13px] font-bold text-white/90 group-hover:text-white transition-colors capitalize",children:e.value}),(0,d.jsxs)("span",{className:"hidden md:inline text-[11px] text-white/30 truncate",children:["• ",e.hint]})]})]})},e.label)})}),(0,d.jsx)("div",{className:"pt-1.5",children:(0,d.jsxs)("button",{type:"button",onClick:function(){return rH(!1)},className:"inline-flex items-center justify-start gap-1.5 text-[12px] font-semibold text-white/40 transition-all hover:text-white","aria-expanded":rM,children:[(0,d.jsx)(w.A,{size:13,className:"rotate-180 transition-transform"}),"Hide ",it.length," properties"]})})]}):(0,d.jsxs)("button",{type:"button",onClick:function(){return rH(!0)},className:"inline-flex items-center justify-start gap-1.5 text-[12px] font-semibold text-white/40 transition-all hover:text-white","aria-expanded":rM,children:[(0,d.jsx)(w.A,{size:13,className:"-rotate-90 transition-transform"}),"Show ",it.length," properties"]})})]}),(0,d.jsxs)("div",{className:"sticky top-0 z-30 bg-[#181818] border-b border-white/[0.08] py-2.5 px-4 sm:px-8 flex items-center justify-between gap-2 shadow-[0_6px_20px_rgba(0,0,0,0.7)] shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between sm:justify-start gap-2 sm:gap-4 shrink-0 min-w-0",children:[(0,d.jsx)("h2",{className:"text-[15px] sm:text-[18px] lg:text-[19px] font-bold capitalize font-dm-sans text-[#78F7FF] whitespace-nowrap",children:sW}),(0,d.jsx)(f.N,{children:tQ&&(0,d.jsxs)(m.P.div,{initial:{opacity:0,x:-20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex items-center gap-2 px-3 py-1 rounded-full bg-[#1ADAF3]/10 border border-[#1ADAF3]/20 shrink-0",children:[(0,d.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-[#1ADAF3] animate-pulse"}),(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#1ADAF3] uppercase tracking-widest",children:"Refining"})]})})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-1.5 sm:gap-2.5 shrink-0",children:[(0,d.jsxs)("button",{type:"button",className:"flex items-center justify-center gap-1 px-3 sm:px-4 py-1.5 rounded-full bg-white/[0.04] hover:bg-white/[0.08] transition-all text-[11px] sm:text-[12px] font-medium text-white/70 hover:text-white group border-none backdrop-blur-md shadow-[inset_0_1px_1px_rgba(255,255,255,0.06),0_4px_12px_rgba(0,0,0,0.4)] hover:shadow-[inset_0_1px_1px_rgba(255,255,255,0.1),0_4px_16px_rgba(26,218,243,0.15)] cursor-pointer shrink-0",onClick:function(){ty((null==is?void 0:is.content)||""),tb(!tg)},title:"Edit Enhanced Prompt",children:[(0,d.jsx)(_.A,{size:13,className:"group-hover:text-white transition-colors"}),(0,d.jsx)("span",{children:"Edit"})]}),(0,d.jsx)("button",{type:"button",className:"flex items-center justify-center gap-1 px-3 sm:px-4 py-1.5 rounded-full bg-white/[0.04] hover:bg-white/[0.08] transition-all text-[11px] sm:text-[12px] font-medium text-white/70 hover:text-white group border-none backdrop-blur-md shadow-[inset_0_1px_1px_rgba(255,255,255,0.06),0_4px_12px_rgba(0,0,0,0.4)] hover:shadow-[inset_0_1px_1px_rgba(255,255,255,0.1),0_4px_16px_rgba(26,218,243,0.15)] cursor-pointer shrink-0",title:"Copy",onClick:function(){var e=null==is?void 0:is.content;e&&(navigator.clipboard.writeText(e),tc(!0),setTimeout(function(){return tc(!1)},2e3),nS(!0),nC({title:"Prompt copied",body:"Copied to clipboard."}))},children:tl?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.A,{size:13,className:"text-[#1ADAF3]"}),(0,d.jsx)("span",{className:"text-[#1ADAF3]",children:"Copied!"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.A,{size:13,className:"group-hover:text-white transition-colors"}),(0,d.jsx)("span",{children:"Copy"})]})}),(0,d.jsxs)("div",{className:"relative",ref:sr,"data-tutorial":"session-save-collection",children:[(0,d.jsx)("button",{type:"button",onClick:function(){rQ(function(e){return!e}),iV(!1)},className:"flex h-7 w-7 sm:h-8 sm:w-8 items-center justify-center rounded-full bg-white/[0.04] text-white/70 transition-all hover:bg-white/[0.08] hover:text-white border-none backdrop-blur-md shadow-[inset_0_1px_1px_rgba(255,255,255,0.06),0_4px_12px_rgba(0,0,0,0.4)] cursor-pointer shrink-0","aria-label":"More prompt actions","aria-expanded":rG,children:(0,d.jsx)(N.A,{size:16})}),(0,d.jsx)(f.N,{children:(rG||iJ)&&(0,d.jsxs)(m.P.div,{initial:{opacity:0,y:-6,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-6,scale:.96},className:"absolute right-0 top-full z-50 mt-2 min-w-[152px] rounded-2xl border border-white/10 bg-[#12141A]/95 p-1.5 shadow-[0_18px_40px_rgba(0,0,0,0.55)] backdrop-blur-2xl",children:[(0,d.jsxs)("button",{onClick:function(){if(!((null==tt?void 0:tt.status)&&(null==tt?void 0:tt.status)!=="guest")){window.dispatchEvent(new CustomEvent("tv:require-auth",{detail:{source:"save_prompt_to_collection"}})),null==eV||eV("save_prompt_to_collection"),rQ(!1);return}iV(!0)},className:"flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-[11px] font-medium text-white/70 transition-all hover:bg-white/[0.08] hover:text-white border-none bg-transparent cursor-pointer",children:[(0,d.jsx)(A.A,{size:14}),(0,d.jsx)("span",{children:"Save to Collection"})]}),(0,d.jsx)(f.N,{children:iJ&&(0,d.jsxs)(m.P.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden border-t border-white/[0.08] pt-1.5 mt-1",children:[st?(0,d.jsxs)("div",{className:"flex items-center gap-1.5 p-1",children:[(0,d.jsx)("input",{type:"text",placeholder:"Collection name...",value:i2,onChange:function(e){return i5(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&sb()},className:"flex-1 rounded-lg bg-black/40 px-2 py-1 text-[11px] text-white placeholder-white/30 border border-white/10 outline-none focus:border-[#1ADAF3]/50",autoFocus:!0}),(0,d.jsx)("button",{onClick:sb,className:"rounded-lg bg-[#1ADAF3] px-2 py-1 text-[10px] font-bold text-black border-none cursor-pointer",children:"Add"})]}):(0,d.jsxs)("button",{onClick:function(){return sn(!0)},className:"flex w-full items-center gap-2 rounded-xl px-3 py-1.5 text-left text-[11px] text-[#1ADAF3] hover:bg-[#1ADAF3]/10 border-none bg-transparent cursor-pointer font-semibold",children:[(0,d.jsx)(y.A,{size:12}),(0,d.jsx)("span",{children:"New Collection"})]}),iU?(0,d.jsx)("p",{className:"px-3 py-2 text-[10px] text-white/40",children:"Loading collections..."}):0===iB.length?(0,d.jsx)("p",{className:"px-3 py-2 text-[10px] text-white/40",children:"No collections yet"}):iB.map(function(e){return(0,d.jsxs)("div",{onClick:function(){var t;return t=e.collection_id,(0,r._)(function(){var e;return(0,u.YH)(this,function(n){switch(n.label){case 0:if(!r5||iX)return[2];iG(t),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,M.A.post("/prompt/collections/".concat(t,"/prompts"),{enhanced_prompt_id:r5})];case 2:return(null==(e=n.sent().data)?void 0:e.success)&&(nC({title:"Added to Collection!",body:"This prompt has been successfully added to your collection."}),nS(!0),iV(!1),sc(),H.A.track("collection_prompt_added",{collection_id:t,surface:"web"})),[3,5];case 3:return console.error("Add to collection failed",n.sent()),[3,5];case 4:return iK(!1),iG(null),[7];case 5:return[2]}})})()},className:"flex w-full items-center justify-between rounded-xl px-3 py-1.5 text-left text-[11px] text-white/70 hover:bg-white/[0.08] hover:text-white border-none bg-transparent cursor-pointer",children:[(0,d.jsx)("span",{className:"truncate",children:e.name}),iW===e.collection_id?(0,d.jsx)(h.A,{size:12,className:"animate-spin text-[#1ADAF3]"}):null]},e.collection_id)})]})}),(0,d.jsxs)("button",{type:"button","data-tutorial":"session-share-prompt",className:"flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-[11px] font-medium text-white/70 transition-all hover:bg-white/[0.08] hover:text-white border-none bg-transparent cursor-pointer",onClick:function(){rQ(!1),il()},children:[(0,d.jsx)(S.A,{size:14}),(0,d.jsx)("span",{children:"Share"})]})]})})]})]})]}),(0,d.jsxs)("div",{className:"px-4 sm:px-8 pt-3 pb-20 leading-[1.8] text-[14px] sm:text-[15px] font-normal text-[#E2E2E2] flex-1",children:[(0,d.jsx)("div",{children:tg?(0,d.jsxs)("div",{className:"space-y-2.5 my-3 bg-black/40 border border-[#1ADAF3]/30 rounded-2xl p-4 backdrop-blur-md",children:[(0,d.jsx)("div",{className:"flex items-center justify-between mb-1",children:(0,d.jsx)("span",{className:"text-[12px] font-bold text-[#1ADAF3] uppercase tracking-wider",children:(null==is?void 0:is.id)==="og"?"Editing Original Prompt":"Editing Enhanced Prompt"})}),(0,d.jsx)("textarea",{value:t_,onChange:function(e){return ty(e.target.value)},className:"w-full bg-[#0D0F14] border border-white/10 rounded-xl p-3.5 text-[14px] text-white leading-relaxed placeholder:text-white/30 focus:outline-none focus:border-[#1ADAF3] transition-all min-h-[220px] resize-y"}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-1",children:[(0,d.jsx)("button",{type:"button",onClick:function(){return tb(!1)},className:"px-4 py-1.5 rounded-xl text-xs font-semibold text-white/60 hover:text-white hover:bg-white/5 transition-all",children:"Cancel"}),(null==is?void 0:is.id)==="og"?(0,d.jsx)("button",{type:"button",onClick:function(){return(0,r._)(function(){var e;return(0,u.YH)(this,function(t){switch(t.label){case 0:if(!(e=t_.trim()))return[2];if(!tn)return[3,4];if("function"!=typeof iz)return[3,2];return[4,iz("re_enhance_prompt")];case 1:if(!t.sent())return[2];t.label=2;case 2:return[4,reEnhancePrompt(e)];case 3:t.sent(),t.label=4;case 4:return tb(!1),[2]}})})()},className:"px-4 py-1.5 rounded-xl text-xs font-bold bg-[#1ADAF3] text-black hover:bg-[#1ADAF3]/90 transition-all shadow-[0_0_12px_rgba(26,218,243,0.3)]",children:"Save & Re-Enhance"}):(0,d.jsx)("button",{type:"button",onClick:function(){var e=t_.trim();e&&handleSaveEditedPrompt(e)},className:"px-4 py-1.5 rounded-xl text-xs font-bold bg-[#1ADAF3] text-black hover:bg-[#1ADAF3]/90 transition-all shadow-[0_0_12px_rgba(26,218,243,0.3)]",children:"Save"})]})]}):is.content?(0,d.jsx)("div",{className:"relative group/output",children:(0,d.jsx)(eU,{content:is.content,segments:is.annotated_segments,className:"text-[14px] sm:text-[15px] font-light leading-relaxed"})}):(0,d.jsxs)("div",{className:"min-h-[140px] rounded-2xl border border-[#223042] bg-[#0b121d] px-4 py-4 sm:px-5 sm:py-5",children:[(0,d.jsxs)("div",{className:"mb-3 inline-flex items-center gap-2 rounded-full border border-[#1ADAF3]/25 bg-[#1ADAF3]/10 px-3 py-1 text-[10px] font-bold uppercase tracking-widest text-[#8beef6]",children:[(0,d.jsx)(h.A,{size:12,className:"animate-spin"}),"Enhancement Loader"]}),(0,d.jsx)("p",{className:"text-[13px] sm:text-[14px] leading-relaxed text-white/70",children:"Your enhanced prompt will appear here."})]})}),!sz&&!t$&&!tZ&&!rb&&(0,d.jsx)("div",{className:"md:hidden px-4 sm:px-8 pb-4 sm:pb-6",children:(0,d.jsx)("div",{className:"flex justify-center pt-2",children:(0,d.jsxs)(m.P.button,{type:"button",onClick:sY,className:"btn-primary-velocity inline-flex items-center justify-center gap-2.5 px-6 py-2.5 font-dm-sans text-[14px] leading-[20px] font-bold text-[#03171d] whitespace-nowrap disabled:opacity-50 disabled:!shadow-none disabled:!filter-none disabled:cursor-not-allowed",children:[(0,d.jsx)(E.A,{size:18,strokeWidth:2.2}),(0,d.jsx)("span",{children:"Refine Prompt"})]})})})]}),!!(null==is?void 0:is.content)&&!(tZ||t0)&&(0,d.jsxs)("div",{className:"sticky bottom-4 self
1-center sm:self-end mx-auto sm:mx-0 sm:mr-10 md:mr-12 mb-4 z-40 flex flex-col items-center sm:items-end gap-2 pointer-events-auto",children:[(0,d.jsx)(f.N,{children:nP&&(0,d.jsxs)(m.P.div,{initial:{opacity:0,y:6,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.96},transition:{duration:.18,ease:[.32,0,.67,0]},className:"pointer-events-auto flex items-center justify-between gap-3 px-3.5 sm:px-4 py-1.5 sm:py-2 rounded-full backdrop-blur-xl shadow-[0_8px_32px_rgba(0,0,0,0.7)] border text-[11px] sm:text-[12px] font-medium",style:{background:"like"===nT?"rgba(12, 32, 34, 0.95)":"rgba(32, 12, 12, 0.95)",borderColor:"like"===nT?"rgba(26, 218, 243, 0.45)":"rgba(255, 75, 75, 0.45)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"flex items-center justify-center w-4 h-4 sm:w-5 sm:h-5 rounded-full text-[10px] sm:text-[11px] font-bold",style:{background:"like"===nT?"rgba(26,218,243,0.2)":"rgba(255,75,75,0.2)",color:"like"===nT?"#1ADAF3":"#FF6B6B"},children:"like"===nT?"✓":"✕"}),(0,d.jsx)("span",{style:{color:"like"===nT?"#1ADAF3":"#FF6B6B"},children:"like"===nT?"Thanks for the feedback!":"Feedback noted. What was wrong?"})]}),"dislike"===nT&&(0,d.jsx)("button",{type:"button",onClick:function(){return iR(!0)},className:"text-[10px] sm:text-[11px] font-bold text-[#FF6B6B] hover:underline bg-transparent border-none cursor-pointer shrink-0",children:"Add detail →"})]},"feedback-toast")}),(0,d.jsxs)("div",{className:"pointer-events-auto inline-flex items-center gap-2.5 sm:gap-3 px-2.5 sm:px-3.5 py-1.5 rounded-[41px] bg-[#12141a]/95 backdrop-blur-2xl border border-white/[0.15] shadow-[0_8px_32px_rgba(0,0,0,0.7),0_0_20px_rgba(26,218,243,0.15)]",children:[(0,d.jsxs)("div",{className:"relative",ref:n0,"data-tutorial":"session-platform-launchers",children:[(0,d.jsxs)("div",{className:"flex h-8 sm:h-9 items-center gap-2 px-3 rounded-full bg-[#24262b] hover:bg-[#2c2f36] border border-white/[0.1] transition-all shadow-[0_2px_10px_rgba(0,0,0,0.5)]",children:[(0,d.jsxs)("button",{type:"button",className:"flex items-center gap-2 text-xs font-bold text-[#1ADAF3] transition-all duration-200 hover:brightness-110 active:scale-95 font-dm-sans border-none bg-transparent cursor-pointer p-0",onClick:function(){return sy(r9)},children:[r9.icon&&(0,d.jsx)("img",{src:r9.icon,alt:ie,className:"w-4 h-4 object-contain",onError:function(e){return e.target.style.display="none"}}),(0,d.jsx)("span",{className:"text-[#1ADAF3] font-bold text-[12px] sm:text-[13px]",children:ie}),(0,d.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-[#1ADAF3] text-black font-black text-[9px] tracking-wide uppercase leading-none shadow-[0_0_6px_rgba(26,218,243,0.3)]",children:"BEST"})]}),(0,d.jsx)("button",{type:"button",className:"flex items-center justify-center p-0 text-[#1ADAF3] hover:text-white transition-colors cursor-pointer bg-transparent border-none ml-0.5",onClick:function(e){e.stopPropagation(),ny(function(e){return!e})},"aria-label":"Choose another AI platform","aria-expanded":n_,children:(0,d.jsx)(w.A,{size:14,className:"transition-transform duration-200 ".concat(n_?"rotate-180":""),strokeWidth:2.5})})]}),(0,d.jsx)(f.N,{children:n_&&(0,d.jsxs)(m.P.div,{initial:{opacity:0,y:10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.95},transition:{duration:.2,ease:"easeOut"},className:"absolute bottom-full mb-3 right-0 w-44 bg-[#0f1416] border border-[#1ADAF3]/30 rounded-[16px] overflow-hidden z-[110] shadow-[0_20px_50px_rgba(0,0,0,0.9)] p-1",children:[(0,d.jsx)("style",{children:"\n                            .open-in-scroll::-webkit-scrollbar { width: 8px; }\n                            .open-in-scroll::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.12); border-radius: 10px; }\n                            .open-in-scroll::-webkit-scrollbar-thumb { background: #45D4E7; border: 1px solid #0f1416; border-radius: 10px; transition: background 0.2s; }\n                            .open-in-scroll:hover::-webkit-scrollbar-thumb { background: #78F7FF; }\n                          "}),(0,d.jsx)("div",{className:"max-h-[180px] overflow-y-auto pr-1 open-in-scroll",style:{scrollbarWidth:"thin",scrollbarColor:"#45D4E7 rgba(255, 255, 255, 0.12)"},children:eH.map(function(e){return(0,d.jsxs)("button",{onClick:function(){return sy(e)},className:"w-full flex items-center gap-2.5 p-2 rounded-xl hover:bg-[#1ADAF3]/10 group/item transition-all text-left border-none cursor-pointer bg-transparent",children:[(0,d.jsx)("div",{className:"w-6 h-6 rounded-lg bg-transparent flex items-center justify-center transition-colors",children:(0,d.jsx)("img",{src:e.icon,alt:e.name,className:"w-4 h-4 object-contain",onError:function(e){return e.target.style.display="none"}})}),(0,d.jsx)("span",{className:"text-[10px] font-bold text-white group-hover/item:text-[#1ADAF3] transition-colors uppercase tracking-widest",children:e.name})]},e.name)})})]})})]}),(0,d.jsx)("div",{className:"w-[1px] h-4 bg-white/20 my-auto"}),(0,d.jsx)(ev.A,{currentVote:io,onFeedback:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1],is){tO(function(t){return(0,a._)((0,s._)({},t),(0,i._)({},is.id,e))}),1===e?iI("like"):-1===e?iI("dislike"):iI(null);var t=function(){return is.enhancedPromptId||("v1"===is.id?r5:null)};if(0===e){if(tR.current&&clearTimeout(tR.current),nI(!1),nR(null),iR(!1),"og"===is.id||!ia)return;if(ts.trackResponseRated({feedback_type:"removed",version_id:is.id,is_refined:!!is.refineId}),is.refineId)sh(is.refineId,null);else{var n=t();n&&sm(n,null)}return}if(1===e){if(ts.trackResponseRated({feedback_type:"like",version_id:is.id,is_refined:!!is.refineId}),nR("like"),nI(!0),tR.current&&clearTimeout(tR.current),tR.current=setTimeout(function(){nI(!1),nR(null)},3e3),iR(!1),(null==tt?void 0:tt.status)==="pro"||"pro"===eY||tr?(tC(!0),H.A.track("like_feedback_popup_shown",{variant:"pro",version_id:is.id}),tD.current&&clearTimeout(tD.current),tD.current=setTimeout(function(){tC(!1)},1e4)):(tL(!0),H.A.track("like_feedback_popup_shown",{variant:"free",version_id:is.id}),tT.current&&clearTimeout(tT.current),tT.current=setTimeout(function(){tL(!1)},1e4)),"og"===is.id||!ia)return;if(is.refineId)sh(is.refineId,!0);else{var r=t();r&&sm(r,!0)}return}if(-1===e){if(ts.trackResponseRated({feedback_type:"dislike",version_id:is.id,is_refined:!!is.refineId}
1),iI("dislike"),iR(!0),"og"===is.id)return;if(is.refineId)return void sh(is.refineId,!1);var o=t();o&&sm(o,!1)}}},disabled:!1,className:"flex items-center gap-1"},(null==is?void 0:is.id)||"og")]})]})]})})})]}),iT?(0,d.jsx)(eL,{onClose:sg,isAtBottom:!0}):null,(0,d.jsx)(eE,{isOpen:nz,onClose:ir,shareUrl:nG,isCreatingLink:nV,userPrompt:(null==nM||null==(X=nM.message)?void 0:X.user_prompt)||(null==nM||null==(K=nM.message)?void 0:K.originalPrompt)||"",enhancedPrompt:(null==nM||null==(ee=nM.message)?void 0:ee.content)||"",onCopied:function(){H.A.track("Share Link Copied",{location:(null==nM?void 0:nM.location)||"prompt_studio",has_token:!!nY}),nS(!0),nC({title:"Link copied",body:"Share link copied to clipboard."})},onPlatformClick:function(e){H.A.track("Share Launched",{platform:e,location:(null==nM?void 0:nM.location)||"prompt_studio"})}}),(0,d.jsx)(f.N,{children:nA&&(0,d.jsx)(m.P.div,{initial:{opacity:0,scale:.95,y:"extension"===nF.type?-20:20,x:"-50%"},animate:{opacity:1,scale:1,y:0,x:"-50%"},exit:{opacity:0,scale:.95,y:"extension"===nF.type?-20:20,x:"-50%"},transition:{type:"spring",damping:20,stiffness:300},className:"fixed ".concat("extension"===nF.type?"top-4 sm:top-6":"bottom-24 sm:bottom-32"," left-1/2 z-[9999] w-[92%] max-w-[340px] sm:max-w-[380px]"),children:"extension"===nF.type?(0,d.jsxs)("div",{className:"relative overflow-hidden rounded-[18px] sm:rounded-[20px] border border-[#1ADAF3]/30 bg-gradient-to-br from-[#0a1a1f] via-[#0f1416] to-[#1a0a1f] p-4 sm:p-5 shadow-[0_20px_60px_rgba(26,218,243,0.25),0_0_0_1px_rgba(26,218,243,0.1),inset_0_1px_0_rgba(255,255,255,0.1)] backdrop-blur-xl",children:[(0,d.jsx)("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-r from-transparent via-[#1ADAF3]/5 to-transparent",style:{animation:"shimmer 3s ease-in-out infinite"}}),(0,d.jsx)("style",{children:"\n                  @keyframes shimmer {\n                    0%, 100% { transform: translateX(-100%); }\n                    50% { transform: translateX(100%); }\n                  }\n                  @keyframes float {\n                    0%, 100% { transform: translateY(0px); }\n                    50% { transform: translateY(-4px); }\n                  }\n                  @keyframes glow-pulse {\n                    0%, 100% { box-shadow: 0 0 20px rgba(26, 218, 243, 0.3); }\n                    50% { box-shadow: 0 0 30px rgba(26, 218, 243, 0.5); }\n                  }\n                "}),(0,d.jsxs)("div",{className:"relative z-10 flex items-start gap-3 sm:gap-4",children:[(0,d.jsxs)("div",{className:"relative mt-0.5 flex h-11 w-11 sm:h-12 sm:w-12 shrink-0 items-center justify-center rounded-full bg-[#12141A] border border-white/20 shadow-[0_4px_16px_rgba(26,218,243,0.3)] p-1.5 overflow-hidden",style:{animation:"float 3s ease-in-out infinite, glow-pulse 2s ease-in-out infinite"},children:[(0,d.jsx)("img",{src:(0,p.Q$)("google_chromelogo.png"),alt:"Chrome Logo",className:"h-full w-full object-contain pointer-events-none"}),(0,d.jsx)("div",{className:"absolute inset-0 animate-ping rounded-full bg-[#1ADAF3] opacity-20",style:{animationDuration:"2s"}})]}),(0,d.jsxs)("div",{className:"flex flex-1 flex-col gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[13px] sm:text-[14px] font-bold text-white leading-snug tracking-wide",children:nF.title||nF.text}),(0,d.jsx)("p",{className:"mt-1 text-[11px] sm:text-[12px] font-medium text-white/60 leading-relaxed",children:"Enhance prompts across 40+ AI tools"})]}),(0,d.jsxs)("a",{href:nF.link,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex w-full items-center justify-center gap-2 rounded-[12px] border-none bg-gradient-to-r from-[#1ADAF3] to-[#0891b2] px-4 py-2.5 text-[12px] sm:text-[13px] font-bold text-[#0a0a0a] shadow-[0_8px_24px_rgba(26,218,243,0.4)] transition-all duration-200 hover:shadow-[0_12px_32px_rgba(26,218,243,0.6)] hover:brightness-110 active:scale-[0.98]",children:[(0,d.jsx)("svg",{className:"h-4 w-4 transition-transform group-hover:scale-110",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}),(0,d.jsx)("span",{className:"tracking-wide",children:"Get Extension Free"}),(0,d.jsx)("svg",{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]}),(0,d.jsx)("div",{className:"pointer-events-none absolute -right-8 -top-8 h-32 w-32 rounded-full bg-[#1ADAF3]/10 blur-3xl"}),(0,d.jsx)("div",{className:"pointer-events-none absolute -bottom-8 -left-8 h-32 w-32 rounded-full bg-[#0891b2]/10 blur-3xl"})]}
1):(0,d.jsx)("div",{className:"rounded-[14px] sm:rounded-[16px] border border-[#1ADAF3]/20 bg-[#12141A]/95 px-3.5 sm:px-4 py-2.5 sm:py-3 text-white shadow-[0_20px_50px_rgba(0,0,0,0.8),inset_0_1px_0_rgba(255,255,255,0.1)] backdrop-blur-2xl",children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5 sm:gap-3 text-left",children:[(0,d.jsx)("div",{className:"mt-0.5 w-6 h-6 sm:w-7 sm:h-7 rounded-full bg-[#1ADAF3]/10 flex items-center justify-center shrink-0",children:(0,d.jsx)(F.A,{size:13,className:"text-[#1ADAF3] sm:w-[14px] sm:h-[14px]"})}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 mt-[2px] flex-1",children:[(0,d.jsx)("p",{className:"text-[12px] sm:text-[13px] font-bold text-white tracking-wide",children:nF.title||nF.text}),nF.body&&(0,d.jsx)("p",{className:"text-[11px] sm:text-[12px] font-medium text-white/50 leading-relaxed",children:nF.body})]})]})})})}),(0,d.jsx)("footer",{className:"relative mt-4 left-1/2 -translate-x-1/2 w-full max-w-[980px] px-3 sm:px-4 pb-0 pt-0 z-[2000] pointer-events-none",children:(0,d.jsxs)("div",{ref:n1,className:"relative mx-auto w-full max-w-[980px] pointer-events-auto",children:[sB&&(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-4 rounded-2xl border-none bg-white/[0.04] backdrop-blur-[16px] px-4 py-3 text-[12px] text-white/85 shadow-[0_20px_40px_rgba(0,0,0,0.45),inset_0_1px_0_rgba(255,255,255,0.08)] relative z-[11100]",children:[(0,d.jsx)("span",{className:"font-medium",children:sq?"All refine answers are ready. Tap Refine Prompt to generate the improved prompt.":"Answer saved. You can refine now, or answer more questions for a stronger result."}),(0,d.jsxs)("span",{className:"rounded-full shadow-[0_0_12px_rgba(26,218,243,0.2)] bg-[#1ADAF3]/10 px-3 py-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-[#1ADAF3] border-none",children:["Progress ",rN.length,"/",Math.max(sM,rN.length||1)]})]}),(0,d.jsx)(f.N,{children:no&&(0,d.jsxs)(m.P.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:350},className:"absolute bottom-0 left-0 right-0 w-full bg-[#0c0c0e]/95 backdrop-blur-[30px] border-none rounded-[28px] overflow-hidden z-[11050] flex flex-col max-h-[70vh] sm:max-h-[60vh] relative shadow-[0_30px_60px_rgba(0,0,0,0.6),inset_0_1px_0_rgba(255,255,255,0.08)] touch-pan-y",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 pt-4 pb-3 md:px-6",children:[(0,d.jsx)("button",{type:"button","aria-label":"Previous question",onClick:function(){return sC(sF-1)},disabled:sF<=0,className:"w-10 h-10 shrink-0 flex items-center justify-center rounded-full bg-white/[0.04] backdrop-blur-[16px] text-white/50 hover:text-[#1ADAF3] hover:bg-white/[0.08] disabled:opacity-20 disabled:pointer-events-none transition-all shadow-[inset_0_1px_0_rgba(255,255,255,0.06)] border-none",children:(0,d.jsx)(C.A,{size:20,strokeWidth:2})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[(0,d.jsxs)("h4",{className:"text-[13px] font-medium text-white/95 leading-relaxed text-left",children:[(0,d.jsxs)("span",{className:"text-[#1ADAF3] font-semibold tabular-nums pr-1",children:["Q",sU,"."]}),no.question]}),rw.length>1&&(0,d.jsxs)("span",{className:"text-[10px] text-white/30 font-medium tabular-nums",children:["Question ",sU," of ",Math.max(sM,1)]})]}),sF>=0&&sF===sE.length-1?(0,d.jsx)("button",{type:"button","aria-label":"Submit answers and refine",onClick:function(){return(0,r._)(function(){var e;return(0,u.YH)(this,function(t){switch(t.label){case 0:if(!sR||tQ)return[2];if(nl(null),!(e=sT()))return[3,2];return[4,sP([e],{openNextQuestion:!1})];case 1:t.sent(),t.label=2;case 2:return[4,function(){return(0,r._)(function(){var e,t,n,r,i,s=arguments;return(0,u.YH)(this,function(a){switch(a.label){case 0:if(t=void 0===(e=(s.length>0&&void 0!==s[0]?s[0]:{}).closePopup)||e,tQ)return[2];if(t&&nl(null),window.innerWidth<768&&(n9("output"),setTimeout(function(){n2.current&&n2.current.scrollTo({top:0,behavior:"smooth"})},40)),!(n=sT()))return[3,3];return[4,sP([n],{openNextQuestion:!1})];case 1:return a.sent(),(i=(r=(0,l._)(rL)).findIndex(function(e,t){return t>0&&e.question===n.question}))>=0?r[i]=n:r.push(n),nl(null),[4,sD(r)];case 2:return a.sent(),sA(),[2];case 3:if(!(rL.length>1))return[3,5];return nl(null),[4,sD(rL)];case 4:a.sent(),sA(),a.label=5;case 5:return[2]}})}).apply(this,arguments)}()];case 3:return t.sent(),[2]}})})()},disabled:!sR||tQ,className:"w-10 h-10 shrink-0 flex items-center justify-center rounded-full border-none bg-gradient-to-b from-[#1ADAF3]/20 to-[#1ADAF3]/10 text-[#1ADAF3] shadow-[0_8px_24px_rgba(26,218,243,0.15),inset_0_1px_1px_rgba(255,255,255,0.15)] hover:-translate-y-[1px] hover:shadow-[0_12px_32px_rgba(26,218,243,0.25),inset_0_1px_1px_rgba(255,255,255,0.25)] hover:bg-[#1ADAF3]/20 transition-all disabled:opacity-25 disabled:pointer-events-none",children:tQ?(0,d.jsx)(h.A,{size:18,className:"animate-spin text-[#1ADAF3]"}):(0,d.jsx)(j.A,{size:20,strokeWidth:2.5})}):(0,d.jsx)("button",{type:"button","aria-label":"Next question",onClick:function(){return(0,r._)(function(){var e;return(0,u.YH)(this,function(t){switch(t.label){case 0:if(!sR||tQ)return[2];if(!(e=sT()))return[3,2];return[4,sP([e],{openNextQuestion:!1})];case 1:t.sent(),t.label=2;case 2:return sF>=0&&sF<sE.length-1?sC(sF+1):nl(null),[2]}})})()},disabled:sF<0||!sR||tQ,className:"w-10 h-10 shrink-0 flex items-center justify-center rounded-full border-none transition-all ".concat(sR?"bg-gradient-to-b from-[#1ADAF3]/20 to-[#1ADAF3]/10 text-[#1ADAF3] shadow-[0_8px_24px_rgba(26,218,243,0.15),inset_0_1px_1px_rgba(255,255,255,0.15)] hover:-translate-y-[1px] hover:shadow-[0_12px_32px_rgba(26,218,243,0.25),inset_0_1px_1px_rgba(255,255,255,0.25)] hover:bg-[#1ADAF3]/20":"bg-white/[0.04] text-white/50 shadow-[inset_0_1px_0_rgba(255,255,255,0.06)] backdrop-blur-[16px]"," disabled:opacity-30 disabled:pointer-events-none"),children:(0,d.jsx)(D.A,{size:20,strokeWidth:2})}),(0,d.jsx)("button",{type:"button","aria-label":"Close options",onClick:function(){return nl(null)},className:"w-10 h-10 shrink-0 flex items-center justify-center rounded-full bg-white/[0.04] backdrop-blur-[16px] text-white/50 hover:text-white/90 hover:bg-white/[0.08] transition-all text-sm shadow-[inset_0_1px_0_rgba(255,255,255,0.06)] border-none",children:"✕"})]}),(0,d.jsx)("div",{className:"flex flex-col gap-2 px-5 pb-3 overflow-y-auto custom-scrollbar",children:null==(et=no.options)?void 0:et.map(function(e,t){var n=no.question,r=eB(e),o=eO(e),u=(nu[n]||[]).some(function(t){return t===e||((void 0===t?"undefined":(0,c._)(t))==="object"&&(t.label||t.text)||String(t)).trim()===((void 0===e?"undefined":(0,c._)(e))==="object"&&(e.label||e.text)||String(e)).trim()});return(0,d.jsxs)("button",{type:"button",onClick:function(t){t.stopPropagation(),nd(function(t){var r=(0,l._)(t[n]||[]),u=r.findIndex(function(t){return t===e||((void 0===t?"undefined":(0,c._)(t))==="object"&&(t.label||t.text)||String(t)).trim()===((void 0===e?"undefined":(0,c._)(e))==="object"&&(e.label||e.text)||String(e)).trim()});return u>=0?(r.splice(u,1),o&&nf(function(e){var t=(0,s._)({},e);return delete t[n],t})):r.push(e),(0,a._)((0,s._)({},t),(0,i._)({},n,r))})},className:"flex items-center gap-3 px-4 py-3 rounded-[16px] transition-all text-left group/opt border-none ".concat(u?"bg-[rgba(26,218,243,0.08)] shadow-[0_0_30px_rgba(26,218,243,0.12),inset_0_1px_1px_rgba(255,255,255,0.08)]":"bg-[linear-gradient(180deg,rgba(255,255,255,0.03),rgba(255,255,255,0.01))] shadow-[0_10px_20px_rgba(0,0,0,0.2),inset_0_1px_0_rgba(255,255,255,0.04)] hover:bg-white/[0.05]"),children:[(0,d.jsx)("div",{className:"w-5 h-5 rounded-[6px] border-none flex items-center justify-center shrink-0 transition-all shadow-[inset_0_1px_1px_rgba(255,255,255,0.1)] ".concat(u?"bg-[#1ADAF3]":"bg-white/10"),"aria-hidden":!0,
1children:u?(0,d.jsx)(j.A,{size:12,className:"text-black",strokeWidth:3}):null}),(0,d.jsx)("span",{className:"text-[13px] font-medium transition-colors text-justify [text-justify:inter-word] [text-align-last:left] ".concat(u?"text-white":"text-white/60 group-hover/opt:text-white"),children:r})]},"".concat(t,"-").concat(r,"-").concat(String(e).slice(0,24)))})}),(nu[V=no.question]||[]).some(function(e){return eO(e)})?(0,d.jsxs)("div",{className:"px-5 pb-5 pt-0 space-y-1.5",children:[(0,d.jsx)("label",{className:"text-[9px] uppercase tracking-widest text-white/30 font-bold",children:"Other — add detail"}),(0,d.jsx)("input",{type:"text",value:nx[V]||"",onChange:function(e){return nf(function(t){return(0,a._)((0,s._)({},t),(0,i._)({},V,e.target.value))})},className:"w-full rounded-xl bg-white/[0.03] border-none shadow-[inset_0_1px_0_rgba(255,255,255,0.06),0_10px_30px_rgba(0,0,0,0.35)] backdrop-blur-[20px] px-3 py-2.5 text-[13px] text-white/90 placeholder:text-white/25 outline-none focus:outline-none focus:ring-0 focus:shadow-[inset_0_1px_0_rgba(255,255,255,0.06),0_0_25px_rgba(26,218,243,0.12)] transition-all duration-300",placeholder:"Type a custom answer (required if only Other is selected)"})]}):null]},"options-panel")}),(0,d.jsxs)("div",{className:"w-full rounded-[18px] p-1.5 transition-all duration-500 ".concat(sz&&!(rw.length>0||sq)?"bg-[#141416] shadow-[0_0_26px_rgba(238,193,60,0.16),0_0_52px_rgba(238,193,60,0.08),0_24px_68px_rgba(0,0,0,0.72)]":"bg-transparent border-0 shadow-none p-0"),children:[rb?(0,d.jsx)("div",{className:"pb-5 pt-1 flex justify-center",children:(0,d.jsxs)(m.P.button,{type:"button",onClick:function(){return null==ea?void 0:ea()},className:"btn-primary-velocity inline-flex items-center justify-center gap-2 px-6 py-2.5 font-dm-sans text-[14px] leading-[20px] font-bold text-[#03171d] whitespace-nowrap cursor-pointer",children:[(0,d.jsx)(y.A,{size:16,strokeWidth:2.2}),(0,d.jsx)("span",{children:"Start New Chat"})]})}):sz||t$||tZ?null:(0,d.jsx)("div",{className:"pb-5 pt-1 hidden md:flex justify-center",children:(0,d.jsxs)(m.P.button,{type:"button",onClick:sY,className:"btn-primary-velocity inline-flex items-center justify-center gap-2.5 px-6 py-2.5 font-dm-sans text-[14px] leading-[20px] font-bold text-[#03171d] whitespace-nowrap disabled:opacity-50 disabled:!shadow-none disabled:!filter-none disabled:cursor-not-allowed",children:[(0,d.jsx)(E.A,{size:18,strokeWidth:2.2}),(0,d.jsx)("span",{children:"Refine Prompt"})]})}),sz&&!(rw.length>0||sq)?(0,d.jsxs)("div",{className:"relative flex flex-col gap-2 px-3 pt-2 ".concat(sO?"pb-11":"pb-2"),children:[ik?(0,d.jsxs)("p",{className:"text-xs text-red-400/90",role:"alert",children:[ik,(0,d.jsx)("button",{type:"button",className:"ml-2 underline opacity-80 hover:opacity-100",onClick:function(){return iD("")},children:"Dismiss"})]}):null,ij?(0,d.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-xs text-[#1ADAF3]",children:[(0,d.jsx)(h.A,{size:12,className:"animate-spin shrink-0"}),(0,d.jsx)("span",{children:"Transcribing audio…"})]}):null,(0,d.jsx)("textarea",{ref:nK,"data-tutorial":"session-refine-input",placeholder:sz?ib&&0===rw.length?iv?"Paused…":"Listening…":no?"Type your refinement…":"Suggest refinements...":"Answer a refine question or click Improve Prompt to activate.",readOnly:!sz||ib,value:tj,onChange:function(e){sz&&!ib&&tk(e.target.value)},onKeyDown:function(e){if(sz&&!ib&&"Enter"===e.key&&!e.shiftKey)if(e.preventDefault(),no){var t,n,i=function(e,t){if("string"!=typeof e)return"";if(!t)return e.trim();var n="Question: ".concat(t,"\n\nAnswer: ");return e.startsWith(n)?e.slice(n.length).trim():e.trim()}(tj,no.question);i&&(n=no.question,(0,r._)(function(){return(0,u.YH)(this,function(e){switch(e.label){case 0:return[4,sP([{question:n,answer:i}])];case 1:return e.sent(),[2]}})})())}else(0,r._)(function(){var e,n,i,o,c,d,p,x,f,m,h,g,b,v,_,y,w;return(0,u.YH)(this,function(j){switch(j.label){case 0:if(rb)return nS(!0),nC({title:"Improvement limit reached (3/3)",body:"Free plan allows up to 3 improvements per prompt. Start a new chat to continue."}),[2];if(tn)return[3,1];if(n=(0,ek.Vq)(),!(0,ek.sw)(n))return window.dispatchEvent(new CustomEvent("popup-state-open",{detail:{state:"GUEST_SIGNUP_NUDGE"}})),[2];return[3,3];case 1:return[4,iz("refine_prompt")];case 2:if(!j.sent())return[2];j.label=3;case 3:if(!(i=tj).trim()||tQ)return[2];o=(null==(e=rm.find(function(e){return e.id===ro}))?void 0:e.content)||er,c=t?{question:"Context",answer:t}:{question:"Refinement",answer:i},d=(0,l._)(rL).concat([c]),ts.trackPromptRefined({original_prompt_length:o.length,qa_pairs_count:d.length,has_manual_input:!!t}),tJ(!0),j.label=4;case 4:return j.trys.push([4,15,16,17]),[4,su()];case 5:return p=j.sent(),t||rT(d),m=(f=(x=(0,eN.vc)()).startsWith(eN.ih))?(0,eN.tz)(p):!!p,[4,fetch(x,{method:"POST",headers:(0,s._)({"Content-Type":"application/json"},m?{Authorization:"Bearer ".concat(p)}:{}),body:JSON.stringify((0,eN.Zt)({promptText:o,qaPairs:d,userId:tn,token:p,isDevTest:f}))})];case 6:if(!(h=j.sent()).ok)throw Error("Refine error: ".concat(h.status));return[4,h.json()];case 7:if(g=j.sent(),v=(b=(0,eN.Yq)(g.refined_prompt||g.result||g.enhanced_prompt,(0,eN.Av)(g))).text,_=b.segments,!v)return[3,14];tn||((0,ek.OS)({refineSubmitCount:1}),setTimeout(function(){window.dispatchEvent(new CustomEvent("popup-state-open",{detail:{state:"GUEST_SIGNUP_NUDGE"}}))},1500)),y=null,j.label=8;case 8:if(j.trys.push([8,12,,13]),!r0)return[3,11];return[4,sf(v,r0,r5,rZ,d,0,_)];case 9:return y=j.sent(),[4,sv()];case 10:j.sent(),j.label=11;case 11:return[3,13];case 12:return console.error("Refine save failed:",j.sent()),[3,13];case 13:w="v".concat(Date.now()),rh(function(e){var t=e.filter(function(e){return"og"!==e.id}).length+1;return[(0,s._)({id:w,name:"Refined ".concat(t),tag:"Latest",content:v,annotated_segments:_},y?{refineId:y}:{},r5?{enhancedPromptId:r5}:{})].concat((0,l._)(e.map(function(e){return(0,a._)((0,s._)({},e),{tag:void 0})})))}),rl(w),t||tk(""),Array.isArray(_)&&0!==_.length||(0,r._)(function(){var e,t;return(0,u.YH)(this,function(n){switch(n.label){case 0:return[4,(0,eN.re)(v,er)];case 1:if(!Array.isArray(e=n.sent())||0===e.length)return[2];if(rh(function(t){return t.map(function(t){return t.id===w?(0,a._)((0,s._)({},t),{annotated_segments:e}):t})}),!y)return[3,3];return[4,su()];case 2:t=n.sent(),(0,eN.cl)({kind:"refined",id:y,segments:e,token:t}).catch(function(){}),n.label=3;case 3:return[2]}})})(),j.label=14;case 14:return[3,17];case 15:return console.error("Refinement failed:",j.sent()),[3,17];case 16:return tJ(!1),[7];case 17:return[2]}})})()},rows:1,className:"w-full bg-transparent border-none outline-none resize-none text-sm py-1.5 min-h-[36px] text-white/80 overflow-y-auto whitespace-pre-wrap font-light scrollbar-hide leading-normal ".concat(ib&&0===rw.length?"cursor-not-allowed placeholder:text-[#1ADAF3] placeholder:opacity-90":"placeholder:text-white/10"," ").concat(no?"max-h-[100px]":"max-h-[72px]")}),sO&&sz?(0,d.jsx)("div",{className:"absolute bottom-2 left-3 right-3 z-10 ".concat(ib?"w-auto":"flex justify-end"),children:ib?(0,d.jsx)(f.N,{mode:"popLayout",children:(0,d.jsx)(ex.A,{borderless:!0,compact:!0,className:"w-full",analyserRef:iA,elapsedSeconds:i_,maxSeconds:iy,isPaused:iv,pauseSupported:iw,onPauseResume:iC,onCancel:iE,onConfirm:iF,confirmDisabled:ij},"test-refine-voice-bar")}
1):(0,d.jsx)("div",{className:"flex items-center justify-end gap-3",children:(0,d.jsx)("div",{className:"flex items-center gap-3",children:no||sq||tj.trim()||!iN||ib?null:(0,d.jsx)("button",{type:"button",onClick:function(){iS(ep.I.STUDIO_REFINE_COMPOSER)},disabled:tQ||ij,"aria-label":"Voice input",className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-white/10 text-[#1ADAF3] transition-all hover:bg-white/[0.14] active:scale-95 disabled:cursor-not-allowed disabled:opacity-40",children:(0,d.jsx)(P.A,{size:18,strokeWidth:2.25})})})})}):null]}):null]})]})})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("header",{className:"h-16 flex-shrink-0 flex items-center justify-between px-4 md:px-8 bg-black backdrop-blur-md border-b border-white/5",children:(0,d.jsx)("div",{className:"flex items-center gap-4"})}),(0,d.jsxs)("div",{className:"flex-1 min-h-0 overflow-auto bg-transparent",children:["prompt-book"===id&&(0,d.jsx)(eP,{embedInStudio:!0}),"memory"===id&&(0,d.jsx)(eC,{userId:tn,token:im,embedInStudio:!0}),"personalise"===id&&(0,d.jsx)(eD,{userId:tn,token:im,embedInStudio:!0}),"profile"===id&&(0,d.jsx)(eI,{embedInStudio:!0})]})]})})," ",(0,d.jsx)(ej.default,{animationsTriggered:!0}),(0,d.jsx)(f.N,{children:tF&&(0,d.jsx)(m.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100000] flex items-center justify-center bg-black/60 backdrop-blur-sm px-4 pointer-events-auto",onClick:function(){tD.current&&clearTimeout(tD.current),tC(!1),H.A.track("like_feedback_popup_dismissed",{variant:"pro",method:"backdrop_click"})},children:(0,d.jsxs)(m.P.div,{initial:{opacity:0,scale:.9,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:12},transition:{type:"spring",damping:25,stiffness:350},className:"relative w-[360px] max-w-[92vw] h-[253px] rounded-[40px] bg-[#101212] p-6 flex flex-col items-center justify-between shadow-[0px_24px_80px_rgba(0,0,0,0.7),inset_0px_4px_4px_rgba(255,255,255,0.05)] border border-white/[0.08] overflow-hidden select-none pointer-events-auto",onClick:function(e){return e.stopPropagation()},children:[(0,d.jsx)("div",{className:"absolute top-[10px] left-1/2 -translate-x-1/2 w-[100px] h-[100px] rounded-full bg-[#53EAFD]/15 blur-[33px] pointer-events-none"}),(0,d.jsx)("button",{type:"button",onClick:function(){tD.current&&clearTimeout(tD.current),tC(!1),H.A.track("like_feedback_popup_dismissed",{variant:"pro",method:"close_button"})},className:"absolute top-5 right-5 text-white/40 hover:text-white hover:bg-white/10 rounded-full p-1 transition-all cursor-pointer z-20 active:scale-95 border-none bg-transparent","aria-label":"Close feedback modal",children:(0,d.jsx)(I.A,{size:18})}),(0,d.jsx)("div",{className:"relative z-10 pt-2 flex items-center justify-center",children:(0,d.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,d.jsx)("path",{d:"M22 4L25.8 17.2L39 21L25.8 24.8L22 38L18.2 24.8L5 21L18.2 17.2L22 4Z",fill:"#00F0FF"}),(0,d.jsx)("path",{d:"M36 4L37.8 10.2L44 12L37.8 13.8L36 20L34.2 13.8L28 12L34.2 10.2L36 4Z",fill:"#00F0FF"}),(0,d.jsx)("path",{d:"M37 28L38.2 32.2L42.4 33.4L38.2 34.6L37 38.8L35.8 34.6L31.6 33.4L35.8 32.2L37 28Z",fill:"#00F0FF"})]})}),(0,d.jsxs)("div",{className:"relative z-10 flex flex-col items-center text-center px-2",children:[(0,d.jsx)("h3",{className:"font-dm-sans font-semibold text-[24px] leading-[29px] tracking-[-0.575px] text-[#DBFCFF] mb-1.5",children:"Enjoying Velocity?"}),(0,d.jsx)("p",{className:"font-dm-sans font-normal text-[14px] leading-[20px] text-[#A1A7B8] max-w-[280px]",children:"Drop us your thoughts and help shape the future of Velocity."})]}),(0,d.jsxs)("button",{type:"button",onClick:function(){tD.current&&clearTimeout(tD.current),tC(!1),H.A.track("like_feedback_popup_cta_clicked",{variant:"pro",cta:"write_feedback"}),window.open("https://chromewebstore.google.com/detail/velocity-the-prompt-co-pi/ggiecgdncaiedmdnbmgjhpfniflebfpa?hl=en-GB","_blank","noopener,noreferrer")},className:"relative z-10 w-[240px] h-[36px] rounded-[90px] bg-[#53EAFD] hover:bg-[#43e5f8] active:scale-98 transition-all flex items-center justify-center gap-2 shadow-[inset_0px_1px_0px_rgba(255,255,255,0.05)] cursor-pointer border-none",children:[(0,d.jsx)("span",{className:"font-dm-sans font-semibold text-[14px] text-black",children:"Write Feedback"}),(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#000000",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,d.jsx)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})]})]})})}),(0,d.jsx)(f.N,{children:tI&&(0,d.jsx)(m.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100000] flex items-center justify-center bg-black/60 backdrop-blur-sm px-4 pointer-events-auto",onClick:function(){tT.current&&clearTimeout(tT.current),tL(!1),H.A.track("like_feedback_popup_dismissed",{variant:"free",method:"backdrop_click"})},children:(0,d.jsxs)(m.P.div,{initial:{opacity:0,scale:.9,y:12},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:12},transition:{type:"spring",damping:25,stiffness:350},className:"relative w-[360px] max-w-[92vw] h-[288px] rounded-[40px] bg-[#101212] p-6 flex flex-col items-center justify-between shadow-[0px_24px_80px_rgba(0,0,0,0.7),inset_0px_4px_4px_rgba(255,255,255,0.05)] border border-white/[0.08] overflow-hidden select-none pointer-events-auto",onClick:function(e){return e.stopPropagation()},children:[(0,d.jsx)("div",{className:"absolute top-[15px] left-1/2 -translate-x-1/2 w-[100px] h-[100px] rounded-full bg-[#53EAFD]/14 blur-[33.5px] pointer-events-none"}),(0,d.jsx)("button",{type:"button",onClick:function(){tT.current&&clearTimeout(tT.current),tL(!1),H.A.track("like_feedback_popup_dismissed",{variant:"free",method:"close_button"})},className:"absolute top-5 right-5 text-white/40 hover:text-white hover:bg-white/10 rounded-full p-1 transition-all cursor-pointer z-20 active:scale-95 border-none bg-transparent","aria-label":"Close modal",children:(0,d.jsx)(I.A,{size:18})}),(0,d.jsx)("div",{className:"relative z-10 pt-2 flex items-center justify-center",children:(0,d.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,d.jsx)("path",{d:"M22 4L25.8 17.2L39 21L25.8 24.8L22 38L18.2 24.8L5 21L18.2 17.2L22 4Z",fill:"#00F0FF"}),(0,d.jsx)("path",{d:"M36 4L37.8 10.2L44 12L37.8 13.8L36 20L34.2 13.8L28 12L34.2 10.2L36 4Z",fill:"#00F0FF"}),(0,d.jsx)("path",{d:"M37 28L38.2 32.2L42.4 33.4L38.2 34.6L37 38.8L35.8 34.6L31.6 33.4L35.8 32.2L37 28Z",fill:"#00F0FF"})]})}),(0,d.jsxs)("div",{className:"relative z-10 flex flex-col items-center text-center px-2",children:[(0,d.jsx)("h3",{className:"font-dm-sans font-semibold text-[24px] leading-[29px] tracking-[-0.575px] text-[#DBFCFF] mb-2",children:"Enjoying Velocity?"}),(0,d.jsxs)("p",{className:"font-space-grotesk font-normal text-[14px] leading-[21px] text-white/55 max-w-[270px]",children:["Share Velocity with a friend and get ",(0,d.jsx)("span",{className:"font-semibold text-white/90",children:"1 month of Pro for free"})]})]}),(0,d.jsxs)("button",{type:"button",onClick:function(){tT.current&&clearTimeout(tT.current),tL(!1),H.A.track("like_feedback_popup_cta_clicked",{variant:"free",cta:"claim_pro"}),eg&&eg()},className:"relative z-10 w-[220px] h-[34px] rounded-[90px] bg-[#53EAFD] hover:bg-[#43e5f8] active:scale-98 transition-all flex items-center justify-center gap-2 shadow-[inset_0px_1px_0px_rgba(255,255,255,0.05)] cursor-pointer border-none",children:[(0,d.jsx)("span",{className:"font-dm-sans font-semibold text-[13px] text-black",children:"Claim 1 month of Pro"}),(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#000000",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,d.jsx)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})]})]})})})]})})},80341:(e,t,n)=>{n.d(t,{A:()=>l});var r=n(22043),i=n(95155),s=n(12115),a=n(25276),o=n(49745);let l=function(e){var t=e.onFeedback,n=e.disabled,l=void 0!==n&&n,c=e.className,u=e.currentVote,d=void 0===u?0:u,p=(0,r._)((0,s.use
1State)(d||0),2),x=p[0],f=p[1];(0,s.useEffect)(function(){f(d||0)},[d]);var m=function(e,n){if(null==e||null==(r=e.preventDefault)||r.call(e),null==e||null==(i=e.stopPropagation)||i.call(e),!l){var r,i,s=x===n?0:n;f(s),null==t||t(s,x)}},h=1===x,g=-1===x;return(0,i.jsxs)("div",{className:void 0===c?"flex items-center gap-1.5 shrink-0":c,children:[(0,i.jsx)("button",{type:"button",onClick:function(e){return m(e,1)},"aria-label":"Helpful","aria-pressed":h,title:h?"Remove like":"Helpful",style:{cursor:l?"not-allowed":"pointer"},className:"w-9 h-9 flex items-center justify-center rounded-full transition-all duration-200 select-none border-none cursor-pointer ".concat(l?"text-white/20 opacity-40 bg-transparent":h?"!text-[#1ADAF3] !bg-[#1ADAF3]/20 shadow-[0_0_14px_rgba(26,218,243,0.35)] scale-105":"text-white/50 bg-transparent hover:text-[#1ADAF3] hover:bg-[#1ADAF3]/15 hover:shadow-[0_0_10px_rgba(26,218,243,0.2)] active:scale-90"),children:(0,i.jsx)(a.A,{size:16,strokeWidth:2,className:h?"fill-[#1ADAF3]":""})}),(0,i.jsx)("button",{type:"button",onClick:function(e){return m(e,-1)},"aria-label":"Not helpful","aria-pressed":g,title:g?"Remove dislike":"Not helpful",style:{cursor:l?"not-allowed":"pointer"},className:"w-9 h-9 flex items-center justify-center rounded-full transition-all duration-200 select-none border-none cursor-pointer ".concat(l?"text-white/20 opacity-40 bg-transparent":g?"!text-[#FF4B4B] !bg-[#FF4B4B]/20 shadow-[0_0_14px_rgba(255,75,75,0.35)] scale-105":"text-white/50 bg-transparent hover:text-[#FF4B4B] hover:bg-[#FF4B4B]/15 hover:shadow-[0_0_10px_rgba(255,75,75,0.2)] active:scale-90"),children:(0,i.jsx)(o.A,{size:16,strokeWidth:2,className:g?"fill-[#FF4B4B]":""})})]})}},81158:(e,t,n)=>{n.r(t),n.d(t,{csrfFetch:()=>u,getCsrfToken:()=>l,withCsrf:()=>c});var r=n(61975),i=n(82732),s=n(45849),a=n(71450),o=n(66563);function l(){if("undefined"==typeof document)return null;var e=document.cookie.split("; ").find(function(e){return e.startsWith("csrfToken=")});return e?decodeURIComponent(e.split("=").slice(1).join("=")):null}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=l(),n=(0,i._)({},e.headers||{});return t&&(n["X-CSRF-Token"]=t),(0,s._)((0,i._)({},e),{credentials:"include",headers:n})}function u(e){return(0,r._)(function(e){var t,n,r,i,s=arguments;return(0,a.YH)(this,function(a){switch(a.label){case 0:return[4,fetch(e,c(t=s.length>1&&void 0!==s[1]?s[1]:{}))];case 1:if(403!==(n=a.sent()).status)return[2,n];r=!1,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,n.clone().json()];case 3:return r=(null==(i=a.sent())?void 0:i.code)==="CSRF_INVALID",[3,5];case 4:return a.sent(),r=!1,[3,5];case 5:if(!r)return[2,n];a.label=6;case 6:return a.trys.push([6,8,,9]),[4,(0,o.M8)()];case 7:case 8:return a.sent(),[3,9];case 9:return[2,fetch(e,c(t))]}})}).apply(this,arguments)}}}]);

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.