blocfeed 0.24.0 → 0.25.0

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.
@@ -1,884 +0,0 @@
1
- import {createContext,forwardRef,useState,useEffect,useRef,useMemo,useImperativeHandle,useCallback,useContext}from'react';import {record}from'rrweb';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';import {AnimatePresence,motion}from'framer-motion';function T(){return typeof window<"u"&&typeof document<"u"}function Kt(e){let t=globalThis.CSS;return typeof t?.escape=="function"?t.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>{let o=n.codePointAt(0);return o===void 0?"":`\\${o.toString(16)} `})}function Ce(e){return {x:e.x,y:e.y,width:e.width,height:e.height}}function qo(e){return {x:e.x+window.scrollX,y:e.y+window.scrollY,width:e.width,height:e.height}}function $o(e){return e.replace(/\s+/g," ").trim()}function re(e,t=140){let n=e.textContent;if(!n)return;let o=$o(n);if(o)return o.length<=t?o:`${o.slice(0,t-1)}\u2026`}function Ko(e){let t=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName===e.tagName&&(t+=1);return t}var ft=["data-testid","data-test-id","data-test","data-qa","data-cy"],ut="data-blocfeed-component";function le(e){let t=e.closest(`[${ut}]`);if(!t)return;let o=t.getAttribute(ut)?.trim();return o||void 0}function we(e,t=5){let n=[],o=e,r=0;for(;o&&r<t*4;){let i=le(o);if(i&&n[n.length-1]!==i&&(n.push(i),n.length>=t))break;o=o.parentElement,r++;}return n}function xe(e,t=4){let n=e,o=0;for(;n&&o<t;){let i=n.getAttribute(ut)?.trim();if(i)return `bf:component:${i}`;for(let a of ft){let b=n.getAttribute(a)?.trim();if(b)return `bf:testid:${b}`}let c=n.getAttribute("id")?.trim();if(c&&!/^\d/.test(c))return `bf:id:${c}`;n=n.parentElement,o+=1;}return null}function Xo(e){for(let t of ft){let n=e.closest(`[${t}]`);if(!n)continue;let r=n.getAttribute(t)?.trim();if(r)return r}}function Xt(e){try{let t=e,n=Object.getOwnPropertyNames(t);for(let o of n)if(o.startsWith("__reactFiber$")||o.startsWith("__reactInternalInstance$")){let r=t[o];if(r&&typeof r=="object")return r}}catch{}return null}function pe(e){if(e.length<=1||e.length===2&&e[0]===e[0].toLowerCase()||e.startsWith("__")&&e.endsWith("__"))return true;let t=e[0];return t>="a"&&t<="z"}function Te(e){if(e){for(let t of e)if(typeof t.name=="string"&&t.name&&!pe(t.name))return t.name}}function X(e){if(e&&typeof e!="string"){if(typeof e=="function"){let t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.name=="string"&&t.name?t.name:void 0}if(typeof e=="object"){let t=e,n=t.displayName;if(typeof n=="string"&&n)return n;let o=t.render;if(typeof o=="function"){let i=o;if(typeof i.displayName=="string"&&i.displayName)return i.displayName;if(typeof i.name=="string"&&i.name)return i.name}let r=t.type;return X(r)}}}function pt(e){let t=Xt(e);if(!t)return;let n=Te(t._debugInfo);if(n)return n;let o=t._debugOwner!==void 0;if(o){let a=t._debugOwner;for(let l=0;a&&l<50;l+=1){let b=Te(a._debugInfo);if(b)return b;let g=X(a.type)??X(a.elementType);if(g&&!pe(g))return g;a=a._debugOwner;}}if(t._owner!==void 0&&t._owner!==t._debugOwner){let a=t._owner;for(let l=0;a&&l<50;l+=1){let b=Te(a._debugInfo);if(b)return b;let g=X(a.type)??X(a.elementType);if(g&&!pe(g))return g;a=a._owner;}}let i=t,s=o?80:25;for(let a=0;i&&a<s;a+=1){let l=Te(i._debugInfo);if(l)return l;let b=X(i.type)??X(i.elementType);if(b&&!pe(b))return b;i=i.return;}let c=e.parentElement;for(let a=0;c&&a<15;a+=1){let l=Xt(c);if(l){let b=Te(l._debugInfo);if(b)return b;let g=X(l.type)??X(l.elementType);if(g&&!pe(g))return g;if(l._debugOwner){let d=X(l._debugOwner.type)??X(l._debugOwner.elementType);if(d&&!pe(d))return d}if(l._owner&&l._owner!==l._debugOwner){let d=X(l._owner.type)??X(l._owner.elementType);if(d&&!pe(d))return d}}c=c.parentElement;}}function jo(e){let t=e.tagName.toLowerCase(),n=e.getAttribute("id");if(n)return `#${Kt(n)}`;for(let o of ft){let r=e.getAttribute(o);if(r)return `${t}[${o}="${Kt(r)}"]`}return `${t}:nth-of-type(${Ko(e)})`}function me(e,t=10){let n=[],o=e;for(;o&&n.length<t;){let r=jo(o);if(n.unshift(r),r.startsWith("#"))break;o=o.parentElement;}return n.join(" > ")}var Yo=new Set(["button","link","tab","menuitem"]);function Yt(e){if(e.tagName==="BUTTON")return e.disabled?null:"button";if(e.tagName==="A"||e.tagName==="a"){let n=e.getAttribute("href")?.trim();return !n||n==="#"||n.toLowerCase().startsWith("javascript:")?null:"link"}let t=e.getAttribute("role");if(t&&Yo.has(t))return "role";try{if(window.getComputedStyle(e).cursor==="pointer")return "cursor_pointer"}catch{}return null}function jt(e,t){if(!t||t.length===0)return false;for(let n of t)if(e.closest(n))return true;return false}function mt(e,t){if(!e||jt(e,t.ignoreSelectors))return null;let n=e;for(;n;){if(jt(n,t.ignoreSelectors))return null;if(t.isSelectable?t.isSelectable(n):Go(n))return n;n=n.parentElement;}return null}function ze(e,t){if(t.length===0)return false;for(let n of t)try{if(e.matches(n)||e.closest(n))return !0}catch{}return false}function Go(e){let t=e.tagName;return !(t==="HTML"||t==="BODY")}function Gt(e){let t=e.getBoundingClientRect(),n={selector:me(e),tagName:e.tagName.toLowerCase(),rect:Ce(t),pageRect:qo(t)},o=e.getAttribute("id");o&&(n.id=o);let r=e.className;typeof r=="string"&&r.trim()&&(n.className=r);let i=re(e);i&&(n.textSnippet=i);let s=le(e)??pt(e);s&&(n.componentName=s);let c=Xo(e);return c&&(n.testId=c),n}function Jo(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return "Unknown error"}}function k(e,t,n){let o={kind:e,message:Jo(t)};return n&&(o.detail=n),o}var gt=null;async function Jt(){return gt||(gt=import('html-to-image')),gt}async function Zo(e){return await new Promise((t,n)=>{let o=new Image;o.onload=()=>t({width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>n(new Error("Failed to load generated screenshot")),o.src=e;})}async function Zt(e,t){let{width:n,height:o}=await Zo(e);return {dataUrl:e,mime:t,width:n,height:o}}function Ee(e){if(e?.aborted)throw new Error("Aborted")}function Qt(){return {async captureElement(e,t){if(!T())throw new Error("captureElement can only run in the browser");Ee(t.signal);let n=await Jt();Ee(t.signal);let o=t.mime==="image/jpeg"?await n.toJpeg(e,{quality:t.quality??.92,pixelRatio:t.pixelRatio}):await n.toPng(e,{pixelRatio:t.pixelRatio});return Ee(t.signal),await Zt(o,t.mime)},async captureFullPage(e){if(!T())throw new Error("captureFullPage can only run in the browser");Ee(e.signal);let t=document.documentElement,n=Math.max(t.scrollWidth,t.clientWidth),o=Math.max(t.scrollHeight,t.clientHeight),r=Math.min(1,e.maxDimension/Math.max(n,o)),i=Math.max(1,Math.round(n*r)),s=Math.max(1,Math.round(o*r)),c=await Jt();Ee(e.signal);let a=e.mime==="image/jpeg"?await c.toJpeg(t,{width:i,height:s,quality:e.quality??.92,pixelRatio:e.pixelRatio}):await c.toPng(t,{width:i,height:s,pixelRatio:e.pixelRatio});return Ee(e.signal),await Zt(a,e.mime)}}}var Qo=12e3,er=2048,tr=.92;function en(){return Date.now()}function nr(e){return new Promise((t,n)=>{let o=()=>n(new Error("Aborted"));if(e.aborted){o();return}e.addEventListener("abort",o,{once:true});})}async function tn(e,t,n){let o=new Promise((i,s)=>{let c=setTimeout(()=>s(new Error("Timeout")),t);typeof c.unref=="function"&&c.unref();}),r=[e,o];return n&&r.push(nr(n)),await Promise.race(r)}function or(e){if(!T())return 1;let t=window.devicePixelRatio||1,n=e?.pixelRatio??Math.min(t,2);return Math.max(.1,n)}function rr(e){return !!(e?.element||e?.fullPage)}function nn(e){let t={mime:e.mime,pixelRatio:e.pixelRatio,maxDimension:e.maxDimension};return e.includeQuality&&(t.quality=e.quality),e.signal&&(t.signal=e.signal),t}async function on(e){let{selectionElement:t,capture:n,signal:o}=e;if(!T()||!rr(n))return;let r=en(),i=[],s=n?.timeoutMs??Qo,c=n?.maxDimension??er,a=n?.mime??"image/png",l=n?.quality??tr,b=n?.adapter??Qt(),g={},d=or(n);if(n?.element&&t)try{let p=t.getBoundingClientRect(),f=Math.min(1,c/Math.max(p.width,p.height)),m=Math.min(d,d*f),y=await tn(Promise.resolve(b.captureElement(t,{...nn({mime:a,quality:l,pixelRatio:m,maxDimension:c,includeQuality:a==="image/jpeg",...o?{signal:o}:{}})})),s,o);g.element=y;}catch(p){if(o?.aborted)throw p;i.push(k("capture_failed",p,{target:"element"}));}if(n?.fullPage)try{let p=await tn(Promise.resolve(b.captureFullPage(nn({mime:a,quality:l,pixelRatio:d,maxDimension:c,includeQuality:a==="image/jpeg",...o?{signal:o}:{}}))),s,o);g.fullPage=p;}catch(p){if(o?.aborted)throw p;i.push(k("capture_failed",p,{target:"fullPage"}));}let h=en(),u={startedAt:r,finishedAt:h,durationMs:Math.max(0,h-r)};return i.length>0&&(u.errors=i),{...g,diagnostics:u}}function ir(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ar(){return T()?{url:window.location.href,title:document.title,referrer:document.referrer||void 0,userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,viewport:{width:window.innerWidth,height:window.innerHeight},screen:{width:window.screen.width,height:window.screen.height},scroll:{x:window.scrollX,y:window.scrollY},devicePixelRatio:window.devicePixelRatio||1,timezone:ir()}:{}}function sr(e){if(!e)return {};let t={};return e.id&&(t.userId=e.id),e.email&&(t.userEmail=e.email),e.name&&(t.userName=e.name),t}async function rn(e){let{config:t,context:n,user:o}=e;if(t?.enabled===false)return {};let r={...ar(),...sr(o)},i=t?.enrich;if(!i)return r;try{let s=await i(n);return {...r,...s}}catch(s){let c=k("unknown",s);return {...r,blocfeedMetadataError:c.message}}}var Re="blocfeed-queue",cr=50;function bt(){if(!T())return [];try{let e=localStorage.getItem(Re);if(!e)return [];let t=JSON.parse(e);if(Array.isArray(t))return t;console.warn("[BlocFeed] offline queue was corrupt (non-array) \u2014 resetting");try{localStorage.removeItem(Re);}catch{}return []}catch(e){console.warn("[BlocFeed] offline queue could not be read \u2014 resetting",e);try{localStorage.removeItem(Re);}catch{}return []}}function ht(e){if(T())try{e.length===0?localStorage.removeItem(Re):localStorage.setItem(Re,JSON.stringify(e));}catch(t){let n=t instanceof DOMException?t.name:"";console.warn(`[BlocFeed] failed to persist offline queue${n?` (${n})`:""} \u2014 feedback may be lost if page is closed`);}}function lr(e){let t={...e};if(t.screenshots){let n={...t.screenshots};n.element&&(n.element={...n.element,dataUrl:""}),n.fullPage&&(n.fullPage={...n.fullPage,dataUrl:""}),t.screenshots=n;}return delete t.video,t}function yt(e){let t=bt(),n=lr(e);for(n.metadata={...n.metadata,_queued:true},t.push({payload:n,timestamp:Date.now()});t.length>cr;)t.shift();ht(t);}function an(){let e=bt();return e.length===0?[]:(ht([]),e.map(t=>t.payload))}function Ga(){ht([]);}function sn(){return bt().length}function vt(e){let t=null,n=null,o=(...r)=>{n=r,t===null&&(t=requestAnimationFrame(()=>{if(t=null,!n)return;let i=n;n=null,e(...i);}));};return o.cancel=()=>{t!==null&&cancelAnimationFrame(t),t=null,n=null;},o}function Ve(e){return e instanceof Element?!!e.closest("[data-blocfeed-ui]"):false}function We(e){e.stopPropagation(),e.stopImmediatePropagation?.();}function cn(e,t){if(!T())throw new Error("BlocFeed picker can only run in a browser environment.");let n=e.ignoreSelectors,o=e.isSelectable,r={};n&&n.length>0&&(r.ignoreSelectors=n),o&&(r.isSelectable=o);let i=null,s=null,c=(u,p=false)=>{if(!u){i=null,s=null,t.onHover(null);return}let f=Ce(u.getBoundingClientRect()),m=`${Math.round(f.x)}:${Math.round(f.y)}:${Math.round(f.width)}:${Math.round(f.height)}`;!p&&u===i&&m===s||(i=u,s=m,t.onHover({element:u,rect:f}));},a=vt(u=>{if(Ve(u.target))return;let p=document.elementFromPoint(u.clientX,u.clientY),f=mt(p,r);c(f);}),l=vt(()=>{i&&c(i,true);}),b=u=>{Ve(u.target)||(We(u),u.pointerType==="mouse"&&u.preventDefault());},g=u=>{Ve(u.target)||(We(u),u.pointerType==="mouse"&&u.preventDefault());},d=u=>{if(Ve(u.target))return;We(u),u.preventDefault();let p=document.elementFromPoint(u.clientX,u.clientY),f=mt(p,r);f&&t.onSelect({element:f,descriptor:Gt(f)});},h=u=>{u.key==="Escape"&&(We(u),u.preventDefault(),t.onCancel());};return window.addEventListener("pointermove",a,{capture:true,passive:true}),window.addEventListener("pointerdown",b,{capture:true}),window.addEventListener("pointerup",g,{capture:true}),window.addEventListener("click",d,{capture:true}),window.addEventListener("keydown",h,{capture:true}),window.addEventListener("scroll",l,{capture:true,passive:true}),window.addEventListener("resize",l,{passive:true}),{stop(){window.removeEventListener("pointermove",a,{capture:true}),window.removeEventListener("pointerdown",b,{capture:true}),window.removeEventListener("pointerup",g,{capture:true}),window.removeEventListener("click",d,{capture:true}),window.removeEventListener("keydown",h,{capture:true}),window.removeEventListener("scroll",l,{capture:true}),window.removeEventListener("resize",l),a.cancel(),l.cancel(),t.onHover(null);}}}var dr=200,Pe=[],ln=0,qe=false;function dn(e){let t=e.target;if(!(t instanceof Element)||t.closest("[data-blocfeed-ui]"))return;let n={timestampMs:Date.now()-ln,path:window.location.pathname,tagName:t.tagName.toLowerCase()},o=re(t,100);o&&(n.textSnippet=o);let r=le(t)??pt(t);r&&(n.componentName=r),Pe.length<dr&&Pe.push(n);}var un={capture:true,passive:true};function fn(){qe||!T()||(qe=true,Pe=[],ln=Date.now(),document.addEventListener("click",dn,un));}function pn(){qe&&(qe=false,document.removeEventListener("click",dn,un));}function wt(){return [...Pe]}function ur(){Pe=[];}var fr=3e4,pr=25e5,mn="video/webm",mr=250,gr=1e3,br=["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];function gn(){if(typeof MediaRecorder>"u")return null;for(let e of br)if(MediaRecorder.isTypeSupported(e))return e;return null}function xt(){return !T()||typeof navigator?.mediaDevices?.getDisplayMedia!="function"?false:gn()!==null}async function Et(e){let{config:t,signal:n}=e;if(!T()||typeof navigator?.mediaDevices?.getDisplayMedia!="function")throw k("recording_failed",new Error("Screen recording is not supported in this browser"));let o=gn();if(!o)throw k("recording_failed",new Error("No supported video codec found (WebM required)"));if(n?.aborted)throw k("aborted",new Error("Recording aborted before start"));let r;try{r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1});}catch(f){let m=f instanceof DOMException&&f.name==="NotAllowedError"?"Screen share permission denied":"Failed to start screen share";throw k("recording_failed",new Error(m))}if(n?.aborted)throw r.getTracks().forEach(f=>f.stop()),k("aborted",new Error("Recording aborted after permission"));let i=t?.maxDurationMs??fr,s=t?.videoBitsPerSecond??pr,c=new MediaRecorder(r,{mimeType:o,videoBitsPerSecond:s}),a=[],l=[],b=0,g=null,d=null,h=false,u=()=>{pn(),g!==null&&(clearInterval(g),g=null),d!==null&&(clearTimeout(d),d=null),r.getTracks().forEach(f=>f.stop());},p=new Promise((f,m)=>{c.ondataavailable=C=>{C.data.size>0&&a.push(C.data);},c.onstop=()=>{if(h)return;h=true,u();let C=Date.now()-b,_=new Blob(a,{type:mn}),E=URL.createObjectURL(_);f({mime:mn,blobUrl:E,blob:_,durationMs:C,sizeBytes:_.size});},c.onerror=()=>{h||(h=true,u(),m(k("recording_failed",new Error("MediaRecorder error"))));};let y=r.getVideoTracks()[0];if(y&&y.addEventListener("ended",()=>{c.state!=="inactive"&&c.stop();}),n){let C=()=>{h||(h=true,c.state!=="inactive"&&c.stop(),u(),m(k("aborted",new Error("Recording aborted"))));};n.addEventListener("abort",C,{once:true});}});return c.start(gr),fn(),b=Date.now(),g=setInterval(()=>{let f=Date.now()-b;for(let m of l)m(f);},mr),d=setTimeout(()=>{!h&&c.state!=="inactive"&&c.stop();},i),{result:p,stop(){!h&&c.state!=="inactive"&&c.stop();},onTick(f){l.push(f);},abort(){h||(h=true,c.state!=="inactive"&&c.stop(),u());}}}var hr=6e4,bn="audio/webm",yr=250,vr=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus"];function hn(){if(typeof MediaRecorder>"u")return null;for(let e of vr)if(MediaRecorder.isTypeSupported(e))return e;return null}function kt(){return !T()||typeof navigator?.mediaDevices?.getUserMedia!="function"?false:hn()!==null}async function St(e){let{config:t,signal:n}=e;if(!T()||typeof navigator?.mediaDevices?.getUserMedia!="function")throw k("recording_failed",new Error("Microphone recording is not supported in this browser"));let o=hn();if(!o)throw k("recording_failed",new Error("No supported audio codec found"));if(n?.aborted)throw k("aborted",new Error("Voice recording aborted before start"));let r;try{r=await navigator.mediaDevices.getUserMedia({audio:!0});}catch(p){let f=p instanceof DOMException&&p.name==="NotAllowedError"?"Microphone permission denied":"Failed to access microphone";throw k("recording_failed",new Error(f))}if(n?.aborted)throw r.getTracks().forEach(p=>p.stop()),k("aborted",new Error("Voice recording aborted after permission"));let i=t?.maxDurationMs??hr,s=new MediaRecorder(r,{mimeType:o}),c=[],a=[],l=0,b=null,g=null,d=false,h=()=>{b!==null&&(clearInterval(b),b=null),g!==null&&(clearTimeout(g),g=null),r.getTracks().forEach(p=>p.stop());},u=new Promise((p,f)=>{if(s.ondataavailable=m=>{m.data.size>0&&c.push(m.data);},s.onstop=()=>{if(d)return;d=true,h();let m=Date.now()-l,y=new Blob(c,{type:bn});p({blob:y,mime:bn,durationMs:m});},s.onerror=()=>{d||(d=true,h(),f(k("recording_failed",new Error("MediaRecorder error"))));},n){let m=()=>{d||(d=true,s.state!=="inactive"&&s.stop(),h(),f(k("aborted",new Error("Voice recording aborted"))));};n.addEventListener("abort",m,{once:true});}});return s.start(1e3),l=Date.now(),b=setInterval(()=>{let p=Date.now()-l;for(let f of a)f(p);},yr),g=setTimeout(()=>{g=null,!d&&s.state!=="inactive"&&s.stop();},i),{result:u,stop(){!d&&s.state!=="inactive"&&s.stop();},onTick(p){a.push(p);},abort(){d||(d=true,s.state!=="inactive"&&s.stop(),h());}}}var wr=12e3,xr=2,Er=500,kr=2e3,_t="https://blocfeed.com/api/feedback",Sr="https://blocfeed.com/api/feedback/voice",yn=0,xn="blocfeed-viewer-token",En="blocfeed-my-feedback-url";function _r(){try{return localStorage.getItem(xn)}catch{return null}}function Tt(){try{return localStorage.getItem(En)}catch{return null}}function Tr(e,t){try{localStorage.setItem(xn,e),t&&localStorage.setItem(En,t);}catch{}}function vn(e,t){return new Promise((n,o)=>{if(t?.aborted){o(new Error("Aborted"));return}let r=setTimeout(n,e),i=()=>{clearTimeout(r),o(new Error("Aborted"));};t?.addEventListener("abort",i,{once:true});})}function Cr(e){return e>=500&&e<=599}function Rr(e){let[t,n]=e.split(",",2);if(!t||!n)throw new Error("Invalid data URL");let r=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",i=atob(n),s=new Uint8Array(i.length);for(let c=0;c<i.length;c+=1)s[c]=i.charCodeAt(c);return new Blob([s],{type:r})}function Pr(e){let t={},n={},o={...e};if(o.screenshots){let r={},i={...o.screenshots};i.element&&(t.element=i.element.dataUrl,r.element={mime:i.element.mime,width:i.element.width,height:i.element.height},i.element={...i.element,dataUrl:""}),i.fullPage&&(t.fullPage=i.fullPage.dataUrl,r.fullPage={mime:i.fullPage.mime,width:i.fullPage.width,height:i.fullPage.height},i.fullPage={...i.fullPage,dataUrl:""}),o.screenshots=i,(r.element||r.fullPage)&&(o.screenshot_intent=r);}return o.video&&(n.blob=o.video.blob,o.video_intent={mime:o.video.mime,durationMs:o.video.durationMs,sizeBytes:o.video.sizeBytes},delete o.video),{lean:o,extracted:t,extractedVideo:n}}async function wn(e,t,n){let o=Rr(t);await fetch(e,{method:"PUT",body:o,headers:{"content-type":o.type},...n?{signal:n}:{}});}async function Fr(e){let{feedbackId:t,extracted:n,screenshots:o,signal:r}=e,i={};n.element&&o?.element&&(i.element={dataUrl:n.element,mime:o.element.mime,width:o.element.width,height:o.element.height}),n.fullPage&&o?.fullPage&&(i.fullPage={dataUrl:n.fullPage,mime:o.fullPage.mime,width:o.fullPage.width,height:o.fullPage.height}),Object.keys(i).length!==0&&await fetch(`${_t}/${t}/screenshots`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),...r?{signal:r}:{}});}async function Br(e){await fetch(`${_t}/${e.feedbackId}/video`,{method:"POST",body:e.blob,headers:{"content-type":e.blob.type},...e.signal?{signal:e.signal}:{}});}async function kn(e){let{signal:t,transport:n}=e;if(Date.now()-yn<kr)return {ok:false,error:k("configuration",new Error("Please wait before submitting again"))};let r=n?.timeoutMs??wr,i=n?.maxAttempts??xr,s=n?.backoffMs??Er,c=!!(e.payload.screenshots?.element?.dataUrl||e.payload.screenshots?.fullPage?.dataUrl),a=!!e.payload.video?.blob,l=c||a,{lean:b,extracted:g,extractedVideo:d}=l?Pr(e.payload):{lean:e.payload,extracted:{},extractedVideo:{}},h=_r();h&&(b.viewer_token=h);let u={...g,...e.screenshotDataUrls};for(let p=1;p<=i;p+=1){let f=new AbortController,m=setTimeout(()=>f.abort(),r),y=()=>f.abort();t&&t.addEventListener("abort",y,{once:true});try{let C=await fetch(_t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b),signal:f.signal});if(C.ok){yn=Date.now();let E;try{E=await C.json();}catch{}if(E?.viewer_token&&Tr(E.viewer_token,E.my_feedback_url),(u.element||u.fullPage)&&E){let F=E.upload_urls;if(F){let A=[];u.element&&F.element&&A.push(wn(F.element,u.element,t)),u.fullPage&&F.fullPage&&A.push(wn(F.fullPage,u.fullPage,t));try{await Promise.all(A);}catch{}}else if(E.feedback_id)try{await Fr({feedbackId:E.feedback_id,extracted:u,screenshots:e.payload.screenshots,...t?{signal:t}:{}});}catch{}}if(d.blob&&E){let F=E.upload_urls;if(F?.video)try{await fetch(F.video,{method:"PUT",body:d.blob,headers:{"content-type":d.blob.type},...t?{signal:t}:{}});}catch{}else if(E.feedback_id)try{await Br({feedbackId:E.feedback_id,blob:d.blob,...t?{signal:t}:{}});}catch{}}let H={ok:!0,status:C.status};return E&&(H.apiResponse=E),H}if(p<i&&Cr(C.status)){let E=.85+Math.random()*.3,z=Math.round(s*2**(p-1)*E);await vn(z,t);continue}let _=`HTTP ${C.status}`;try{let E=await C.json();E?.error&&(_=E.error);}catch{}return {ok:!1,status:C.status,error:k("api_failed",new Error(_))}}catch(C){if(f.signal.aborted||t?.aborted)return {ok:false,error:k("aborted",C)};if(p<i){let _=.85+Math.random()*.3,E=Math.round(s*2**(p-1)*_);await vn(E,t);continue}return {ok:false,error:k("api_failed",C)}}finally{clearTimeout(m),t&&t.removeEventListener("abort",y);}}return {ok:false,error:k("api_failed",new Error("Failed"))}}async function Sn(e){let{blob:t,mime:n,blocfeedId:o,signal:r}=e,i=await fetch(Sr,{method:"POST",headers:{"Content-Type":n,"X-Blocfeed-Id":o},body:t,...r?{signal:r}:{}});if(!i.ok){let c=await i.json().catch(()=>({error:"Unknown error"}));throw k("api_failed",new Error(c?.error??`Voice API returned ${i.status}`))}let s=await i.json();return {text:s.text??"",warning:s.warning}}async function Ct(e){let{signal:t,transport:n}=e,o={ok:false};try{let r={payload:e.payload,...t?{signal:t}:{},...n?{transport:n}:{}};o.api=await kn(r),o.ok=!!o.api?.ok;}catch(r){o.api={ok:false,error:k("api_failed",r)},o.ok=false;}return {payload:e.payload,result:o}}var Mr={enabled:true,sampling:1,ignoreSelectors:["[data-blocfeed-ui]","[data-blocfeed-ignore]"],rageClick:{enabled:true,threshold:3,windowMs:1e3,streakIdleMs:1500},httpFail:{enabled:true,statusCodes:[400,401,403,404,408,409,422,429,500,502,503,504],ignoreUrls:["/api/behavioral-events","/api/feedback"],treatJsonErrorAsFail:false},redirectLoop:{enabled:true,threshold:3,windowMs:2e3},formDataLoss:{enabled:true},deadClick:{enabled:true,observationWindowMs:300,rateLimitPerSelector:5},piiScrub:"default"};function _n(e){let t=Mr;return {enabled:e?.enabled??t.enabled,sampling:e?.sampling??t.sampling,ignoreSelectors:e?.ignoreSelectors??t.ignoreSelectors,rageClick:{...t.rageClick,...e?.rageClick??{}},httpFail:{...t.httpFail,...e?.httpFail??{}},redirectLoop:{...t.redirectLoop,...e?.redirectLoop??{}},formDataLoss:{...t.formDataLoss,...e?.formDataLoss??{}},deadClick:{...t.deadClick,...e?.deadClick??{}},piiScrub:e?.piiScrub??t.piiScrub}}function Tn(e){let t=[];async function n(){if(t.length===0)return;let r=t.splice(0,50);try{await fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-blocfeed-id":e.blocfeedId},body:JSON.stringify({events:r}),keepalive:!0});}catch{}}function o(){if(t.length===0)return;if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"){n();return}let r=t.splice(0,50),i=new Blob([JSON.stringify({events:r})],{type:"application/json"}),s=`${e.endpoint}?_bfid=${encodeURIComponent(e.blocfeedId)}`;try{navigator.sendBeacon(s,i);}catch{}}return {enqueue(r){t.push(r);},flush:n,flushBeacon:o,size(){return t.length}}}var Cn="bf_behavioral_session",$e=null;function D(){try{let e=sessionStorage.getItem(Cn);if(e)return e;let t=Rn();return sessionStorage.setItem(Cn,t),t}catch{return $e||($e=Rn(),$e)}}function Rn(){let e=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `bf_${Date.now()}_${e}`}function Ke(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function Pn(e,t){if(!e.rageClick.enabled)return ()=>{};let{threshold:n,windowMs:o,streakIdleMs:r}=e.rageClick,i=new Map;function s(g){let d=g.target,h=d?Ar(d):false,u=d?re(d,200)??null:null,p=d?d.tagName.toLowerCase():"",f=d&&d.id||null,m=d?le(d)??null:null,y=d?we(d,5):[];return {session_id:D(),event_type:"rage_click",page_url:typeof window>"u"?"":window.location.href,selector:g.selector,element_text:u,event_data:{click_count:g.timestamps.length,window_ms:o,final:true,...h?{disabled:true}:{},tag_name:p,...f?{element_id:f}:{},...m?{component_name:m}:{},...y.length>0?{parent_components:y}:{}},created_at:new Date().toISOString(),stable_key:g.stableKey}}function c(g){let d=i.get(g);d&&(d.idleTimer&&(clearTimeout(d.idleTimer),d.idleTimer=null),d.reached&&t(s(d)),i.delete(g));}function a(g){let d=i.get(g);d&&(d.idleTimer&&clearTimeout(d.idleTimer),d.idleTimer=setTimeout(()=>{c(g);},r));}function l(g){try{let d=g.target;if(!d||!(d instanceof Element)||ze(d,e.ignoreSelectors))return;let h=me(d,4);if(!h)return;let u=xe(d),p=u??h,f=Date.now(),m=i.get(p);m?(m.target=d,m.selector=h):(m={selector:h,stableKey:u,timestamps:[],reached:!1,idleTimer:null,target:d},i.set(p,m)),m.reached||(m.timestamps=m.timestamps.filter(y=>f-y<=o)),m.timestamps.push(f),a(p),!m.reached&&m.timestamps.length>=n&&(m.reached=!0);}catch{}}function b(){for(let g of Array.from(i.keys()))c(g);}return document.addEventListener("click",l,{capture:true,passive:true}),typeof window<"u"&&window.addEventListener("pagehide",b),()=>{document.removeEventListener("click",l,{capture:true}),typeof window<"u"&&window.removeEventListener("pagehide",b);for(let g of i.values())g.idleTimer&&clearTimeout(g.idleTimer);i.clear();}}function Ar(e){if(e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true")return true;try{if(window.getComputedStyle(e).pointerEvents==="none")return !0}catch{}return false}var Fn=0,Bn=null,je=null,Ye=[],Ir=1500;function Lr(){function e(t){try{let n=t.target;if(!n)return;let o=n.closest('button[type="submit"], input[type="submit"], [data-blocfeed-submit]');if(!o)return;Fn=Date.now();let r=o.closest("form");Bn=(r?me(r,3):"")||null,je=re(o,100)??null,Ye=we(o,5);}catch{}}return document.addEventListener("click",e,{capture:true,passive:true}),()=>document.removeEventListener("click",e,{capture:true})}function Mn(e,t){if(!e.httpFail.enabled)return ()=>{};let{statusCodes:n,ignoreUrls:o,treatJsonErrorAsFail:r}=e.httpFail,i=new Set(n),s=Lr(),c=globalThis.fetch,a=async(d,h)=>{let u=typeof d=="string"?d:d instanceof URL?d.toString():d.url,p=(h?.method??d.method??"GET").toUpperCase(),f;try{f=await c.call(globalThis,d,h);}catch(m){try{if(!Xe(u,o)){let y=m&&typeof m=="object"&&m.name==="AbortError"?"abort":"network";t(g(0,u,p,y));}}catch{}throw m}try{if(!Xe(u,o)&&i.has(f.status))t(g(f.status,u,p));else if(r&&!Xe(u,o)&&f.status>=200&&f.status<300){let m=f.headers.get("content-type")??"";(m.includes("application/json")||m.includes("+json"))&&f.clone().json().then(y=>{if(Nr(y))try{t(g(f.status,u,p,"json_error"));}catch{}}).catch(()=>{});}}catch{}return f};globalThis.fetch=a;let l=XMLHttpRequest.prototype.open,b=XMLHttpRequest.prototype.send;return XMLHttpRequest.prototype.open=function(d,h,...u){return this.__bf_url=h,this.__bf_method=d.toUpperCase(),l.call(this,d,h,...u)},XMLHttpRequest.prototype.send=function(d){let h=()=>{try{let u=this.__bf_url??"",p=this.__bf_method??"GET";!Xe(u,o)&&i.has(this.status)&&t(g(this.status,u,p));}catch{}};return this.__bf_handler=h,this.addEventListener("loadend",h),b.call(this,d??null)},()=>{globalThis.fetch=c,XMLHttpRequest.prototype.open=l,XMLHttpRequest.prototype.send=b,s(),je=null,Ye=[];};function g(d,h,u,p){let m=Date.now()-Fn<Ir;return {session_id:D(),event_type:"error",page_url:typeof window>"u"?"":window.location.href,selector:null,element_text:null,event_data:{http_status:d,request_url:h,method:u,...p?{error_kind:p}:{},form_selector:m?Bn:null,...m&&je?{button_text:je}:{},...m&&Ye.length>0?{parent_components:Ye}:{}},created_at:new Date().toISOString(),stable_key:null}}}function Nr(e){if(!e||typeof e!="object")return false;let t=e;return t.ok===false||t.success===false||"error"in t&&t.error!=null&&t.error!==false}function Xe(e,t){if(t.length===0)return false;for(let n of t)if(e.includes(n))return true;return false}var Dr=3e4;function An(e,t){if(!e.redirectLoop.enabled)return ()=>{};if(typeof window>"u")return ()=>{};let{threshold:n,windowMs:o}=e.redirectLoop,r=new Map,i=new Map,s=history.pushState,c=history.replaceState;function a(b){try{let g=Date.now(),d=i.get(b)??0;if(g<d)return;let u=(r.get(b)??[]).filter(p=>g-p<=o);if(u.push(g),r.set(b,u),u.length>=n){let p={session_id:D(),event_type:"thrashing",page_url:window.location.href,selector:null,element_text:null,event_data:{count:u.length,url:b,window_ms:o},created_at:new Date().toISOString(),stable_key:null};t(p),i.set(b,g+Dr),r.set(b,[]);}}catch{}}function l(){let b=window.location.pathname+window.location.search;a(b);}return history.pushState=function(...b){let g=s.apply(this,b);return l(),g},history.replaceState=function(...b){let g=c.apply(this,b);return l(),g},window.addEventListener("popstate",l),()=>{history.pushState=s,history.replaceState=c,window.removeEventListener("popstate",l);}}var Or=6e4;function In(e,t){if(!e.formDataLoss.enabled)return ()=>{};if(typeof window>"u")return ()=>{};let n=new Set,o=new Map,r=new Map,i=new Map;function s(p){let f=p.closest("form");return f?f.id?`#${f.id}`:"form":null}function c(){let p=0;for(let f of o.values())p+=f;return p}function a(p){n.delete(p),o.delete(p),i.delete(p);}function l(p){try{let f=p.target;if(!f||!(f instanceof HTMLInputElement||f instanceof HTMLTextAreaElement||f instanceof HTMLSelectElement))return;let m=s(f);if(!m)return;n.add(m),o.set(m,(o.get(m)??0)+1);let y=f.closest("form");y&&i.set(m,y);}catch{}}function b(p){try{let f=p.target;if(!f||!(f instanceof HTMLFormElement))return;let m=f.id?`#${f.id}`:"form";r.set(m,Date.now()),a(m);}catch{}}function g(p){try{let f=p.target;if(!f||!(f instanceof HTMLFormElement))return;let m=f.id?`#${f.id}`:"form";a(m);}catch{}}function d(p){if(n.size===0)return;let f=Array.from(n),m=f[0]??null,y=m?i.get(m)??null:null,C=y?xe(y):null,_={session_id:D(),event_type:"form_abandonment",page_url:window.location.href,selector:m,element_text:null,event_data:{cause:p,field_count:c(),forms:f},created_at:new Date().toISOString(),stable_key:C};t(_);}function h(p){if(!p.persisted||n.size===0)return;let f=Date.now();for(let[,m]of r)if(f-m<Or)return;d("bfcache_restore");}function u(){d("beforeunload_after_edit");}return document.addEventListener("input",l,{capture:true,passive:true}),document.addEventListener("submit",b,{capture:true}),document.addEventListener("reset",g,{capture:true}),window.addEventListener("pageshow",h),window.addEventListener("beforeunload",u),()=>{document.removeEventListener("input",l,{capture:true}),document.removeEventListener("submit",b,{capture:true}),document.removeEventListener("reset",g,{capture:true}),window.removeEventListener("pageshow",h),window.removeEventListener("beforeunload",u);}}function Hr(){let e={urlChangeCount:0,networkCount:0,filePickerCount:0,uninstall:()=>{}},t=history.pushState,n=history.replaceState;history.pushState=function(...c){return e.urlChangeCount+=1,t.apply(this,c)},history.replaceState=function(...c){return e.urlChangeCount+=1,n.apply(this,c)};let o=()=>{e.urlChangeCount+=1;};window.addEventListener("popstate",o);let r=globalThis.fetch;if(r){let c=(a,l)=>(e.networkCount+=1,r.call(globalThis,a,l));globalThis.fetch=c;}let i=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(c,a,...l){return e.networkCount+=1,i.call(this,c,a,...l)};let s=HTMLInputElement.prototype.click;return HTMLInputElement.prototype.click=function(){return this.type==="file"&&(e.filePickerCount+=1),s.call(this)},e.uninstall=()=>{history.pushState=t,history.replaceState=n,window.removeEventListener("popstate",o),r&&(globalThis.fetch=r),XMLHttpRequest.prototype.open=i,HTMLInputElement.prototype.click=s;},e}function Ln(e,t){if(!e.deadClick.enabled)return ()=>{};if(typeof window>"u")return ()=>{};let{observationWindowMs:n,rateLimitPerSelector:o}=e.deadClick,r=new Map,i=Hr();function s(c){try{let a=c.target;if(!a||!(a instanceof Element)||c.button!==0||c.metaKey||c.ctrlKey||c.altKey||c.shiftKey||ze(a,e.ignoreSelectors)||a.closest("label"))return;if(a instanceof HTMLInputElement){let A=a.type;if(A==="checkbox"||A==="radio"||A==="file")return}if(a instanceof HTMLSelectElement||a.closest("a[target='_blank'], a[download]")||a.closest('[contenteditable="true"]'))return;try{let A=window.getSelection();if(A&&A.toString().length>0)return}catch{}let l=Yt(a);if(!l)return;let b=me(a,4);if(!b)return;let g=xe(a),d=g??b,h=i.urlChangeCount,u=i.networkCount,p=i.filePickerCount,f=new Date().toISOString(),m=re(a,200)??null,y=a.tagName.toLowerCase(),C=a.id||null,_=le(a)??null,E=we(a,5),z=Ur(a),H=0,F=null;if(z){F=new MutationObserver(()=>{H+=1;});try{F.observe(z,{childList:!0,attributes:!0,characterData:!0,subtree:!0});}catch{F=null;}}setTimeout(()=>{if(F)try{F.disconnect();}catch{}if(H>0||i.urlChangeCount!==h||i.networkCount!==u||i.filePickerCount!==p)return;let A=r.get(d)??0;if(A>=o)return;r.set(d,A+1);let se={session_id:D(),event_type:"dead_click",page_url:typeof window>"u"?"":window.location.href,selector:b,element_text:m,event_data:{tag_name:y,...C?{element_id:C}:{},..._?{component_name:_}:{},...E.length>0?{parent_components:E}:{},clickable_reason:l},created_at:f,stable_key:g};t(se);},n);}catch{}}return document.addEventListener("click",s,{capture:true,passive:true}),()=>{document.removeEventListener("click",s,{capture:true}),i.uninstall();}}function Ur(e){let t=e.closest('button, a, form, [role="button"]');return t||e.parentElement}var Vr="https://blocfeed.com/api/replay-events";function Nn(e){if(!e.config.enabled)return ()=>{};if(typeof window>"u")return ()=>{};if(typeof globalThis.matchMedia>"u")return ()=>{};let t=D();if(Ke(t)%100/100>=e.config.sampling)return ()=>{};let o=Date.now(),r=e.config.endpoint??Vr,i=[],s=0,c=false,a=false,l=null,b=`bf_replay_chunkseq_${t}`,g=`bf_replay_pauses_${t}`,d=0,h=0;try{let v=sessionStorage.getItem(b);v&&(d=parseInt(v,10)||0);let S=sessionStorage.getItem(g);S&&(h=parseInt(S,10)||0);}catch{}let u=(v=false)=>{if(i.length===0)return;let S=v?qr(i):i;i=[],s=0;let L=d++;try{sessionStorage.setItem(b,String(d));}catch{}$r({blocfeedId:e.blocfeedId,sessionId:t,sessionStartedAtMs:o,chunkSeq:L,events:S,endpoint:r,useBeacon:v,pauseCount:h});},p=setInterval(()=>{c||u();},e.config.flushIntervalMs),f=setTimeout(()=>{u(),ue();},e.config.maxDurationMs),m=null,y=()=>{m&&clearTimeout(m),m=setTimeout(()=>{A();},e.config.inactivityTimeoutMs);},C=()=>{u(true);};window.addEventListener("pagehide",C);let _=e.config.masking,E={emit(v){c||(i.push(v),s+=Wr(v),y(),s>=e.config.flushSizeBytes&&u());},recordCanvas:false,sampling:{mousemove:50}};_.maskAllInputs!==void 0&&(E.maskAllInputs=_.maskAllInputs),_.maskTextSelector!==void 0&&(E.maskTextSelector=_.maskTextSelector),_.maskTextClass!==void 0&&(E.maskTextClass=_.maskTextClass),_.blockSelector!==void 0&&(E.blockSelector=_.blockSelector);let z=null,H=()=>{z&&(document.removeEventListener("pointerdown",z,true),document.removeEventListener("keydown",z,true),z=null);};function F(){l=record(E)??null;}function A(){if(c||a)return;a=true,h++;try{sessionStorage.setItem(g,String(h));}catch{}if(u(),l){try{l();}catch{}l=null;}m&&(clearTimeout(m),m=null);let v=()=>{H(),se();};z=v,document.addEventListener("pointerdown",v,{capture:true,once:true}),document.addEventListener("keydown",v,{capture:true,once:true});}function se(){c||!a||(a=false,F(),y());}y(),F();function ue(){if(!c&&(c=true,clearInterval(p),clearTimeout(f),m&&clearTimeout(m),H(),window.removeEventListener("pagehide",C),l)){try{l();}catch{}l=null;}}return ue}function Wr(e){try{return JSON.stringify(e).length}catch{return 1024}}function qr(e){let n=JSON.stringify(e);if(n.length<=6e4)return e;let o=[...e];for(;o.length>1;)if(o.shift(),n=JSON.stringify(o),n.length<=6e4)return o;return o}async function $r(e){let t=JSON.stringify({blocfeed_id:e.blocfeedId,session_id:e.sessionId,session_started_at_ms:e.sessionStartedAtMs,chunk_seq:e.chunkSeq,pause_count:e.pauseCount,events:e.events,page_url:typeof window<"u"?window.location.href:"",user_agent:typeof navigator<"u"?navigator.userAgent:""});if(e.useBeacon&&typeof navigator<"u"&&typeof navigator.sendBeacon=="function")try{let o=new Blob([t],{type:"application/json"});navigator.sendBeacon(e.endpoint,o);return}catch{}let n=!!e.useBeacon;try{await fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:t,...n?{keepalive:!0}:{}});}catch{}}var Kr={enabled:true,endpoint:null,maxDurationMs:144e5,flushIntervalMs:3e4,flushSizeBytes:1048576,inactivityTimeoutMs:18e5,sampling:1,masking:{maskAllInputs:true,maskTextSelector:"[data-blocfeed-mask]",maskTextClass:"blocfeed-mask",blockSelector:"[data-blocfeed-block]"}};function Dn(e){let t=Kr;return {enabled:e?.enabled??t.enabled,endpoint:e?.endpoint??t.endpoint,maxDurationMs:e?.maxDurationMs??t.maxDurationMs,flushIntervalMs:e?.flushIntervalMs??t.flushIntervalMs,flushSizeBytes:e?.flushSizeBytes??t.flushSizeBytes,inactivityTimeoutMs:e?.inactivityTimeoutMs??t.inactivityTimeoutMs,sampling:e?.sampling??t.sampling,masking:{...t.masking,...e?.masking??{}}}}var On=[{name:"email",regex:/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,replacement:"[email]"},{name:"credit_card",regex:/\b(?:\d[ -]?){13,19}\b/g,replacement:"[card]"},{name:"ssn",regex:/\b\d{3}-\d{2}-\d{4}\b/g,replacement:"[ssn]"},{name:"phone",regex:/(?:\+?\d{1,3}[\s.-]?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/g,replacement:"[phone]"}],Xr=[...On,{name:"ipv4",regex:/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g,replacement:"[ip]"},{name:"iban",regex:/\b[A-Z]{2}\d{2}[A-Z0-9]{11,30}\b/g,replacement:"[iban]"}],jr=10;function Yr(e){return e==="strict"?Xr:e==="default"?On:[]}function Gr(e,t){let n=e;for(let o of t)n=n.replace(o.regex,o.replacement);return n}function Rt(e,t,n){if(n>jr||e==null)return e;if(typeof e=="string")return Gr(e,t);if(typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(o=>Rt(o,t,n+1));if(typeof e=="object"){let o={};for(let r of Object.keys(e))o[r]=Rt(e[r],t,n+1);return o}return e}function Fe(e,t){if(t==="off")return e;let n=Yr(t);return n.length===0?e:Rt(e,n,0)}var Jr="https://blocfeed.com/api/events/track",Zr=5e3,Qr=50,ei=1024,Ze="blocfeed-events-queue",Hn=500,Un=100,ti=/^[a-z][a-z0-9_]{0,127}$/,zn=50,Vn=1024,Wn,Pt="default";function qn(e){Wn=e;}function $n(e){Pt=e;}function ni(e){if(typeof e!="string"||!ti.test(e))throw new Error(`[BlocFeed] track(): event_name "${e}" must match /^[a-z][a-z0-9_]{0,127}$/ (lowercase, start with a letter, only [a-z0-9_], \u2264128 chars).`)}function oi(e){if(e===void 0)return {};if(e===null||typeof e!="object"||Array.isArray(e))throw new Error("[BlocFeed] track(): properties must be a plain object.");let t=Object.keys(e);if(t.length>zn)throw new Error(`[BlocFeed] track(): properties has ${t.length} keys, max ${zn}.`);for(let o of t){let r=e[o];if(r!==null&&typeof r!="string"&&typeof r!="number"&&typeof r!="boolean")throw new Error(`[BlocFeed] track(): property "${o}" has unsupported type "${typeof r}". Allowed: string | number | boolean | null.`)}let n;try{n=JSON.stringify(e);}catch(o){throw new Error(`[BlocFeed] track(): properties is not JSON-serializable (${o.message}).`)}if(n.length>Vn)throw new Error(`[BlocFeed] track(): properties serialized to ${n.length} bytes, max ${Vn}. Server allows 8192 bytes \u2014 the client cap is defensive; trim down or split the event.`);return e}function Ft(){if(typeof localStorage>"u")return [];try{let e=localStorage.getItem(Ze);if(!e)return [];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{try{localStorage.removeItem(Ze);}catch{}return []}}function Bt(e){if(!(typeof localStorage>"u"))try{if(e.length===0)localStorage.removeItem(Ze);else {let t=e.length>Hn?e.slice(e.length-Hn):e;localStorage.setItem(Ze,JSON.stringify(t));}}catch{}}var Y=null;function ri(){if(Y)return Y;if(typeof window>"u")return null;let e=ii();return e?(Y={blocfeedId:e,endpoint:Jr,events:[],bytes:0,flushTimer:null,pageHideHandler:null,visibilityHandler:null},Y.flushTimer=setInterval(()=>{Je(false);},Zr),Y.pageHideHandler=()=>{Je(true);},Y.visibilityHandler=()=>{document.visibilityState==="hidden"&&Je(true);},window.addEventListener("pagehide",Y.pageHideHandler),document.addEventListener("visibilitychange",Y.visibilityHandler),Y):null}function ii(){try{let t=window.__blocfeed_id__;return typeof t=="string"&&t.length>0?t:null}catch{return null}}function ke(e){try{window.__blocfeed_id__=e;}catch{}Y&&(Y.blocfeedId=e);}function Be(e,t,n){ni(e);let o=oi(t),r=Pt==="off"?o:Fe(o,Pt),i=n?.occurredAt?di(n.occurredAt):new Date().toISOString(),s={event_name:e,properties:r,occurred_at:i},c=n?.sessionId??si();c&&(s.session_id=c);let a=n?.userId??Wn;a&&(s.user_id=a);let l=n?.pageUrl??ci();l&&(s.page_url=l);let b=li();b&&(s.user_agent=b);let g=ri();if(!g){let d=Ft();d.push(s),Bt(d);return}g.events.push(s),g.bytes+=ai(s),(g.events.length>=Qr||g.bytes>=ei)&&Je(false);}async function Je(e){let t=Y;if(!t)return;let o=Ft().concat(t.events);if(t.events=[],t.bytes=0,Bt([]),o.length!==0)for(let r=0;r<o.length;r+=Un){let i=o.slice(r,r+Un),s=JSON.stringify({blocfeed_id:t.blocfeedId,events:i});if(e&&ui())try{let c=new Blob([s],{type:"application/json"});navigator.sendBeacon(t.endpoint,c)||Ge(i);continue}catch{Ge(i);continue}try{(await fetch(t.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:s})).ok||Ge(i);}catch{Ge(i);}}}function Ge(e){let t=Ft();Bt(t.concat(e));}function ai(e){try{return JSON.stringify(e).length}catch{return 256}}function si(){try{return D()}catch{return}}function ci(){try{return typeof window<"u"?window.location.href:void 0}catch{return}}function li(){try{return typeof navigator<"u"?navigator.userAgent:void 0}catch{return}}function di(e){return e instanceof Date?e.toISOString():new Date(e).toISOString()}function ui(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}var fi="https://blocfeed.com/api/heartbeat",pi=300*1e3;function Kn(e){if(typeof window>"u")return ()=>{};if(typeof globalThis.matchMedia>"u")return ()=>{};let t=e.endpoint??fi,n=e.intervalMs??pi,o=e.features??["replay","behavioral","customEvents"],r=c=>{try{let a=JSON.stringify({blocfeed_id:e.blocfeedId,session_id:mi(),version:e.version,page_url:typeof window<"u"?window.location.href:"",user_agent:typeof navigator<"u"?navigator.userAgent:"",sdk_features:o}),l={method:"POST",headers:{"Content-Type":"application/json"},body:a};c&&(l.keepalive=!0),fetch(t,l).catch(()=>{});}catch{}};try{r(!1);}catch{}let i=null;try{i=setInterval(()=>{try{r(!1);}catch{}},n);}catch{i=null;}let s=()=>{try{r(!0);}catch{}};try{window.addEventListener("pagehide",s);}catch{}return function(){try{i&&clearInterval(i);}catch{}i=null;try{window.removeEventListener("pagehide",s);}catch{}}}function mi(){try{return D()}catch{return ""}}var gi=5e3,Me=class{constructor(t){this.submitter=null;this.detectorUninstallers=[];this.flushTimer=null;this.pageHideHandler=null;this.installed=false;this.opts=t,this.resolved=_n(t.config);}install(){if(this.installed||!this.resolved.enabled)return;let t=()=>{try{let a=D();return Ke(a)%100/100<this.resolved.sampling}catch{return false}};if(!(this.opts.passiveSampler??t)())return;ke(this.opts.blocfeedId),$n(this.resolved.piiScrub);let o=this.opts.endpoint??"https://blocfeed.com/api/behavioral-events";this.submitter=this.opts.submitter??Tn({endpoint:o,blocfeedId:this.opts.blocfeedId});let r=this.resolved.piiScrub,i=a=>{let l=r==="off"?a:{...a,element_text:a.element_text==null?a.element_text:Fe(a.element_text,r),event_data:a.event_data==null?a.event_data:Fe(a.event_data,r)};this.submitter?.enqueue(l);};this.detectorUninstallers.push(Pn(this.resolved,i)),this.detectorUninstallers.push(Mn(this.resolved,i)),this.detectorUninstallers.push(An(this.resolved,i)),this.detectorUninstallers.push(In(this.resolved,i)),this.detectorUninstallers.push(Ln(this.resolved,i));let s=Dn(this.opts.config?.sessionReplay);this.detectorUninstallers.push(Nn({blocfeedId:this.opts.blocfeedId,config:s}));let c=["behavioral","customEvents"];if(s.enabled&&c.unshift("replay"),this.opts.extraSdkFeatures)for(let a of this.opts.extraSdkFeatures)c.push(a);this.detectorUninstallers.push(Kn({blocfeedId:this.opts.blocfeedId,version:Xn,features:c})),this.flushTimer=setInterval(()=>{this.submitter?.flush();},gi),this.pageHideHandler=()=>{this.submitter?.flushBeacon();},typeof window<"u"&&window.addEventListener("pagehide",this.pageHideHandler),this.installed=true;}uninstall(){if(this.installed){for(let t of [...this.detectorUninstallers].reverse())try{t();}catch{}this.detectorUninstallers=[],this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.pageHideHandler&&typeof window<"u"&&(window.removeEventListener("pagehide",this.pageHideHandler),this.pageHideHandler=null);try{this.submitter?.flush();}catch{}this.submitter=null,this.installed=false;}}};var bi=["[data-blocfeed-ui]","[data-blocfeed-ignore]"];function hi(e){let t=[...bi,...e?.ignoreSelectors??[]],n=Array.from(new Set(t));return {...e,ignoreSelectors:n}}function jn(){return {phase:"idle"}}function yi(e){if(e.ok)return false;let t=e.api;return t?t.status&&t.status>=400&&t.status<500||t.error?.kind==="aborted"||t.error?.kind==="configuration"?false:!t.ok:true}function Yn(e){let t=e,n=new Me({blocfeedId:t.blocfeed_id??"",...t.behavioral!==void 0?{config:t.behavioral}:{}});n.install();let o=jn(),r=new Set,i=new Set,s=null,c=null,a=null,l=null,b=0,g=null,d=null,h=null,u=null,p=false,f=()=>{for(let v of r)v(o);},m=v=>{for(let S of i)S(v);},y=v=>{o=v,f();},C=()=>{b+=1,l?.abort(),l=null;},_=()=>{s?.stop(),s=null,m(null),a!==null&&T()&&(document.documentElement.style.cursor=a,a=null);},E=()=>{if(h){try{URL.revokeObjectURL(h.blobUrl);}catch{}h=null;}},z=()=>{d&&(d.abort(),d=null),E();},H=null,F=()=>{u&&(u.abort(),u=null),H&&(H.abort(),H=null);},A=()=>{C(),_(),z(),F(),c=null,y(jn());},se=()=>{if(!T())return;_(),c=null;let v=hi(t.picker);a=document.documentElement.style.cursor,document.documentElement.style.cursor="crosshair",y({phase:"picking"}),s=cn(v,{onHover:m,onSelect:({element:S,descriptor:L})=>{c=S,_(),y({phase:"review",selection:L});},onCancel:()=>{A();}});},ue=()=>{let v=an();if(v.length!==0)for(let S of v)Ct({payload:S,...t.transport?{transport:t.transport}:{}}).catch(()=>{yt(S);});};if(T()){setTimeout(ue,1e3);let v=()=>ue();window.addEventListener("online",v),g=()=>window.removeEventListener("online",v);}return {getState:()=>o,getConfig:()=>t,subscribe(v){return r.add(v),()=>r.delete(v)},subscribeHover(v){return i.add(v),()=>i.delete(v)},start(){o.phase==="capturing"||o.phase==="submitting"||o.phase==="recording"||o.phase!=="picking"&&se();},stop(){A();},clearSelection(){o.phase==="capturing"||o.phase==="submitting"||o.phase==="recording"||se();},setConfig(v){t=v;},async submit(v,S){if(!T()){let B=k("configuration",new Error("BlocFeed submit can only run in the browser"));return y({phase:"error",lastError:B}),{ok:false}}let L=t.blocfeed_id?.trim?.()??"";if(!L){let M={phase:"error",lastError:k("configuration",new Error("Missing blocfeed_id. Create a project in BlocFeed and pass its blocfeed_id."))};return o.selection&&(M.selection=o.selection),y(M),{ok:false}}if(p)return {ok:false};if(o.phase==="capturing"||o.phase==="submitting"||o.phase==="recording")return {ok:false};p=true;let N=b+1;b=N,l?.abort(),l=new AbortController;let I=l.signal,R=o.selection,G=S?.capture?{...t.capture,...S.capture}:t.capture,te=!!(G?.element||G?.fullPage),ce={phase:te?"capturing":"submitting"};R&&(ce.selection=R),y(ce);try{let B=te?await on({selectionElement:c,capture:G,signal:I}):void 0;if(I.aborted||b!==N)return {ok:!1};let M={phase:"submitting"};R&&(M.selection=R),B&&(M.capture=B),y(M);let U={};R&&(U.selection=R),B&&(U.capture=B);let ne=await rn({config:t.metadata,context:U,...t.user?{user:t.user}:{}}),Z={version:1,createdAt:new Date().toISOString(),blocfeed_id:L,message:v,metadata:ne};S?.category&&(Z.category=S.category),t.user&&(Z.user=t.user),R&&(Z.selection=R),B&&(Z.screenshots=B),h&&(Z.video=h);let{result:j}=await Ct({payload:Z,signal:I,...t.transport?{transport:t.transport}:{}});if(I.aborted||b!==N)return j;if(j.ok){E(),c=null;let oe={phase:"success",lastSubmit:j};return R&&(oe.selection=R),B&&(oe.capture=B),y(oe),j}yi(j)&&yt(Z);let dt=j.api?.error??k("unknown",new Error("Submission failed")),ve={phase:"error",lastSubmit:j,lastError:dt};return R&&(ve.selection=R),B&&(ve.capture=B),y(ve),j}catch(B){if(I.aborted||b!==N)return {ok:false};let U={phase:"error",lastError:I.aborted?k("aborted",B):k("unknown",B)};return R&&(U.selection=R),y(U),{ok:false}}finally{p=false,b===N&&(l=null);}},async startRecording(){if(o.phase!=="review"||!t.recording?.enabled||u||d)return;let v=o.selection,S={phase:"recording",recordingElapsedMs:0};v&&(S.selection=v),y(S);try{let L={config:t.recording};l&&(L.signal=l.signal);let N=await Et(L);d=N,N.onTick(G=>{if(o.phase==="recording"){let te={phase:"recording",recordingElapsedMs:G};v&&(te.selection=v),y(te);}});let I=await N.result;d=null,h=I;let R={phase:"review",video:I};v&&(R.selection=v),y(R);}catch(L){d=null;let I={phase:"review",lastError:L?.kind?L:k("recording_failed",L)};v&&(I.selection=v),y(I);}},stopRecording(){o.phase!=="recording"||!d||d.stop();},removeVideo(){E();let v=o.selection,S={phase:"review"};v&&(S.selection=v),y(S);},async startVoice(){if(o.phase!=="review"){console.warn("[BlocFeed] startVoice: ignored \u2014 phase is",o.phase,'(expected "review")');return}let v=t.voice;if(!v?.enabled){console.warn("[BlocFeed] startVoice: ignored \u2014 voice is not enabled in config");return}if(d){console.warn("[BlocFeed] startVoice: ignored \u2014 a screen recording is already in progress");return}F();let S=o.selection,L={phase:"review",voiceRecording:true,voiceElapsedMs:0};S&&(L.selection=S),h&&(L.video=h),y(L);try{let N={config:v};l&&(N.signal=l.signal);let I=await St(N);u=I,I.onTick(U=>{let ne={phase:"review",voiceRecording:!0,voiceElapsedMs:U};S&&(ne.selection=S),h&&(ne.video=h),y(ne);});let R=await I.result;u=null;let G={phase:"review",voiceRecording:!1,voiceTranscribing:!0};S&&(G.selection=S),h&&(G.video=h),y(G),H=new AbortController;let te={blob:R.blob,mime:R.mime,blocfeedId:t.blocfeed_id,signal:H.signal},{text:Ue,warning:ce}=await Sn(te);H=null;let B={phase:"review",voiceRecording:!1,voiceTranscribing:!1};S&&(B.selection=S),h&&(B.video=h),y(B);let M={text:Ue};return ce&&(M.warning=ce),M}catch(N){F();let I=N?.kind?N:k("recording_failed",N);console.warn("[BlocFeed] Voice error:",I.message);let R={phase:"review",voiceRecording:false,voiceTranscribing:false,lastError:I};S&&(R.selection=S),h&&(R.video=h),y(R);return}},stopVoice(){u&&u.stop();},__unsafeGetSelectedElement(){return c},destroy(){n.uninstall(),A(),r.clear(),i.clear(),g?.(),g=null;}}}var Qe=createContext(null);function Mt(e){let t=useMemo(()=>Yn({...e.config??{},blocfeed_id:e.blocfeed_id}),[]);useEffect(()=>{ke(e.blocfeed_id);},[e.blocfeed_id]);let[n,o]=useState(()=>t.getState());return useEffect(()=>t.subscribe(o),[t]),useEffect(()=>t.setConfig({...e.config??{},blocfeed_id:e.blocfeed_id}),[t,e.config,e.blocfeed_id]),useEffect(()=>()=>t.destroy(),[t]),jsx(Qe.Provider,{value:{controller:t,state:n},children:e.children})}var Gn="blocfeed-styles-v1",ki=`
2
- :where([data-blocfeed-ui-root]),
3
- :where([data-blocfeed-ui-root]) * {
4
- box-sizing: border-box;
5
- }
6
-
7
- :where([data-blocfeed-ui-root]) {
8
- --bf-z: 2147483647;
9
- --bf-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
10
- --bf-panel-bg: rgba(17, 24, 39, 0.98);
11
- --bf-panel-fg: rgb(243, 244, 246);
12
- --bf-muted: rgba(243, 244, 246, 0.72);
13
- --bf-border: rgba(255, 255, 255, 0.14);
14
- --bf-accent: rgb(99, 102, 241);
15
- --bf-danger: rgb(239, 68, 68);
16
- --bf-shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
17
-
18
- /* Ensure widget always floats above customer modals/sidepanels/overlays */
19
- position: fixed;
20
- top: 0;
21
- left: 0;
22
- width: 0;
23
- height: 0;
24
- overflow: visible;
25
- z-index: var(--bf-z);
26
- isolation: isolate;
27
- pointer-events: none;
28
-
29
- font-family: var(--bf-font);
30
- color: var(--bf-panel-fg);
31
- }
32
-
33
- /* ------------------------------------------------------------------ */
34
- /* Light theme */
35
- /* ------------------------------------------------------------------ */
36
-
37
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) {
38
- --bf-panel-bg: rgba(255, 255, 255, 0.98);
39
- --bf-panel-fg: rgb(17, 24, 39);
40
- --bf-muted: rgba(17, 24, 39, 0.6);
41
- --bf-border: rgba(0, 0, 0, 0.12);
42
- --bf-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
43
- }
44
-
45
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-textarea {
46
- border-color: rgba(0, 0, 0, 0.14);
47
- background: rgba(0, 0, 0, 0.04);
48
- color: var(--bf-panel-fg);
49
- }
50
-
51
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-panelHeader {
52
- border-bottom-color: rgba(0, 0, 0, 0.08);
53
- }
54
-
55
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-title {
56
- color: rgba(17, 24, 39, 0.85);
57
- }
58
-
59
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-error {
60
- color: rgb(185, 28, 28);
61
- }
62
-
63
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-watermark a {
64
- color: rgba(17, 24, 39, 0.35);
65
- }
66
-
67
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-watermark {
68
- border-top-color: rgba(0, 0, 0, 0.06);
69
- }
70
-
71
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-highlight {
72
- box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.42);
73
- }
74
-
75
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-blocker {
76
- background: rgba(255, 255, 255, 0.35);
77
- }
78
-
79
- /* ------------------------------------------------------------------ */
80
- /* Trigger button \u2014 default bottom-right */
81
- /* ------------------------------------------------------------------ */
82
-
83
- :where([data-blocfeed-ui-root]) .bf-trigger {
84
- position: fixed;
85
- right: 18px;
86
- bottom: 18px;
87
- z-index: var(--bf-z);
88
- pointer-events: auto;
89
-
90
- display: inline-flex;
91
- align-items: center;
92
- gap: 10px;
93
- padding: 10px 12px;
94
- border-radius: 999px;
95
- border: 1px solid var(--bf-border);
96
- background: var(--bf-panel-bg);
97
- color: var(--bf-panel-fg);
98
- box-shadow: var(--bf-shadow);
99
- cursor: pointer;
100
- user-select: none;
101
- -webkit-tap-highlight-color: transparent;
102
- }
103
-
104
- :where([data-blocfeed-ui-root]) .bf-trigger:hover {
105
- border-color: var(--bf-accent);
106
- }
107
-
108
- :where([data-blocfeed-ui-root]) .bf-trigger:focus-visible {
109
- outline: 2px solid var(--bf-accent);
110
- outline-offset: 2px;
111
- }
112
-
113
- /* Position variants (item 9) */
114
- :where([data-blocfeed-ui-root]) .bf-trigger-bl {
115
- left: 18px; bottom: 18px; right: auto; top: auto;
116
- }
117
- :where([data-blocfeed-ui-root]) .bf-trigger-tr {
118
- right: 18px; top: 18px; bottom: auto; left: auto;
119
- }
120
- :where([data-blocfeed-ui-root]) .bf-trigger-tl {
121
- left: 18px; top: 18px; right: auto; bottom: auto;
122
- }
123
-
124
- :where([data-blocfeed-ui-root]) .bf-dot {
125
- width: 10px;
126
- height: 10px;
127
- border-radius: 999px;
128
- background: var(--bf-accent);
129
- box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
130
- }
131
-
132
- /* ------------------------------------------------------------------ */
133
- /* Overlay, blocker, highlight */
134
- /* ------------------------------------------------------------------ */
135
-
136
- :where([data-blocfeed-ui-root]) .bf-overlay {
137
- position: fixed;
138
- inset: 0;
139
- z-index: var(--bf-z);
140
- pointer-events: none;
141
- }
142
-
143
- :where([data-blocfeed-ui-root]) .bf-blocker {
144
- position: fixed;
145
- inset: 0;
146
- background: rgba(0, 0, 0, 0.35);
147
- pointer-events: auto;
148
- }
149
-
150
- :where([data-blocfeed-ui-root]) .bf-highlight {
151
- position: fixed;
152
- border: 2px solid var(--bf-accent);
153
- border-radius: 10px;
154
- box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
155
- pointer-events: none;
156
- }
157
-
158
- /* ------------------------------------------------------------------ */
159
- /* Hint bar */
160
- /* ------------------------------------------------------------------ */
161
-
162
- :where([data-blocfeed-ui-root]) .bf-hint {
163
- position: fixed;
164
- top: 16px;
165
- left: 50%;
166
- transform: translateX(-50%);
167
- max-width: min(640px, calc(100vw - 24px));
168
- padding: 10px 12px;
169
- border-radius: 12px;
170
- border: 1px solid var(--bf-border);
171
- background: var(--bf-panel-bg);
172
- box-shadow: var(--bf-shadow);
173
- pointer-events: auto;
174
- display: flex;
175
- align-items: center;
176
- justify-content: space-between;
177
- gap: 12px;
178
- }
179
-
180
- :where([data-blocfeed-ui-root]) .bf-hint p {
181
- margin: 0;
182
- font-size: 13px;
183
- color: var(--bf-muted);
184
- }
185
-
186
- /* ------------------------------------------------------------------ */
187
- /* Buttons */
188
- /* ------------------------------------------------------------------ */
189
-
190
- :where([data-blocfeed-ui-root]) .bf-btn {
191
- border: 1px solid var(--bf-border);
192
- background: transparent;
193
- color: var(--bf-panel-fg);
194
- padding: 8px 10px;
195
- border-radius: 10px;
196
- cursor: pointer;
197
- user-select: none;
198
- }
199
-
200
- :where([data-blocfeed-ui-root]) .bf-btn:focus-visible {
201
- outline: 2px solid var(--bf-accent);
202
- outline-offset: 2px;
203
- }
204
-
205
- :where([data-blocfeed-ui-root]) .bf-btn[disabled] {
206
- opacity: 0.6;
207
- cursor: not-allowed;
208
- }
209
-
210
- :where([data-blocfeed-ui-root]) .bf-btnPrimary {
211
- background: var(--bf-accent);
212
- border-color: rgba(99, 102, 241, 0.6);
213
- color: white;
214
- }
215
-
216
- /* ------------------------------------------------------------------ */
217
- /* Panel */
218
- /* ------------------------------------------------------------------ */
219
-
220
- :where([data-blocfeed-ui-root]) .bf-panel {
221
- position: fixed;
222
- width: 360px;
223
- max-width: calc(100vw - 24px);
224
- border-radius: 14px;
225
- border: 1px solid var(--bf-border);
226
- background: var(--bf-panel-bg);
227
- box-shadow: var(--bf-shadow);
228
- pointer-events: auto;
229
- overflow: hidden;
230
- }
231
-
232
- :where([data-blocfeed-ui-root]) .bf-panelHeader {
233
- display: flex;
234
- align-items: center;
235
- justify-content: space-between;
236
- gap: 8px;
237
- padding: 12px 12px 10px;
238
- border-bottom: 1px solid rgba(255, 255, 255, 0.08);
239
- }
240
-
241
- :where([data-blocfeed-ui-root]) .bf-title {
242
- font-size: 13px;
243
- letter-spacing: 0.3px;
244
- text-transform: uppercase;
245
- color: rgba(243, 244, 246, 0.85);
246
- }
247
-
248
- :where([data-blocfeed-ui-root]) .bf-panelBody {
249
- padding: 12px;
250
- display: grid;
251
- gap: 10px;
252
- }
253
-
254
- /* ------------------------------------------------------------------ */
255
- /* Form elements */
256
- /* ------------------------------------------------------------------ */
257
-
258
- :where([data-blocfeed-ui-root]) .bf-textarea {
259
- width: 100%;
260
- min-height: 96px;
261
- resize: vertical;
262
- padding: 10px 10px;
263
- border-radius: 12px;
264
- border: 1px solid rgba(255, 255, 255, 0.14);
265
- background: rgba(0, 0, 0, 0.18);
266
- color: var(--bf-panel-fg);
267
- font-size: 14px;
268
- line-height: 1.4;
269
- }
270
-
271
- :where([data-blocfeed-ui-root]) .bf-textarea:focus-visible {
272
- outline: 2px solid rgba(99, 102, 241, 0.9);
273
- outline-offset: 2px;
274
- }
275
-
276
- :where([data-blocfeed-ui-root]) .bf-row {
277
- display: flex;
278
- align-items: center;
279
- justify-content: space-between;
280
- gap: 10px;
281
- }
282
-
283
- :where([data-blocfeed-ui-root]) .bf-row label {
284
- font-size: 13px;
285
- color: var(--bf-muted);
286
- display: inline-flex;
287
- align-items: center;
288
- gap: 8px;
289
- user-select: none;
290
- }
291
-
292
- :where([data-blocfeed-ui-root]) .bf-actions {
293
- display: flex;
294
- gap: 10px;
295
- justify-content: flex-end;
296
- padding-top: 4px;
297
- }
298
-
299
- /* ------------------------------------------------------------------ */
300
- /* Status, errors, toast */
301
- /* ------------------------------------------------------------------ */
302
-
303
- :where([data-blocfeed-ui-root]) .bf-status {
304
- font-size: 12px;
305
- color: var(--bf-muted);
306
- display: flex;
307
- align-items: center;
308
- gap: 8px;
309
- }
310
-
311
- :where([data-blocfeed-ui-root]) .bf-error {
312
- font-size: 12px;
313
- color: rgb(254, 202, 202);
314
- }
315
-
316
- :where([data-blocfeed-ui-root]) .bf-toast {
317
- position: fixed;
318
- left: 50%;
319
- bottom: 18px;
320
- transform: translateX(-50%);
321
- z-index: var(--bf-z);
322
- padding: 10px 12px;
323
- border-radius: 12px;
324
- border: 1px solid var(--bf-border);
325
- background: var(--bf-panel-bg);
326
- box-shadow: var(--bf-shadow);
327
- pointer-events: none;
328
- font-size: 13px;
329
- color: rgba(243, 244, 246, 0.9);
330
- }
331
-
332
- /* ------------------------------------------------------------------ */
333
- /* Category pills */
334
- /* ------------------------------------------------------------------ */
335
-
336
- :where([data-blocfeed-ui-root]) .bf-pills {
337
- display: flex;
338
- flex-wrap: wrap;
339
- gap: 6px;
340
- }
341
-
342
- :where([data-blocfeed-ui-root]) .bf-pill {
343
- padding: 4px 10px;
344
- border-radius: 999px;
345
- border: 1px solid var(--bf-border);
346
- background: transparent;
347
- color: var(--bf-muted);
348
- font-size: 12px;
349
- font-family: var(--bf-font);
350
- cursor: pointer;
351
- user-select: none;
352
- transition: border-color 0.15s, color 0.15s, background 0.15s;
353
- }
354
-
355
- :where([data-blocfeed-ui-root]) .bf-pill:hover {
356
- border-color: var(--bf-accent);
357
- color: var(--bf-panel-fg);
358
- }
359
-
360
- :where([data-blocfeed-ui-root]) .bf-pill-active {
361
- border-color: var(--bf-accent);
362
- background: var(--bf-accent);
363
- color: white;
364
- }
365
-
366
- :where([data-blocfeed-ui-root]) .bf-pill[disabled] {
367
- opacity: 0.6;
368
- cursor: not-allowed;
369
- }
370
-
371
- /* ------------------------------------------------------------------ */
372
- /* Capture spinner (item 12) */
373
- /* ------------------------------------------------------------------ */
374
-
375
- :where([data-blocfeed-ui-root]) .bf-spinner {
376
- display: inline-block;
377
- width: 10px;
378
- height: 10px;
379
- border-radius: 50%;
380
- background: var(--bf-accent);
381
- animation: bf-pulse 1s ease-in-out infinite;
382
- }
383
-
384
- @keyframes bf-pulse {
385
- 0%, 100% { opacity: 0.4; transform: scale(0.8); }
386
- 50% { opacity: 1; transform: scale(1.2); }
387
- }
388
-
389
- /* ------------------------------------------------------------------ */
390
- /* Trigger variant: edge-tab */
391
- /* ------------------------------------------------------------------ */
392
-
393
- :where([data-blocfeed-ui-root]) .bf-trigger-edge {
394
- position: fixed;
395
- z-index: var(--bf-z);
396
- pointer-events: auto;
397
- display: flex;
398
- align-items: center;
399
- justify-content: center;
400
- border: 1px solid var(--bf-border);
401
- background: var(--bf-panel-bg);
402
- color: var(--bf-panel-fg);
403
- box-shadow: var(--bf-shadow);
404
- cursor: pointer;
405
- user-select: none;
406
- -webkit-tap-highlight-color: transparent;
407
- overflow: hidden;
408
- padding: 0;
409
- font-family: var(--bf-font);
410
- font-size: 12px;
411
- letter-spacing: 0.5px;
412
- }
413
-
414
- :where([data-blocfeed-ui-root]) .bf-trigger-edge:focus-visible {
415
- outline: 2px solid var(--bf-accent);
416
- outline-offset: 2px;
417
- }
418
-
419
- :where([data-blocfeed-ui-root]) .bf-trigger-edge-left {
420
- left: 0;
421
- right: auto;
422
- border-radius: 0 6px 6px 0;
423
- border-left: none;
424
- }
425
-
426
- :where([data-blocfeed-ui-root]) .bf-trigger-edge-right {
427
- right: 0;
428
- left: auto;
429
- border-radius: 6px 0 0 6px;
430
- border-right: none;
431
- }
432
-
433
- /* ------------------------------------------------------------------ */
434
- /* Trigger variant: minimal */
435
- /* ------------------------------------------------------------------ */
436
-
437
- :where([data-blocfeed-ui-root]) .bf-trigger-minimal {
438
- position: fixed;
439
- right: 18px;
440
- bottom: 18px;
441
- z-index: var(--bf-z);
442
- pointer-events: auto;
443
- display: inline-flex;
444
- align-items: center;
445
- background: transparent;
446
- border: none;
447
- box-shadow: none;
448
- padding: 8px 4px;
449
- font-family: var(--bf-font);
450
- font-size: 13px;
451
- color: var(--bf-panel-fg);
452
- cursor: pointer;
453
- user-select: none;
454
- -webkit-tap-highlight-color: transparent;
455
- }
456
-
457
- :where([data-blocfeed-ui-root]) .bf-trigger-minimal.bf-trigger-bl {
458
- left: 18px; bottom: 18px; right: auto; top: auto;
459
- }
460
- :where([data-blocfeed-ui-root]) .bf-trigger-minimal.bf-trigger-tr {
461
- right: 18px; top: 18px; bottom: auto; left: auto;
462
- }
463
- :where([data-blocfeed-ui-root]) .bf-trigger-minimal.bf-trigger-tl {
464
- left: 18px; top: 18px; right: auto; bottom: auto;
465
- }
466
-
467
- :where([data-blocfeed-ui-root]) .bf-trigger-minimal:focus-visible {
468
- outline: 2px solid var(--bf-accent);
469
- outline-offset: 2px;
470
- }
471
-
472
- /* ------------------------------------------------------------------ */
473
- /* Screen reader only */
474
- /* ------------------------------------------------------------------ */
475
-
476
- :where([data-blocfeed-ui-root]) .bf-sr-only {
477
- position: absolute;
478
- width: 1px;
479
- height: 1px;
480
- padding: 0;
481
- margin: -1px;
482
- overflow: hidden;
483
- clip: rect(0, 0, 0, 0);
484
- white-space: nowrap;
485
- border: 0;
486
- }
487
-
488
- /* ------------------------------------------------------------------ */
489
- /* Queue badge */
490
- /* ------------------------------------------------------------------ */
491
-
492
- :where([data-blocfeed-ui-root]) .bf-badge {
493
- display: inline-flex;
494
- align-items: center;
495
- justify-content: center;
496
- min-width: 16px;
497
- height: 16px;
498
- padding: 0 4px;
499
- border-radius: 999px;
500
- background: var(--bf-danger);
501
- color: white;
502
- font-size: 10px;
503
- font-weight: 600;
504
- line-height: 1;
505
- flex-shrink: 0;
506
- }
507
-
508
- :where([data-blocfeed-ui-root]) .bf-badge-float {
509
- position: absolute;
510
- top: -4px;
511
- right: -4px;
512
- }
513
-
514
- /* ------------------------------------------------------------------ */
515
- /* Typewriter cursor */
516
- /* ------------------------------------------------------------------ */
517
-
518
- :where([data-blocfeed-ui-root]) .bf-cursor {
519
- display: inline-block;
520
- width: 1px;
521
- height: 1em;
522
- background: var(--bf-panel-fg);
523
- margin-left: 1px;
524
- vertical-align: text-bottom;
525
- animation: bf-blink 1s steps(2) infinite;
526
- }
527
-
528
- @keyframes bf-blink {
529
- 0% { opacity: 1; }
530
- 50% { opacity: 0; }
531
- }
532
-
533
- /* ------------------------------------------------------------------ */
534
- /* Panel / toast / hint entrance animations */
535
- /* ------------------------------------------------------------------ */
536
-
537
- :where([data-blocfeed-ui-root]) .bf-panel {
538
- animation: bf-panel-in 0.2s ease-out;
539
- }
540
-
541
- @keyframes bf-panel-in {
542
- from { opacity: 0; transform: translateY(8px); }
543
- to { opacity: 1; transform: translateY(0); }
544
- }
545
-
546
- :where([data-blocfeed-ui-root]) .bf-toast {
547
- animation: bf-toast-in 0.25s ease-out;
548
- }
549
-
550
- @keyframes bf-toast-in {
551
- from { opacity: 0; transform: translateX(-50%) translateY(12px); }
552
- to { opacity: 1; transform: translateX(-50%) translateY(0); }
553
- }
554
-
555
- :where([data-blocfeed-ui-root]) .bf-hint {
556
- animation: bf-hint-in 0.2s ease-out;
557
- }
558
-
559
- @keyframes bf-hint-in {
560
- from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
561
- to { opacity: 1; transform: translateX(-50%) translateY(0); }
562
- }
563
-
564
- /* ------------------------------------------------------------------ */
565
- /* Security warning banner */
566
- /* ------------------------------------------------------------------ */
567
-
568
- :where([data-blocfeed-ui-root]) .bf-security-banner {
569
- position: fixed;
570
- top: 8px;
571
- right: 8px;
572
- z-index: var(--bf-z);
573
- max-width: 360px;
574
- padding: 10px 14px;
575
- border-radius: 10px;
576
- border-left: 3px solid var(--bf-danger);
577
- background: rgba(239, 68, 68, 0.12);
578
- color: rgb(254, 202, 202);
579
- font-family: var(--bf-font);
580
- font-size: 12px;
581
- line-height: 1.5;
582
- pointer-events: auto;
583
- animation: bf-panel-in 0.2s ease-out;
584
- }
585
-
586
- :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-security-banner {
587
- background: rgba(239, 68, 68, 0.08);
588
- color: rgb(185, 28, 28);
589
- }
590
-
591
- :where([data-blocfeed-ui-root]) .bf-security-banner strong {
592
- display: block;
593
- margin-bottom: 4px;
594
- font-size: 13px;
595
- }
596
-
597
- :where([data-blocfeed-ui-root]) .bf-security-banner-dismiss {
598
- position: absolute;
599
- top: 6px;
600
- right: 6px;
601
- background: none;
602
- border: none;
603
- color: inherit;
604
- opacity: 0.6;
605
- cursor: pointer;
606
- padding: 2px 4px;
607
- font-size: 14px;
608
- line-height: 1;
609
- }
610
-
611
- :where([data-blocfeed-ui-root]) .bf-security-banner-dismiss:hover {
612
- opacity: 1;
613
- }
614
-
615
- /* ------------------------------------------------------------------ */
616
- /* Reduced motion */
617
- /* ------------------------------------------------------------------ */
618
-
619
- /* ------------------------------------------------------------------ */
620
- /* Video recording */
621
- /* ------------------------------------------------------------------ */
622
-
623
- :where([data-blocfeed-ui-root]) .bf-record-btn {
624
- display: inline-flex;
625
- align-items: center;
626
- gap: 6px;
627
- padding: 6px 10px;
628
- border-radius: 10px;
629
- border: 1px solid var(--bf-border);
630
- background: transparent;
631
- color: var(--bf-panel-fg);
632
- font-size: 13px;
633
- font-family: var(--bf-font);
634
- cursor: pointer;
635
- user-select: none;
636
- }
637
-
638
- :where([data-blocfeed-ui-root]) .bf-record-btn:hover {
639
- border-color: var(--bf-danger);
640
- color: var(--bf-danger);
641
- }
642
-
643
- :where([data-blocfeed-ui-root]) .bf-record-btn:focus-visible {
644
- outline: 2px solid var(--bf-accent);
645
- outline-offset: 2px;
646
- }
647
-
648
- :where([data-blocfeed-ui-root]) .bf-record-btn[disabled] {
649
- opacity: 0.6;
650
- cursor: not-allowed;
651
- }
652
-
653
- /* ---- Voice feedback button ---- */
654
-
655
- :where([data-blocfeed-ui-root]) .bf-voice-btn {
656
- display: inline-flex;
657
- align-items: center;
658
- gap: 6px;
659
- padding: 6px 12px;
660
- border-radius: 6px;
661
- border: 1px solid var(--bf-border);
662
- background: transparent;
663
- color: var(--bf-panel-fg);
664
- font-size: 13px;
665
- cursor: pointer;
666
- transition: background 0.15s, border-color 0.15s;
667
- }
668
-
669
- :where([data-blocfeed-ui-root]) .bf-voice-btn:hover {
670
- background: rgba(128,128,128,0.1);
671
- }
672
-
673
- :where([data-blocfeed-ui-root]) .bf-voice-btn:focus-visible {
674
- outline: 2px solid var(--bf-accent);
675
- outline-offset: 2px;
676
- }
677
-
678
- :where([data-blocfeed-ui-root]) .bf-voice-btn[disabled] {
679
- opacity: 0.6;
680
- cursor: not-allowed;
681
- }
682
-
683
- :where([data-blocfeed-ui-root]) .bf-voice-btn-active {
684
- border-color: var(--bf-danger);
685
- color: var(--bf-danger);
686
- }
687
-
688
- :where([data-blocfeed-ui-root]) .bf-mic-icon {
689
- flex-shrink: 0;
690
- }
691
-
692
- :where([data-blocfeed-ui-root]) .bf-recording-indicator {
693
- display: flex;
694
- align-items: center;
695
- gap: 8px;
696
- font-size: 12px;
697
- color: var(--bf-danger);
698
- }
699
-
700
- :where([data-blocfeed-ui-root]) .bf-rec-dot {
701
- width: 8px;
702
- height: 8px;
703
- border-radius: 50%;
704
- background: var(--bf-danger);
705
- flex-shrink: 0;
706
- }
707
-
708
- :where([data-blocfeed-ui-root]) .bf-rec-dot-pulse {
709
- animation: bf-rec-pulse 1s ease-in-out infinite;
710
- }
711
-
712
- @keyframes bf-rec-pulse {
713
- 0%, 100% { opacity: 1; }
714
- 50% { opacity: 0.3; }
715
- }
716
-
717
- :where([data-blocfeed-ui-root]) .bf-video-preview {
718
- position: relative;
719
- border-radius: 8px;
720
- overflow: hidden;
721
- border: 1px solid var(--bf-border);
722
- }
723
-
724
- :where([data-blocfeed-ui-root]) .bf-video-preview video {
725
- width: 100%;
726
- max-height: 120px;
727
- object-fit: contain;
728
- display: block;
729
- background: black;
730
- }
731
-
732
- :where([data-blocfeed-ui-root]) .bf-video-remove {
733
- position: absolute;
734
- top: 4px;
735
- right: 4px;
736
- background: rgba(0, 0, 0, 0.7);
737
- border: none;
738
- color: white;
739
- border-radius: 50%;
740
- width: 20px;
741
- height: 20px;
742
- font-size: 12px;
743
- cursor: pointer;
744
- display: flex;
745
- align-items: center;
746
- justify-content: center;
747
- line-height: 1;
748
- }
749
-
750
- :where([data-blocfeed-ui-root]) .bf-video-remove:hover {
751
- background: rgba(0, 0, 0, 0.9);
752
- }
753
-
754
- :where([data-blocfeed-ui-root]) .bf-video-meta {
755
- font-size: 11px;
756
- color: var(--bf-muted);
757
- padding: 4px 8px;
758
- }
759
-
760
- /* ------------------------------------------------------------------ */
761
- /* Floating recording bar (shown during active recording) */
762
- /* ------------------------------------------------------------------ */
763
-
764
- :where([data-blocfeed-ui-root]) .bf-recording-bar {
765
- position: fixed;
766
- z-index: var(--bf-z);
767
- display: flex;
768
- align-items: center;
769
- gap: 10px;
770
- padding: 8px 14px;
771
- border-radius: 20px;
772
- background: var(--bf-bg);
773
- border: 1px solid var(--bf-danger);
774
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(239, 68, 68, 0.25);
775
- font-size: 13px;
776
- color: var(--bf-fg);
777
- pointer-events: auto;
778
- animation: bf-slideUp 0.2s ease-out;
779
- }
780
-
781
- :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-bottom-right {
782
- bottom: 24px;
783
- right: 24px;
784
- }
785
-
786
- :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-bottom-left {
787
- bottom: 24px;
788
- left: 24px;
789
- }
790
-
791
- :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-top-right {
792
- top: 24px;
793
- right: 24px;
794
- }
795
-
796
- :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-top-left {
797
- top: 24px;
798
- left: 24px;
799
- }
800
-
801
- :where([data-blocfeed-ui-root]) .bf-recording-bar-timer {
802
- color: var(--bf-danger);
803
- font-weight: 500;
804
- font-variant-numeric: tabular-nums;
805
- }
806
-
807
- :where([data-blocfeed-ui-root]) .bf-recording-bar-stop {
808
- padding: 4px 12px;
809
- border-radius: 12px;
810
- border: 1px solid var(--bf-danger);
811
- background: transparent;
812
- color: var(--bf-danger);
813
- font-size: 12px;
814
- font-weight: 600;
815
- cursor: pointer;
816
- transition: background 0.15s, color 0.15s;
817
- }
818
-
819
- :where([data-blocfeed-ui-root]) .bf-recording-bar-stop:hover {
820
- background: var(--bf-danger);
821
- color: #fff;
822
- }
823
-
824
- /* ------------------------------------------------------------------ */
825
- /* Watermark */
826
- /* ------------------------------------------------------------------ */
827
-
828
- :where([data-blocfeed-ui-root]) .bf-watermark {
829
- padding: 6px 12px;
830
- border-top: 1px solid rgba(255, 255, 255, 0.06);
831
- text-align: center;
832
- }
833
-
834
- :where([data-blocfeed-ui-root]) .bf-watermark a {
835
- font-size: 10px;
836
- color: rgba(243, 244, 246, 0.35);
837
- text-decoration: none;
838
- }
839
-
840
- :where([data-blocfeed-ui-root]) .bf-watermark a:hover {
841
- color: var(--bf-accent);
842
- }
843
-
844
- :where([data-blocfeed-ui-root]) .bf-watermark .bf-my-feedback-link {
845
- display: block;
846
- margin-bottom: 2px;
847
- font-size: 10px;
848
- color: var(--bf-accent);
849
- opacity: 0.7;
850
- }
851
-
852
- :where([data-blocfeed-ui-root]) .bf-watermark .bf-my-feedback-link:hover {
853
- opacity: 1;
854
- }
855
-
856
- :where([data-blocfeed-ui-root]) .bf-toast-link {
857
- display: block;
858
- margin-top: 4px;
859
- font-size: 11px;
860
- color: var(--bf-accent);
861
- pointer-events: auto;
862
- text-decoration: none;
863
- }
864
-
865
- :where([data-blocfeed-ui-root]) .bf-toast-link:hover {
866
- text-decoration: underline;
867
- }
868
-
869
- /* ------------------------------------------------------------------ */
870
- /* Reduced motion */
871
- /* ------------------------------------------------------------------ */
872
-
873
- @media (prefers-reduced-motion: reduce) {
874
- :where([data-blocfeed-ui-root]) .bf-panel,
875
- :where([data-blocfeed-ui-root]) .bf-toast,
876
- :where([data-blocfeed-ui-root]) .bf-hint,
877
- :where([data-blocfeed-ui-root]) .bf-cursor,
878
- :where([data-blocfeed-ui-root]) .bf-rec-dot-pulse,
879
- :where([data-blocfeed-ui-root]) .bf-recording-bar {
880
- animation: none;
881
- }
882
- }
883
- `;function Jn(){if(!T()||document.getElementById(Gn))return;let e=document.createElement("style");e.id=Gn,e.textContent=ki,document.head.appendChild(e);}var Ae=[],Ie=[],Zn=20,Qn=15,tt=[],eo=typeof console<"u"?{log:console.log?.bind(console),warn:console.warn?.bind(console),error:console.error?.bind(console),info:console.info?.bind(console),debug:console.debug?.bind(console)}:{},nt=typeof globalThis<"u"&&typeof globalThis.fetch=="function"?globalThis.fetch:void 0,ot=typeof XMLHttpRequest<"u"?XMLHttpRequest.prototype.open:void 0,rt=typeof XMLHttpRequest<"u"?XMLHttpRequest.prototype.send:void 0,It=new Set,Lt=false,Nt=false,it=false,Si=["blocfeed.com","google-analytics.com","googletagmanager.com","analytics.google.com","googleads.g.doubleclick.net","googlesyndication.com","googleadservices.com","google.com/pagead","google.com/ads","facebook.net","facebook.com/tr","connect.facebook.net","graph.facebook.com","api.mixpanel.com","api-js.mixpanel.com","api.amplitude.com","api2.amplitude.com","api.segment.io","cdn.segment.com","vars.hotjar.com","in.hotjar.com","script.hotjar.com","heapanalytics.com","fullstory.com/s/fs.js","rs.fullstory.com","app.posthog.com","us.posthog.com","eu.posthog.com","api-iam.intercom.io","widget.intercom.io","sentry.io/api","browser.sentry-cdn.com","browser-intake-datadoghq.com","clarity.ms","js.hs-analytics.net","api.hubapi.com","forms.hubspot.com","plausible.io/api","client.crisp.chat","js.driftt.com","r.logrocket.com","app.pendo.io","events.launchdarkly.com","app.launchdarkly.com","grammarly.com","gnar.grammarly.com","capi.grammarly.com","api.languagetool.org","api.languagetoolplus.com","fonts.googleapis.com","fonts.gstatic.com","cdn.cookielaw.org","consent.cookiebot.com","js.stripe.com","api.stripe.com/v1/tokens","google.com/recaptcha","hcaptcha.com","bam.nr-data.net","rec.smartlook.com","o2.mouseflow.com","api.luckyorange.com","static.zdassets.com","ekr.zdassets.com"];function _i(e){if(e instanceof Error)return e.name&&e.name!=="Error"?`${e.name}: ${e.message}`:e.message||String(e);if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Ti(e,t){let n=t.map(_i).join(" "),o=t.find(i=>i instanceof Error),r={level:e,message:n.slice(0,2e3),timestamp:Date.now()};for(o?.stack&&(r.stack=o.stack.slice(0,2e3)),Ae.push(r);Ae.length>Zn;)Ae.shift();}function At(e){let t=e.url.toLowerCase();for(let n of tt)if(t.includes(n))return;for(Ie.push(e);Ie.length>Qn;)Ie.shift();}function to(e={}){if(it||!T())return;it=true,Zn=e.consoleLimit??20,Qn=e.networkLimit??15;let t=e.ignoreUrls;if(t!==void 0?tt=t.map(n=>n.toLowerCase()):tt=[...Si],e.console!==false){let n=e.consoleLevels??["error","warn"];for(let o of n){let r=eo[o];r&&(It.add(o),console[o]=(...i)=>{Ti(o,i),r.apply(console,i);});}}if(e.network!==false&&nt){let n=nt;Lt=true,window.fetch=async function(r,i){let s=typeof r=="string"?r:r instanceof URL?r.toString():r.url,c=(i?.method??"GET").toUpperCase(),a=Date.now();try{let l=await n.call(window,r,i);return l.ok||At({url:s.slice(0,500),method:c,status:l.status,statusText:l.statusText,timestamp:a,durationMs:Date.now()-a}),l}catch(l){throw At({url:s.slice(0,500),method:c,status:0,statusText:l instanceof Error?l.message:"Network error",timestamp:a,durationMs:Date.now()-a}),l}};}if(e.network!==false&&ot&&rt){let n=ot,o=rt;Nt=true,XMLHttpRequest.prototype.open=function(r,i,...s){return this.__bf_method=r.toUpperCase(),this.__bf_url=String(i),n.apply(this,[r,i,...s])},XMLHttpRequest.prototype.send=function(...r){let i=this.__bf_method||"GET",s=this.__bf_url||"",c=Date.now();return this.addEventListener("loadend",function(){if(this.status>=400||this.status===0){let a={url:s.slice(0,500),method:i,status:this.status,timestamp:c,durationMs:Date.now()-c};this.statusText&&(a.statusText=this.statusText),At(a);}},{once:true}),o.apply(this,r)};}}function no(){if(it){for(let e of It){let t=eo[e];t&&(console[e]=t);}It.clear(),Lt&&nt&&(window.fetch=nt,Lt=false),Nt&&ot&&rt&&(XMLHttpRequest.prototype.open=ot,XMLHttpRequest.prototype.send=rt,Nt=false),tt=[],it=false;}}function oo(){return {consoleLogs:[...Ae],networkErrors:[...Ie]}}function Ac(){Ae=[],Ie=[];}var Ci=[{name:"supabase_service_role_key",pattern:/SUPABASE_SERVICE_ROLE_KEY["'=:\s]{1,8}[A-Za-z0-9_.=-]{30,400}/},{name:"supabase_db_password",pattern:/SUPABASE_DB_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"postgres_password",pattern:/POSTGRES_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"database_url_with_creds",pattern:/(?:postgres|postgresql|mysql|mongodb|redis|amqp):\/\/[^:\s"']{1,100}:[^@\s"']{1,200}@/},{name:"aws_access_key",pattern:/AKIA[0-9A-Z]{16}/},{name:"aws_secret_key",pattern:/AWS_SECRET_ACCESS_KEY["'=:\s]{1,8}[A-Za-z0-9/+=]{30,200}/},{name:"aws_session_token",pattern:/AWS_SESSION_TOKEN["'=:\s]{1,8}[A-Za-z0-9/+=]{30,600}/},{name:"stripe_secret_key",pattern:/sk_live_[a-zA-Z0-9]{10,200}/},{name:"stripe_secret_key_test",pattern:/sk_test_[a-zA-Z0-9]{10,200}/},{name:"stripe_restricted_key",pattern:/rk_(?:live|test)_[a-zA-Z0-9]{10,200}/},{name:"github_pat",pattern:/ghp_[A-Za-z0-9_]{36,100}/},{name:"github_oauth",pattern:/gho_[A-Za-z0-9_]{36,100}/},{name:"github_user_token",pattern:/ghu_[A-Za-z0-9_]{36,100}/},{name:"github_server_token",pattern:/ghs_[A-Za-z0-9_]{36,100}/},{name:"github_fine_grained",pattern:/github_pat_[A-Za-z0-9_]{22,200}/},{name:"openai_api_key",pattern:/sk-[a-zA-Z0-9]{20,200}(?![a-zA-Z0-9_])/},{name:"anthropic_api_key",pattern:/sk-ant-[a-zA-Z0-9\-_]{20,200}/},{name:"private_key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/},{name:"sendgrid_api_key",pattern:/SG\.[a-zA-Z0-9_-]{22,100}\.[a-zA-Z0-9_-]{22,100}/},{name:"twilio_auth_token",pattern:/TWILIO_AUTH_TOKEN["'=:\s]{1,8}[a-f0-9]{32}/},{name:"generic_secret_key",pattern:/[A-Z_]{2,60}_SECRET_KEY["'=:\s]{1,8}[^\s"']{8,200}/},{name:"generic_secret",pattern:/[A-Z_]{2,60}_SECRET["'=:\s]{1,8}[^\s"']{8,200}/},{name:"generic_password",pattern:/[A-Z_]{2,60}_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"generic_private_key_var",pattern:/[A-Z_]{2,60}_PRIVATE_KEY["'=:\s]{1,8}[^\s"']{8,400}/}],ge=[],Ot=0,Dt=false;function Ri(e){let t=e.slice(0,80);return t.length<=6?"***":t.slice(0,6)+"***"}function Pi(e,t,n,o){if(ge.some(s=>s.rule===e&&s.source===t))return;let i={rule:e,source:t,hint:Ri(n),timestamp:Date.now()};o&&(i.location=o),ge.push(i);}function Le(e,t,n,o){for(let{name:r,pattern:i}of n){let s=i.exec(e);s&&Pi(r,t,s[0],o);}}function Fi(e){try{let t=window;if(t.__NEXT_DATA__){let n=JSON.stringify(t.__NEXT_DATA__);Le(n,"hydration",e,"__NEXT_DATA__");}if(t.__NUXT__){let n=JSON.stringify(t.__NUXT__);Le(n,"hydration",e,"__NUXT__");}}catch{}}function Bi(e){try{document.querySelectorAll("script:not([src])").forEach((n,o)=>{let r=n.textContent;r&&r.length>0&&Le(r,"scripts",e,`inline-script[${o}]`);});}catch{}}function Mi(e){try{document.querySelectorAll("meta[content]").forEach(n=>{let o=n.getAttribute("content"),r=n.getAttribute("name")||n.getAttribute("property")||"";o&&o.length>10&&Le(o,"meta",e,r?`meta[${r}]`:void 0);});}catch{}}function Ai(e){try{document.querySelectorAll("[data-api-key], [data-secret], [data-token], [data-password]").forEach(n=>{let o=n.attributes;for(let r=0;r<o.length;r++){let i=o[r];i.name.startsWith("data-")&&i.value.length>10&&Le(i.value,"dom",e,`${n.tagName.toLowerCase()}[${i.name}]`);}});}catch{}}function ro(e={}){if(Dt||!T()||(Dt=true,e.secretScan===false))return;let t=[...Ci,...e.customPatterns??[]],n=e.scanTargets??["hydration","scripts","meta","dom"];setTimeout(()=>{Ot=Date.now(),n.includes("hydration")&&Fi(t),n.includes("scripts")&&Bi(t),n.includes("meta")&&Mi(t),n.includes("dom")&&Ai(t);let o=e.notify??"both";ge.length>0&&(o==="console"||o==="both")&&console.warn(`[BlocFeed Security] Found ${ge.length} potential secret(s) exposed in client code:`,ge.map(r=>`${r.rule} (${r.source}${r.location?`: ${r.location}`:""})`));},100);}function Ht(){return {findings:[...ge],scannedAt:Ot}}function Nc(){ge=[],Ot=0,Dt=false;}var io={triggerLabel:"Feedback",panelTitle:"Feedback",hintText:"Click an element to attach your feedback. Press Esc to cancel.",cancelButton:"Cancel",rePickButton:"Re-pick",closeButton:"Close",textareaPlaceholder:"What's happening? What did you expect?",screenshotElement:"Screenshot element",screenshotFullPage:"Full page",capturingText:"Capturing screenshots\u2026",submittingText:"Submitting\u2026",successText:"Sent. Thank you!",toastText:"Feedback sent",sendButton:"Send",categoryBug:"Bug",categoryFeature:"Feature",categoryUx:"UX",categoryGeneral:"General",recordButton:"Record",stopRecordButton:"Stop",recordingText:"Recording\u2026",recordingDeniedText:"Screen share was denied",videoPreviewLabel:"Video attached",removeVideoButton:"Remove",voiceButton:"Voice",voiceStopButton:"Stop",voiceRecordingText:"Recording\u2026",voiceTranscribingText:"Transcribing\u2026",voiceDeniedText:"Microphone access was denied",voiceErrorText:"Voice transcription failed. Please type instead.",voiceEmptyText:"No speech detected. Try again or type instead."};function ao(e){return e?{...io,...e}:io}function Ut(){let e=useContext(Qe);if(!e)throw new Error("useBlocFeed must be used within a <BlocFeedProvider />");return {state:e.state,controller:e.controller,start:e.controller.start,stop:e.controller.stop,clearSelection:e.controller.clearSelection,submit:e.controller.submit,startRecording:e.controller.startRecording,stopRecording:e.controller.stopRecording,removeVideo:e.controller.removeVideo,track:Be}}function q(e){switch(e){case "bottom-left":return "bf-trigger bf-trigger-bl";case "top-right":return "bf-trigger bf-trigger-tr";case "top-left":return "bf-trigger bf-trigger-tl";default:return "bf-trigger"}}function O({size:e=14}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function so({size:e=14}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function co({size:e=16}){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M22 6l-10 7L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function uo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){return n?jsxs("button",{className:q(e),type:"button",onClick:t,"aria-label":o,children:[i?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})}):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),o]}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]}):null}function V(){let[e,t]=useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return useEffect(()=>{let n=window.matchMedia("(prefers-reduced-motion: reduce)"),o=r=>t(r.matches);return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[]),e}var Ui={duration:.18,ease:"easeOut"},zi={duration:0};function po({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),a=V(),l=a?zi:Ui;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:q(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.92},style:{overflow:"hidden"},children:i?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{className:"bf-dot","aria-hidden":"true",animate:a?{}:{scale:s?1:[1,1.2,1],boxShadow:s?"0 0 0 4px rgba(99, 102, 241, 0.18)":["0 0 0 4px rgba(99, 102, 241, 0.18)","0 0 0 8px rgba(99, 102, 241, 0.28)","0 0 0 4px rgba(99, 102, 241, 0.18)"]},transition:s||a?l:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"dot")})}var $i={duration:.18,ease:"easeOut"},go={duration:0};function ho({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),a=V(),l=a?go:$i;return jsx(AnimatePresence,{mode:"wait",children:n&&jsxs(motion.div,{className:q(e),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:l,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.div,{initial:{opacity:0,y:a?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:a?0:4},transition:l,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",padding:"6px 12px",borderRadius:"8px",background:"var(--bf-panel-bg)",border:"1px solid var(--bf-border)",boxShadow:"var(--bf-shadow)",whiteSpace:"nowrap",fontSize:"12px",color:"var(--bf-panel-fg)",pointerEvents:"none"},children:o},"tooltip")}),jsxs(motion.button,{type:"button",onClick:t,"aria-label":o,style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"40px",borderRadius:"50%",border:"1px solid var(--bf-border)",background:"var(--bf-panel-bg)",color:"var(--bf-panel-fg)",boxShadow:"var(--bf-shadow)",cursor:"pointer",padding:0},animate:a?{}:{y:[0,-3,0]},transition:a?go:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[i?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:16})},"success"):jsx(so,{size:16}),r>0&&jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${r} queued`,children:r})]})]},"bubble")})}var ji={duration:.2,ease:"easeOut"},Yi={duration:0};function vo(e){return e==="bottom-left"||e==="top-left"}function Gi(e){return `bf-trigger-edge ${vo(e)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function wo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),a=vo(e),l=V(),b=l?Yi:ji;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:Gi(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{opacity:0,width:0},animate:{opacity:1,width:s?140:22,height:s?40:90},exit:{width:0,opacity:0},transition:b,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:i?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:b,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})},"success"):jsxs(Fragment,{children:[jsxs(motion.span,{animate:{rotate:l||s?0:a?-90:90,opacity:s?1:.6},transition:b,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[s&&jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:{duration:.12},style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--bf-accent)",flexShrink:0}}),o]}),jsx(motion.span,{"aria-hidden":"true",animate:{opacity:s?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[a?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"edge-tab")})}var Qi={duration:.18,ease:"easeOut"},ea={duration:0};function Eo({delay:e,hovered:t,reduced:n}){return n?null:jsx(motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"10px",height:"10px",borderRadius:"50%",border:"2px solid var(--bf-accent)",pointerEvents:"none"},animate:t?{scale:1,opacity:0}:{scale:[1,1.8],opacity:[.5,0]},transition:t?{duration:.15}:{duration:2,repeat:1/0,delay:e,ease:"easeOut"}})}function So({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),a=V(),l=a?ea:Qi;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:q(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.92},style:{overflow:"hidden"},children:i?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})},"success"):jsxs(Fragment,{children:[jsxs("span",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsx(Eo,{delay:0,hovered:s,reduced:a}),jsx(Eo,{delay:.7,hovered:s,reduced:a}),jsx(motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"pulse-ring")})}var ra={duration:.18,ease:"easeOut"},ia={duration:0};function aa(e){switch(e){case "bottom-left":return "bf-trigger-minimal bf-trigger-bl";case "top-right":return "bf-trigger-minimal bf-trigger-tr";case "top-left":return "bf-trigger-minimal bf-trigger-tl";default:return "bf-trigger-minimal"}}function Co({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),a=V(),l=a?ia:ra;return jsx(AnimatePresence,{mode:"wait",children:n&&jsxs(motion.button,{className:aa(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{opacity:0,y:a?0:5},animate:{opacity:s?1:.65,y:0},exit:{opacity:0,y:a?0:5},transition:l,whileTap:{scale:.95},children:[i?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})}):jsxs(Fragment,{children:[jsx("span",{children:o}),r>0&&jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${r} queued`,children:r})]}),!a&&jsx(motion.span,{"aria-hidden":"true",style:{position:"absolute",bottom:4,left:4,right:4,height:"2px",background:"var(--bf-accent)",borderRadius:"1px",transformOrigin:"left"},initial:false,animate:{scaleX:s?1:0},transition:l})]},"minimal")})}var la={duration:.18,ease:"easeOut"},da={duration:0};function Po({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),a=V(),l=a?da:la;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:q(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.9},style:{overflow:"hidden"},children:i?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{style:{display:"inline-flex",flexShrink:0},animate:a?{}:s?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:s||a?l:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsx(co,{size:16})}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:a?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-8},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"icon-pop")})}var ma={duration:.18,ease:"easeOut"},ga={duration:0};function Mo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),a=V(),l=a?ga:ma;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:q(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.92},style:{overflow:"hidden"},children:i?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})},"success"):jsxs(Fragment,{children:[jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsx(motion.span,{"aria-hidden":"true",style:{width:"10px",height:"10px",borderRadius:"50%",background:"var(--bf-accent)",position:"relative",zIndex:1},animate:a?{}:{opacity:s?1:[.5,1,.5],boxShadow:s?"0 0 8px 2px var(--bf-accent)":["0 0 4px 1px var(--bf-accent)","0 0 12px 4px var(--bf-accent)","0 0 4px 1px var(--bf-accent)"]},transition:s||a?l:{duration:2,repeat:1/0,ease:"easeInOut"}}),!s&&!a&&jsx(motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"18px",height:"2px",background:"linear-gradient(90deg, var(--bf-accent), transparent)",transformOrigin:"left center",left:"5px",top:"4px"},animate:{rotate:[0,360]},transition:{duration:4,repeat:1/0,ease:"linear"}})]}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"beacon")})}var wa={duration:.18,ease:"easeOut"},xa={duration:0};function No({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:i}){let[s,c]=useState(false),[a,l]=useState(0),b=V(),g=b?xa:wa,d=useRef(null);useEffect(()=>{if(d.current&&(clearInterval(d.current),d.current=null),!n||s||b){l(s||b?o.length:0);return}let u=8,p=o.length*2+u*2,f=0;return d.current=setInterval(()=>{f=(f+1)%p,f<=o.length?l(f):f<=o.length+u?l(o.length):f<=o.length*2+u?l(o.length*2+u-f):l(0);},100),()=>{d.current&&(clearInterval(d.current),d.current=null);}},[n,s,b,o]);let h=o.slice(0,a);return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:q(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{opacity:0,y:b?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:b?0:5},transition:g,whileTap:{scale:.95},style:{minWidth:"44px"},children:i?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:g,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(O,{size:14})},"success"):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[h,jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"typewriter")})}function Do(e){switch(e){case "dot":return po;case "bubble":return ho;case "edge-tab":return wo;case "pulse-ring":return So;case "minimal":return Co;case "icon-pop":return Po;case "beacon":return Mo;case "typewriter":return No;default:return uo}}function Oo(e,t,n){return Math.max(t,Math.min(n,e))}function Ta(e,t,n="bottom-right"){let r=window.innerWidth,i=window.innerHeight,s;s=Oo(e.x,12,Math.max(12,r-t-12));let c=e.y+e.height+12,a=Math.max(12,e.y-240);return {top:c+240<=i?c:a,left:s}}function Ca(e){let{rect:t}=e,n={left:`${t.x}px`,top:`${t.y}px`,width:`${Math.max(0,t.width)}px`,height:`${Math.max(0,t.height)}px`};return jsx("div",{className:"bf-highlight",style:n,"aria-hidden":"true"})}function Ra(e){let t=useRef(null);return useEffect(()=>{if(!e||!t.current)return;let n=t.current,o=n.querySelector(".bf-textarea");o?.focus();let r=s=>{if(s.key!=="Tab")return;let c=n.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(c.length===0)return;let a=c[0],l=c[c.length-1];s.shiftKey&&document.activeElement===a?(s.preventDefault(),l.focus()):!s.shiftKey&&document.activeElement===l&&(s.preventDefault(),a.focus());},i=s=>{let c=s.target;c&&(n.contains(c)||(s.stopImmediatePropagation(),o?.focus()));};return document.addEventListener("keydown",r,{capture:true}),document.addEventListener("focusin",i,{capture:true}),()=>{document.removeEventListener("keydown",r,{capture:true}),document.removeEventListener("focusin",i,{capture:true});}},[e]),t}function Pa(e,t){return e?typeof e=="function"?e(t):e.some(n=>n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n):true}var Wt=new Set,Ho=false;function Fa(){if(Ho||typeof window>"u")return;Ho=true;let e=history.pushState,t=history.replaceState,n=()=>{for(let o of Wt)o();};history.pushState=function(...o){e.apply(this,o),setTimeout(n,0);},history.replaceState=function(...o){t.apply(this,o),setTimeout(n,0);};}function Ba(e){let[t,n]=useState(()=>typeof window<"u"?window.location.pathname:"/");return useEffect(()=>{if(typeof window>"u")return;let o=()=>n(window.location.pathname);return window.addEventListener("popstate",o),Fa(),Wt.add(o),()=>{window.removeEventListener("popstate",o),Wt.delete(o);}},[]),Pa(e,t)}function Ma(e){let[t,n]=useState(()=>!e||e==="dark"?"dark":e==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return useEffect(()=>{if(e!=="auto"){n(e==="light"?"light":"dark");return}let o=window.matchMedia("(prefers-color-scheme: dark)"),r=i=>n(i.matches?"dark":"light");return n(o.matches?"dark":"light"),o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}var Aa=["bug","feature","ux","general"],Ia={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function He(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),o=t%60;return `${n}:${String(o).padStart(2,"0")}`}function La(e){return e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Na(e){let{state:t,controller:n,start:o,stop:r,clearSelection:i,submit:s}=Ut(),c=e.config.ui?.position,a=ao(e.config.ui?.strings),l=e.config.ui?.branding!==false,[b,g]=useState(null),[d,h]=useState(""),[u,p]=useState(e.config.capture?.element??true),[f,m]=useState(e.config.capture?.fullPage??false),[y,C]=useState(null),[_,E]=useState(void 0),z=e.config.ui?.categories??Aa,H=e.config.recording?.enabled===true&&xt(),F=e.config.recording?.maxDurationMs??3e4,A=n.getConfig().voice,se=A?.enabled===true&&kt(),ue=A?.maxDurationMs??6e4,[v,S]=useState(false),[L,N]=useState(0);useEffect(()=>{let w=window.setTimeout(()=>{let W=Ht();N(W.findings.length);},500);return ()=>window.clearTimeout(w)},[]),useImperativeHandle(e.handleRef,()=>({open:o,close:r,submit:w=>s(w),startRecording:()=>n.startRecording(),stopRecording:()=>n.stopRecording(),get isOpen(){return t.phase!=="idle"}}),[o,r,s,n,t.phase]);let I=t.phase==="review"||t.phase==="capturing"||t.phase==="submitting"||t.phase==="error"||t.phase==="success",R=Ra(I),[G,te]=useState(0);useEffect(()=>{t.phase==="idle"&&te(sn());},[t.phase]);let[Ue,ce]=useState(false),B=useRef(t.phase);useEffect(()=>{if(B.current==="success"&&t.phase==="idle"){ce(true);let w=window.setTimeout(()=>ce(false),1500);return ()=>window.clearTimeout(w)}B.current=t.phase;},[t.phase]),useEffect(()=>{let w=e.config.ui?.shortcut;if(!w)return;let W=w.toLowerCase().split("+").map(ee=>ee.trim()),Q=W[W.length-1]||"",fe=new Set(W.slice(0,-1)),$t=ee=>{let Wo=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(fe.has("mod")){if(Wo?!ee.metaKey:!ee.ctrlKey)return}else if(fe.has("ctrl")&&!ee.ctrlKey||(fe.has("meta")||fe.has("cmd"))&&!ee.metaKey)return;fe.has("shift")&&!ee.shiftKey||(fe.has("alt")||fe.has("option"))&&!ee.altKey||ee.key.toLowerCase()===Q&&(ee.preventDefault(),t.phase==="idle"?o():r());};return document.addEventListener("keydown",$t),()=>document.removeEventListener("keydown",$t)},[e.config.ui?.shortcut,t.phase,o,r]),useEffect(()=>n.subscribeHover(g),[n]),useEffect(()=>{let w=n.__unsafeGetSelectedElement();if(!w||t.phase==="idle"||t.phase==="picking"){C(null);return}let W=()=>{C(Ce(w.getBoundingClientRect()));};W();let Q=()=>W();return window.addEventListener("scroll",Q,{capture:true,passive:true}),window.addEventListener("resize",Q,{passive:true}),()=>{window.removeEventListener("scroll",Q,{capture:true}),window.removeEventListener("resize",Q);}},[n,t.phase,t.selection?.selector]),useEffect(()=>{t.phase==="review"&&(h(""),p(e.config.capture?.element??true),m(e.config.capture?.fullPage??false),E(void 0),oe(null));},[t.phase,t.selection?.selector,e.config.capture?.element,e.config.capture?.fullPage]),useEffect(()=>{if(t.phase!=="success")return;let w=window.setTimeout(()=>r(),1200);return ()=>window.clearTimeout(w)},[t.phase,r]);let M=t.phase==="capturing"||t.phase==="submitting",U=t.phase==="picking"?b?.rect??null:y??t.selection?.rect??null,ne=useMemo(()=>U?Ta(U,360,c):null,[U?.x,U?.y,U?.width,U?.height,c]),Z=t.lastError?.message,j=useCallback(()=>{let w={capture:{element:u,fullPage:f}};_&&(w.category=_),s(d,w);},[s,d,u,f,_]),dt=useCallback(w=>{(w.metaKey||w.ctrlKey)&&w.key==="Enter"&&d.trim().length>0&&!M&&(w.preventDefault(),j());},[j,d,M]),[ve,oe]=useState(null),zo=useCallback(async()=>{if(t.voiceRecording){n.stopVoice();return}oe(null);let w=await n.startVoice();if(w?.text)h(W=>W?W+" "+w.text:w.text);else if(w?.warning)oe(a.voiceEmptyText);else if(!w){let W=n.getState().lastError;if(W){let Q=W.message?.toLowerCase()??"";Q.includes("denied")||Q.includes("permission")||Q.includes("not allowed")?oe(a.voiceDeniedText):oe(a.voiceErrorText);}}},[t.voiceRecording,n,a]),Vo=Do(e.config.ui?.triggerStyle);return jsxs(Fragment,{children:[jsx(Vo,{position:c,onClick:()=>o(),isVisible:t.phase==="idle",label:e.config.ui?.triggerLabel??a.triggerLabel,queueCount:G,showSuccess:Ue}),t.phase!=="idle"&&t.phase!=="recording"&&jsxs("div",{className:"bf-overlay",role:"presentation",children:[t.phase!=="picking"&&jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>r()}),U&&jsx(Ca,{rect:U}),t.phase==="picking"&&jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsx("p",{id:"bf-hint-text",children:a.hintText}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),"aria-label":a.cancelButton,children:a.cancelButton})]}),I&&ne&&jsxs("div",{ref:R,className:"bf-panel",style:{left:ne.left,top:ne.top},role:"dialog","aria-modal":"true","aria-label":"Feedback form",children:[jsxs("div",{className:"bf-panelHeader",children:[jsx("div",{className:"bf-title",id:"bf-panel-title",children:a.panelTitle}),jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>i(),disabled:M,"aria-label":a.rePickButton,children:a.rePickButton}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:M,"aria-label":a.closeButton,children:a.closeButton})]})]}),jsxs("div",{className:"bf-panelBody",children:[jsx("textarea",{className:"bf-textarea",placeholder:a.textareaPlaceholder,value:d,onChange:w=>h(w.target.value),onKeyDown:dt,disabled:M,"aria-label":a.panelTitle}),z.length>0&&jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:z.map(w=>jsx("button",{type:"button",className:`bf-pill${_===w?" bf-pill-active":""}`,onClick:()=>E(_===w?void 0:w),disabled:M,children:a[Ia[w]]},w))}),jsxs("div",{className:"bf-row",role:"group","aria-label":a.screenshotElement,children:[jsxs("label",{children:[jsx("input",{type:"checkbox",checked:u,onChange:w=>p(w.target.checked),disabled:M}),a.screenshotElement]}),jsxs("label",{children:[jsx("input",{type:"checkbox",checked:f,onChange:w=>m(w.target.checked),disabled:M}),a.screenshotFullPage]})]}),se&&t.phase==="review"&&!t.voiceTranscribing&&jsx("button",{type:"button",className:`bf-voice-btn${t.voiceRecording?" bf-voice-btn-active":""}`,onClick:zo,disabled:M,"aria-label":t.voiceRecording?a.voiceStopButton:a.voiceButton,children:t.voiceRecording?jsxs(Fragment,{children:[jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),a.voiceRecordingText," ",He(t.voiceElapsedMs??0)," / ",He(ue)," \u2014 ",a.voiceStopButton]}):jsxs(Fragment,{children:[jsxs("svg",{className:"bf-mic-icon",viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[jsx("rect",{x:"9",y:"1",width:"6",height:"11",rx:"3"}),jsx("path",{d:"M19 10v1a7 7 0 0 1-14 0v-1"}),jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),a.voiceButton]})}),t.voiceTranscribing&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),a.voiceTranscribingText]}),ve&&!t.voiceRecording&&!t.voiceTranscribing&&jsx("div",{className:"bf-error",role:"alert",children:ve}),H&&t.phase==="review"&&!t.video&&jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>n.startRecording(),disabled:M,"aria-label":a.recordButton,children:[jsx("span",{className:"bf-rec-dot","aria-hidden":"true"}),a.recordButton]}),t.video&&t.phase==="review"&&jsxs("div",{className:"bf-video-preview",children:[jsx("video",{src:t.video.blobUrl,controls:true,muted:true,playsInline:true}),jsx("button",{type:"button",className:"bf-video-remove",onClick:()=>n.removeVideo(),"aria-label":a.removeVideoButton,children:"\xD7"}),jsxs("div",{className:"bf-video-meta",children:[a.videoPreviewLabel," (",He(t.video.durationMs),", ",La(t.video.sizeBytes),")"]})]}),t.phase==="capturing"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),a.capturingText]}),t.phase==="submitting"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),a.submittingText]}),t.phase==="success"&&jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:a.successText}),t.phase==="error"&&Z&&jsx("div",{className:"bf-error",role:"alert",children:Z}),jsxs("div",{className:"bf-actions",children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:M,"aria-label":a.cancelButton,children:a.cancelButton}),jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:j,disabled:M||d.trim().length===0,"aria-label":a.sendButton,children:a.sendButton})]})]}),l&&jsxs("div",{className:"bf-watermark",children:[(()=>{let w=Tt();return w?jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"bf-my-feedback-link",children:"View my feedback"}):null})(),jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})]})]})]}),t.phase==="recording"&&jsxs("div",{className:`bf-recording-bar bf-pos-${c}`,role:"status","aria-live":"polite","data-blocfeed-ui":"true",children:[jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),jsxs("span",{className:"bf-recording-bar-timer",children:[a.recordingText," ",He(t.recordingElapsedMs??0)," / ",He(F)]}),jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>n.stopRecording(),"aria-label":a.stopRecordButton,children:a.stopRecordButton})]}),t.phase==="success"&&jsxs("div",{className:"bf-toast",role:"status","aria-live":"polite",children:[a.toastText,(()=>{let w=Tt();return w?jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"bf-toast-link",children:"View my feedback"}):null})()]}),L>0&&!v&&jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>S(true),"aria-label":"Dismiss",children:"\xD7"}),jsx("strong",{children:"Security Warning"}),L," potential secret",L>1?"s":""," exposed in client code. Check your environment variables."]})]})}var Da=forwardRef(function(t,n){let o={...t.config??{},blocfeed_id:t.blocfeed_id},[r,i]=useState(null),s=Ba(o.ui?.showOn),c=Ma(o.ui?.theme?.mode),a=!!o.diagnostics;useEffect(()=>{if(a)return to(o.diagnostics),()=>no()},[a]);let l=!!o.security;useEffect(()=>{l&&ro(o.security);},[l]);let b=useRef(t.config?.metadata?.enrich);b.current=t.config?.metadata?.enrich;let g=useMemo(()=>{if(t.config)return {...t.config,metadata:{...t.config.metadata,enrich:async d=>{let h=b.current,u=h?await h(d):{},p=oo(),f=Ht(),m=wt();return {...u,...p.consoleLogs.length>0?{_consoleLogs:p.consoleLogs}:{},...p.networkErrors.length>0?{_networkErrors:p.networkErrors}:{},...f.findings.length>0?{_securityFindings:f.findings}:{},...m.length>0?{_clickEvents:m}:{}}}}}},[]);return useEffect(()=>{Jn();let d=document.createElement("div");d.setAttribute("data-blocfeed-ui-root","true"),d.setAttribute("data-blocfeed-ui","true"),d.setAttribute("data-bf-theme",c);let h=o.ui?.zIndex;typeof h=="number"&&d.style.setProperty("--bf-z",String(h));let u=o.ui?.theme;u&&(u.accentColor&&d.style.setProperty("--bf-accent",u.accentColor),u.panelBackground&&d.style.setProperty("--bf-panel-bg",u.panelBackground),u.panelForeground&&d.style.setProperty("--bf-panel-fg",u.panelForeground),u.fontFamily&&d.style.setProperty("--bf-font",u.fontFamily));let p=m=>m.stopPropagation(),f=["pointerdown","pointerup","mousedown","mouseup","click","touchstart","touchend"];for(let m of f)d.addEventListener(m,p);try{document.body.appendChild(d);}catch{return}return i(d),()=>{for(let m of f)d.removeEventListener(m,p);d.remove(),i(null);}},[o.ui?.zIndex,o.ui?.theme?.accentColor,o.ui?.theme?.panelBackground,o.ui?.theme?.panelForeground,o.ui?.theme?.fontFamily,c]),!s||!r?null:createPortal(jsx(Mt,{blocfeed_id:o.blocfeed_id,...g?{config:g}:{},children:jsx(Na,{config:o,handleRef:n})}),r)});var Xn="0.24.0",_d={init(e){ke(e);},identify(e){qn(e);},track:Be};
884
- export{ro as A,Ht as B,Nc as C,Ut as D,Da as E,Xn as F,_d as G,T as a,Qt as b,on as c,rn as d,yt as e,an as f,Ga as g,sn as h,wt as i,ur as j,xt as k,Et as l,kt as m,St as n,_r as o,Tt as p,Sn as q,qn as r,Be as s,Me as t,Yn as u,Mt as v,to as w,no as x,oo as y,Ac as z};