gotcha-feedback 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -131,6 +131,6 @@ ${Yo}
131
131
  opacity: 1 !important;
132
132
  }
133
133
  }
134
- `.trim()}function Ze(e){if(typeof document>"u")return;let r=document.getElementById(qo);r||(r=document.createElement("style"),r.id=qo,document.head.appendChild(r)),r.textContent=Wt(e);}var Qo=createContext(null),Qt={};function Kt({apiKey:e,children:r,baseUrl:o,debug:t=false,disabled:n=false,defaultUser:d,defaultUserEmail:i,themeConfig:c}){let[u,s]=useState(null);o&&!o.startsWith("https://")&&!o.startsWith("/")&&!o.includes("localhost")&&console.warn("[Gotcha] baseUrl should use HTTPS in production:",o);let l=useMemo(()=>Ho({apiKey:e,baseUrl:o,debug:t}),[e,o,t]),p=useMemo(()=>d??Qt,[JSON.stringify(d)]);useEffect(()=>{let v=ce("light","light",c);Ze(v);},[c]),useEffect(()=>(Go(),()=>Lo()),[]),useEffect(()=>{l.flushQueue();let v=()=>l.flushQueue();return window.addEventListener("online",v),()=>window.removeEventListener("online",v)},[l]);let a=useCallback(v=>{s(v);},[]),g=useCallback(()=>{s(null);},[]),y=useMemo(()=>({client:l,disabled:n,defaultUser:p,defaultUserEmail:i,debug:t,activeModalId:u,openModal:a,closeModal:g,themeConfig:c}),[l,n,p,i,t,u,a,g,c]);return jsx(Qo.Provider,{value:y,children:r})}function P(){let e=useContext(Qo);if(!e)throw new Error("useGotchaContext must be used within a GotchaProvider");return e}function Jt(e,r){let o=new Date(e).getTime();if(isNaN(o))return true;let t=Date.now()-o,n=r*24*60*60*1e3;return t>=n}function Ko(e){let{client:r,defaultUser:o}=P(),[t,n]=useState(false),[d,i]=useState(false),[c,u]=useState(null),[s,l]=useState(null);return useEffect(()=>{process.env.NODE_ENV!=="production"&&e.cooldownDays&&!e.onePerUser&&console.warn("[Gotcha] cooldownDays has no effect without onePerUser=true");let a=e.user?.id||o?.id;if(!a||!e.onePerUser){l(null);return}let g=false;return (async()=>{i(true);try{let v=await r.checkExistingResponse(e.elementId,a);g||(v&&e.cooldownDays&&e.cooldownDays>0&&Jt(v.createdAt,e.cooldownDays)?l(null):l(v));}catch{g||l(null);}finally{g||i(false);}})(),()=>{g=true;}},[r,e.elementId,e.user?.id,o?.id,e.onePerUser,e.cooldownDays]),{submit:useCallback(async a=>{n(true),u(null);try{let g=e.user?.id||o?.id,y;return e.onePerUser&&s&&g?y=await r.updateResponse(s.id,{content:a.content,title:a.title,rating:a.rating,vote:a.vote,pollSelected:a.pollSelected},g):y=await r.submitResponse({elementId:e.elementId,mode:e.mode,content:a.content,title:a.title,rating:a.rating,vote:a.vote,pollOptions:e.pollOptions,pollSelected:a.pollSelected,isBug:a.isBug,screenshot:a.screenshot,user:{...o,...e.user},userEmail:e.userEmail}),e.onePerUser&&l({id:y.id,mode:e.mode,content:a.content??null,title:a.title??null,rating:a.rating??null,vote:a.vote??null,pollSelected:a.pollSelected??null,createdAt:y.createdAt}),e.onSuccess?.(y),y}catch(g){let y=g instanceof Error?g.message:"Something went wrong";throw u(y),e.onError?.(g instanceof Error?g:new Error(y)),g}finally{n(false);}},[r,o,e,s]),isLoading:t,isCheckingExisting:d,error:c,existingResponse:s,isEditing:!!s,clearError:()=>u(null)}}function Zo(e,r){return `${j.HIDDEN_UNTIL}_${e}_${r}`}function Vo(e,r,o){if(!o||o<=0)return false;let t=Zo(e,r),n=ie(t);return n?new Date(n).getTime()>Date.now():false}function jo(e){let{elementId:r,userId:o,hideAfterSubmitDays:t}=e,n=useMemo(()=>o||Qe(),[o]),[d,i]=useState(()=>Vo(r,n,t));useEffect(()=>{i(Vo(r,n,t));},[r,n,t]);let c=useCallback(()=>{if(!t||t<=0)return;let u=Zo(r,n),s=new Date(Date.now()+t*24*60*60*1e3);ae(u,s.toISOString()),i(true);},[r,n,t]);return {isHidden:d,markHidden:c}}function tr(e){return `${j.VISIT_COUNT}_${e}`}function $o(e){let{elementId:r,showAfterSeconds:o,showAfterScrollPercent:t,showAfterVisits:n}=e,d=o!=null||t!=null||n!=null,[i,c]=useState(!o),[u,s]=useState(!t),[l]=useState(()=>{if(!n)return true;let p=tr(r),g=parseInt(ie(p)||"0",10)+1;return ae(p,String(g)),g>=n});return useEffect(()=>{if(!o||o<=0)return;let p=Date.now(),a=o*1e3,g=()=>{Date.now()-p>=a?c(true):y=setTimeout(g,Math.min(1e3,a-(Date.now()-p)));},y=setTimeout(g,Math.min(1e3,a));return ()=>clearTimeout(y)},[o]),useEffect(()=>{if(!t||t<=0)return;let p=()=>{let a=document.documentElement.scrollHeight,g=window.innerHeight;if(a<=g){s(true);return}(window.scrollY+g)/a*100>=t&&s(true);};if(p(),!u)return window.addEventListener("scroll",p,{passive:true}),()=>window.removeEventListener("scroll",p)},[t,u]),{conditionsMet:!d||i&&u&&l}}function Je(...e){return e.filter(Boolean).join(" ")}var W=()=>typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0,_o=(e,r)=>{let o={sm:{desktop:24,mobile:28},md:{desktop:32,mobile:34},lg:{desktop:40,mobile:40}};return r?o[e].mobile:o[e].desktop};function nr(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function et({size:e,theme:r,customStyles:o,showOnHover:t,touchBehavior:n,onClick:d,isOpen:i,isParentHovered:c=false,animated:u=true,queuedCount:s=0}){let[l,p]=useState(false),[a,g]=useState(false),[y,v]=useState(nr),[m,f]=useState(false),[E,S]=useState(false),[C,x]=useState(false),{themeConfig:k}=P();useEffect(()=>{if(p(W()),typeof window>"u")return;let K=window.matchMedia("(prefers-color-scheme: dark)"),pe=Se=>v(Se.matches?"dark":"light");return K.addEventListener("change",pe),()=>K.removeEventListener("change",pe)},[]);let T=i?true:!l&&t?c:l&&n==="tap-to-reveal"?a:true;useEffect(()=>{if(T&&!C){let K=setTimeout(()=>x(true),320);return ()=>clearTimeout(K)}},[T,C]);let U=()=>{if(l&&n==="tap-to-reveal"&&!a){g(true);return}d();},N=_o(e,l),A=useMemo(()=>ce(r,y,k),[r,y,k]),F=i?A.colors.warning:A.colors.border,M=i?A.colors.warning:A.colors.glassColor,H=()=>T?E?"scale(0.97)":"scale(1)":"scale(0.96)",q=E?"80ms":"160ms",w=A.animation.easing.default,O=m&&!i?A.colors.surfaceHover:A.colors.glassBackground,Fe={position:"relative",width:N,height:N,borderRadius:A.borders.radius.full,border:`1px solid ${F}`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",background:O,color:M,boxShadow:m?A.colors.glassHoverShadow:A.colors.glassShadow,transition:C?`transform ${q} ${w}, background-color 180ms ${w}, box-shadow 180ms ${w}, border-color 240ms ${w}, color 240ms ${w}`:`opacity 320ms ${w}, transform 320ms ${w}`,opacity:T?1:0,transform:H(),pointerEvents:T?"auto":"none",...o?.button};return jsxs("button",{type:"button",onClick:U,onMouseEnter:()=>f(true),onMouseLeave:()=>{f(false),S(false);},onMouseDown:()=>S(true),onMouseUp:()=>S(false),onTouchStart:()=>S(true),onTouchEnd:()=>S(false),style:Fe,className:Je("gotcha-button",i&&"gotcha-button--open"),"aria-label":"Give feedback on this feature","aria-expanded":i,"aria-haspopup":"dialog",children:[jsx(sr,{size:N*.62,color:M,fontFamilyDisplay:A.typography.fontFamilyDisplay,animated:u&&!C}),s>0&&jsx("span",{"aria-label":`${s} queued`,style:{position:"absolute",top:-2,right:-2,width:8,height:8,borderRadius:"50%",backgroundColor:A.colors.warning,border:`1.5px solid ${A.colors.background}`}})]})}function sr({size:e,color:r,fontFamilyDisplay:o,animated:t}){let[n,d]=useState(false);return useEffect(()=>{d(true);},[]),jsx("span",{"aria-hidden":"true",style:{fontFamily:o,fontWeight:400,fontSize:e,fontStyle:"normal",lineHeight:1,color:r,transform:"translateY(1px) translateZ(0)",willChange:"transform",letterSpacing:"normal",userSelect:"none",display:"inline-block",opacity:t?n?1:0:1,transition:t?"opacity 240ms cubic-bezier(0.22, 0.61, 0.36, 1) 120ms":"none"},children:"G"})}function tt({src:e,onRemove:r,resolvedTheme:o}){let[t,n]=useState(false),[d,i]=useState(false);useEffect(()=>{n(W());},[]);let c=(()=>{if(!e.startsWith("data:"))return null;let u=e.indexOf(",");if(u<0)return null;let s=e.slice(u+1);return Math.round(s.length*3/4/1024)})();return jsxs("div",{style:{marginTop:12},children:[jsxs("div",{style:{position:"relative",borderRadius:o.borders.radius.sm,overflow:"hidden",border:`1px solid ${o.colors.border}`,padding:4,background:o.colors.background},children:[jsx("img",{src:e,alt:"Screenshot attached to the feedback",style:{display:"block",width:"100%",maxHeight:140,objectFit:"cover",borderRadius:Math.max(0,o.borders.radius.sm-2)}}),jsx("button",{type:"button",onClick:r,onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),"aria-label":"Remove screenshot",style:{position:"absolute",top:8,right:8,width:t?32:24,height:t?32:24,borderRadius:"50%",border:`1px solid ${d?o.colors.error:o.colors.border}`,backgroundColor:d?o.colors.error:o.colors.background,color:d?o.colors.primaryText:o.colors.textSecondary,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:`all ${o.animation.duration.fast} ${o.animation.easing.default}`},children:jsx("svg",{width:10,height:10,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:jsx("path",{d:"M1 1L13 13M1 13L13 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxs("p",{style:{margin:"6px 0 0",fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace",fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase",color:o.colors.textSecondary},children:["screenshot.png",c!=null?` \xB7 ${c} KB`:""]})]})}function nt({resolvedTheme:e,placeholder:r,submitText:o,isLoading:t,onSubmit:n,customStyles:d,initialValues:i,isEditing:c=false,showText:u=true,showRating:s=true,enableBugFlag:l=false,bugFlagLabel:p,enableScreenshot:a=false}){let[g,y]=useState(i?.content||""),[v,m]=useState(i?.rating??null),[f,E]=useState(false),[S,C]=useState(false),[x,k]=useState(null),[T,U]=useState(false),[N,A]=useState(false);useEffect(()=>{C(W());},[]),useEffect(()=>{i?.content!==void 0&&y(i.content||""),i?.rating!==void 0&&m(i.rating??null);},[i?.content,i?.rating]);let F=u&&s?g.trim().length>0||v!==null:u?g.trim().length>0:s?v!==null:false,M=async()=>{U(true),A(false);try{let{captureScreenshot:w}=await import('./screenshot-KDHUL63V.mjs'),O=await w();O?k(O):A(!0);}catch{A(true);}finally{U(false);}},H=w=>{w.preventDefault(),!(!F||t)&&n({content:u&&g.trim()?g.trim():void 0,rating:s&&v!==null?v:void 0,isBug:f||void 0,screenshot:x||void 0});},q={width:"100%",padding:S?"12px 0":"10px 0",border:"none",borderBottom:`1px solid ${e.colors.inputBorder}`,borderRadius:0,backgroundColor:"transparent",color:e.colors.text,fontSize:S?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:S?96:80,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.55,...d?.input};return jsxs("form",{onSubmit:H,children:[s&&jsx("div",{style:{marginBottom:u?S?18:16:0,...u?{}:{display:"flex",justifyContent:"center",padding:"6px 0"}},children:jsx(lr,{value:v,onChange:m,theme:e,isTouch:S,large:!u})}),u&&jsx("textarea",{value:g,onChange:w=>y(w.target.value),placeholder:r||"Share your thoughts\u2026",maxLength:5e3,style:q,disabled:t,"aria-label":"Your feedback",onFocus:w=>{w.currentTarget.style.borderBottomColor=e.colors.inputBorderFocus;},onBlur:w=>{w.currentTarget.style.borderBottomColor=e.colors.inputBorder;}}),l&&jsxs("button",{type:"button",role:"switch","aria-checked":f,onClick:()=>E(!f),style:{display:"flex",alignItems:"center",gap:10,width:"100%",marginTop:16,padding:S?"12px 12px":"10px 12px",border:`1px solid ${f?e.colors.warningBorder:e.colors.border}`,borderRadius:e.borders.radius.sm,backgroundColor:f?e.colors.warningSurface:"transparent",cursor:"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,fontFamily:e.typography.fontFamily,...d?.bugFlag},children:[jsx("span",{"aria-hidden":"true",style:{width:14,height:14,borderRadius:3,border:`1px solid ${f?e.colors.warningActive:e.colors.border}`,backgroundColor:f?e.colors.warning:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},children:f&&jsx("svg",{width:8,height:8,viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:jsx("path",{d:"M2 5L4 7L8 3",stroke:e.colors.primaryText,strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{style:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.normal,color:f?e.colors.text:e.colors.textSecondary,letterSpacing:"0",textAlign:"left",flex:1},children:f?"Reported as an issue":p||"Report an issue"})]}),l&&a&&f&&!x&&jsxs("button",{type:"button",onClick:M,disabled:T,style:{display:"flex",alignItems:"center",gap:8,width:"100%",marginTop:8,padding:"9px 12px",border:`1px solid ${e.colors.border}`,borderRadius:e.borders.radius.sm,backgroundColor:"transparent",cursor:T?"progress":"pointer",fontFamily:e.typography.fontFamily,fontSize:e.typography.fontSize.xs,letterSpacing:"0.06em",textTransform:"uppercase",color:e.colors.textSecondary,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},onMouseEnter:w=>{w.currentTarget.style.borderColor=e.colors.inputBorderFocus,w.currentTarget.style.color=e.colors.text;},onMouseLeave:w=>{w.currentTarget.style.borderColor=e.colors.border,w.currentTarget.style.color=e.colors.textSecondary;},children:[jsxs("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),jsx("circle",{cx:"12",cy:"10",r:"3"}),jsx("path",{d:"M2 17l4-4 3 3 4-4 9 9"})]}),T?"Capturing\u2026":"Attach screenshot"]}),N&&jsxs("div",{role:"alert",style:{marginTop:8,padding:"6px 0 6px 10px",borderLeft:`2px solid ${e.colors.error}`,fontSize:e.typography.fontSize.xs,color:e.colors.text,fontFamily:e.typography.fontFamily,display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[jsx("span",{children:"Screenshot capture unavailable."}),jsx("button",{type:"button",onClick:M,style:{background:"none",border:"none",padding:0,color:e.colors.text,fontFamily:e.typography.fontFamily,fontSize:e.typography.fontSize.xs,textDecoration:"underline",textDecorationColor:e.colors.border,textUnderlineOffset:3,cursor:"pointer"},children:"Try again"})]}),l&&a&&f&&x&&jsx(tt,{src:x,onRemove:()=>k(null),resolvedTheme:e}),jsx("button",{type:"submit",disabled:t||!F,style:{width:"100%",padding:S?"14px 16px":"11px 16px",marginTop:18,border:"none",borderRadius:e.borders.radius.sm,backgroundColor:F?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:F?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||!F?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:t?"italic":"normal",...d?.submitButton},onMouseEnter:w=>{w.currentTarget.disabled||(w.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:w=>{w.currentTarget.disabled||(w.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:t?c?"Updating\u2026":"Sending\u2026":c?"Update":o})]})}function lr({value:e,onChange:r,theme:o,isTouch:t,large:n=false}){let[d,i]=useState(null),c=n?t?34:28:t?26:20,u=n?8:6,s=n?t?6:4:t?6:2,l=p=>d!==null&&d>=p?`${(p-1)*30}ms`:"0ms";return jsx("div",{style:{display:"flex",gap:u},role:"group","aria-label":"Rating",onMouseLeave:()=>i(null),children:[1,2,3,4,5].map(p=>{let a=(d??e??0)>=p;return jsx("button",{type:"button",onClick:()=>r(p),onMouseEnter:()=>i(p),"aria-label":`Rate ${p} out of 5`,"aria-pressed":e===p,style:{background:"none",border:"none",cursor:"pointer",padding:s,color:a?o.colors.starFilled:o.colors.starEmpty,transition:`color 180ms ${o.animation.easing.default}`,transitionDelay:l(p),outline:"none",WebkitTapHighlightColor:"transparent"},children:jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:a?0:1.5,strokeLinejoin:"round",children:jsx("path",{d:"M12 3.5L14.472 8.506L20 9.308L16 13.205L16.944 18.706L12 16.107L7.056 18.706L8 13.205L4 9.308L9.528 8.506L12 3.5Z"})})},p)})})}function st({resolvedTheme:e,isLoading:r,onSubmit:o,initialVote:t,isEditing:n=false,labels:d}){let[i,c]=useState(false),[u,s]=useState(t||null),[l,p]=useState(t||null);useEffect(()=>{c(W());},[]),useEffect(()=>{t!==void 0&&(p(t),s(t));},[t]),useEffect(()=>{!r&&!n&&s(null);},[r,n]);let a=m=>{s(m),o({vote:m});},g=i?24:20,y=m=>{let f=l===m,E=m==="up"?e.colors.voteUp:e.colors.voteDown,S=m==="up"?e.colors.voteUpSurface:e.colors.voteDownSurface,C=m==="up"?e.colors.voteUpBorder:e.colors.voteDownBorder;return {flex:1,minWidth:0,padding:i?"14px 18px":"11px 16px",border:`1px solid ${f?E:C}`,borderRadius:e.borders.radius.full,background:f?E:S,color:f?e.colors.primaryText:e.colors.text,fontSize:i?15:13,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:r?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}, border-color ${e.animation.duration.fast} ${e.animation.easing.default}, color ${e.animation.duration.fast} ${e.animation.easing.default}`,display:"flex",alignItems:"center",justifyContent:"center",gap:i?10:8,outline:"none"}},v=(m,f)=>d?.[m]?d[m]:m==="up"?f?"Liked":"Like":f?"Disliked":"Dislike";return jsx("div",{style:{display:"flex",gap:i?12:10},role:"group","aria-label":"Vote",children:["up","down"].map(m=>{let f=l===m,E=r&&u===m,S=v(m,f),C=E?`${S}, submitting`:S,x=m==="up"?e.colors.voteUpBorder:e.colors.voteDownBorder;return jsxs("button",{type:"button",onClick:()=>a(m),disabled:r,style:y(m),"aria-label":C,"aria-pressed":f,onMouseEnter:k=>{r||f||(k.currentTarget.style.borderColor=e.colors.inputBorderFocus);},onMouseLeave:k=>{f||(k.currentTarget.style.borderColor=x);},children:[m==="up"?jsx(cr,{size:g}):jsx(dr,{size:g}),jsx("span",{style:{fontStyle:E?"italic":"normal"},children:E?n?"Updating\u2026":"Sending\u2026":S})]},m)})})}function cr({size:e=20}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"})})}function dr({size:e=20}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"})})}function at({resolvedTheme:e,options:r,allowMultiple:o,isLoading:t,onSubmit:n,initialSelected:d,isEditing:i=false}){let[c,u]=useState(d||[]),[s,l]=useState(false),[p,a]=useState(null);useEffect(()=>{l(W());},[]),useEffect(()=>{d&&u(d);},[d]);let g=m=>{t||u(o?f=>f.includes(m)?f.filter(E=>E!==m):[...f,m]:f=>f.includes(m)?[]:[m]);},y=()=>{c.length===0||t||n({pollSelected:c});},v=s?"14px 14px":"12px 14px";return jsxs("div",{children:[jsx("ul",{role:"group","aria-label":o?"Select one or more options":"Select an option",style:{listStyle:"none",margin:0,padding:0,borderTop:`1px solid ${e.colors.border}`},children:r.map((m,f)=>{let E=c.includes(m),S=p===f;return jsxs("li",{style:{borderBottom:`1px solid ${e.colors.border}`,position:"relative",animation:`gotcha-fade-up ${e.animation.duration.normal} ${e.animation.easing.default} both`,animationDelay:`${f*.04}s`},children:[E&&jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:8,bottom:8,width:2,backgroundColor:e.colors.pollSelectedBorder}}),jsxs("button",{type:"button",onClick:()=>g(m),onMouseEnter:()=>a(f),onMouseLeave:()=>a(null),disabled:t,"aria-pressed":E,style:{display:"flex",alignItems:"center",gap:12,width:"100%",padding:v,paddingLeft:E?16:14,border:"none",background:S&&!E?e.colors.surfaceHover:"transparent",color:e.colors.text,fontSize:s?15:e.typography.fontSize.md,fontWeight:E?e.typography.fontWeight.medium:e.typography.fontWeight.normal,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,textAlign:"left",letterSpacing:"0",outline:"none"},children:[jsx("span",{style:{flex:1},children:m}),jsx("span",{"aria-hidden":"true",style:{width:14,height:14,borderRadius:o?3:"50%",border:`1px solid ${E?e.colors.pollCheckSelectedBorder:e.colors.pollCheckBorder}`,backgroundColor:E?e.colors.pollCheckSelectedBg:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},children:E&&jsx("svg",{width:8,height:8,viewBox:"0 0 10 10",fill:"none",children:jsx("path",{d:"M2 5L4 7L8 3",stroke:e.colors.primaryText,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]},m)})}),jsx("button",{type:"button",onClick:y,disabled:t||c.length===0,style:{width:"100%",marginTop:18,padding:s?"14px 16px":"11px 16px",border:"none",borderRadius:e.borders.radius.sm,backgroundColor:c.length===0?e.colors.buttonBackgroundDisabled:e.colors.buttonBackground,color:c.length===0?e.colors.buttonColorDisabled:e.colors.buttonColor,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||c.length===0?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:t?"italic":"normal"},onMouseEnter:m=>{m.currentTarget.disabled||(m.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:m=>{m.currentTarget.disabled||(m.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:t?i?"Updating\u2026":"Sending\u2026":i?"Update":"Submit"})]})}function ct({size:e=16,color:r="currentColor"}){let t=2*Math.PI*9,n=t*.25;return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading",style:{animation:"gotcha-spin 1.1s linear infinite",transformOrigin:"center"},children:[jsx("circle",{cx:"12",cy:"12",r:9,stroke:r,strokeOpacity:"0.18",strokeWidth:"1.25",fill:"none"}),jsx("circle",{cx:"12",cy:"12",r:9,stroke:r,strokeWidth:"1.25",strokeLinecap:"round",fill:"none",strokeDasharray:`${n} ${t}`,strokeDashoffset:"0"})]})}function ut({resolvedTheme:e,submitText:r,isLoading:o,onSubmit:t,customStyles:n,showFollowUp:d=true,followUpPlaceholder:i,lowLabel:c="Not likely",highLabel:u="Very likely",initialValues:s,isEditing:l=false}){let[p,a]=useState(s?.rating??null),[g,y]=useState(s?.content||""),[v,m]=useState(false),[f,E]=useState(null);useEffect(()=>{m(W());},[]),useEffect(()=>{s?.rating!==void 0&&a(s.rating??null),s?.content!==void 0&&y(s.content||"");},[s?.rating,s?.content]);let S=p!==null;return jsxs("form",{onSubmit:x=>{x.preventDefault(),!(!S||o)&&t({rating:p??void 0,content:d&&g.trim()?g.trim():void 0});},children:[jsx("div",{style:{position:"relative",display:"flex",gap:v?4:5,justifyContent:"center"},role:"group","aria-label":"NPS Score",onMouseLeave:()=>E(null),children:Array.from({length:11},(x,k)=>{let T=p===k,U=f===k;return jsx("button",{type:"button",onClick:()=>a(k),onMouseEnter:()=>E(k),"aria-label":`Score ${k} out of 10`,"aria-pressed":T,style:{flex:1,minWidth:0,aspectRatio:"1",borderRadius:e.borders.radius.sm,border:`1px solid ${T?e.colors.buttonBackground:U?e.colors.inputBorderFocus:e.colors.border}`,backgroundColor:T?e.colors.buttonBackground:"transparent",color:T?e.colors.buttonColor:e.colors.text,fontSize:15,fontWeight:T?e.typography.fontWeight.medium:e.typography.fontWeight.normal,fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}, border-color ${e.animation.duration.fast} ${e.animation.easing.default}, color ${e.animation.duration.fast} ${e.animation.easing.default}`,outline:"none",...n?.npsButton,...T?n?.npsButtonSelected:{}},children:k},k)})}),jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:12,padding:"0 2px",...n?.npsLabels},children:[c,u].map(x=>jsx("span",{style:{fontFamily:e.typography.fontFamily,fontSize:11,color:e.colors.text,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.14em",textTransform:"uppercase"},children:x},x))}),d&&p!==null&&jsx("textarea",{value:g,onChange:x=>y(x.target.value),placeholder:i||"What's the main reason for your score?",maxLength:5e3,style:{width:"100%",padding:v?"12px 0":"10px 0",marginTop:18,border:"none",borderBottom:`1px solid ${e.colors.inputBorder}`,borderRadius:0,backgroundColor:"transparent",color:e.colors.text,fontSize:v?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:v?72:56,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.55,animation:`gotcha-expand-in ${e.animation.duration.normal} ${e.animation.easing.default} both`,overflow:"hidden",...n?.input},disabled:o,"aria-label":"Follow-up feedback",onFocus:x=>{x.currentTarget.style.borderBottomColor=e.colors.inputBorderFocus;},onBlur:x=>{x.currentTarget.style.borderBottomColor=e.colors.inputBorder;}}),jsx("button",{type:"submit",disabled:o||!S,style:{width:"100%",marginTop:18,padding:v?"14px 16px":"11px 16px",border:"none",borderRadius:e.borders.radius.sm,backgroundColor:S?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:S?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:o||!S?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:o?"italic":"normal",...n?.submitButton},onMouseEnter:x=>{x.currentTarget.disabled||(x.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:x=>{x.currentTarget.disabled||(x.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:o?l?"Updating\u2026":"Sending\u2026":l?"Update":r})]})}function gt({resolvedTheme:e,promptText:r,placeholder:o,isLoading:t,onSubmit:n}){let[d,i]=useState(""),[c,u]=useState(false);return useEffect(()=>{u(W());},[]),jsxs("form",{onSubmit:l=>{l.preventDefault(),!(!d.trim()||t)&&n(d.trim());},children:[jsx("p",{style:{margin:"0 0 14px 0",fontFamily:e.typography.fontFamilyDisplay,fontSize:c?17:16,fontStyle:"italic",color:e.colors.text,lineHeight:1.45,letterSpacing:"-0.01em"},children:r}),jsx("textarea",{value:d,onChange:l=>i(l.target.value),placeholder:o||"Tell us more\u2026",maxLength:5e3,disabled:t,"aria-label":"Follow-up feedback",style:{width:"100%",padding:c?"12px 0":"10px 0",border:"none",borderBottom:`1px solid ${e.colors.inputBorder}`,borderRadius:0,backgroundColor:"transparent",color:e.colors.text,fontSize:c?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:c?96:72,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.55},onFocus:l=>{l.currentTarget.style.borderBottomColor=e.colors.inputBorderFocus;},onBlur:l=>{l.currentTarget.style.borderBottomColor=e.colors.inputBorder;}}),jsx("button",{type:"submit",disabled:t||!d.trim(),style:{width:"100%",marginTop:16,padding:c?"14px 16px":"11px 16px",border:"none",borderRadius:e.borders.radius.sm,backgroundColor:d.trim()?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:d.trim()?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||!d.trim()?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:t?"italic":"normal"},onMouseEnter:l=>{l.currentTarget.disabled||(l.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:l=>{l.currentTarget.disabled||(l.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:t?"Sending\u2026":"Submit"})]})}var br={feedback:"Feedback",vote:"Vote",poll:"Poll",nps:"Rate"};function yr(e,r){switch(e){case "vote":return "What do you think?";case "poll":return "Cast your vote.";case "nps":return r||"How likely are you to recommend us?";default:return "What do you think of this feature?"}}var vr=4e3;function ft({mode:e,theme:r,customStyles:o,promptText:t,placeholder:n,submitText:d,thankYouMessage:i,isLoading:c,isCheckingExisting:u=false,isSubmitted:s,phase:l="form",followUpConfig:p,followUpLoading:a=false,onFollowUpSubmit:g,error:y,existingResponse:v,isEditing:m=false,showText:f=true,showRating:E=true,voteLabels:S,options:C,allowMultiple:x=false,npsQuestion:k,npsFollowUp:T=true,npsFollowUpPlaceholder:U,npsLowLabel:N,npsHighLabel:A,enableBugFlag:F=false,bugFlagLabel:M,enableScreenshot:H=false,onSubmit:q,onClose:w,anchorRect:O,useFixedPosition:Fe=false,isMobile:K}){let pe=useRef(null),Se=useRef(null),Re=useRef(w);Re.current=w;let[Ue,oo]=useState(false),z=K??Ue,[Ne,He]=useState("light"),{themeConfig:J}=P();useEffect(()=>{if(typeof window>"u")return;let L=window.matchMedia("(prefers-color-scheme: dark)"),V=I=>He(I.matches?"dark":"light");V(L);let Y=I=>V(I);L.addEventListener("change",Y);let Z=[()=>L.removeEventListener("change",Y)];if(K===void 0){let I=window.matchMedia("(max-width: 1023px)"),te=()=>oo(I.matches);te(),I.addEventListener("change",te),Z.push(()=>I.removeEventListener("change",te));}return ()=>{for(let I of Z)I();}},[K]);let h=useMemo(()=>ce(r,Ne,J),[r,Ne,J]);useEffect(()=>{Ze(h);},[h]);let Be=typeof window>"u"||!O?false:window.innerHeight-O.bottom<340;useEffect(()=>{let L=pe.current;if(!L)return;Se.current?.focus();let V=Y=>{if(Y.key==="Escape"){Re.current();return}if(Y.key==="Tab"){let Z=L.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),I=Z[0],te=Z[Z.length-1];Y.shiftKey&&document.activeElement===I?(Y.preventDefault(),te?.focus()):!Y.shiftKey&&document.activeElement===te&&(Y.preventDefault(),I?.focus());}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[]);let ge=t||yr(e,k),Oe=br[e],me=e==="nps"?420:e==="poll"?400:360,We=z?"gotcha-modal-enter-center":Be?"gotcha-modal-enter-above":"gotcha-modal-enter",Me=typeof window<"u"?window.innerHeight:0,Q={padding:0,borderRadius:h.borders.radius.lg,background:h.colors.background,color:h.colors.text,boxShadow:h.shadows.modal,border:`${h.borders.width}px solid ${h.colors.border}`,fontFamily:h.typography.fontFamily,textAlign:"left",overflow:"hidden"},Ge=z?{...Q,position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"calc(100vw - 32px)",maxWidth:me,zIndex:9999,...o?.modal}:Fe&&O&&Me?(()=>{let L=window.innerWidth,V=24,Z=O.left+O.width/2-me/2,I=Math.max(V,Math.min(Z,L-me-V));return {...Q,position:"fixed",left:I,width:me,zIndex:99999,...Be?{bottom:Me-O.top+10}:{top:O.bottom+10},...o?.modal}})():{...Q,position:"absolute",left:"50%",width:me,zIndex:9999,...Be?{bottom:"100%",marginBottom:10,transform:"translateX(-50%)"}:{top:"100%",marginTop:10,transform:"translateX(-50%)"},...o?.modal},oe=L=>z?{}:{animation:`gotcha-fade-up ${h.animation.duration.normal} ${h.animation.easing.default} both`,animationDelay:`${L*.04}s`},to=z?"20px 24px 24px":"20px 28px 24px";return jsxs("div",{ref:pe,role:"dialog","aria-modal":"true","aria-label":s?"Feedback submitted":void 0,"aria-labelledby":s?void 0:"gotcha-modal-title","data-gotcha":true,style:Ge,className:Je("gotcha-modal","gotcha-root",We),children:[!s&&jsxs("header",{style:{padding:z?"20px 24px 16px":"22px 28px 16px",borderBottom:`${h.borders.width}px solid ${h.colors.border}`,position:"relative"},children:[jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10,...oe(0)},children:[jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:16,height:1,backgroundColor:h.colors.warning}}),jsx("span",{style:{fontFamily:h.typography.fontFamily,fontSize:10,fontWeight:h.typography.fontWeight.medium,letterSpacing:"0.16em",textTransform:"uppercase",color:h.colors.textSecondary},children:Oe})]}),jsx("h2",{id:"gotcha-modal-title",style:{margin:0,paddingRight:z?52:44,fontFamily:h.typography.fontFamilyDisplay,fontSize:z?22:20,fontWeight:h.typography.fontWeight.normal,letterSpacing:"-0.01em",lineHeight:1.25,color:h.colors.text,...oe(1),...o?.title},children:ge}),jsx("button",{ref:Se,type:"button",onClick:w,"aria-label":"Close feedback form",style:{position:"absolute",top:z?14:16,right:z?14:18,width:z?44:32,height:z?44:32,border:"none",background:"transparent",outline:"none",cursor:"pointer",color:h.colors.closeButton,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:h.borders.radius.sm,transition:`color ${h.animation.duration.fast} ${h.animation.easing.default}`,...o?.closeButton},onMouseEnter:L=>{L.currentTarget.style.color=h.colors.closeButtonHover;},onMouseLeave:L=>{L.currentTarget.style.color=h.colors.closeButton;},children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1L11 11M1 11L11 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxs("div",{style:{padding:s?0:to,position:"relative"},children:[y&&!s&&jsxs("div",{role:"alert",style:{padding:"2px 0 2px 14px",marginBottom:16,borderLeft:`2px solid ${h.colors.error}`,color:h.colors.text,fontSize:h.typography.fontSize.sm,lineHeight:1.55,...oe(2),...o?.errorMessage},children:[y,jsx("span",{style:{color:h.colors.textSecondary},children:" \u2014 try again?"})]}),s&&jsxs("div",{style:{padding:z?"32px 24px 28px":"36px 28px 28px",textAlign:"center",position:"relative"},children:[jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",style:{display:"block",margin:"0 auto 14px",...o?.successIcon},children:jsx("path",{d:"M10 20.5L17 27.5L31 13.5",stroke:h.colors.success,strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",style:{strokeDasharray:30,strokeDashoffset:30,animation:`gotcha-check-draw 320ms ${h.animation.easing.default} forwards`}})}),jsx("p",{style:{margin:0,fontFamily:h.typography.fontFamilyDisplay,fontSize:22,fontWeight:h.typography.fontWeight.normal,letterSpacing:"-0.01em",color:h.colors.text,...o?.successMessage},children:i}),jsx("p",{style:{margin:"8px 0 0",fontFamily:h.typography.fontFamily,fontSize:h.typography.fontSize.sm,color:h.colors.textSecondary,fontStyle:"italic"},children:"We\u2019ll close this in a moment."}),jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:1,right:1,bottom:1,height:1,backgroundColor:h.colors.success,transformOrigin:"left center",animation:`gotcha-progress ${vr}ms linear forwards`}})]}),l==="followUp"&&p&&g&&!s&&jsx("div",{style:oe(2),children:jsx(gt,{resolvedTheme:h,promptText:p.promptText,placeholder:p.placeholder,isLoading:a,onSubmit:g})}),l==="form"&&u&&jsx("div",{style:{display:"flex",justifyContent:"center",padding:"24px 0",...oe(2)},children:jsx(ct,{size:20,color:h.colors.textSecondary})}),l==="form"&&!u&&!s&&jsxs("div",{style:oe(2),children:[e==="feedback"&&jsx(nt,{resolvedTheme:h,placeholder:n,submitText:d,isLoading:c,onSubmit:q,customStyles:o,initialValues:v?{content:v.content,rating:v.rating}:void 0,isEditing:m,showText:f,showRating:E,enableBugFlag:F,bugFlagLabel:M,enableScreenshot:H}),e==="vote"&&jsx(st,{resolvedTheme:h,isLoading:c,onSubmit:q,initialVote:v?.vote||void 0,isEditing:m,labels:S}),e==="nps"&&jsx(ut,{resolvedTheme:h,submitText:d,isLoading:c,onSubmit:q,showFollowUp:T,followUpPlaceholder:U,lowLabel:N,highLabel:A,customStyles:o,initialValues:v?{rating:v.rating,content:v.content}:void 0,isEditing:m}),e==="poll"&&C&&C.length>0&&jsx(at,{resolvedTheme:h,options:C,allowMultiple:x,isLoading:c,onSubmit:q,initialSelected:v?.pollSelected||void 0,isEditing:m})]})]}),jsx("div",{"aria-live":"polite",className:"sr-only",style:{position:"absolute",left:-9999},children:s?"Thank you. Your feedback has been submitted.":y?`Error: ${y}`:""})]})}function Sr({elementId:e,user:r,userEmail:o,mode:t="feedback",showText:n=true,showRating:d=true,voteLabels:i,options:c,allowMultiple:u=false,npsQuestion:s,npsFollowUp:l=true,npsFollowUpPlaceholder:p,npsLowLabel:a,npsHighLabel:g,enableBugFlag:y=false,bugFlagLabel:v,enableScreenshot:m=false,onePerUser:f=false,cooldownDays:E,hideAfterSubmitDays:S,showAfterSeconds:C,showAfterScrollPercent:x,showAfterVisits:k,followUp:T,animated:U=true,position:N=se.POSITION,size:A=se.SIZE,theme:F=se.THEME,customStyles:M,visible:H=true,showOnHover:q=se.SHOW_ON_HOVER,touchBehavior:w=se.TOUCH_BEHAVIOR,promptText:O,placeholder:Fe,submitText:K=se.SUBMIT_TEXT,thankYouMessage:pe=se.THANK_YOU_MESSAGE,onSubmit:Se,onOpen:Re,onClose:Ue,onError:oo}){let{disabled:z,activeModalId:Ne,openModal:He,closeModal:J,defaultUser:h,defaultUserEmail:Be,client:ge,debug:Oe}=P(),{conditionsMet:Eo}=$o({elementId:e,showAfterSeconds:C,showAfterScrollPercent:x,showAfterVisits:k}),{isHidden:me,markHidden:We}=jo({elementId:e,userId:r?.id||h?.id,hideAfterSubmitDays:S}),[Me,Q]=useState("form"),[Ge,oe]=useState(null),[to,L]=useState(false),[V,Y]=useState(0),[Z,I]=useState(false),[te,To]=useState(null),[X,vt]=useState(false),[ko,St]=useState(false),xe=useRef(null),Le=useRef(),xt=useRef(null),De=useRef(null),[fe,Ye]=useState(null);useEffect(()=>{if(St(true),typeof window>"u")return;let b=window.matchMedia("(max-width: 1023px)"),G=()=>vt(b.matches);return G(),b.addEventListener("change",G),()=>{b.removeEventListener("change",G),clearTimeout(Le.current);}},[]),useEffect(()=>{Y(ge.getQueueLength());let b=()=>{setTimeout(()=>Y(ge.getQueueLength()),2e3);};return window.addEventListener("online",b),()=>window.removeEventListener("online",b)},[ge]);let re=Ne===e;useEffect(()=>{if(!re||X)return;let b=0,G=()=>{b||(b=requestAnimationFrame(()=>{b=0;let ne=xe.current;if(!ne)return;let we=ne.querySelector("button");To((we??ne).getBoundingClientRect());}));};return window.addEventListener("resize",G),window.addEventListener("scroll",G,{passive:true}),()=>{b&&cancelAnimationFrame(b),window.removeEventListener("resize",G),window.removeEventListener("scroll",G);}},[re,X]),useEffect(()=>{re||(Q("form"),clearTimeout(Le.current));},[re]),useEffect(()=>{if(!re||!X)return;let b=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=b;}},[re,X]),useEffect(()=>{if(!q)return;let b=xe.current;if(!b)return;let G=b.parentElement;if(!G)return;let ne=()=>I(true),we=()=>I(false);return G.addEventListener("mouseenter",ne),G.addEventListener("mouseleave",we),()=>{G.removeEventListener("mouseenter",ne),G.removeEventListener("mouseleave",we);}},[q]);let{submit:qe,isLoading:wt,isCheckingExisting:Et,error:Tt,existingResponse:kt,isEditing:Ao}=Ko({elementId:e,mode:t,pollOptions:c,user:r,userEmail:o??Be,onePerUser:f,cooldownDays:E,onSuccess:b=>{oe(b.id),Se?.(b),Ye(null),De.current=null;},onError:b=>{console.warn("[Gotcha] Submission failed:",b instanceof Error?b.message:b),oo?.(b),De.current&&Ye({message:b instanceof Error?b.message:"Something went wrong",retrying:false});}}),At=useCallback(()=>{if(xe.current){let b=xe.current.querySelector("button");To((b??xe.current).getBoundingClientRect());}He(e),Re?.();},[e,He,Re]),Co=useCallback(()=>{clearTimeout(Le.current),J(),Q("form"),Ue?.();},[J,Ue]),Ct=useCallback(b=>{xt.current={rating:b.rating,vote:b.vote},De.current=b,T&&(T.ratingThreshold!=null&&b.rating!=null&&b.rating<=T.ratingThreshold||T.onNegativeVote&&b.vote==="down")&&t!=="poll"?Q("followUp"):(Q("success"),Le.current=setTimeout(()=>{J(),Q("form");},4e3)),S&&We();let ne=typeof performance<"u"?performance.now():Date.now();qe(b).catch(()=>{}).finally(()=>{if(Oe){let we=(typeof performance<"u"?performance.now():Date.now())-ne;console.log(`[Gotcha] Server ack in ${we.toFixed(0)}ms`);}});},[qe,T,t,S,We,J,Oe]),Ft=useCallback(()=>{let b=De.current;!b||!fe||fe.retrying||(Ye({...fe,retrying:true}),qe(b).catch(()=>{}));},[fe,qe]),Rt=useCallback(()=>{Ye(null),De.current=null;},[]),Bt=useCallback(async b=>{if(Ge){L(true);try{await ge.updateResponse(Ge,{content:b});}catch(G){console.warn("[Gotcha] Follow-up submission failed:",G instanceof Error?G.message:G);}finally{L(false),Q("success"),Le.current=setTimeout(()=>{J(),Q("form");},4e3);}}},[Ge,J,ge]),Mt=f&&Ao?"Update":K;if(z||!H||me||!Eo)return null;let Gt={"top-right":{position:"absolute",top:0,right:0,transform:"translate(50%, -50%)"},"top-left":{position:"absolute",top:0,left:0,transform:"translate(-50%, -50%)"},"bottom-right":{position:"absolute",bottom:0,right:0,transform:"translate(50%, 50%)"},"bottom-left":{position:"absolute",bottom:0,left:0,transform:"translate(-50%, 50%)"},inline:{position:"relative",display:"inline-flex"}},Lt={mode:t,theme:F,customStyles:M,promptText:O,placeholder:Fe,submitText:Mt,thankYouMessage:pe,isLoading:wt,isCheckingExisting:f&&Et,isSubmitted:Me==="success",phase:Me,followUpConfig:T,followUpLoading:to,onFollowUpSubmit:Bt,error:Tt,existingResponse:f?kt:null,isEditing:f&&Ao,showText:n,showRating:d,voteLabels:i,options:c,allowMultiple:u,npsQuestion:s,npsFollowUp:l,npsFollowUpPlaceholder:p,npsLowLabel:a,npsHighLabel:g,enableBugFlag:y,bugFlagLabel:v,enableScreenshot:m,onSubmit:Ct,onClose:Co,anchorRect:te||void 0,useFixedPosition:!X,isMobile:X};return jsxs("div",{ref:xe,style:{...Gt[N],zIndex:"auto"},className:"gotcha-container","data-gotcha-element":e,children:[jsx(et,{size:A,theme:F,customStyles:M,showOnHover:q,touchBehavior:w,onClick:At,isOpen:re,isParentHovered:Z,animated:U,queuedCount:V}),fe&&ko&&createPortal(jsx(xr,{message:fe.message,retrying:fe.retrying,onRetry:Ft,onDismiss:Rt}),document.body),re&&ko&&createPortal(jsx("div",{role:"presentation",onClick:X?Co:void 0,style:{position:"fixed",inset:0,zIndex:99999,backgroundColor:X?"rgba(26,23,20,0.32)":"transparent",backdropFilter:X?"blur(8px)":"none",WebkitBackdropFilter:X?"blur(8px)":"none",pointerEvents:X?"auto":"none",transition:"background-color 180ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:jsx("div",{onClick:X?b=>b.stopPropagation():void 0,style:{pointerEvents:"auto"},children:jsx(ft,{...Lt})})}),document.body)]})}function xr({message:e,retrying:r,onRetry:o,onDismiss:t}){return jsxs("div",{role:"status","aria-live":"polite",className:"editorial",style:{position:"fixed",bottom:16,right:16,zIndex:99998,maxWidth:360,borderRadius:6,border:"1px solid rgba(155, 58, 46, 0.35)",backgroundColor:"#FAF8F4",boxShadow:"0 4px 16px rgba(26, 23, 20, 0.12)",padding:"14px 16px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif",color:"#1A1714",animation:"gotcha-fade-up 240ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:[jsx("div",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, 'Courier New', monospace",fontSize:10,textTransform:"uppercase",letterSpacing:"0.18em",color:"#9B3A2E",marginBottom:6},children:"Couldn\u2019t save"}),jsx("p",{style:{margin:0,fontSize:13,lineHeight:1.55,color:"#1A1714"},children:e||"Your feedback didn\u2019t reach us. Retry?"}),jsxs("div",{style:{marginTop:12,display:"flex",gap:8},children:[jsx("button",{type:"button",onClick:o,disabled:r,style:{backgroundColor:"#1A1714",color:"#FAF8F4",border:"none",borderRadius:4,padding:"6px 14px",fontSize:12,fontWeight:500,cursor:r?"default":"pointer",opacity:r?.6:1,transition:"opacity 180ms"},children:r?"Retrying\u2026":"Retry"}),jsx("button",{type:"button",onClick:t,style:{backgroundColor:"transparent",color:"#6B655D",border:"1px solid #E8E2D9",borderRadius:4,padding:"6px 14px",fontSize:12,cursor:"pointer",transition:"color 180ms"},children:"Dismiss"})]})]})}function bt({elementId:e,refreshInterval:r}){let{client:o}=P(),[t,n]=useState(null),[d,i]=useState(true),[c,u]=useState(null);return useEffect(()=>{let s=false,l=async()=>{try{let a=await o.getScore(e);s||(n(a),u(null));}catch(a){s||u(a instanceof Error?a.message:"Failed to load score");}finally{s||i(false);}};l();let p;return r&&r>0&&(p=setInterval(l,r)),()=>{s=true,p&&clearInterval(p);}},[o,e,r]),{score:t,isLoading:d,error:c}}var Ar={sm:{fontSize:11,ratingFontSize:13,starSize:13,gap:5,pillPx:8,pillPy:4,barHeight:3,iconSize:12},md:{fontSize:12.5,ratingFontSize:15,starSize:15,gap:6,pillPx:10,pillPy:5,barHeight:4,iconSize:14},lg:{fontSize:14,ratingFontSize:18,starSize:18,gap:8,pillPx:12,pillPy:6,barHeight:5,iconSize:16}};function Cr({rating:e,size:r,filledColor:o,emptyColor:t}){let n=`gotcha-star-clip-${Math.random().toString(36).slice(2,8)}`,d=[];for(let i=1;i<=5;i++){let c=Math.min(1,Math.max(0,e-(i-1))),u=`${n}-${i}`;d.push(jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",style:{display:"block"},children:[jsx("defs",{children:jsx("clipPath",{id:u,children:jsx("rect",{x:"0",y:"0",width:24*c,height:"24"})})}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:t}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:o,clipPath:`url(#${u})`})]},i));}return jsx("span",{style:{display:"inline-flex",gap:Math.max(1,r*.08),alignItems:"center"},children:d})}function Fr({rate:e,height:r,filledColor:o,trackColor:t}){return jsx("span",{style:{display:"inline-block",width:48,height:r,borderRadius:r,backgroundColor:t,overflow:"hidden",verticalAlign:"middle"},children:jsx("span",{style:{display:"block",width:`${e}%`,height:"100%",borderRadius:r,background:o,transition:"width 0.6s cubic-bezier(0.4, 0, 0.2, 1)"}})})}function Rr({size:e,color:r}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:jsx("path",{d:"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"})})}function Br({elementId:e,variant:r="stars",showCount:o=true,size:t="md",theme:n="auto",refreshInterval:d,style:i}){let{score:c,isLoading:u}=bt({elementId:e,refreshInterval:d}),[s,l]=useState("light");useEffect(()=>{if(typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");l(F.matches?"dark":"light");let M=H=>l(H.matches?"dark":"light");return F.addEventListener("change",M),()=>F.removeEventListener("change",M)},[]);let{themeConfig:p}=P(),a=useMemo(()=>ce(n,s,p),[n,s,p]);if(u||!c)return null;let g=Ar[t],y=a.colors.text,v=a.colors.textDisabled,m=a.colors.starFilled,f=a.colors.starEmpty,E=a.colors.voteUp,S=a.colors.starEmpty,C={display:"inline-flex",alignItems:"center",gap:g.gap,fontFamily:a.typography.fontFamily,lineHeight:1,WebkitFontSmoothing:"antialiased",...i},x={fontFamily:a.typography.fontFamily,fontSize:g.ratingFontSize,fontWeight:700,color:y,fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em",lineHeight:1},k={fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace",fontSize:Math.max(9,g.fontSize-1),color:v,fontWeight:400,letterSpacing:"0.1em",textTransform:"uppercase"},T=(F,M)=>{let H=F===1?M:`${M}s`;return `${F.toLocaleString()} ${H}`};if(r==="votes"){let{voteCount:F,positiveRate:M}=c,H=F.up+F.down;return H===0?null:jsxs("span",{style:C,children:[jsx(Rr,{size:g.iconSize,color:E}),jsxs("span",{style:{...x,color:E},children:[M,"%"]}),jsx(Fr,{rate:M??0,height:g.barHeight,filledColor:E,trackColor:S}),o&&jsx("span",{style:k,children:T(H,"vote")})]})}let{averageRating:U,totalResponses:N}=c;if(U===null||N===0)return null;let A=U.toFixed(1);return r==="compact"?jsxs("span",{style:C,children:[jsx("svg",{width:g.starSize,height:g.starSize,viewBox:"0 0 24 24",style:{display:"block",flexShrink:0},children:jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:m})}),jsx("span",{style:x,children:A}),o&&jsxs("span",{style:k,children:["(",N.toLocaleString(),")"]})]}):r==="number"?jsxs("span",{style:C,children:[jsx("span",{style:x,children:A}),jsx("span",{style:{...k,marginLeft:2},children:"/ 5"}),o&&jsxs("span",{style:{...k,marginLeft:2},children:["(",T(N,"response"),")"]})]}):jsxs("span",{style:C,children:[jsx(Cr,{rating:U,size:g.starSize,filledColor:m,emptyColor:f}),jsx("span",{style:x,children:A}),o&&jsxs("span",{style:k,children:["(",T(N,"response"),")"]})]})}function Mr(){let{client:e,disabled:r,defaultUser:o,debug:t,openModal:n,closeModal:d,activeModalId:i}=P();return {client:e,disabled:r,defaultUser:o,debug:t,submitFeedback:e.submitResponse.bind(e),openModal:n,closeModal:d,activeModalId:i}}function Gr(e){let{activeModalId:r,openModal:o,closeModal:t}=P(),n=useCallback(()=>o(e),[o,e]),d=useCallback(()=>t(),[t]);return {open:n,close:d,isOpen:r===e}}
134
+ `.trim()}function Ze(e){if(typeof document>"u")return;let r=document.getElementById(qo);r||(r=document.createElement("style"),r.id=qo,document.head.appendChild(r)),r.textContent=Wt(e);}var Qo=createContext(null),Qt={};function Kt({apiKey:e,children:r,baseUrl:o,debug:t=false,disabled:n=false,defaultUser:d,defaultUserEmail:i,themeConfig:c}){let[u,s]=useState(null);o&&!o.startsWith("https://")&&!o.startsWith("/")&&!o.includes("localhost")&&console.warn("[Gotcha] baseUrl should use HTTPS in production:",o);let l=useMemo(()=>Ho({apiKey:e,baseUrl:o,debug:t}),[e,o,t]),p=useMemo(()=>d??Qt,[JSON.stringify(d)]);useEffect(()=>{let v=ce("light","light",c);Ze(v);},[c]),useEffect(()=>(Go(),()=>Lo()),[]),useEffect(()=>{l.flushQueue();let v=()=>l.flushQueue();return window.addEventListener("online",v),()=>window.removeEventListener("online",v)},[l]);let a=useCallback(v=>{s(v);},[]),g=useCallback(()=>{s(null);},[]),y=useMemo(()=>({client:l,disabled:n,defaultUser:p,defaultUserEmail:i,debug:t,activeModalId:u,openModal:a,closeModal:g,themeConfig:c}),[l,n,p,i,t,u,a,g,c]);return jsx(Qo.Provider,{value:y,children:r})}function P(){let e=useContext(Qo);if(!e)throw new Error("useGotchaContext must be used within a GotchaProvider");return e}function Jt(e,r){let o=new Date(e).getTime();if(isNaN(o))return true;let t=Date.now()-o,n=r*24*60*60*1e3;return t>=n}function Ko(e){let{client:r,defaultUser:o}=P(),[t,n]=useState(false),[d,i]=useState(false),[c,u]=useState(null),[s,l]=useState(null);return useEffect(()=>{process.env.NODE_ENV!=="production"&&e.cooldownDays&&!e.onePerUser&&console.warn("[Gotcha] cooldownDays has no effect without onePerUser=true");let a=e.user?.id||o?.id;if(!a||!e.onePerUser){l(null);return}let g=false;return (async()=>{i(true);try{let v=await r.checkExistingResponse(e.elementId,a);g||(v&&e.cooldownDays&&e.cooldownDays>0&&Jt(v.createdAt,e.cooldownDays)?l(null):l(v));}catch{g||l(null);}finally{g||i(false);}})(),()=>{g=true;}},[r,e.elementId,e.user?.id,o?.id,e.onePerUser,e.cooldownDays]),{submit:useCallback(async a=>{n(true),u(null);try{let g=e.user?.id||o?.id,y;return e.onePerUser&&s&&g?y=await r.updateResponse(s.id,{content:a.content,title:a.title,rating:a.rating,vote:a.vote,pollSelected:a.pollSelected},g):y=await r.submitResponse({elementId:e.elementId,mode:e.mode,content:a.content,title:a.title,rating:a.rating,vote:a.vote,pollOptions:e.pollOptions,pollSelected:a.pollSelected,isBug:a.isBug,screenshot:a.screenshot,user:{...o,...e.user},userEmail:e.userEmail}),e.onePerUser&&l({id:y.id,mode:e.mode,content:a.content??null,title:a.title??null,rating:a.rating??null,vote:a.vote??null,pollSelected:a.pollSelected??null,createdAt:y.createdAt}),e.onSuccess?.(y),y}catch(g){let y=g instanceof Error?g.message:"Something went wrong";throw u(y),e.onError?.(g instanceof Error?g:new Error(y)),g}finally{n(false);}},[r,o,e,s]),isLoading:t,isCheckingExisting:d,error:c,existingResponse:s,isEditing:!!s,clearError:()=>u(null)}}function Zo(e,r){return `${j.HIDDEN_UNTIL}_${e}_${r}`}function Vo(e,r,o){if(!o||o<=0)return false;let t=Zo(e,r),n=ie(t);return n?new Date(n).getTime()>Date.now():false}function jo(e){let{elementId:r,userId:o,hideAfterSubmitDays:t}=e,n=useMemo(()=>o||Qe(),[o]),[d,i]=useState(()=>Vo(r,n,t));useEffect(()=>{i(Vo(r,n,t));},[r,n,t]);let c=useCallback(()=>{if(!t||t<=0)return;let u=Zo(r,n),s=new Date(Date.now()+t*24*60*60*1e3);ae(u,s.toISOString()),i(true);},[r,n,t]);return {isHidden:d,markHidden:c}}function tr(e){return `${j.VISIT_COUNT}_${e}`}function $o(e){let{elementId:r,showAfterSeconds:o,showAfterScrollPercent:t,showAfterVisits:n}=e,d=o!=null||t!=null||n!=null,[i,c]=useState(!o),[u,s]=useState(!t),[l]=useState(()=>{if(!n)return true;let p=tr(r),g=parseInt(ie(p)||"0",10)+1;return ae(p,String(g)),g>=n});return useEffect(()=>{if(!o||o<=0)return;let p=Date.now(),a=o*1e3,g=()=>{Date.now()-p>=a?c(true):y=setTimeout(g,Math.min(1e3,a-(Date.now()-p)));},y=setTimeout(g,Math.min(1e3,a));return ()=>clearTimeout(y)},[o]),useEffect(()=>{if(!t||t<=0)return;let p=()=>{let a=document.documentElement.scrollHeight,g=window.innerHeight;if(a<=g){s(true);return}(window.scrollY+g)/a*100>=t&&s(true);};if(p(),!u)return window.addEventListener("scroll",p,{passive:true}),()=>window.removeEventListener("scroll",p)},[t,u]),{conditionsMet:!d||i&&u&&l}}function Je(...e){return e.filter(Boolean).join(" ")}var W=()=>typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0,_o=(e,r)=>{let o={sm:{desktop:24,mobile:28},md:{desktop:32,mobile:34},lg:{desktop:40,mobile:40}};return r?o[e].mobile:o[e].desktop};function nr(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function et({size:e,theme:r,customStyles:o,showOnHover:t,touchBehavior:n,onClick:d,isOpen:i,isParentHovered:c=false,animated:u=true,queuedCount:s=0}){let[l,p]=useState(false),[a,g]=useState(false),[y,v]=useState(nr),[m,f]=useState(false),[E,S]=useState(false),[C,x]=useState(false),{themeConfig:k}=P();useEffect(()=>{if(p(W()),typeof window>"u")return;let K=window.matchMedia("(prefers-color-scheme: dark)"),pe=Se=>v(Se.matches?"dark":"light");return K.addEventListener("change",pe),()=>K.removeEventListener("change",pe)},[]);let T=i?true:!l&&t?c:l&&n==="tap-to-reveal"?a:true;useEffect(()=>{if(T&&!C){let K=setTimeout(()=>x(true),320);return ()=>clearTimeout(K)}},[T,C]);let U=()=>{if(l&&n==="tap-to-reveal"&&!a){g(true);return}d();},N=_o(e,l),A=useMemo(()=>ce(r,y,k),[r,y,k]),F=i?A.colors.warning:A.colors.border,M=i?A.colors.warning:A.colors.glassColor,H=()=>T?E?"scale(0.97)":"scale(1)":"scale(0.96)",q=E?"80ms":"160ms",w=A.animation.easing.default,O=m&&!i?A.colors.surfaceHover:A.colors.glassBackground,Fe={position:"relative",width:N,height:N,borderRadius:A.borders.radius.full,border:`1px solid ${F}`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",background:O,color:M,boxShadow:m?A.colors.glassHoverShadow:A.colors.glassShadow,transition:C?`transform ${q} ${w}, background-color 180ms ${w}, box-shadow 180ms ${w}, border-color 240ms ${w}, color 240ms ${w}`:`opacity 320ms ${w}, transform 320ms ${w}`,opacity:T?1:0,transform:H(),pointerEvents:T?"auto":"none",...o?.button};return jsxs("button",{type:"button",onClick:U,onMouseEnter:()=>f(true),onMouseLeave:()=>{f(false),S(false);},onMouseDown:()=>S(true),onMouseUp:()=>S(false),onTouchStart:()=>S(true),onTouchEnd:()=>S(false),style:Fe,className:Je("gotcha-button",i&&"gotcha-button--open"),"aria-label":"Give feedback on this feature","aria-expanded":i,"aria-haspopup":"dialog",children:[jsx(sr,{size:N*.62,color:M,fontFamilyDisplay:A.typography.fontFamilyDisplay,animated:u&&!C}),s>0&&jsx("span",{"aria-label":`${s} queued`,style:{position:"absolute",top:-2,right:-2,width:8,height:8,borderRadius:"50%",backgroundColor:A.colors.warning,border:`1.5px solid ${A.colors.background}`}})]})}function sr({size:e,color:r,fontFamilyDisplay:o,animated:t}){let[n,d]=useState(false);return useEffect(()=>{d(true);},[]),jsx("span",{"aria-hidden":"true",style:{fontFamily:o,fontWeight:400,fontSize:e,fontStyle:"normal",lineHeight:1,color:r,transform:"translateY(1px) translateZ(0)",willChange:"transform",letterSpacing:"normal",userSelect:"none",display:"inline-block",opacity:t?n?1:0:1,transition:t?"opacity 240ms cubic-bezier(0.22, 0.61, 0.36, 1) 120ms":"none"},children:"G"})}function tt({src:e,onRemove:r,resolvedTheme:o}){let[t,n]=useState(false),[d,i]=useState(false);useEffect(()=>{n(W());},[]);let c=(()=>{if(!e.startsWith("data:"))return null;let u=e.indexOf(",");if(u<0)return null;let s=e.slice(u+1);return Math.round(s.length*3/4/1024)})();return jsxs("div",{style:{marginTop:12},children:[jsxs("div",{style:{position:"relative",borderRadius:o.borders.radius.sm,overflow:"hidden",border:`1px solid ${o.colors.border}`,padding:4,background:o.colors.background},children:[jsx("img",{src:e,alt:"Screenshot attached to the feedback",style:{display:"block",width:"100%",maxHeight:140,objectFit:"cover",borderRadius:Math.max(0,o.borders.radius.sm-2)}}),jsx("button",{type:"button",onClick:r,onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),"aria-label":"Remove screenshot",style:{position:"absolute",top:8,right:8,width:t?32:24,height:t?32:24,borderRadius:"50%",border:`1px solid ${d?o.colors.error:o.colors.border}`,backgroundColor:d?o.colors.error:o.colors.background,color:d?o.colors.primaryText:o.colors.textSecondary,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:`all ${o.animation.duration.fast} ${o.animation.easing.default}`},children:jsx("svg",{width:10,height:10,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:jsx("path",{d:"M1 1L13 13M1 13L13 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxs("p",{style:{margin:"6px 0 0",fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace",fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase",color:o.colors.textSecondary},children:["screenshot.png",c!=null?` \xB7 ${c} KB`:""]})]})}function nt({resolvedTheme:e,placeholder:r,submitText:o,isLoading:t,onSubmit:n,customStyles:d,initialValues:i,isEditing:c=false,showText:u=true,showRating:s=true,enableBugFlag:l=false,bugFlagLabel:p,enableScreenshot:a=false}){let[g,y]=useState(i?.content||""),[v,m]=useState(i?.rating??null),[f,E]=useState(false),[S,C]=useState(false),[x,k]=useState(null),[T,U]=useState(false),[N,A]=useState(false);useEffect(()=>{C(W());},[]),useEffect(()=>{i?.content!==void 0&&y(i.content||""),i?.rating!==void 0&&m(i.rating??null);},[i?.content,i?.rating]);let F=u&&s?g.trim().length>0||v!==null:u?g.trim().length>0:s?v!==null:false,M=async()=>{U(true),A(false);try{let{captureScreenshot:w}=await import('./screenshot-KDHUL63V.mjs'),O=await w();O?k(O):A(!0);}catch{A(true);}finally{U(false);}},H=w=>{w.preventDefault(),!(!F||t)&&n({content:u&&g.trim()?g.trim():void 0,rating:s&&v!==null?v:void 0,isBug:f||void 0,screenshot:x||void 0});},q={width:"100%",padding:S?"12px 0":"10px 0",border:"none",borderBottom:`1px solid ${e.colors.inputBorder}`,borderRadius:0,backgroundColor:"transparent",color:e.colors.text,fontSize:S?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:S?96:80,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.55,...d?.input};return jsxs("form",{onSubmit:H,children:[s&&jsx("div",{style:{marginBottom:u?S?18:16:0,...u?{}:{display:"flex",justifyContent:"center",padding:"6px 0"}},children:jsx(lr,{value:v,onChange:m,theme:e,isTouch:S,large:!u})}),u&&jsx("textarea",{value:g,onChange:w=>y(w.target.value),placeholder:r||"Share your thoughts\u2026",maxLength:5e3,style:q,disabled:t,"aria-label":"Your feedback",onFocus:w=>{w.currentTarget.style.borderBottomColor=e.colors.inputBorderFocus;},onBlur:w=>{w.currentTarget.style.borderBottomColor=e.colors.inputBorder;}}),l&&jsxs("button",{type:"button",role:"switch","aria-checked":f,onClick:()=>E(!f),style:{display:"flex",alignItems:"center",gap:10,width:"100%",marginTop:16,padding:S?"12px 12px":"10px 12px",border:`1px solid ${f?e.colors.warningBorder:e.colors.border}`,borderRadius:e.borders.radius.sm,backgroundColor:f?e.colors.warningSurface:"transparent",cursor:"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,fontFamily:e.typography.fontFamily,...d?.bugFlag},children:[jsx("span",{"aria-hidden":"true",style:{width:14,height:14,borderRadius:3,border:`1px solid ${f?e.colors.warningActive:e.colors.border}`,backgroundColor:f?e.colors.warning:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},children:f&&jsx("svg",{width:8,height:8,viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:jsx("path",{d:"M2 5L4 7L8 3",stroke:e.colors.primaryText,strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{style:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.normal,color:f?e.colors.text:e.colors.textSecondary,letterSpacing:"0",textAlign:"left",flex:1},children:f?"Reported as an issue":p||"Report an issue"})]}),l&&a&&f&&!x&&jsxs("button",{type:"button",onClick:M,disabled:T,style:{display:"flex",alignItems:"center",gap:8,width:"100%",marginTop:8,padding:"9px 12px",border:`1px solid ${e.colors.border}`,borderRadius:e.borders.radius.sm,backgroundColor:"transparent",cursor:T?"progress":"pointer",fontFamily:e.typography.fontFamily,fontSize:e.typography.fontSize.xs,letterSpacing:"0.06em",textTransform:"uppercase",color:e.colors.textSecondary,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},onMouseEnter:w=>{w.currentTarget.style.borderColor=e.colors.inputBorderFocus,w.currentTarget.style.color=e.colors.text;},onMouseLeave:w=>{w.currentTarget.style.borderColor=e.colors.border,w.currentTarget.style.color=e.colors.textSecondary;},children:[jsxs("svg",{width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),jsx("circle",{cx:"12",cy:"10",r:"3"}),jsx("path",{d:"M2 17l4-4 3 3 4-4 9 9"})]}),T?"Capturing\u2026":"Attach screenshot"]}),N&&jsxs("div",{role:"alert",style:{marginTop:8,padding:"6px 0 6px 10px",borderLeft:`2px solid ${e.colors.error}`,fontSize:e.typography.fontSize.xs,color:e.colors.text,fontFamily:e.typography.fontFamily,display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[jsx("span",{children:"Screenshot capture unavailable."}),jsx("button",{type:"button",onClick:M,style:{background:"none",border:"none",padding:0,color:e.colors.text,fontFamily:e.typography.fontFamily,fontSize:e.typography.fontSize.xs,textDecoration:"underline",textDecorationColor:e.colors.border,textUnderlineOffset:3,cursor:"pointer"},children:"Try again"})]}),l&&a&&f&&x&&jsx(tt,{src:x,onRemove:()=>k(null),resolvedTheme:e}),jsx("button",{type:"submit",disabled:t||!F,style:{width:"100%",padding:S?"14px 16px":"11px 16px",marginTop:18,border:"none",borderRadius:e.borders.radius.sm,backgroundColor:F?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:F?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||!F?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:t?"italic":"normal",...d?.submitButton},onMouseEnter:w=>{w.currentTarget.disabled||(w.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:w=>{w.currentTarget.disabled||(w.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:t?c?"Updating\u2026":"Sending\u2026":c?"Update":o})]})}function lr({value:e,onChange:r,theme:o,isTouch:t,large:n=false}){let[d,i]=useState(null),c=n?t?34:28:t?26:20,u=n?8:6,s=n?t?6:4:t?6:2,l=p=>d!==null&&d>=p?`${(p-1)*30}ms`:"0ms";return jsx("div",{style:{display:"flex",gap:u},role:"group","aria-label":"Rating",onMouseLeave:()=>i(null),children:[1,2,3,4,5].map(p=>{let a=(d??e??0)>=p;return jsx("button",{type:"button",onClick:()=>r(p),onMouseEnter:()=>i(p),"aria-label":`Rate ${p} out of 5`,"aria-pressed":e===p,style:{background:"none",border:"none",cursor:"pointer",padding:s,color:a?o.colors.starFilled:o.colors.starEmpty,transition:`color 180ms ${o.animation.easing.default}`,transitionDelay:l(p),outline:"none",WebkitTapHighlightColor:"transparent"},children:jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:a?"currentColor":"none",stroke:"currentColor",strokeWidth:a?0:1.5,strokeLinejoin:"round",children:jsx("path",{d:"M12 3.5L14.472 8.506L20 9.308L16 13.205L16.944 18.706L12 16.107L7.056 18.706L8 13.205L4 9.308L9.528 8.506L12 3.5Z"})})},p)})})}function st({resolvedTheme:e,isLoading:r,onSubmit:o,initialVote:t,isEditing:n=false,labels:d}){let[i,c]=useState(false),[u,s]=useState(t||null),[l,p]=useState(t||null);useEffect(()=>{c(W());},[]),useEffect(()=>{t!==void 0&&(p(t),s(t));},[t]),useEffect(()=>{!r&&!n&&s(null);},[r,n]);let a=m=>{s(m),o({vote:m});},g=i?24:20,y=m=>{let f=l===m,E=m==="up"?e.colors.voteUp:e.colors.voteDown,S=m==="up"?e.colors.voteUpSurface:e.colors.voteDownSurface,C=m==="up"?e.colors.voteUpBorder:e.colors.voteDownBorder;return {flex:1,minWidth:0,padding:i?"14px 18px":"11px 16px",border:`1px solid ${f?E:C}`,borderRadius:e.borders.radius.full,background:f?E:S,color:f?e.colors.primaryText:e.colors.text,fontSize:i?15:13,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:r?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}, border-color ${e.animation.duration.fast} ${e.animation.easing.default}, color ${e.animation.duration.fast} ${e.animation.easing.default}`,display:"flex",alignItems:"center",justifyContent:"center",gap:i?10:8,outline:"none"}},v=(m,f)=>d?.[m]?d[m]:m==="up"?f?"Liked":"Like":f?"Disliked":"Dislike";return jsx("div",{style:{display:"flex",gap:i?12:10},role:"group","aria-label":"Vote",children:["up","down"].map(m=>{let f=l===m,E=r&&u===m,S=v(m,f),C=E?`${S}, submitting`:S,x=m==="up"?e.colors.voteUpBorder:e.colors.voteDownBorder;return jsxs("button",{type:"button",onClick:()=>a(m),disabled:r,style:y(m),"aria-label":C,"aria-pressed":f,onMouseEnter:k=>{r||f||(k.currentTarget.style.borderColor=e.colors.inputBorderFocus);},onMouseLeave:k=>{f||(k.currentTarget.style.borderColor=x);},children:[m==="up"?jsx(cr,{size:g}):jsx(dr,{size:g}),jsx("span",{style:{fontStyle:E?"italic":"normal"},children:E?n?"Updating\u2026":"Sending\u2026":S})]},m)})})}function cr({size:e=20}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"})})}function dr({size:e=20}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"})})}function at({resolvedTheme:e,options:r,allowMultiple:o,isLoading:t,onSubmit:n,initialSelected:d,isEditing:i=false}){let[c,u]=useState(d||[]),[s,l]=useState(false),[p,a]=useState(null);useEffect(()=>{l(W());},[]),useEffect(()=>{d&&u(d);},[d]);let g=m=>{t||u(o?f=>f.includes(m)?f.filter(E=>E!==m):[...f,m]:f=>f.includes(m)?[]:[m]);},y=()=>{c.length===0||t||n({pollSelected:c});},v=s?"14px 14px":"12px 14px";return jsxs("div",{children:[jsx("ul",{role:"group","aria-label":o?"Select one or more options":"Select an option",style:{listStyle:"none",margin:0,padding:0,borderTop:`1px solid ${e.colors.border}`},children:r.map((m,f)=>{let E=c.includes(m),S=p===f;return jsxs("li",{style:{borderBottom:`1px solid ${e.colors.border}`,position:"relative",animation:`gotcha-fade-up ${e.animation.duration.normal} ${e.animation.easing.default} both`,animationDelay:`${f*.04}s`},children:[E&&jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:8,bottom:8,width:2,backgroundColor:e.colors.pollSelectedBorder}}),jsxs("button",{type:"button",onClick:()=>g(m),onMouseEnter:()=>a(f),onMouseLeave:()=>a(null),disabled:t,"aria-pressed":E,style:{display:"flex",alignItems:"center",gap:12,width:"100%",padding:v,paddingLeft:E?16:14,border:"none",background:S&&!E?e.colors.surfaceHover:"transparent",color:e.colors.text,fontSize:s?15:e.typography.fontSize.md,fontWeight:E?e.typography.fontWeight.medium:e.typography.fontWeight.normal,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,textAlign:"left",letterSpacing:"0",outline:"none"},children:[jsx("span",{style:{flex:1},children:m}),jsx("span",{"aria-hidden":"true",style:{width:14,height:14,borderRadius:o?3:"50%",border:`1px solid ${E?e.colors.pollCheckSelectedBorder:e.colors.pollCheckBorder}`,backgroundColor:E?e.colors.pollCheckSelectedBg:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},children:E&&jsx("svg",{width:8,height:8,viewBox:"0 0 10 10",fill:"none",children:jsx("path",{d:"M2 5L4 7L8 3",stroke:e.colors.primaryText,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]},m)})}),jsx("button",{type:"button",onClick:y,disabled:t||c.length===0,style:{width:"100%",marginTop:18,padding:s?"14px 16px":"11px 16px",border:"none",borderRadius:e.borders.radius.sm,backgroundColor:c.length===0?e.colors.buttonBackgroundDisabled:e.colors.buttonBackground,color:c.length===0?e.colors.buttonColorDisabled:e.colors.buttonColor,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||c.length===0?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:t?"italic":"normal"},onMouseEnter:m=>{m.currentTarget.disabled||(m.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:m=>{m.currentTarget.disabled||(m.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:t?i?"Updating\u2026":"Sending\u2026":i?"Update":"Submit"})]})}function ct({size:e=16,color:r="currentColor"}){let t=2*Math.PI*9,n=t*.25;return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading",style:{animation:"gotcha-spin 1.1s linear infinite",transformOrigin:"center"},children:[jsx("circle",{cx:"12",cy:"12",r:9,stroke:r,strokeOpacity:"0.18",strokeWidth:"1.25",fill:"none"}),jsx("circle",{cx:"12",cy:"12",r:9,stroke:r,strokeWidth:"1.25",strokeLinecap:"round",fill:"none",strokeDasharray:`${n} ${t}`,strokeDashoffset:"0"})]})}function ut({resolvedTheme:e,submitText:r,isLoading:o,onSubmit:t,customStyles:n,showFollowUp:d=true,followUpPlaceholder:i,lowLabel:c="Not likely",highLabel:u="Very likely",initialValues:s,isEditing:l=false}){let[p,a]=useState(s?.rating??null),[g,y]=useState(s?.content||""),[v,m]=useState(false),[f,E]=useState(null);useEffect(()=>{m(W());},[]),useEffect(()=>{s?.rating!==void 0&&a(s.rating??null),s?.content!==void 0&&y(s.content||"");},[s?.rating,s?.content]);let S=p!==null;return jsxs("form",{onSubmit:x=>{x.preventDefault(),!(!S||o)&&t({rating:p??void 0,content:d&&g.trim()?g.trim():void 0});},children:[jsx("div",{style:{position:"relative",display:"flex",gap:v?4:5,justifyContent:"center"},role:"group","aria-label":"NPS Score",onMouseLeave:()=>E(null),children:Array.from({length:11},(x,k)=>{let T=p===k,U=f===k;return jsx("button",{type:"button",onClick:()=>a(k),onMouseEnter:()=>E(k),"aria-label":`Score ${k} out of 10`,"aria-pressed":T,style:{flex:1,minWidth:0,aspectRatio:"1",borderRadius:e.borders.radius.sm,border:`1px solid ${T?e.colors.buttonBackground:U?e.colors.inputBorderFocus:e.colors.border}`,backgroundColor:T?e.colors.buttonBackground:"transparent",color:T?e.colors.buttonColor:e.colors.text,fontSize:15,fontWeight:T?e.typography.fontWeight.medium:e.typography.fontWeight.normal,fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}, border-color ${e.animation.duration.fast} ${e.animation.easing.default}, color ${e.animation.duration.fast} ${e.animation.easing.default}`,outline:"none",...n?.npsButton,...T?n?.npsButtonSelected:{}},children:k},k)})}),jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:12,padding:"0 2px",...n?.npsLabels},children:[c,u].map(x=>jsx("span",{style:{fontFamily:e.typography.fontFamily,fontSize:11,color:e.colors.text,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.14em",textTransform:"uppercase"},children:x},x))}),d&&p!==null&&jsx("textarea",{value:g,onChange:x=>y(x.target.value),placeholder:i||"What's the main reason for your score?",maxLength:5e3,style:{width:"100%",padding:v?"12px 0":"10px 0",marginTop:18,border:"none",borderBottom:`1px solid ${e.colors.inputBorder}`,borderRadius:0,backgroundColor:"transparent",color:e.colors.text,fontSize:v?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:v?72:56,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.55,animation:`gotcha-expand-in ${e.animation.duration.normal} ${e.animation.easing.default} both`,overflow:"hidden",...n?.input},disabled:o,"aria-label":"Follow-up feedback",onFocus:x=>{x.currentTarget.style.borderBottomColor=e.colors.inputBorderFocus;},onBlur:x=>{x.currentTarget.style.borderBottomColor=e.colors.inputBorder;}}),jsx("button",{type:"submit",disabled:o||!S,style:{width:"100%",marginTop:18,padding:v?"14px 16px":"11px 16px",border:"none",borderRadius:e.borders.radius.sm,backgroundColor:S?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:S?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:o||!S?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:o?"italic":"normal",...n?.submitButton},onMouseEnter:x=>{x.currentTarget.disabled||(x.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:x=>{x.currentTarget.disabled||(x.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:o?l?"Updating\u2026":"Sending\u2026":l?"Update":r})]})}function gt({resolvedTheme:e,promptText:r,placeholder:o,isLoading:t,onSubmit:n}){let[d,i]=useState(""),[c,u]=useState(false);return useEffect(()=>{u(W());},[]),jsxs("form",{onSubmit:l=>{l.preventDefault(),!(!d.trim()||t)&&n(d.trim());},children:[jsx("p",{style:{margin:"0 0 14px 0",fontFamily:e.typography.fontFamilyDisplay,fontSize:c?17:16,fontStyle:"italic",color:e.colors.text,lineHeight:1.45,letterSpacing:"-0.01em"},children:r}),jsx("textarea",{value:d,onChange:l=>i(l.target.value),placeholder:o||"Tell us more\u2026",maxLength:5e3,disabled:t,"aria-label":"Follow-up feedback",style:{width:"100%",padding:c?"12px 0":"10px 0",border:"none",borderBottom:`1px solid ${e.colors.inputBorder}`,borderRadius:0,backgroundColor:"transparent",color:e.colors.text,fontSize:c?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:c?96:72,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.55},onFocus:l=>{l.currentTarget.style.borderBottomColor=e.colors.inputBorderFocus;},onBlur:l=>{l.currentTarget.style.borderBottomColor=e.colors.inputBorder;}}),jsx("button",{type:"submit",disabled:t||!d.trim(),style:{width:"100%",marginTop:16,padding:c?"14px 16px":"11px 16px",border:"none",borderRadius:e.borders.radius.sm,backgroundColor:d.trim()?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:d.trim()?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||!d.trim()?"not-allowed":"pointer",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,fontStyle:t?"italic":"normal"},onMouseEnter:l=>{l.currentTarget.disabled||(l.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover);},onMouseLeave:l=>{l.currentTarget.disabled||(l.currentTarget.style.backgroundColor=e.colors.buttonBackground);},children:t?"Sending\u2026":"Submit"})]})}var br={feedback:"Feedback",vote:"Vote",poll:"Poll",nps:"Rate"};function yr(e,r){switch(e){case "vote":return "What do you think?";case "poll":return "Cast your vote.";case "nps":return r||"How likely are you to recommend us?";default:return "What do you think of this feature?"}}var vr=4e3;function ft({mode:e,theme:r,customStyles:o,promptText:t,placeholder:n,submitText:d,thankYouMessage:i,isLoading:c,isCheckingExisting:u=false,isSubmitted:s,phase:l="form",followUpConfig:p,followUpLoading:a=false,onFollowUpSubmit:g,error:y,existingResponse:v,isEditing:m=false,showText:f=true,showRating:E=true,voteLabels:S,options:C,allowMultiple:x=false,npsQuestion:k,npsFollowUp:T=true,npsFollowUpPlaceholder:U,npsLowLabel:N,npsHighLabel:A,enableBugFlag:F=false,bugFlagLabel:M,enableScreenshot:H=false,onSubmit:q,onClose:w,anchorRect:O,useFixedPosition:Fe=false,isMobile:K}){let pe=useRef(null),Se=useRef(null),Re=useRef(w);Re.current=w;let[Ue,oo]=useState(false),z=K??Ue,[Ne,He]=useState("light"),{themeConfig:J}=P();useEffect(()=>{if(typeof window>"u")return;let L=window.matchMedia("(prefers-color-scheme: dark)"),V=I=>He(I.matches?"dark":"light");V(L);let Y=I=>V(I);L.addEventListener("change",Y);let Z=[()=>L.removeEventListener("change",Y)];if(K===void 0){let I=window.matchMedia("(max-width: 1023px)"),te=()=>oo(I.matches);te(),I.addEventListener("change",te),Z.push(()=>I.removeEventListener("change",te));}return ()=>{for(let I of Z)I();}},[K]);let h=useMemo(()=>ce(r,Ne,J),[r,Ne,J]);useEffect(()=>{Ze(h);},[h]);let Be=typeof window>"u"||!O?false:window.innerHeight-O.bottom<340;useEffect(()=>{let L=pe.current;if(!L)return;Se.current?.focus();let V=Y=>{if(Y.key==="Escape"){Re.current();return}if(Y.key==="Tab"){let Z=L.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),I=Z[0],te=Z[Z.length-1];Y.shiftKey&&document.activeElement===I?(Y.preventDefault(),te?.focus()):!Y.shiftKey&&document.activeElement===te&&(Y.preventDefault(),I?.focus());}};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[]);let ge=t||yr(e,k),Oe=br[e],me=e==="nps"?420:e==="poll"?400:360,We=z?"gotcha-modal-enter-center":Be?"gotcha-modal-enter-above":"gotcha-modal-enter",Me=typeof window<"u"?window.innerHeight:0,Q={padding:0,borderRadius:h.borders.radius.lg,background:h.colors.background,color:h.colors.text,boxShadow:h.shadows.modal,border:`${h.borders.width}px solid ${h.colors.border}`,fontFamily:h.typography.fontFamily,textAlign:"left",overflow:"hidden"},Ge=z?{...Q,position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"calc(100vw - 32px)",maxWidth:me,zIndex:9999,...o?.modal}:Fe&&O&&Me?(()=>{let L=window.innerWidth,V=24,Z=O.left+O.width/2-me/2,I=Math.max(V,Math.min(Z,L-me-V));return {...Q,position:"fixed",left:I,width:me,zIndex:99999,...Be?{bottom:Me-O.top+10}:{top:O.bottom+10},...o?.modal}})():{...Q,position:"absolute",left:"50%",width:me,zIndex:9999,...Be?{bottom:"100%",marginBottom:10,transform:"translateX(-50%)"}:{top:"100%",marginTop:10,transform:"translateX(-50%)"},...o?.modal},oe=L=>z?{}:{animation:`gotcha-fade-up ${h.animation.duration.normal} ${h.animation.easing.default} both`,animationDelay:`${L*.04}s`},to=z?"20px 24px 24px":"20px 28px 24px";return jsxs("div",{ref:pe,role:"dialog","aria-modal":"true","aria-label":s?"Feedback submitted":void 0,"aria-labelledby":s?void 0:"gotcha-modal-title","data-gotcha":true,style:Ge,className:Je("gotcha-modal","gotcha-root",We),children:[!s&&jsxs("header",{style:{padding:z?"20px 24px 16px":"22px 28px 16px",borderBottom:`${h.borders.width}px solid ${h.colors.border}`,position:"relative"},children:[jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10,...oe(0)},children:[jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:16,height:1,backgroundColor:h.colors.warning}}),jsx("span",{style:{fontFamily:h.typography.fontFamily,fontSize:10,fontWeight:h.typography.fontWeight.medium,letterSpacing:"0.16em",textTransform:"uppercase",color:h.colors.textSecondary},children:Oe})]}),jsx("h2",{id:"gotcha-modal-title",style:{margin:0,paddingRight:z?52:44,fontFamily:h.typography.fontFamilyDisplay,fontSize:z?22:20,fontWeight:h.typography.fontWeight.normal,letterSpacing:"-0.01em",lineHeight:1.25,color:h.colors.text,...oe(1),...o?.title},children:ge}),jsx("button",{ref:Se,type:"button",onClick:w,"aria-label":"Close feedback form",style:{position:"absolute",top:z?14:16,right:z?14:18,width:z?44:32,height:z?44:32,border:"none",background:"transparent",outline:"none",cursor:"pointer",color:h.colors.closeButton,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:h.borders.radius.sm,transition:`color ${h.animation.duration.fast} ${h.animation.easing.default}`,...o?.closeButton},onMouseEnter:L=>{L.currentTarget.style.color=h.colors.closeButtonHover;},onMouseLeave:L=>{L.currentTarget.style.color=h.colors.closeButton;},children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1L11 11M1 11L11 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxs("div",{style:{padding:s?0:to,position:"relative"},children:[y&&!s&&jsxs("div",{role:"alert",style:{padding:"2px 0 2px 14px",marginBottom:16,borderLeft:`2px solid ${h.colors.error}`,color:h.colors.text,fontSize:h.typography.fontSize.sm,lineHeight:1.55,...oe(2),...o?.errorMessage},children:[y,jsx("span",{style:{color:h.colors.textSecondary},children:" \u2014 try again?"})]}),s&&jsxs("div",{style:{padding:z?"32px 24px 28px":"36px 28px 28px",textAlign:"center",position:"relative"},children:[jsx("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",style:{display:"block",margin:"0 auto 14px",...o?.successIcon},children:jsx("path",{d:"M10 20.5L17 27.5L31 13.5",stroke:h.colors.success,strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",style:{strokeDasharray:30,strokeDashoffset:30,animation:`gotcha-check-draw 320ms ${h.animation.easing.default} forwards`}})}),jsx("p",{style:{margin:0,fontFamily:h.typography.fontFamilyDisplay,fontSize:22,fontWeight:h.typography.fontWeight.normal,letterSpacing:"-0.01em",color:h.colors.text,...o?.successMessage},children:i}),jsx("p",{style:{margin:"8px 0 0",fontFamily:h.typography.fontFamily,fontSize:h.typography.fontSize.sm,color:h.colors.textSecondary,fontStyle:"italic"},children:"We\u2019ll close this in a moment."}),jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:1,right:1,bottom:1,height:1,backgroundColor:h.colors.success,transformOrigin:"left center",animation:`gotcha-progress ${vr}ms linear forwards`}})]}),l==="followUp"&&p&&g&&!s&&jsx("div",{style:oe(2),children:jsx(gt,{resolvedTheme:h,promptText:p.promptText,placeholder:p.placeholder,isLoading:a,onSubmit:g})}),l==="form"&&u&&jsx("div",{style:{display:"flex",justifyContent:"center",padding:"24px 0",...oe(2)},children:jsx(ct,{size:20,color:h.colors.textSecondary})}),l==="form"&&!u&&!s&&jsxs("div",{style:oe(2),children:[e==="feedback"&&jsx(nt,{resolvedTheme:h,placeholder:n,submitText:d,isLoading:c,onSubmit:q,customStyles:o,initialValues:v?{content:v.content,rating:v.rating}:void 0,isEditing:m,showText:f,showRating:E,enableBugFlag:F,bugFlagLabel:M,enableScreenshot:H}),e==="vote"&&jsx(st,{resolvedTheme:h,isLoading:c,onSubmit:q,initialVote:v?.vote||void 0,isEditing:m,labels:S}),e==="nps"&&jsx(ut,{resolvedTheme:h,submitText:d,isLoading:c,onSubmit:q,showFollowUp:T,followUpPlaceholder:U,lowLabel:N,highLabel:A,customStyles:o,initialValues:v?{rating:v.rating,content:v.content}:void 0,isEditing:m}),e==="poll"&&C&&C.length>0&&jsx(at,{resolvedTheme:h,options:C,allowMultiple:x,isLoading:c,onSubmit:q,initialSelected:v?.pollSelected||void 0,isEditing:m})]})]}),jsx("div",{"aria-live":"polite",className:"sr-only",children:s?"Thank you. Your feedback has been submitted.":y?`Error: ${y}`:""})]})}function Sr({elementId:e,user:r,userEmail:o,mode:t="feedback",showText:n=true,showRating:d=true,voteLabels:i,options:c,allowMultiple:u=false,npsQuestion:s,npsFollowUp:l=true,npsFollowUpPlaceholder:p,npsLowLabel:a,npsHighLabel:g,enableBugFlag:y=false,bugFlagLabel:v,enableScreenshot:m=false,onePerUser:f=false,cooldownDays:E,hideAfterSubmitDays:S,showAfterSeconds:C,showAfterScrollPercent:x,showAfterVisits:k,followUp:T,animated:U=true,position:N=se.POSITION,size:A=se.SIZE,theme:F=se.THEME,customStyles:M,visible:H=true,showOnHover:q=se.SHOW_ON_HOVER,touchBehavior:w=se.TOUCH_BEHAVIOR,promptText:O,placeholder:Fe,submitText:K=se.SUBMIT_TEXT,thankYouMessage:pe=se.THANK_YOU_MESSAGE,onSubmit:Se,onOpen:Re,onClose:Ue,onError:oo}){let{disabled:z,activeModalId:Ne,openModal:He,closeModal:J,defaultUser:h,defaultUserEmail:Be,client:ge,debug:Oe}=P(),{conditionsMet:Eo}=$o({elementId:e,showAfterSeconds:C,showAfterScrollPercent:x,showAfterVisits:k}),{isHidden:me,markHidden:We}=jo({elementId:e,userId:r?.id||h?.id,hideAfterSubmitDays:S}),[Me,Q]=useState("form"),[Ge,oe]=useState(null),[to,L]=useState(false),[V,Y]=useState(0),[Z,I]=useState(false),[te,To]=useState(null),[X,vt]=useState(false),[ko,St]=useState(false),xe=useRef(null),Le=useRef(),xt=useRef(null),De=useRef(null),[fe,Ye]=useState(null);useEffect(()=>{if(St(true),typeof window>"u")return;let b=window.matchMedia("(max-width: 1023px)"),G=()=>vt(b.matches);return G(),b.addEventListener("change",G),()=>{b.removeEventListener("change",G),clearTimeout(Le.current);}},[]),useEffect(()=>{Y(ge.getQueueLength());let b=()=>{setTimeout(()=>Y(ge.getQueueLength()),2e3);};return window.addEventListener("online",b),()=>window.removeEventListener("online",b)},[ge]);let re=Ne===e;useEffect(()=>{if(!re||X)return;let b=0,G=()=>{b||(b=requestAnimationFrame(()=>{b=0;let ne=xe.current;if(!ne)return;let we=ne.querySelector("button");To((we??ne).getBoundingClientRect());}));};return window.addEventListener("resize",G),window.addEventListener("scroll",G,{passive:true}),()=>{b&&cancelAnimationFrame(b),window.removeEventListener("resize",G),window.removeEventListener("scroll",G);}},[re,X]),useEffect(()=>{re||(Q("form"),clearTimeout(Le.current));},[re]),useEffect(()=>{if(!re||!X)return;let b=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=b;}},[re,X]),useEffect(()=>{if(!q)return;let b=xe.current;if(!b)return;let G=b.parentElement;if(!G)return;let ne=()=>I(true),we=()=>I(false);return G.addEventListener("mouseenter",ne),G.addEventListener("mouseleave",we),()=>{G.removeEventListener("mouseenter",ne),G.removeEventListener("mouseleave",we);}},[q]);let{submit:qe,isLoading:wt,isCheckingExisting:Et,error:Tt,existingResponse:kt,isEditing:Ao}=Ko({elementId:e,mode:t,pollOptions:c,user:r,userEmail:o??Be,onePerUser:f,cooldownDays:E,onSuccess:b=>{oe(b.id),Se?.(b),Ye(null),De.current=null;},onError:b=>{console.warn("[Gotcha] Submission failed:",b instanceof Error?b.message:b),oo?.(b),De.current&&Ye({message:b instanceof Error?b.message:"Something went wrong",retrying:false});}}),At=useCallback(()=>{if(xe.current){let b=xe.current.querySelector("button");To((b??xe.current).getBoundingClientRect());}He(e),Re?.();},[e,He,Re]),Co=useCallback(()=>{clearTimeout(Le.current),J(),Q("form"),Ue?.();},[J,Ue]),Ct=useCallback(b=>{xt.current={rating:b.rating,vote:b.vote},De.current=b,T&&(T.ratingThreshold!=null&&b.rating!=null&&b.rating<=T.ratingThreshold||T.onNegativeVote&&b.vote==="down")&&t!=="poll"?Q("followUp"):(Q("success"),Le.current=setTimeout(()=>{J(),Q("form");},4e3)),S&&We();let ne=typeof performance<"u"?performance.now():Date.now();qe(b).catch(()=>{}).finally(()=>{if(Oe){let we=(typeof performance<"u"?performance.now():Date.now())-ne;console.log(`[Gotcha] Server ack in ${we.toFixed(0)}ms`);}});},[qe,T,t,S,We,J,Oe]),Ft=useCallback(()=>{let b=De.current;!b||!fe||fe.retrying||(Ye({...fe,retrying:true}),qe(b).catch(()=>{}));},[fe,qe]),Rt=useCallback(()=>{Ye(null),De.current=null;},[]),Bt=useCallback(async b=>{if(Ge){L(true);try{await ge.updateResponse(Ge,{content:b});}catch(G){console.warn("[Gotcha] Follow-up submission failed:",G instanceof Error?G.message:G);}finally{L(false),Q("success"),Le.current=setTimeout(()=>{J(),Q("form");},4e3);}}},[Ge,J,ge]),Mt=f&&Ao?"Update":K;if(z||!H||me||!Eo)return null;let Gt={"top-right":{position:"absolute",top:0,right:0,transform:"translate(50%, -50%)"},"top-left":{position:"absolute",top:0,left:0,transform:"translate(-50%, -50%)"},"bottom-right":{position:"absolute",bottom:0,right:0,transform:"translate(50%, 50%)"},"bottom-left":{position:"absolute",bottom:0,left:0,transform:"translate(-50%, 50%)"},inline:{position:"relative",display:"inline-flex"}},Lt={mode:t,theme:F,customStyles:M,promptText:O,placeholder:Fe,submitText:Mt,thankYouMessage:pe,isLoading:wt,isCheckingExisting:f&&Et,isSubmitted:Me==="success",phase:Me,followUpConfig:T,followUpLoading:to,onFollowUpSubmit:Bt,error:Tt,existingResponse:f?kt:null,isEditing:f&&Ao,showText:n,showRating:d,voteLabels:i,options:c,allowMultiple:u,npsQuestion:s,npsFollowUp:l,npsFollowUpPlaceholder:p,npsLowLabel:a,npsHighLabel:g,enableBugFlag:y,bugFlagLabel:v,enableScreenshot:m,onSubmit:Ct,onClose:Co,anchorRect:te||void 0,useFixedPosition:!X,isMobile:X};return jsxs("div",{ref:xe,style:{...Gt[N],zIndex:"auto"},className:"gotcha-container","data-gotcha-element":e,children:[jsx(et,{size:A,theme:F,customStyles:M,showOnHover:q,touchBehavior:w,onClick:At,isOpen:re,isParentHovered:Z,animated:U,queuedCount:V}),fe&&ko&&createPortal(jsx(xr,{message:fe.message,retrying:fe.retrying,onRetry:Ft,onDismiss:Rt}),document.body),re&&ko&&createPortal(jsx("div",{role:"presentation",onClick:X?Co:void 0,style:{position:"fixed",inset:0,zIndex:99999,backgroundColor:X?"rgba(26,23,20,0.32)":"transparent",backdropFilter:X?"blur(8px)":"none",WebkitBackdropFilter:X?"blur(8px)":"none",pointerEvents:X?"auto":"none",transition:"background-color 180ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:jsx("div",{onClick:X?b=>b.stopPropagation():void 0,style:{pointerEvents:"auto"},children:jsx(ft,{...Lt})})}),document.body)]})}function xr({message:e,retrying:r,onRetry:o,onDismiss:t}){return jsxs("div",{role:"status","aria-live":"polite",className:"editorial",style:{position:"fixed",bottom:16,right:16,zIndex:99998,maxWidth:360,borderRadius:6,border:"1px solid rgba(155, 58, 46, 0.35)",backgroundColor:"#FAF8F4",boxShadow:"0 4px 16px rgba(26, 23, 20, 0.12)",padding:"14px 16px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif",color:"#1A1714",animation:"gotcha-fade-up 240ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:[jsx("div",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, 'Courier New', monospace",fontSize:10,textTransform:"uppercase",letterSpacing:"0.18em",color:"#9B3A2E",marginBottom:6},children:"Couldn\u2019t save"}),jsx("p",{style:{margin:0,fontSize:13,lineHeight:1.55,color:"#1A1714"},children:e||"Your feedback didn\u2019t reach us. Retry?"}),jsxs("div",{style:{marginTop:12,display:"flex",gap:8},children:[jsx("button",{type:"button",onClick:o,disabled:r,style:{backgroundColor:"#1A1714",color:"#FAF8F4",border:"none",borderRadius:4,padding:"6px 14px",fontSize:12,fontWeight:500,cursor:r?"default":"pointer",opacity:r?.6:1,transition:"opacity 180ms"},children:r?"Retrying\u2026":"Retry"}),jsx("button",{type:"button",onClick:t,style:{backgroundColor:"transparent",color:"#6B655D",border:"1px solid #E8E2D9",borderRadius:4,padding:"6px 14px",fontSize:12,cursor:"pointer",transition:"color 180ms"},children:"Dismiss"})]})]})}function bt({elementId:e,refreshInterval:r}){let{client:o}=P(),[t,n]=useState(null),[d,i]=useState(true),[c,u]=useState(null);return useEffect(()=>{let s=false,l=async()=>{try{let a=await o.getScore(e);s||(n(a),u(null));}catch(a){s||u(a instanceof Error?a.message:"Failed to load score");}finally{s||i(false);}};l();let p;return r&&r>0&&(p=setInterval(l,r)),()=>{s=true,p&&clearInterval(p);}},[o,e,r]),{score:t,isLoading:d,error:c}}var Ar={sm:{fontSize:11,ratingFontSize:13,starSize:13,gap:5,pillPx:8,pillPy:4,barHeight:3,iconSize:12},md:{fontSize:12.5,ratingFontSize:15,starSize:15,gap:6,pillPx:10,pillPy:5,barHeight:4,iconSize:14},lg:{fontSize:14,ratingFontSize:18,starSize:18,gap:8,pillPx:12,pillPy:6,barHeight:5,iconSize:16}};function Cr({rating:e,size:r,filledColor:o,emptyColor:t}){let n=`gotcha-star-clip-${Math.random().toString(36).slice(2,8)}`,d=[];for(let i=1;i<=5;i++){let c=Math.min(1,Math.max(0,e-(i-1))),u=`${n}-${i}`;d.push(jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",style:{display:"block"},children:[jsx("defs",{children:jsx("clipPath",{id:u,children:jsx("rect",{x:"0",y:"0",width:24*c,height:"24"})})}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:t}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:o,clipPath:`url(#${u})`})]},i));}return jsx("span",{style:{display:"inline-flex",gap:Math.max(1,r*.08),alignItems:"center"},children:d})}function Fr({rate:e,height:r,filledColor:o,trackColor:t}){return jsx("span",{style:{display:"inline-block",width:48,height:r,borderRadius:r,backgroundColor:t,overflow:"hidden",verticalAlign:"middle"},children:jsx("span",{style:{display:"block",width:`${e}%`,height:"100%",borderRadius:r,background:o,transition:"width 0.6s cubic-bezier(0.4, 0, 0.2, 1)"}})})}function Rr({size:e,color:r}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:jsx("path",{d:"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"})})}function Br({elementId:e,variant:r="stars",showCount:o=true,size:t="md",theme:n="auto",refreshInterval:d,style:i}){let{score:c,isLoading:u}=bt({elementId:e,refreshInterval:d}),[s,l]=useState("light");useEffect(()=>{if(typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");l(F.matches?"dark":"light");let M=H=>l(H.matches?"dark":"light");return F.addEventListener("change",M),()=>F.removeEventListener("change",M)},[]);let{themeConfig:p}=P(),a=useMemo(()=>ce(n,s,p),[n,s,p]);if(u||!c)return null;let g=Ar[t],y=a.colors.text,v=a.colors.textDisabled,m=a.colors.starFilled,f=a.colors.starEmpty,E=a.colors.voteUp,S=a.colors.starEmpty,C={display:"inline-flex",alignItems:"center",gap:g.gap,fontFamily:a.typography.fontFamily,lineHeight:1,WebkitFontSmoothing:"antialiased",...i},x={fontFamily:a.typography.fontFamily,fontSize:g.ratingFontSize,fontWeight:700,color:y,fontVariantNumeric:"tabular-nums",letterSpacing:"-0.01em",lineHeight:1},k={fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace",fontSize:Math.max(9,g.fontSize-1),color:v,fontWeight:400,letterSpacing:"0.1em",textTransform:"uppercase"},T=(F,M)=>{let H=F===1?M:`${M}s`;return `${F.toLocaleString()} ${H}`};if(r==="votes"){let{voteCount:F,positiveRate:M}=c,H=F.up+F.down;return H===0?null:jsxs("span",{style:C,children:[jsx(Rr,{size:g.iconSize,color:E}),jsxs("span",{style:{...x,color:E},children:[M,"%"]}),jsx(Fr,{rate:M??0,height:g.barHeight,filledColor:E,trackColor:S}),o&&jsx("span",{style:k,children:T(H,"vote")})]})}let{averageRating:U,totalResponses:N}=c;if(U===null||N===0)return null;let A=U.toFixed(1);return r==="compact"?jsxs("span",{style:C,children:[jsx("svg",{width:g.starSize,height:g.starSize,viewBox:"0 0 24 24",style:{display:"block",flexShrink:0},children:jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:m})}),jsx("span",{style:x,children:A}),o&&jsxs("span",{style:k,children:["(",N.toLocaleString(),")"]})]}):r==="number"?jsxs("span",{style:C,children:[jsx("span",{style:x,children:A}),jsx("span",{style:{...k,marginLeft:2},children:"/ 5"}),o&&jsxs("span",{style:{...k,marginLeft:2},children:["(",T(N,"response"),")"]})]}):jsxs("span",{style:C,children:[jsx(Cr,{rating:U,size:g.starSize,filledColor:m,emptyColor:f}),jsx("span",{style:x,children:A}),o&&jsxs("span",{style:k,children:["(",T(N,"response"),")"]})]})}function Mr(){let{client:e,disabled:r,defaultUser:o,debug:t,openModal:n,closeModal:d,activeModalId:i}=P();return {client:e,disabled:r,defaultUser:o,debug:t,submitFeedback:e.submitResponse.bind(e),openModal:n,closeModal:d,activeModalId:i}}function Gr(e){let{activeModalId:r,openModal:o,closeModal:t}=P(),n=useCallback(()=>o(e),[o,e]),d=useCallback(()=>t(),[t]);return {open:n,close:d,isOpen:r===e}}
135
135
  export{Sr as Gotcha,Kt as GotchaProvider,Br as GotchaScore,Nt as createTheme,Mr as useGotcha,Gr as useGotchaTrigger};//# sourceMappingURL=index.mjs.map
136
136
  //# sourceMappingURL=index.mjs.map