1"use strict";(self.webpackChunkmy_webpack_project=self.webpackChunkmy_webpack_project||[]).push([[1447],{59154(e,t,n){var r,l=n(39471);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(null,arguments)}n.d(t,["A",0,e=>l.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",width:11,height:32,fill:"none"},e),r||(r=l.createElement("path",{fill:"#fff",d:"M10.5 27c0 2.813-2.25 5-5 5-2.812 0-5-2.187-5-5 0-2.75 2.188-5 5-5 2.75 0 5 2.25 5 5M1.063 1.625A1.51 1.51 0 0 1 2.563 0h5.812c.875 0 1.563.75 1.5 1.625l-.812 17C9 19.375 8.313 20 7.563 20H3.375c-.75 0-1.437-.625-1.5-1.375z"})))])},31447(e,t,n){n.r(t),n.d(t,{default:()=>B});var r,l,o=n(39471),a=n(88477),i=n(18467),s=n(47281),c=(n(39231),n(89306),n(45126),n(16243)),u=n(55395),d=n(51794),p=n(28152),m=n(17705),v=n(90234),h=n(45345),f=n(78854),g=n(32972),y=(n(58752),n(69287));function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b.apply(null,arguments)}const w=e=>o.createElement("svg",b({xmlns:"http://www.w3.org/2000/svg",width:40,height:40,fill:"none"},e),r||(r=o.createElement("path",{fill:"#34B5B1",d:"M33.333 8.333H30L27.5 5h-15L10 8.333H6.667C5.75 8.333 5 9.083 5 10v21.667c0 .916.75 1.666 1.667 1.666h26.666c.917 0 1.667-.75 1.667-1.666V10c0-.917-.75-1.667-1.667-1.667M20 28.333a6.665 6.665 0 0 1-6.667-6.666A6.665 6.665 0 0 1 20 15a6.665 6.665 0 0 1 6.667 6.667A6.665 6.665 0 0 1 20 28.333"})),l||(l=o.createElement("path",{fill:"#34B5B1",d:"M20 18.333a4.001 4.001 0 0 0 0 8 4.001 4.001 0 0 0 0-8"})));var S=n(66502),E=n(49655),x=n(27714),C=n(59154),k=n(52967),_=(n(33306),n(68103)),A=n(1834);n(83300);const O=(0,o.createContext)();function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function P(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,o,a,i=[],s=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);s=!0);}catch(e){c=!0,l=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw l}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const B=e=>{var t,n,r,l,b,T,P,M,B,N,L;const D=[{name:"tip",type:"number",placeholder:"0.00",inputProps:{step:"0.01",min:"0",max:"5000",required:!0}}],F=I((0,o.useState)(!1),2),U=F[0],W=F[1],H=I((0,o.useState)(""),2),q=H[0],K=H[1],R=I((0,o.useState)(!1),2),V=R[0],$=R[1],z=I((0,o.useState)(!1),2),Y=z[0],J=z[1],Z=I((0,o.useState)(!1),2),G=Z[0],Q=Z[1],X=I((0,o.useState)(!0),2),ee=X[0],te=X[1],ne=I((0,o.useState)(!1),2),re=ne[0],le=ne[1],oe=I((0,o.useState)(!1),2),ae=oe[0],ie=oe[1],se=I((0,o.useState)(!1),2),ce=se[0],ue=se[1],de=I((0,o.useState)(!1),2),pe=de[0],me=de[1];o.useEffect(()=>{e.onLoadingChange&&e.onLoadingChange(pe)},[pe]);const ve=I((0,o.useState)({tip:""}),2),he=ve[0],fe=ve[1],ge=I((0,o.useState)({}),2),ye=ge[0],be=ge[1],we=(0,g.Zp)(),Se=I((0,o.useState)("oneTime"),2),Ee=Se[0],xe=Se[1],Ce=I((0,o.useState)(!1),2),ke=Ce[0],_e=Ce[1],Ae=I((0,o.useState)(!1),2),Oe=Ae[0],Te=Ae[1],je=I((0,o.useState)(null),2),Pe=je[0],Ie=je[1],Me=I((0,o.useState)("idle"),2),Be=Me[0],Ne=Me[1],Le=I((0,o.useState)(""),2),De=Le[0],Fe=Le[1],Ue=I((0,o.useState)(!1),2),We=Ue[0],He=Ue[1],qe=(0,i.d4)(e=>e.chatConfig),Ke=qe.mode,Re=qe.error,Ve=(0,i.wA)(),$e=e=>Ve((0,s.x0)(e)),ze=I((0,o.useState)("monthly"),2),Ye=ze[0],Je=ze[1],Ze=(0,o.useRef)(!1);let Ge=null;try{const e=(()=>{const e=(0,o.useContext)(O);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e})();Ge=null==e?void 0:e.ws}
1catch(e){Ze.current||(Ze.current=!0,console.warn("[MessageInput] WebSocket context not yet ready; will retry silently on next render"))}const Qe=(0,A.KR)(Ge,null===(t=e.rdxSelectedChannel)||void 0===t?void 0:t.id,null===(n=e.rdxSelectedChannel)||void 0===n?void 0:n.inf_id),Xe=()=>{if(!q.trim())return void Ie({message:"Empty message can't be sent.",severity:"error"});const t=q;K(""),me(!0),Qe.hasImages?(console.log("[MessageInput] Sending message with vision context"),Qe.sendMessageWithVision(t,e.sendTextMessage,(e,t)=>{me(!1),200===e.statusCode&&Re&&$e(!1),403===e.statusCode&&null!=e&&e.error&&$e(!0)})):e.sendTextMessage(t,(e,t)=>{me(!1),200===e.statusCode&&Re&&$e(!1),403===e.statusCode&&null!=e&&e.error&&$e(!0)})},et=e=>{const t=e.target,n=t.name,r=t.value;if("tip"===n){let e="";""===r?e="This field is required":isNaN(r)?e="Only numbers are allowed.":Number(r)<1?e="Tip must be atleast $1":Number(r)>5e3?e="Tip cannot exceed $5000":/^\d+\.\d{3,}$/.test(r)&&(e="Only up to 2 decimal places allowed."),fe(e=>j(j({},e),{},{[n]:r})),be(t=>j(j({},t),{},{[n]:e}))}else fe(e=>j(j({},e),{},{[n]:r})),be(e=>j(j({},e),{},{[n]:""}))},tt=t=>{t.preventDefault();let n={};D.forEach(e=>{he[e.name]&&""!==he[e.name].trim()?ye[e.name]&&(n[e.name]=ye[e.name]):n[e.name]="This field is required"}),be(n),0===Object.keys(n).length&&(ue(!1),fe({tip:""}),be({}),(async t=>{try{var n;const r=f.LK.payment.route;we(r,{state:{amount:t,tip:!0,influencerId:null==e||null===(n=e.rdxSelectedChannel)||void 0===n?void 0:n.inf_id}})}catch(e){console.error(e),null!=e&&e.request}})(Number(null==he?void 0:he.tip)))},nt=(t,n)=>{console.log(n,"plannnn"),ue(!1),fe({tip:""}),be({}),(async(t,n)=>{try{var r;const l=f.LK.payment.route;we(l,{state:{amount:n[t][0].amount,tip:!0,mode:"sub",plans:n,subType:t,influencerId:null==e||null===(r=e.rdxSelectedChannel)||void 0===r?void 0:r.inf_id}})}catch(e){console.error(e),null!=e&&e.request}})(t,n)},rt=async(t,n)=>{try{var r,l,o;const a=null===(r=n[t])||void 0===r?void 0:r[0];if(!a)throw new Error("Plan not found");await(0,d.gM)({influencer_id:null==e||null===(l=e.rdxSelectedChannel)||void 0===l?void 0:l.inf_id,plan:a.id}),Ie({message:"You have unsubscribed from ".concat(t," tips for ").concat(null==e||null===(o=e.rdxSelectedChannel)||void 0===o?void 0:o.name,"."),severity:"success"}),setTimeout(()=>{const e=document.getElementById("gallery-companion");e&&e.scrollIntoView({behavior:"smooth",block:"start"})},500)}catch(e){Ie({message:"Failed to unsubscribe. Please try again.",severity:"error"})}finally{ue(!1),fe({tip:""}),be({})}};return o.createElement("div",{className:"pn-msg-input pn-msg-input--light bg-transparent border-t border-black border-solid"},o.createElement("div",{className:"pn-msg-input__wrapper"},o.createElement("div",{className:"pn-msg-input__icons icons-left"},o.createElement(v.A,{title:Oe?"Show Icons":"Hide Icons",placement:"top",arrow:!0},o.createElement("button",{onClick:()=>Te(!Oe),style:{background:"transparent",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center"}},o.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},o.createElement("path",{d:Oe?"M9 18l6-6-6-6":"M15 18l-6-6 6-6",stroke:"#34B5B1",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})))),o.createElement("div",{className:"icons-collapsible ".concat(Oe?"collapsed":"expanded"),style:{display:"flex",gap:"2px",overflow:"hidden",transition:"max-width 0.3s ease, opacity 0.3s ease",maxWidth:Oe?"0":"300px",opacity:Oe?"0":"1"}},o.createElement(v.A,{title:"Send a Tip",placement:"top",arrow:!0},o.createElement("button",{onClick:async()=>{try{var t,n;const r=await(0,d.mF)(null==e||null===(t=e.rdxSelectedChannel)||void 0===t?void 0:t.inf_id);null!=r&&null!==(n=r.data)&&void 0!==n&&n.tips_enabled?ue(!0):_e(!0)}catch(e){console.error("Failed to fetch tip status",e),Ie({message:"Unable to check tip status. Please try again later.",severity:"error"})}}},o.createElement(E.A,null))),o.createElement(v.A,{title:"Upload Document",placement:"top",arrow:!0},o.createElement("button",{onClick:()=>Q(!0)},o.createElement("span",{style:{display:"inline-flex",transform:"scale(0.7)",transformOrigin:"center"}},o.createElement(S.A,null)))),o.createElement(v.A,{title:"Request Photo",placement:"top",arrow:!0},o.createElement("button",{onClick:async()=>{var t;if(null!=e&&null!==(t=e.rdxSelectedChannel)&&void 0!==t&&t.id)try{await(0,d.kM)(e.rdxSelectedChannel.i
1d)}catch(e){var n;Fe((null==e||null===(n=e.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.error)||"Failed to publish photo data."),He(!0)}}},o.createElement(w,null))),o.createElement(v.A,{title:"Upload Image for Vision Chat",placement:"top",arrow:!0},o.createElement("div",null,o.createElement(_.A,{channelId:null===(r=e.rdxSelectedChannel)||void 0===r?void 0:r.id,infId:null===(l=e.rdxSelectedChannel)||void 0===l?void 0:l.inf_id,onImageUploaded:Qe.handleImageUploaded,onError:e=>{Ie({message:e,severity:"error"})},onSuccess:e=>{Ie({message:e,severity:"success"})},disabled:pe||!(null!==(b=e.rdxSelectedChannel)&&void 0!==b&&b.id)}))))),o.createElement(A.lw,{images:Qe.uploadedImages,onRemove:Qe.removeImage}),o.createElement("textarea",{className:"pn-msg-input__textarea resize-none sm:w-full mx-4","data-testid":"message-input",placeholder:"image-only"===Ke?"Describe Image":"Type your message",value:q,onChange:e=>{K(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Xe())},style:{minHeight:"45px",maxHeight:"200px",overflowY:"auto",wordBreak:"break-word",whiteSpace:"pre-wrap",scrollbarWidth:"none",msOverflowStyle:"none"}}),o.createElement("div",{className:"pn-msg-input__icons icons-right"},o.createElement(v.A,{title:"Send Message",placement:"top",arrow:!0},o.createElement("button",{"aria-label":"Send",className:"pn-msg-input__send",onClick:Xe},o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"43",height:"43",viewBox:"0 0 43 43",fill:"none"},o.createElement("g",{clipPath:"url(#clip0_12118_2729)"},o.createElement("path",{d:"M38.8909 21.2132H19.4455M38.8909 21.2132L15.0261 32.7037L19.4455 21.2132M38.8909 21.2132L15.0261 9.72272L19.4455 21.2132",stroke:"#2B2A2A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_12118_2729"},o.createElement("rect",{width:"30",height:"30",fill:"white",transform:"translate(21.2133) rotate(45)"})))))),o.createElement(v.A,{title:"Add Emoji",placement:"top",arrow:!0},o.createElement("div",{className:"pn-msg-input__emoji-toggle"},o.createElement(a.rc,{showPicker:V,setShowPicker:$,handleEmojiButtonClick:()=>{$(!V)},handleEmojiSelect:e=>{K(t=>t+e.native),$(!1)}}))))),G&&o.createElement(u.A,{open:G,title:"done"===Be?"Upload Successful!":"Upload a Document",description:"done"===Be?"Now you can chat with your companion about this document.":"You can upload PDF (.pdf) or Word (.docx) files to chat about their content.",confirmText:"Browse",cancelText:"Cancel",onCancel:()=>{Q(!1),Ne("idle")},onConfirm:()=>"",height:"500px",showButton:ee,setShowButton:te,onFileUpload:async(t,n)=>{try{var r,l;return t.append("influencer_id",null==e||null===(r=e.rdxSelectedChannel)||void 0===r?void 0:r.inf_id),t.append("channel_id",null==e||null===(l=e.rdxSelectedChannel)||void 0===l?void 0:l.id),await(0,d.KJ)(t,n)}catch(e){var o;const t=(null===(o=e.response)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.error)||"Failed to upload the document.";throw Ne("error"),Fe(t),He(!0),e}},status:Be,setStatus:Ne,notification:Pe,setNotification:Ie}),o.createElement(c.A,{open:ke,description:"".concat(null==e||null===(T=e.rdxSelectedChannel)||void 0===T?void 0:T.name," is not receiving tips for now."),onCancel:()=>_e(!1),onConfirm:()=>_e(!1),showCancelButton:!1,confirmText:"OK"}),Y&&o.createElement(m.A,{open:Y,onClose:()=>{J(!1),le(!1),ie(!1)},onShare:async t=>{try{var n,r;const l={influencer_id:null==e||null===(n=e.rdxSelectedChannel)||void 0===n?void 0:n.inf_id,channel_id:null==e||null===(r=e.rdxSelectedChannel)||void 0===r?void 0:r.id,youtube_url:t},o=await(0,d.bJ)(l);return ie(!0),setTimeout(()=>{J(!1),ie(!1),le(!1)},2e3),o}catch(e){var l;const t=(null===(l=e.response)||void 0===l||null===(l=l.data)||void 0===l?void 0:l.error)||"Failed to upload link.";throw le(t),e}},success:ae,error:re,setError:le}),o.createElement(p.A,{message:null==Pe?void 0:Pe.message,severity:null==Pe?void 0:Pe.severity,onClose:()=>Ie(null),backgroundColor:"success"===(null==Pe?void 0:Pe.severity)?"#34B5B1":"#FF4D4F",icon:"error"===(null==Pe?void 0:Pe.severity)?o.createElement(C.A,null):o.createElement(x.A,null),textColor:"#fff"}),ce&&o.createElement(y.A,{open:ce,onClose:()=>{ue(!1),fe({tip:""}),be({})},title:"Enter a Tip Amount",description:"".concat(null==e||null===(P=e.rdxSelectedChannel)||void 0===P?void 0:P.name," is grateful for supporters like you. Choose to give a one-time tip or subscribe to monthly tips or one yearly tip to get perks and awards."),fields:D,value:he,errors:ye,onChange:et,onSubmit:tt,onSubscribe:(e,t)=>
1nt(e,t),onUnsubscribe:(e,t)=>rt(e,t),submitText:"Send Tip",cancelText:"Cancel",selectedTipType:Ee,onTipTypeChange:e=>{xe(e.target.value)},influencerId:null==e||null===(M=e.rdxSelectedChannel)||void 0===M?void 0:M.inf_id}),U&&o.createElement(k.A,{open:U,onClose:()=>{W(!1),fe({tip:""}),be({})},title:"".concat(null==e||null===(B=e.rdxSelectedChannel)||void 0===B?void 0:B.name," Subscription"),description:"Support ".concat(null==e||null===(N=e.rdxSelectedChannel)||void 0===N?void 0:N.name," with recurring tips to unlock exclusive perks, special rewards, and show your appreciation as a valued supporter."),fields:D,value:he,errors:ye,onChange:et,onSubmit:tt,submitText:"Send Tip",cancelText:"Cancel",selectedTipType:Ye,onTipTypeChange:e=>{Je(e.target.value)},onSubscribe:(e,t)=>nt(e,t),onUnsubscribe:(e,t)=>rt(e,t),influencerId:null==e||null===(L=e.rdxSelectedChannel)||void 0===L?void 0:L.inf_id}),o.createElement(h.A,{anchorOrigin:{vertical:"top",horizontal:"center"},open:We,onClose:()=>He(!1),message:De,key:"topcenter"}))}}}]);
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.