{"version":3,"file":"ChatInput.BlSdW2MP.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/kR9f1AypuoflRYHyZXme/9ghKbauFvlDRFDSCGTKB/ChatInput.js"],"sourcesContent":["// AI chat input form with send button included in the main frame like the attached image\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * AI Chat Input\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ChatInput(props){const{placeholder,placeholderColor,backgroundColor,textColor,borderColor,borderWidth,buttonColor,buttonIconColor,borderRadius,font,onSend,inputFontSize,style}=props;const[message,setMessage]=useState(\"\");const[isHovered,setIsHovered]=useState(false);const maxLength=500;const handleSend=()=>{if(message.trim()){const url=new URL(\"https://academy.planetnocode.com/check\");url.searchParams.set(\"q\",message.trim());if(typeof window!==\"undefined\"){window.location.href=url.toString();}onSend?.(message);startTransition(()=>setMessage(\"\"));}};const handleKeyDown=e=>{if(e.key===\"Enter\"&&!e.shiftKey){e.preventDefault();handleSend();}};const handleInputChange=e=>{const newValue=e.target.value;if(newValue.length<=maxLength){setMessage(newValue);}};const remainingChars=maxLength-message.length;const isNearLimit=remainingChars<=50;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:\"8px\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                    .chat-input-textarea::placeholder {\n                        color: ${placeholderColor};\n                        opacity: 1;\n                    }\n                `}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",display:\"flex\",alignItems:\"center\",backgroundColor,border:`${borderWidth}px solid ${borderColor}`,borderRadius,padding:\"16px 20px\",gap:\"16px\",boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"textarea\",{value:message,onChange:e=>{const newValue=e.target.value;if(newValue.length<=maxLength){setMessage(newValue);}},onKeyDown:handleKeyDown,placeholder:placeholder,maxLength:maxLength,rows:3,style:{flex:1,background:\"none\",border:\"none\",outline:\"none\",color:textColor,...font,fontSize:`${inputFontSize}px`,padding:0,resize:\"none\",width:\"100%\"},className:\"chat-input-textarea\",\"aria-label\":\"Chat message input\"}),/*#__PURE__*/_jsxs(\"button\",{onClick:handleSend,onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),style:{backgroundColor:buttonColor,border:\"none\",borderRadius:\"24px\",padding:\"12px 20px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:\"8px\",cursor:\"pointer\",flexShrink:0,transition:\"transform 0.2s ease\",transform:isHovered?\"scale(1.05)\":\"scale(1)\"},\"aria-label\":\"Send message\",children:[/*#__PURE__*/_jsx(\"span\",{style:{color:buttonIconColor,fontSize:\"16px\",fontWeight:600,whiteSpace:\"nowrap\"},children:\"Ask AI\"}),/*#__PURE__*/_jsx(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 22l-.394-1.433a2.25 2.25 0 00-1.423-1.423L13.25 19l1.433-.394a2.25 2.25 0 001.423-1.423L16.5 15.75l.394 1.433a2.25 2.25 0 001.423 1.423L19.75 19l-1.433.394a2.25 2.25 0 00-1.423 1.423z\",stroke:buttonIconColor,strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})]})]}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"12px\",color:isNearLimit?\"#FF5588\":\"#CCCCCC\",textAlign:\"right\",paddingRight:\"20px\"},children:message.length>0&&/*#__PURE__*/_jsxs(\"span\",{children:[remainingChars,\" characters remaining\"]})})]});}addPropertyControls(ChatInput,{placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Type your message...\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"#CCCCCC\"},inputFontSize:{type:ControlType.Number,title:\"Input Font Size\",defaultValue:16,min:12,max:32,step:1,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:2,min:0,max:10,step:1,unit:\"px\"},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},buttonIconColor:{type:ControlType.Color,title:\"Button Icon\",defaultValue:\"#FFFFFF\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:32,min:0,max:100,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Regular\",letterSpacing:\"0em\",lineHeight:\"1.5em\"}},onSend:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ChatInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ChatInput.map"],"mappings":"sMAMG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,cA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