sitemana-widget-embed 0.1.41 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/widget.js +2 -2
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -3450,7 +3450,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
|
|
|
3450
3450
|
`)?"":`
|
|
3451
3451
|
`)}${l}
|
|
3452
3452
|
|
|
3453
|
-
`})}return r},Gst=/([\\`*_~[\]|])/g,Wst=e=>e.replace(Gst,"\\$1"),Yst=(e,t)=>{if(!t.length)return e;let r=e;for(let n of t){let i=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");r=r.replace(i,(a,s,o,l)=>s+Wst(o).replace(/\n\n/g," ")+l)}return r},Qoe=e=>e.type==="text"?e.value:"children"in e&&Array.isArray(e.children)?e.children.map(Qoe).join(""):"",jst=e=>t=>{if(!e||e.length===0)return;let r=new Set(e.map(n=>n.toLowerCase()));Hd(t,"element",n=>{if(r.has(n.tagName.toLowerCase())){let i=Qoe(n);n.children=i?[{type:"text",value:i}]:[]}})},Xst=()=>e=>{Hd(e,"code",t=>{var r,n;t.meta&&(t.data=(r=t.data)!=null?r:{},t.data.hProperties={...(n=t.data.hProperties)!=null?n:{},metastring:t.meta})})},Kst=/^[ \t]*<[\w!/?-]/,Qst=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Zst=e=>typeof e!="string"||e.length===0||!Kst.test(e)?e:e.replace(Qst,"$1"),N5={...Y0,protocols:{...Y0.protocols,href:[...(eot=(Jst=Y0.protocols)==null?void 0:Jst.href)!=null?eot:[],"tel"]},attributes:{...Y0.attributes,code:[...(rot=(tot=Y0.attributes)==null?void 0:tot.code)!=null?rot:[],"metastring"]}},MO={raw:Mae,sanitize:[Yet,N5],harden:[yVt,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},not={gfm:[LQt,{}],codeMeta:Xst},Zoe=Object.values(MO),iot=Object.values(not),aot={block:" ▋",circle:" ●"},Joe=["github-light","github-dark"],ele={enabled:!0},To=(0,yt.createContext)({shikiTheme:Joe,controls:!0,isAnimating:!1,lineNumbers:!0,mode:"streaming",mermaid:void 0,linkSafety:ele}),tle=(0,yt.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:r,index:n,isIncomplete:i,dir:a,animatePlugin:s,...o})=>{if(s){let h=s.getLastRenderCharCount();s.setPrevContentLength(h)}let l=typeof e=="string"&&r?Zst(e):e,u=(0,Xe.jsx)(Woe,{...o,children:l});return(0,Xe.jsx)(aoe.Provider,{value:i,children:a?(0,Xe.jsx)("div",{dir:a,style:{display:"contents"},children:u}):u})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let r=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(r.length!==n.length||r.some(i=>{var a,s;return((a=e.components)==null?void 0:a[i])!==((s=t.components)==null?void 0:s[i])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)}),tle.displayName="Block",rle=(0,yt.memo)(({children:e,mode:t="streaming",dir:r,parseIncompleteMarkdown:n=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:s=Zoe,remarkPlugins:o=iot,className:l,shikiTheme:u=Joe,mermaid:h,controls:d=!0,isAnimating:f=!1,animated:p,BlockComponent:g=tle,parseMarkdownIntoBlocksFn:y=Vst,caret:b,plugins:T,remend:w,linkSafety:x=ele,lineNumbers:C=!0,allowedTags:R,literalTagContent:_,translations:S,icons:A,prefix:M,onAnimationStart:O,onAnimationEnd:P,...H})=>{let L=(0,yt.useId)(),[$,I]=(0,yt.useTransition)(),B=(0,yt.useMemo)(()=>Bat(M),[M]),D=(0,yt.useRef)(null),F=(0,yt.useRef)(O),V=(0,yt.useRef)(P);F.current=O,V.current=P,(0,yt.useEffect)(()=>{var ze,_e,Je;if(t==="static")return;let Pe=D.current;if(D.current=f,Pe===null){f&&((ze=F.current)==null||ze.call(F));return}f&&!Pe?(_e=F.current)==null||_e.call(F):!f&&Pe&&((Je=V.current)==null||Je.call(V))},[f,t]);let U=(0,yt.useMemo)(()=>R?Object.keys(R):[],[R]),j=(0,yt.useMemo)(()=>{if(typeof e!="string")return"";let ze=t==="streaming"&&n?Rnt(e,w):e;return _&&_.length>0&&(ze=Yst(ze,_)),U.length>0&&(ze=qst(ze,U)),ze},[e,t,n,w,U,_]),W=(0,yt.useMemo)(()=>y(j),[j,y]),[G,K]=(0,yt.useState)(W);(0,yt.useEffect)(()=>{t==="streaming"&&!J?I(()=>{K(W)}):K(W)},[W,t]);let Z=t==="streaming"?G:W,ae=(0,yt.useMemo)(()=>r==="auto"?Z.map(wat):void 0,[Z,r]),te=(0,yt.useMemo)(()=>Z.map((ze,_e)=>`${L}-${_e}`),[Z.length,L]),se=(0,yt.useMemo)(()=>p===!0?"true":p?JSON.stringify(p):"",[p]),J=(0,yt.useMemo)(()=>se?se==="true"?roe():roe(p):null,[se]),ce=(0,yt.useMemo)(()=>{var ze,_e;return{shikiTheme:(_e=(ze=T?.code)==null?void 0:ze.getThemes())!=null?_e:u,controls:d,isAnimating:f,lineNumbers:C,mode:t,mermaid:h,linkSafety:x}},[u,d,f,C,t,h,x,T?.code]),ue=(0,yt.useMemo)(()=>({...hoe,...S}),[(0,yt.useMemo)(()=>S?JSON.stringify(S):"",[S])]),he=(0,yt.useMemo)(()=>{let{inlineCode:ze,..._e}=a??{},Je={...xst,..._e};if(ze){let Pe=Je.code;Je.code=gt=>"data-block"in gt?Pe?(0,yt.createElement)(Pe,gt):null:(0,yt.createElement)(ze,gt)}return Je},[a]),Ce=(0,yt.useMemo)(()=>{let ze=[];return T!=null&&T.cjk&&(ze=[...ze,...T.cjk.remarkPluginsBefore]),ze=[...ze,...o],T!=null&&T.cjk&&(ze=[...ze,...T.cjk.remarkPluginsAfter]),T!=null&&T.math&&(ze=[...ze,T.math.remarkPlugin]),ze},[o,T?.math,T?.cjk]),Se=(0,yt.useMemo)(()=>{var ze;let _e=s;if(R&&Object.keys(R).length>0&&s===Zoe){let Je={...N5,tagNames:[...(ze=N5.tagNames)!=null?ze:[],...Object.keys(R)],attributes:{...N5.attributes,...R}};_e=[MO.raw,[Yet,Je],MO.harden]}return _&&_.length>0&&(_e=[..._e,[jst,_]]),T!=null&&T.math&&(_e=[..._e,T.math.rehypePlugin]),J&&f&&(_e=[..._e,J.rehypePlugin]),_e},[s,T?.math,J,f,R,_]),Le=(0,yt.useMemo)(()=>{if(!f||Z.length===0)return!1;let ze=Z.at(-1);return Hoe(ze)||Cst(ze)},[f,Z]),He=(0,yt.useMemo)(()=>b&&f&&!Le?{"--streamdown-caret":`"${aot[b]}"`}:void 0,[b,f,Le]);return t==="static"?(0,Xe.jsx)(kO.Provider,{value:ue,children:(0,Xe.jsx)(SO.Provider,{value:T??null,children:(0,Xe.jsx)(To.Provider,{value:ce,children:(0,Xe.jsx)(uoe,{icons:A,children:(0,Xe.jsx)(wO.Provider,{value:B,children:(0,Xe.jsx)("div",{className:B("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",l),dir:r==="auto"?wat(j):r,children:(0,Xe.jsx)(Woe,{components:he,rehypePlugins:Se,remarkPlugins:Ce,...H,children:j})})})})})})}):(0,Xe.jsx)(kO.Provider,{value:ue,children:(0,Xe.jsx)(SO.Provider,{value:T??null,children:(0,Xe.jsx)(To.Provider,{value:ce,children:(0,Xe.jsx)(uoe,{icons:A,children:(0,Xe.jsx)(wO.Provider,{value:B,children:(0,Xe.jsxs)("div",{className:B("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",b&&!Le?"[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]":null,l),style:He,children:[Z.length===0&&b&&f&&(0,Xe.jsx)("span",{}),Z.map((ze,_e)=>{var Je;let Pe=_e===Z.length-1,gt=f&&Pe&&Hoe(ze);return(0,Xe.jsx)(g,{animatePlugin:J,components:he,content:ze,dir:(Je=ae?.[_e])!=null?Je:r!=="auto"?r:void 0,index:_e,isIncomplete:gt,rehypePlugins:Se,remarkPlugins:Ce,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:n,...H},te[_e])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir),rle.displayName="Streamdown",sot=({children:e,className:t,minZoom:r=.5,maxZoom:n=3,zoomStep:i=.1,showControls:a=!0,initialZoom:s=1,fullscreen:o=!1})=>{let{RotateCcwIcon:l,ZoomInIcon:u,ZoomOutIcon:h}=nc(),d=mn(),f=(0,yt.useRef)(null),p=(0,yt.useRef)(null),[g,y]=(0,yt.useState)(s),[b,T]=(0,yt.useState)({x:0,y:0}),[w,x]=(0,yt.useState)(!1),[C,R]=(0,yt.useState)({x:0,y:0}),[_,S]=(0,yt.useState)({x:0,y:0}),A=(0,yt.useCallback)(B=>{y(D=>Math.max(r,Math.min(n,D+B)))},[r,n]),M=(0,yt.useCallback)(()=>{A(i)},[A,i]),O=(0,yt.useCallback)(()=>{A(-i)},[A,i]),P=(0,yt.useCallback)(()=>{y(s),T({x:0,y:0})},[s]),H=(0,yt.useCallback)(B=>{B.preventDefault(),A(B.deltaY>0?-i:i)},[A,i]),L=(0,yt.useCallback)(B=>{if(B.button!==0||B.isPrimary===!1)return;x(!0),R({x:B.clientX,y:B.clientY}),S(b);let D=B.currentTarget;D instanceof HTMLElement&&D.setPointerCapture(B.pointerId)},[b]),$=(0,yt.useCallback)(B=>{if(!w)return;B.preventDefault();let D=B.clientX-C.x,F=B.clientY-C.y;T({x:_.x+D,y:_.y+F})},[w,C,_]),I=(0,yt.useCallback)(B=>{x(!1);let D=B.currentTarget;D instanceof HTMLElement&&D.releasePointerCapture(B.pointerId)},[]);return(0,yt.useEffect)(()=>{let B=f.current;if(B)return B.addEventListener("wheel",H,{passive:!1}),()=>{B.removeEventListener("wheel",H)}},[H]),(0,yt.useEffect)(()=>{let B=p.current;if(B&&w)return document.body.style.userSelect="none",B.addEventListener("pointermove",$,{passive:!1}),B.addEventListener("pointerup",I),B.addEventListener("pointercancel",I),()=>{document.body.style.userSelect="",B.removeEventListener("pointermove",$),B.removeEventListener("pointerup",I),B.removeEventListener("pointercancel",I)}},[w,$,I]),(0,Xe.jsxs)("div",{className:d("relative flex flex-col",o?"h-full w-full":"min-h-28 w-full",t),ref:f,style:{cursor:w?"grabbing":"grab"},children:[a?(0,Xe.jsxs)("div",{className:d("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm",o?"bottom-4 left-4":"bottom-2 left-2"),children:[(0,Xe.jsx)("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:g>=n,onClick:M,title:"Zoom in",type:"button",children:(0,Xe.jsx)(u,{size:16})}),(0,Xe.jsx)("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:g<=r,onClick:O,title:"Zoom out",type:"button",children:(0,Xe.jsx)(h,{size:16})}),(0,Xe.jsx)("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),onClick:P,title:"Reset zoom and pan",type:"button",children:(0,Xe.jsx)(l,{size:16})})]}):null,(0,Xe.jsx)("div",{className:d("flex-1 origin-center transition-transform duration-150 ease-out",o?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:L,ref:p,role:"application",style:{transform:`translate(${b.x}px, ${b.y}px) scale(${g})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},nle=({chart:e,className:t,config:r,fullscreen:n=!1,showControls:i=!0})=>{let a=mn(),[s,o]=(0,yt.useState)(null),[l,u]=(0,yt.useState)(!1),[h,d]=(0,yt.useState)(""),[f,p]=(0,yt.useState)(""),[g,y]=(0,yt.useState)(0),{mermaid:b}=(0,yt.useContext)(To),T=AO(),w=b?.errorComponent,{shouldRender:x,containerRef:C}=Ger({immediate:n});if((0,yt.useEffect)(()=>{if(x){if(!T){o("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{o(null),u(!0);let _=T.getMermaid(r),S=e.split("").reduce((O,P)=>(O<<5)-O+P.charCodeAt(0)|0,0),A=`mermaid-${Math.abs(S)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:M}=await _.render(A,e);d(M),p(M)}catch(_){f||h||o(_ instanceof Error?_.message:"Failed to render Mermaid chart")}finally{u(!1)}})()}},[e,r,g,x,T]),!(x||h||f))return(0,Xe.jsx)("div",{className:a("my-4 min-h-[200px]",t),ref:C});if(l&&!h&&!f)return(0,Xe.jsx)("div",{className:a("my-4 flex justify-center p-4",t),ref:C,children:(0,Xe.jsxs)("div",{className:a("flex items-center space-x-2 text-muted-foreground"),children:[(0,Xe.jsx)("div",{className:a("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),(0,Xe.jsx)("span",{className:a("text-sm"),children:"Loading diagram..."})]})});if(s&&!h&&!f){let _=()=>y(S=>S+1);return w?(0,Xe.jsx)("div",{ref:C,children:(0,Xe.jsx)(w,{chart:e,error:s,retry:_})}):(0,Xe.jsxs)("div",{className:a("rounded-md bg-red-50 p-4",t),ref:C,children:[(0,Xe.jsxs)("p",{className:a("font-mono text-red-700 text-sm"),children:["Mermaid Error: ",s]}),(0,Xe.jsxs)("details",{className:a("mt-2"),children:[(0,Xe.jsx)("summary",{className:a("cursor-pointer text-red-600 text-xs"),children:"Show Code"}),(0,Xe.jsx)("pre",{className:a("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:e})]})]})}let R=h||f;return(0,Xe.jsx)("div",{className:a("size-full",t),"data-streamdown":"mermaid",ref:C,children:(0,Xe.jsx)(sot,{className:a(n?"size-full overflow-hidden":"overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,Xe.jsx)("div",{"aria-label":"Mermaid chart",className:a("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:R},role:"img"})})})}}));ile();var Yer=xge("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function jer({className:e,variant:t,...r}){return(0,rt.jsx)("div",{"data-slot":"alert",role:"alert",className:on(Yer({variant:t}),e),...r})}function Xer({className:e,...t}){return(0,rt.jsx)("div",{"data-slot":"alert-title",className:on("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function Ker({className:e,...t}){return(0,rt.jsx)("div",{"data-slot":"alert-description",className:on("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),...t})}var oot=Fe.createContext(null);function OO(){const e=Fe.useContext(oot);if(!e)throw new Error("Confirmation components must be used within <Confirmation />");return e}function Qer({approval:e,state:t="pending",className:r,children:n}){return(0,rt.jsx)(jer,{className:on("gap-2 rounded-2xl border-border/70",r),children:(0,rt.jsx)(oot.Provider,{value:{state:t,approvalId:e?.id},children:n})})}function Zer({className:e,...t}){return(0,rt.jsx)(Xer,{className:on("text-sm font-semibold",e),...t})}function Jer({className:e,...t}){const{state:r}=OO();return r!=="pending"?null:(0,rt.jsx)(Ker,{className:on("text-sm leading-relaxed",e),...t})}function etr({className:e,children:t}){const{state:r}=OO();return r!=="accepted"?null:(0,rt.jsxs)("div",{className:on("flex items-center gap-2 text-sm font-medium text-emerald-600 dark:text-emerald-400",e),children:[(0,rt.jsx)(H1t,{className:"size-4 shrink-0"}),(0,rt.jsx)("span",{children:t??"Conversation stopped."})]})}function ttr({className:e,children:t}){const{state:r}=OO();return r!=="rejected"?null:(0,rt.jsxs)("div",{className:on("flex items-center gap-2 text-sm font-medium text-rose-600 dark:text-rose-400",e),children:[(0,rt.jsx)(q1t,{className:"size-4 shrink-0"}),(0,rt.jsx)("span",{children:t??"Conversation continues."})]})}function rtr({className:e,...t}){const{state:r}=OO();return r!=="pending"?null:(0,rt.jsx)("div",{className:on("flex w-full flex-wrap justify-end gap-2 pt-1",e),...t})}function lot({children:e,...t}){return(0,rt.jsx)(tf,{...t,children:e})}function cot({children:e,from:t,role:r,className:n}){const i=t??r??"assistant";return(0,rt.jsx)(ef.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:on("w-full flex",i==="user"?"justify-end":"justify-start",n),children:e})}function ntr({children:e,className:t,...r}){return(0,rt.jsx)("div",{className:on("rounded-2xl px-3 py-2 text-sm leading-relaxed whitespace-pre-wrap",t),...r,children:e})}function uot({children:e="",className:t,onLinkClick:r,plugins:n,mode:i="static",confirmation:a,confirmationPrompt:s,confirmationActionsDisabled:o,onConfirmationDecision:l,...u}){const h=a??wA(e);if(h){const d=h.confirmationId,f=h.kind==="stop_confirmation"?h.state:h.decision==="accepted"?"accepted":"rejected",p=s??(h.kind==="stop_confirmation"?h.prompt:"Do you want to stop this conversation?");return(0,rt.jsxs)(Qer,{approval:{id:d},state:f,className:on("w-full",t),children:[(0,rt.jsx)(Zer,{children:"Stop conversation"}),f==="pending"&&(0,rt.jsx)(Jer,{children:p}),f==="accepted"&&(0,rt.jsx)(etr,{children:"Conversation stopped."}),f==="rejected"&&(0,rt.jsx)(ttr,{children:"Conversation continues."}),f==="pending"&&l&&(0,rt.jsxs)(rtr,{className:"pt-2",children:[(0,rt.jsx)(lot,{variant:"outline",disabled:o,onClick:()=>{l(d,!1)},children:"No"}),(0,rt.jsx)(lot,{variant:"default",disabled:o,onClick:()=>{l(d,!0)},children:"Yes"})]})]})}return(0,rt.jsx)("div",{onClickCapture:Fe.useCallback(d=>{if(!r)return;const f=d.target;if(!(f instanceof Element))return;const p=f.closest("a[href]");if(!(p instanceof HTMLAnchorElement))return;const g=p.href?.trim();g&&r(g)},[r]),children:(0,rt.jsx)(rle,{...u,mode:i,plugins:{mermaid:iVt,...n},className:on("text-sm leading-relaxed whitespace-normal",t),children:e})})}function itr(e,t){if(e.length===0)return[];const r=t?.initialDelayMs??0,n=t?.typingHoldMs??1260,i=t?.interMessageDelayMs??1520,a=Math.max(0,t?.interMessageDelayJitterMs??100);return e.map((s,o)=>{const l=o===0?r+n:i,u=o===0||a===0?0:Math.round((Math.random()*2-1)*a);return{message:s,delayMs:Math.max(0,l+u)}})}var atr={type:"spring",stiffness:400,damping:35},PO=1024,str=40,otr=2e3;function hot(e,t){const r=t?.typingSpeedMs??str,n=t?.pauseAfterMs??otr,i=e.join("\0"),[a,s]=Fe.useState(0),[o,l]=Fe.useState(()=>e.length>0?1:0),[u,h]=Fe.useState("typing"),d=e.length>0?e[a%e.length]:"",f=d.slice(0,o);return Fe.useEffect(()=>{if(e.length===0){s(0),l(0),h("typing");return}s(0),l(1),h("typing")},[i,e.length]),Fe.useEffect(()=>{if(e.length!==0){if(u==="paused"){const p=setTimeout(()=>{s(g=>(g+1)%e.length),l(1),h("typing")},n);return()=>clearTimeout(p)}if(o<d.length){const p=setTimeout(()=>l(g=>g+1),r);return()=>clearTimeout(p)}h("paused")}},[e.length,a,o,d.length,u,r,n]),f}function dot(e){const t=Fe.useRef(null);return Fe.useEffect(()=>{e.length>0&&(t.current=e)},[e]),e.length>0?e:t.current??[]}function ltr(e,t=3e3){const[r,n]=Fe.useState(0);return Fe.useEffect(()=>{if(e.length<=1)return;const i=setInterval(()=>{n(a=>(a+1)%e.length)},t);return()=>clearInterval(i)},[e.length,t]),e.length>0?e[r%e.length]:""}function ale({agentName:e="Assistant",agentAvatarUrl:t,appearance:r,statusText:n="Online",className:i,onStopConversation:a,stopDisabled:s=!1,onClose:o}){const l=a!=null||o!=null;return(0,rt.jsxs)("div",{className:on("flex items-center gap-2 w-full",i),children:[(0,rt.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,rt.jsxs)(JB,{size:"lg",style:t?void 0:eP(r),children:[t?(0,rt.jsx)(e$,{src:t,alt:e}):null,(0,rt.jsx)(t$,{className:on(r?"bg-transparent text-white":void 0),children:e.slice(0,2).toUpperCase()})]}),(0,rt.jsxs)("div",{className:"min-w-0",children:[(0,rt.jsx)("div",{className:"truncate text-sm font-semibold",children:e}),(0,rt.jsx)("div",{className:"text-xs text-muted-foreground",children:n})]})]}),l&&(0,rt.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[a!=null&&(0,rt.jsx)(tf,{variant:"ghost",size:"icon","aria-label":"Stop conversation",title:"Stop conversation",disabled:s,onClick:a,children:(0,rt.jsx)(W1t,{})}),o!=null&&(0,rt.jsx)(tf,{variant:"ghost",size:"icon","aria-label":"Close",title:"Close",onClick:o,children:(0,rt.jsx)(K1t,{})})]})]})}function ctr({className:e}){return(0,rt.jsx)("div",{className:"w-full flex",children:(0,rt.jsx)("div",{className:on("max-w-[85%] rounded-2xl px-3 py-2 text-sm leading-relaxed","bg-muted text-foreground",e),children:(0,rt.jsx)("div",{className:"flex items-center gap-1 py-0.5","aria-label":"Thinking",children:[0,1,2].map(t=>(0,rt.jsx)(ef.span,{className:"size-1.5 rounded-full bg-current opacity-60",animate:{y:[0,-4,0]},transition:{duration:.5,repeat:1/0,delay:t*.12,ease:"easeInOut"}},t))})})})}function sle({messages:e,isTyping:t=!1,status:r="idle",errorMessage:n,appearance:i,onConfirmationDecision:a,onLinkClick:s,className:o,emptyTitle:l=Aht,emptyDescription:u=Lht,emptyAction:h}){const{scrollClassName:d,contentClassName:f}=_yt(),p=Fe.useMemo(()=>Cyt(e),[e]);return(0,rt.jsxs)(myt,{className:on("relative size-full",o),children:[(0,rt.jsx)(yyt,{scrollClassName:d,className:f,children:e.length===0&&!t?r==="error"?(0,rt.jsx)("div",{className:"state error",children:n??"Something went wrong."}):(0,rt.jsx)("div",{className:"flex min-h-full flex-1 items-center justify-center px-4 py-6",children:(0,rt.jsxs)(vyt,{className:"w-full max-w-[280px]",children:[(0,rt.jsx)("div",{className:"flex size-16 items-center justify-center rounded-2xl border border-border/70 bg-background/90 shadow-sm",children:(0,rt.jsx)(j1t,{className:"size-7 text-foreground"})}),(0,rt.jsxs)("div",{children:[(0,rt.jsx)("p",{className:"text-lg font-semibold leading-tight text-foreground",children:l}),(0,rt.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:u})]}),h&&(0,rt.jsx)(tf,{size:"lg",disabled:h.disabled,onClick:h.onClick,className:"rounded-full bg-black px-6 text-white hover:bg-black/90",children:h.label})]})}):(0,rt.jsxs)(rt.Fragment,{children:[p.map(g=>{if(g.type==="confirmation")return(0,rt.jsx)(cot,{from:"assistant",children:(0,rt.jsx)("div",{className:"flex w-fit max-w-[85%] shrink-0 flex-col gap-2",children:(0,rt.jsx)(uot,{confirmation:g.latestEnvelope,confirmationPrompt:g.envelope.prompt,confirmationActionsDisabled:r==="sending",onConfirmationDecision:a})})},g.message.id);const y=g.message;return(0,rt.jsx)(cot,{from:y.role,children:(0,rt.jsxs)("div",{className:"flex w-fit max-w-[85%] shrink-0 flex-col gap-2",children:[(0,rt.jsx)(ntr,{className:on("whitespace-pre-wrap",y.role==="user"?"text-white":"bg-muted text-foreground"),style:y.role==="user"?Xv(i):void 0,children:y.role==="assistant"?(0,rt.jsx)(uot,{onLinkClick:s,children:y.content}):y.content}),y.actions&&y.actions.length>0&&(0,rt.jsx)("div",{className:"flex flex-wrap gap-2 px-1",children:y.actions.map((b,T)=>(0,rt.jsx)(tf,{size:"sm",variant:b.variant??"outline",onClick:b.onClick,children:b.label},T))})]})},y.id)}),t&&(0,rt.jsx)(ef.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:"w-full",children:(0,rt.jsx)(ctr,{})})]})}),(0,rt.jsx)(byt,{})]})}var utr=2;function ole({placeholder:e=_ht,value:t,onChange:r,onSubmit:n,appearance:i,disabled:a=!1,className:s}){const o=t!==void 0&&r!==void 0,[l,u]=Fe.useState(""),h=o?t:l,d=Fe.useRef(null),f=y=>{const b=y.target.value;o?r(b):u(b)},p=()=>{const y=h.trim();!y||!n||(n(y),o&&r?r(""):u(""),d.current?.focus())},g=y=>{y.key==="Enter"&&(y.shiftKey||(y.preventDefault(),p()))};return(0,rt.jsxs)("div",{className:on("flex items-end gap-2",s),children:[(0,rt.jsx)(D1t,{ref:d,placeholder:e,value:h,onChange:f,onKeyDown:g,rows:utr,disabled:a,className:on("min-h-10 max-h-32 flex-1 resize-none py-2.5","focus-visible:ring-2")}),(0,rt.jsx)(tf,{type:"button",size:"icon",className:"h-10 w-10 shrink-0 text-white",style:Xv(i),"aria-label":"Send",disabled:a||!n,onClick:p,children:(0,rt.jsx)(eyt,{className:"size-4"})})]})}function lle({text:e="Powered by Mana Agents",className:t}){return(0,rt.jsx)("div",{className:on("text-center text-xs text-muted-foreground",t),children:e})}function cle({open:e,onOpenChange:t,children:r,desktopClassName:n,desktopStyle:i,portalContainer:a}){const s=BO(),o=htr(e,s);return s?(0,rt.jsx)(ayt,{open:e,onOpenChange:t,children:(0,rt.jsxs)(lyt,{container:a,showCloseButton:!1,"aria-describedby":void 0,style:{"--chat-widget-fullscreen-height":o!=null?`${o}px`:"100svh"},className:on("z-50 flex fixed! inset-0! h-(--chat-widget-fullscreen-height)! max-h-(--chat-widget-fullscreen-height)! w-screen! max-w-none translate-x-0! translate-y-0! flex-col gap-0 rounded-none border-0 p-0 shadow-lg","data-[state=open]:zoom-in-100 data-[state=closed]:zoom-out-100"),children:[(0,rt.jsx)(cyt,{className:"sr-only",children:"Chat"}),r]})}):(0,rt.jsx)(ef.div,{className:on(n,"z-10 flex h-112.5 flex-col"),style:{...i,pointerEvents:e?"auto":"none"},initial:!1,animate:{opacity:e?1:0,visibility:e?"visible":"hidden",scale:e?1:.96},transition:atr,children:r})}function BO(){const[e,t]=Fe.useState(()=>typeof window<"u"&&window.innerWidth<PO);return Fe.useEffect(()=>{const r=window.matchMedia(`(max-width: ${PO-1}px)`),n=()=>{t(window.innerWidth<PO)};return r.addEventListener("change",n),t(window.innerWidth<PO),()=>r.removeEventListener("change",n)},[]),e}function htr(e,t){const[r,n]=Fe.useState(null);return Fe.useEffect(()=>{if(!e||!t){n(null);return}const i=window.visualViewport?.height??window.innerHeight;n(Math.round(i))},[e,t]),r}var dtr=360,$O=56,ftr=8,ptr=12,gtr={duration:.4};function fot({agentName:e=kht,agentAvatarUrl:t,appearance:r,spotlightMessages:n=[],messages:i=[],poweredBy:a=J9,headerStatus:s="Online",errorMessage:o,status:l="idle",sendDisabled:u=!1,onSendMessage:h,isTyping:d,onSuggestion:f,onLauncherClick:p,className:g,open:y,defaultOpen:b=!1,onOpenChange:T,previewOnly:w=!1,onStopConversation:x,stopDisabled:C,onConfirmationDecision:R,onLinkClick:_,emptyAction:S,portalContainer:A}){const[M,O]=Fe.useState(w?!1:b),[P,H]=Fe.useState(""),L=n.length>0?n:[...Rw],$=ltr(L,3e3),I=w?!1:y??M,B=Fe.useCallback(F=>{if(T){T(F);return}O(F)},[T]),D=BO()&&I;return(0,rt.jsxs)("div",{className:on("relative",g),style:{width:L.length>0?260:$O,height:L.length>0?$O+ftr+56:$O},children:[L.length>0&&!I&&(0,rt.jsx)(Sgt,{mode:"wait",children:(0,rt.jsxs)(ef.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:gtr,className:"absolute right-0 bottom-[calc(56px+SPOTLIGHT_GAP)] flex w-full max-w-65 flex-col items-end",children:[(0,rt.jsx)("div",{className:"rounded-2xl border bg-background/95 px-4 py-3 text-right shadow-lg backdrop-blur-sm dark:bg-background/90",children:(0,rt.jsx)("p",{className:"text-sm leading-relaxed text-foreground",children:$})}),(0,rt.jsx)("div",{className:"flex w-full justify-end pr-6","aria-hidden":!0,children:(0,rt.jsx)("span",{className:"border-[6px] border-transparent border-t-background/95 bg-transparent dark:border-t-background/90"})})]},$)}),!w&&(0,rt.jsxs)(cle,{open:I,onOpenChange:B,portalContainer:A,desktopClassName:"absolute right-0 overflow-hidden rounded-2xl border bg-background shadow-xl",desktopStyle:{width:dtr,bottom:$O+ptr},children:[(0,rt.jsx)("div",{className:"flex shrink-0 border-b p-4",children:(0,rt.jsx)(ale,{agentName:e,agentAvatarUrl:t,appearance:r,statusText:s,onStopConversation:x??void 0,stopDisabled:C,onClose:()=>B(!1)})}),(0,rt.jsx)("div",{className:"flex min-h-0 flex-1 flex-col p-4 overflow-hidden",children:(0,rt.jsx)(sle,{messages:i,isTyping:d??l==="sending",status:l,suggestions:L,errorMessage:o,appearance:r,onConfirmationDecision:R,onLinkClick:_,onSuggestion:F=>{H(F),f?.(F)},emptyAction:S})}),!(S&&i.length===0&&!d)&&(0,rt.jsxs)("div",{className:"shrink-0 border-t p-3",children:[(0,rt.jsx)(ole,{value:P,onChange:H,onSubmit:h,appearance:r,disabled:u||l==="booting"}),(0,rt.jsx)(lle,{text:a,className:"mt-2"})]})]}),!D&&(0,rt.jsx)(ef.button,{type:"button",onClick:w?void 0:()=>{p?.(),B(!I)},className:on("absolute bottom-0 right-0 flex size-14 shrink-0 items-center justify-center rounded-full text-white shadow-lg",w&&"pointer-events-none"),style:r?Xv(r):void 0,"aria-label":I?"Close chat":"Open chat","aria-expanded":I,animate:{scale:1},whileHover:w?void 0:{scale:1.02},whileTap:w?void 0:{scale:.98},children:I?(0,rt.jsx)(r$,{className:"size-6"}):(0,rt.jsxs)(JB,{className:"size-12",style:r?eP(r):void 0,children:[t?(0,rt.jsx)(e$,{src:t,alt:e}):null,(0,rt.jsx)(t$,{className:"bg-transparent text-white",children:e.slice(0,2).toUpperCase()})]})})]})}var mtr=360,ytr=12,pot=280,got=120,FO=56,vtr={type:"spring",stiffness:400,damping:35};function btr({agentName:e=wht,agentAvatarUrl:t,appearance:r,spotlightMessages:n=[],messages:i=[],poweredBy:a=J9,headerStatus:s="Online",errorMessage:o,status:l="idle",sendDisabled:u=!1,startChatLabel:h=Cht,onSendMessage:d,isTyping:f,onSuggestion:p,onLauncherClick:g,className:y,open:b,defaultOpen:T=!1,onOpenChange:w,previewOnly:x=!1,onStopConversation:C,stopDisabled:R,onConfirmationDecision:_,onLinkClick:S,emptyAction:A,portalContainer:M}){const[O,P]=Fe.useState(x?!1:T),[H,L]=Fe.useState(""),$=x?!1:b??O,I=Fe.useCallback(G=>{if(w){w(G);return}P(G)},[w]),B=dot(n),D=B.length>0?B:[...Rw],F=hot(D)||D[0]||Rw[0],V=$?FO:got,U=$?FO:pot,j=BO()&&$,W={width:FO,height:FO,...r?Xv(r):{},pointerEvents:$?"auto":"none"};return(0,rt.jsxs)("div",{className:on("relative",y),style:{width:U,height:V},children:[!x&&(0,rt.jsxs)(cle,{open:$,onOpenChange:I,portalContainer:M,desktopClassName:"absolute right-0 overflow-hidden rounded-2xl border bg-background shadow-xl",desktopStyle:{width:mtr,bottom:V+ytr},children:[(0,rt.jsx)("div",{className:"flex shrink-0 border-b p-4",children:(0,rt.jsx)(ale,{agentName:e,agentAvatarUrl:t,appearance:r,statusText:s,onStopConversation:C??void 0,stopDisabled:R,onClose:()=>I(!1)})}),(0,rt.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden p-4 md:max-h-90",children:(0,rt.jsx)(sle,{messages:i,isTyping:f??l==="sending",status:l,errorMessage:o,appearance:r,onConfirmationDecision:_,onLinkClick:S,onSuggestion:G=>{L(G),p?.(G)},emptyAction:A})}),!(A&&i.length===0&&!f)&&(0,rt.jsxs)("div",{className:"border-t p-3 shrink-0",children:[(0,rt.jsx)(ole,{value:H,onChange:L,onSubmit:d,appearance:r,disabled:u||l==="booting"}),(0,rt.jsx)(lle,{text:a,className:"mt-2"})]})]}),!$&&(0,rt.jsxs)(ef.div,{className:"absolute bottom-0 right-0 flex flex-col gap-4 rounded-2xl border bg-background p-4 shadow-xl",style:{width:pot,height:got},initial:!1,animate:{opacity:1},children:[(0,rt.jsxs)("div",{className:"flex flex-1 items-start gap-2",children:[(0,rt.jsxs)(JB,{className:"size-9 shrink-0",style:r?eP(r):void 0,children:[t?(0,rt.jsx)(e$,{src:t,alt:e}):null,(0,rt.jsx)(t$,{className:"bg-transparent text-white text-xs",children:e.slice(0,2).toUpperCase()})]}),F?(0,rt.jsx)("p",{className:"min-w-0 flex-1 text-sm leading-snug text-foreground",children:F}):null]}),(0,rt.jsx)(tf,{className:on("w-full rounded-full",x&&"pointer-events-none"),onClick:x?void 0:()=>{g?.(),I(!0)},style:r?Xv(r):void 0,children:r?.actionText?.trim()||h})]}),!x&&!j&&(0,rt.jsx)(ef.button,{type:"button",onClick:()=>I(!1),className:"absolute bottom-0 right-0 flex items-center justify-center rounded-full text-primary-foreground shadow-lg",style:W,"aria-label":"Close chat",initial:!1,animate:{opacity:$?1:0,visibility:$?"visible":"hidden"},transition:vtr,whileHover:$?{scale:1.02}:void 0,whileTap:$?{scale:.98}:void 0,children:(0,rt.jsx)(r$,{className:"size-6"})})]})}var ule=560,mot=320,hle=48,xtr=48,Ttr=10,wtr={type:"spring",stiffness:400,damping:35};function ktr({agentName:e=Eht,agentAvatarUrl:t,appearance:r,spotlightMessages:n=[],messages:i=[],poweredBy:a=J9,headerStatus:s="Online",errorMessage:o,status:l="idle",sendDisabled:u=!1,launcherLabel:h="Ask",onSendMessage:d,isTyping:f,onSuggestion:p,onLauncherClick:g,className:y,open:b,defaultOpen:T=!1,onOpenChange:w,previewOnly:x=!1,onStopConversation:C,stopDisabled:R,onConfirmationDecision:_,onLinkClick:S,emptyAction:A,portalContainer:M}){const[O,P]=Fe.useState(x?!1:T),[H,L]=Fe.useState(""),$=x?!1:b??O,I=BO()&&$,B=Fe.useCallback(G=>{if(w){w(G);return}P(G)},[w]),D=dot(n),F=D.length>0?D:[...Rw],V=hot(F)||F[0]||Rw[0],U=Fe.useRef(null),[j,W]=Fe.useState(ule);return Fe.useEffect(()=>{if($)return;const G=U.current;if(!G)return;const K=new ResizeObserver(Z=>{const ae=Z[0]?.contentRect.width;typeof ae=="number"&&W(ae)});return K.observe(G),()=>K.disconnect()},[$]),(0,rt.jsxs)("div",{className:on("relative w-full max-w-full shrink-0",y),style:{maxWidth:ule,minWidth:mot,minHeight:hle},children:[!x&&(0,rt.jsxs)(cle,{open:$,onOpenChange:B,portalContainer:M,desktopClassName:on("absolute left-0 right-0 mx-auto overflow-hidden rounded-2xl border bg-white/90 shadow-lg backdrop-blur-xl dark:bg-background/90"),desktopStyle:{width:"100%",minWidth:mot,maxWidth:ule,bottom:hle+Ttr},children:[(0,rt.jsx)("div",{className:"flex shrink-0 border-b p-4",children:(0,rt.jsx)(ale,{agentName:e,agentAvatarUrl:t,appearance:r,statusText:s,onStopConversation:C??void 0,stopDisabled:R,onClose:()=>B(!1)})}),(0,rt.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden p-4 md:p-2 md:max-h-85",children:(0,rt.jsx)(sle,{messages:i,isTyping:f??l==="sending",status:l,errorMessage:o,appearance:r,onConfirmationDecision:_,onLinkClick:S,onSuggestion:G=>{L(G),p?.(G)},emptyAction:A})}),!(A&&i.length===0&&!f)&&(0,rt.jsxs)("div",{className:"border-t p-3 shrink-0",children:[(0,rt.jsx)(ole,{value:H,onChange:L,onSubmit:d,appearance:r,disabled:u||l==="booting"}),(0,rt.jsx)(lle,{text:a,className:"mt-2"})]})]}),!I&&(0,rt.jsx)("div",{className:"absolute bottom-0 left-0 right-0 z-0 flex w-full justify-center",children:(0,rt.jsx)("div",{ref:U,className:"flex w-full max-w-full justify-center",children:(0,rt.jsx)(ef.button,{type:"button",onClick:x?void 0:()=>{$||g?.(),B(!$)},className:on("flex shrink-0 items-center gap-2.5 rounded-full border bg-white/80 px-4 py-3 shadow-lg backdrop-blur-xl dark:bg-white/10",$&&"justify-center",x&&"pointer-events-none","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),style:{height:hle},initial:!1,animate:{width:$?xtr:j,borderRadius:9999},transition:wtr,"aria-label":$?"Close chat":"Open chat","aria-expanded":$,whileHover:x?void 0:{scale:1.02},whileTap:x?void 0:{scale:.98},children:$?(0,rt.jsx)(r$,{className:"size-5 shrink-0 text-foreground"}):(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsx)(Z1t,{className:"size-5 shrink-0 text-muted-foreground"}),(0,rt.jsx)("span",{className:"min-w-0 flex-1 truncate text-left text-sm text-muted-foreground",children:V}),(0,rt.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium text-white",style:r?Xv(r):void 0,children:[(0,rt.jsx)(ryt,{className:"size-4"}),r?.actionText?.trim()||h]})]})})})})]})}var Etr=`
|
|
3453
|
+
`})}return r},Gst=/([\\`*_~[\]|])/g,Wst=e=>e.replace(Gst,"\\$1"),Yst=(e,t)=>{if(!t.length)return e;let r=e;for(let n of t){let i=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");r=r.replace(i,(a,s,o,l)=>s+Wst(o).replace(/\n\n/g," ")+l)}return r},Qoe=e=>e.type==="text"?e.value:"children"in e&&Array.isArray(e.children)?e.children.map(Qoe).join(""):"",jst=e=>t=>{if(!e||e.length===0)return;let r=new Set(e.map(n=>n.toLowerCase()));Hd(t,"element",n=>{if(r.has(n.tagName.toLowerCase())){let i=Qoe(n);n.children=i?[{type:"text",value:i}]:[]}})},Xst=()=>e=>{Hd(e,"code",t=>{var r,n;t.meta&&(t.data=(r=t.data)!=null?r:{},t.data.hProperties={...(n=t.data.hProperties)!=null?n:{},metastring:t.meta})})},Kst=/^[ \t]*<[\w!/?-]/,Qst=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Zst=e=>typeof e!="string"||e.length===0||!Kst.test(e)?e:e.replace(Qst,"$1"),N5={...Y0,protocols:{...Y0.protocols,href:[...(eot=(Jst=Y0.protocols)==null?void 0:Jst.href)!=null?eot:[],"tel"]},attributes:{...Y0.attributes,code:[...(rot=(tot=Y0.attributes)==null?void 0:tot.code)!=null?rot:[],"metastring"]}},MO={raw:Mae,sanitize:[Yet,N5],harden:[yVt,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},not={gfm:[LQt,{}],codeMeta:Xst},Zoe=Object.values(MO),iot=Object.values(not),aot={block:" ▋",circle:" ●"},Joe=["github-light","github-dark"],ele={enabled:!0},To=(0,yt.createContext)({shikiTheme:Joe,controls:!0,isAnimating:!1,lineNumbers:!0,mode:"streaming",mermaid:void 0,linkSafety:ele}),tle=(0,yt.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:r,index:n,isIncomplete:i,dir:a,animatePlugin:s,...o})=>{if(s){let h=s.getLastRenderCharCount();s.setPrevContentLength(h)}let l=typeof e=="string"&&r?Zst(e):e,u=(0,Xe.jsx)(Woe,{...o,children:l});return(0,Xe.jsx)(aoe.Provider,{value:i,children:a?(0,Xe.jsx)("div",{dir:a,style:{display:"contents"},children:u}):u})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let r=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(r.length!==n.length||r.some(i=>{var a,s;return((a=e.components)==null?void 0:a[i])!==((s=t.components)==null?void 0:s[i])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)}),tle.displayName="Block",rle=(0,yt.memo)(({children:e,mode:t="streaming",dir:r,parseIncompleteMarkdown:n=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:s=Zoe,remarkPlugins:o=iot,className:l,shikiTheme:u=Joe,mermaid:h,controls:d=!0,isAnimating:f=!1,animated:p,BlockComponent:g=tle,parseMarkdownIntoBlocksFn:y=Vst,caret:b,plugins:T,remend:w,linkSafety:x=ele,lineNumbers:C=!0,allowedTags:R,literalTagContent:_,translations:S,icons:A,prefix:M,onAnimationStart:O,onAnimationEnd:P,...H})=>{let L=(0,yt.useId)(),[$,I]=(0,yt.useTransition)(),B=(0,yt.useMemo)(()=>Bat(M),[M]),D=(0,yt.useRef)(null),F=(0,yt.useRef)(O),V=(0,yt.useRef)(P);F.current=O,V.current=P,(0,yt.useEffect)(()=>{var ze,_e,Je;if(t==="static")return;let Pe=D.current;if(D.current=f,Pe===null){f&&((ze=F.current)==null||ze.call(F));return}f&&!Pe?(_e=F.current)==null||_e.call(F):!f&&Pe&&((Je=V.current)==null||Je.call(V))},[f,t]);let U=(0,yt.useMemo)(()=>R?Object.keys(R):[],[R]),j=(0,yt.useMemo)(()=>{if(typeof e!="string")return"";let ze=t==="streaming"&&n?Rnt(e,w):e;return _&&_.length>0&&(ze=Yst(ze,_)),U.length>0&&(ze=qst(ze,U)),ze},[e,t,n,w,U,_]),W=(0,yt.useMemo)(()=>y(j),[j,y]),[G,K]=(0,yt.useState)(W);(0,yt.useEffect)(()=>{t==="streaming"&&!J?I(()=>{K(W)}):K(W)},[W,t]);let Z=t==="streaming"?G:W,ae=(0,yt.useMemo)(()=>r==="auto"?Z.map(wat):void 0,[Z,r]),te=(0,yt.useMemo)(()=>Z.map((ze,_e)=>`${L}-${_e}`),[Z.length,L]),se=(0,yt.useMemo)(()=>p===!0?"true":p?JSON.stringify(p):"",[p]),J=(0,yt.useMemo)(()=>se?se==="true"?roe():roe(p):null,[se]),ce=(0,yt.useMemo)(()=>{var ze,_e;return{shikiTheme:(_e=(ze=T?.code)==null?void 0:ze.getThemes())!=null?_e:u,controls:d,isAnimating:f,lineNumbers:C,mode:t,mermaid:h,linkSafety:x}},[u,d,f,C,t,h,x,T?.code]),ue=(0,yt.useMemo)(()=>({...hoe,...S}),[(0,yt.useMemo)(()=>S?JSON.stringify(S):"",[S])]),he=(0,yt.useMemo)(()=>{let{inlineCode:ze,..._e}=a??{},Je={...xst,..._e};if(ze){let Pe=Je.code;Je.code=gt=>"data-block"in gt?Pe?(0,yt.createElement)(Pe,gt):null:(0,yt.createElement)(ze,gt)}return Je},[a]),Ce=(0,yt.useMemo)(()=>{let ze=[];return T!=null&&T.cjk&&(ze=[...ze,...T.cjk.remarkPluginsBefore]),ze=[...ze,...o],T!=null&&T.cjk&&(ze=[...ze,...T.cjk.remarkPluginsAfter]),T!=null&&T.math&&(ze=[...ze,T.math.remarkPlugin]),ze},[o,T?.math,T?.cjk]),Se=(0,yt.useMemo)(()=>{var ze;let _e=s;if(R&&Object.keys(R).length>0&&s===Zoe){let Je={...N5,tagNames:[...(ze=N5.tagNames)!=null?ze:[],...Object.keys(R)],attributes:{...N5.attributes,...R}};_e=[MO.raw,[Yet,Je],MO.harden]}return _&&_.length>0&&(_e=[..._e,[jst,_]]),T!=null&&T.math&&(_e=[..._e,T.math.rehypePlugin]),J&&f&&(_e=[..._e,J.rehypePlugin]),_e},[s,T?.math,J,f,R,_]),Le=(0,yt.useMemo)(()=>{if(!f||Z.length===0)return!1;let ze=Z.at(-1);return Hoe(ze)||Cst(ze)},[f,Z]),He=(0,yt.useMemo)(()=>b&&f&&!Le?{"--streamdown-caret":`"${aot[b]}"`}:void 0,[b,f,Le]);return t==="static"?(0,Xe.jsx)(kO.Provider,{value:ue,children:(0,Xe.jsx)(SO.Provider,{value:T??null,children:(0,Xe.jsx)(To.Provider,{value:ce,children:(0,Xe.jsx)(uoe,{icons:A,children:(0,Xe.jsx)(wO.Provider,{value:B,children:(0,Xe.jsx)("div",{className:B("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",l),dir:r==="auto"?wat(j):r,children:(0,Xe.jsx)(Woe,{components:he,rehypePlugins:Se,remarkPlugins:Ce,...H,children:j})})})})})})}):(0,Xe.jsx)(kO.Provider,{value:ue,children:(0,Xe.jsx)(SO.Provider,{value:T??null,children:(0,Xe.jsx)(To.Provider,{value:ce,children:(0,Xe.jsx)(uoe,{icons:A,children:(0,Xe.jsx)(wO.Provider,{value:B,children:(0,Xe.jsxs)("div",{className:B("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",b&&!Le?"[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]":null,l),style:He,children:[Z.length===0&&b&&f&&(0,Xe.jsx)("span",{}),Z.map((ze,_e)=>{var Je;let Pe=_e===Z.length-1,gt=f&&Pe&&Hoe(ze);return(0,Xe.jsx)(g,{animatePlugin:J,components:he,content:ze,dir:(Je=ae?.[_e])!=null?Je:r!=="auto"?r:void 0,index:_e,isIncomplete:gt,rehypePlugins:Se,remarkPlugins:Ce,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:n,...H},te[_e])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir),rle.displayName="Streamdown",sot=({children:e,className:t,minZoom:r=.5,maxZoom:n=3,zoomStep:i=.1,showControls:a=!0,initialZoom:s=1,fullscreen:o=!1})=>{let{RotateCcwIcon:l,ZoomInIcon:u,ZoomOutIcon:h}=nc(),d=mn(),f=(0,yt.useRef)(null),p=(0,yt.useRef)(null),[g,y]=(0,yt.useState)(s),[b,T]=(0,yt.useState)({x:0,y:0}),[w,x]=(0,yt.useState)(!1),[C,R]=(0,yt.useState)({x:0,y:0}),[_,S]=(0,yt.useState)({x:0,y:0}),A=(0,yt.useCallback)(B=>{y(D=>Math.max(r,Math.min(n,D+B)))},[r,n]),M=(0,yt.useCallback)(()=>{A(i)},[A,i]),O=(0,yt.useCallback)(()=>{A(-i)},[A,i]),P=(0,yt.useCallback)(()=>{y(s),T({x:0,y:0})},[s]),H=(0,yt.useCallback)(B=>{B.preventDefault(),A(B.deltaY>0?-i:i)},[A,i]),L=(0,yt.useCallback)(B=>{if(B.button!==0||B.isPrimary===!1)return;x(!0),R({x:B.clientX,y:B.clientY}),S(b);let D=B.currentTarget;D instanceof HTMLElement&&D.setPointerCapture(B.pointerId)},[b]),$=(0,yt.useCallback)(B=>{if(!w)return;B.preventDefault();let D=B.clientX-C.x,F=B.clientY-C.y;T({x:_.x+D,y:_.y+F})},[w,C,_]),I=(0,yt.useCallback)(B=>{x(!1);let D=B.currentTarget;D instanceof HTMLElement&&D.releasePointerCapture(B.pointerId)},[]);return(0,yt.useEffect)(()=>{let B=f.current;if(B)return B.addEventListener("wheel",H,{passive:!1}),()=>{B.removeEventListener("wheel",H)}},[H]),(0,yt.useEffect)(()=>{let B=p.current;if(B&&w)return document.body.style.userSelect="none",B.addEventListener("pointermove",$,{passive:!1}),B.addEventListener("pointerup",I),B.addEventListener("pointercancel",I),()=>{document.body.style.userSelect="",B.removeEventListener("pointermove",$),B.removeEventListener("pointerup",I),B.removeEventListener("pointercancel",I)}},[w,$,I]),(0,Xe.jsxs)("div",{className:d("relative flex flex-col",o?"h-full w-full":"min-h-28 w-full",t),ref:f,style:{cursor:w?"grabbing":"grab"},children:[a?(0,Xe.jsxs)("div",{className:d("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm",o?"bottom-4 left-4":"bottom-2 left-2"),children:[(0,Xe.jsx)("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:g>=n,onClick:M,title:"Zoom in",type:"button",children:(0,Xe.jsx)(u,{size:16})}),(0,Xe.jsx)("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),disabled:g<=r,onClick:O,title:"Zoom out",type:"button",children:(0,Xe.jsx)(h,{size:16})}),(0,Xe.jsx)("button",{className:d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),onClick:P,title:"Reset zoom and pan",type:"button",children:(0,Xe.jsx)(l,{size:16})})]}):null,(0,Xe.jsx)("div",{className:d("flex-1 origin-center transition-transform duration-150 ease-out",o?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:L,ref:p,role:"application",style:{transform:`translate(${b.x}px, ${b.y}px) scale(${g})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},nle=({chart:e,className:t,config:r,fullscreen:n=!1,showControls:i=!0})=>{let a=mn(),[s,o]=(0,yt.useState)(null),[l,u]=(0,yt.useState)(!1),[h,d]=(0,yt.useState)(""),[f,p]=(0,yt.useState)(""),[g,y]=(0,yt.useState)(0),{mermaid:b}=(0,yt.useContext)(To),T=AO(),w=b?.errorComponent,{shouldRender:x,containerRef:C}=Ger({immediate:n});if((0,yt.useEffect)(()=>{if(x){if(!T){o("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{o(null),u(!0);let _=T.getMermaid(r),S=e.split("").reduce((O,P)=>(O<<5)-O+P.charCodeAt(0)|0,0),A=`mermaid-${Math.abs(S)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:M}=await _.render(A,e);d(M),p(M)}catch(_){f||h||o(_ instanceof Error?_.message:"Failed to render Mermaid chart")}finally{u(!1)}})()}},[e,r,g,x,T]),!(x||h||f))return(0,Xe.jsx)("div",{className:a("my-4 min-h-[200px]",t),ref:C});if(l&&!h&&!f)return(0,Xe.jsx)("div",{className:a("my-4 flex justify-center p-4",t),ref:C,children:(0,Xe.jsxs)("div",{className:a("flex items-center space-x-2 text-muted-foreground"),children:[(0,Xe.jsx)("div",{className:a("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),(0,Xe.jsx)("span",{className:a("text-sm"),children:"Loading diagram..."})]})});if(s&&!h&&!f){let _=()=>y(S=>S+1);return w?(0,Xe.jsx)("div",{ref:C,children:(0,Xe.jsx)(w,{chart:e,error:s,retry:_})}):(0,Xe.jsxs)("div",{className:a("rounded-md bg-red-50 p-4",t),ref:C,children:[(0,Xe.jsxs)("p",{className:a("font-mono text-red-700 text-sm"),children:["Mermaid Error: ",s]}),(0,Xe.jsxs)("details",{className:a("mt-2"),children:[(0,Xe.jsx)("summary",{className:a("cursor-pointer text-red-600 text-xs"),children:"Show Code"}),(0,Xe.jsx)("pre",{className:a("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:e})]})]})}let R=h||f;return(0,Xe.jsx)("div",{className:a("size-full",t),"data-streamdown":"mermaid",ref:C,children:(0,Xe.jsx)(sot,{className:a(n?"size-full overflow-hidden":"overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,Xe.jsx)("div",{"aria-label":"Mermaid chart",className:a("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:R},role:"img"})})})}}));ile();var Yer=xge("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function jer({className:e,variant:t,...r}){return(0,rt.jsx)("div",{"data-slot":"alert",role:"alert",className:on(Yer({variant:t}),e),...r})}function Xer({className:e,...t}){return(0,rt.jsx)("div",{"data-slot":"alert-title",className:on("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function Ker({className:e,...t}){return(0,rt.jsx)("div",{"data-slot":"alert-description",className:on("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),...t})}var oot=Fe.createContext(null);function OO(){const e=Fe.useContext(oot);if(!e)throw new Error("Confirmation components must be used within <Confirmation />");return e}function Qer({approval:e,state:t="pending",className:r,children:n}){return(0,rt.jsx)(jer,{className:on("gap-2 rounded-2xl border-border/70",r),children:(0,rt.jsx)(oot.Provider,{value:{state:t,approvalId:e?.id},children:n})})}function Zer({className:e,...t}){return(0,rt.jsx)(Xer,{className:on("text-sm font-semibold",e),...t})}function Jer({className:e,...t}){const{state:r}=OO();return r!=="pending"?null:(0,rt.jsx)(Ker,{className:on("text-sm leading-relaxed",e),...t})}function etr({className:e,children:t}){const{state:r}=OO();return r!=="accepted"?null:(0,rt.jsxs)("div",{className:on("flex items-center gap-2 text-sm font-medium text-emerald-600 dark:text-emerald-400",e),children:[(0,rt.jsx)(H1t,{className:"size-4 shrink-0"}),(0,rt.jsx)("span",{children:t??"Conversation stopped."})]})}function ttr({className:e,children:t}){const{state:r}=OO();return r!=="rejected"?null:(0,rt.jsxs)("div",{className:on("flex items-center gap-2 text-sm font-medium text-rose-600 dark:text-rose-400",e),children:[(0,rt.jsx)(q1t,{className:"size-4 shrink-0"}),(0,rt.jsx)("span",{children:t??"Conversation continues."})]})}function rtr({className:e,...t}){const{state:r}=OO();return r!=="pending"?null:(0,rt.jsx)("div",{className:on("flex w-full flex-wrap justify-end gap-2 pt-1",e),...t})}function lot({children:e,...t}){return(0,rt.jsx)(tf,{...t,children:e})}function cot({children:e,from:t,role:r,className:n}){const i=t??r??"assistant";return(0,rt.jsx)(ef.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:on("w-full flex",i==="user"?"justify-end":"justify-start",n),children:e})}function ntr({children:e,className:t,...r}){return(0,rt.jsx)("div",{className:on("rounded-2xl px-3 py-2 text-sm leading-relaxed whitespace-pre-wrap",t),...r,children:e})}function uot({children:e="",className:t,onLinkClick:r,plugins:n,mode:i="static",linkSafety:a,confirmation:s,confirmationPrompt:o,confirmationActionsDisabled:l,onConfirmationDecision:u,...h}){const d=s??wA(e);if(d){const y=d.confirmationId,b=d.kind==="stop_confirmation"?d.state:d.decision==="accepted"?"accepted":"rejected",T=o??(d.kind==="stop_confirmation"?d.prompt:"Do you want to stop this conversation?");return(0,rt.jsxs)(Qer,{approval:{id:y},state:b,className:on("w-full",t),children:[(0,rt.jsx)(Zer,{children:"Stop conversation"}),b==="pending"&&(0,rt.jsx)(Jer,{children:T}),b==="accepted"&&(0,rt.jsx)(etr,{children:"Conversation stopped."}),b==="rejected"&&(0,rt.jsx)(ttr,{children:"Conversation continues."}),b==="pending"&&u&&(0,rt.jsxs)(rtr,{className:"pt-2",children:[(0,rt.jsx)(lot,{variant:"outline",disabled:l,onClick:()=>{u(y,!1)},children:"No"}),(0,rt.jsx)(lot,{variant:"default",disabled:l,onClick:()=>{u(y,!0)},children:"Yes"})]})]})}const f=Fe.useCallback(y=>{if(!r)return;const b=y.target;if(!(b instanceof Element))return;const T=b.closest("a[href]");if(!(T instanceof HTMLAnchorElement))return;const w=T.href?.trim();w&&r(w)},[r]),p=Fe.useCallback(async y=>{const b=y?.trim();if(a?.onLinkCheck){const T=await a.onLinkCheck(y);return!T&&b&&r?.(b),T}return b&&r?.(b),!1},[a,r]),g=Fe.useMemo(()=>!r||a?.enabled===!1?a:{...a??{},enabled:a?.enabled??!0,onLinkCheck:p},[p,a,r]);return(0,rt.jsx)("div",{onClickCapture:f,children:(0,rt.jsx)(rle,{...h,mode:i,linkSafety:g,plugins:{mermaid:iVt,...n},className:on("text-sm leading-relaxed whitespace-normal",t),children:e})})}function itr(e,t){if(e.length===0)return[];const r=t?.initialDelayMs??0,n=t?.typingHoldMs??1260,i=t?.interMessageDelayMs??1520,a=Math.max(0,t?.interMessageDelayJitterMs??100);return e.map((s,o)=>{const l=o===0?r+n:i,u=o===0||a===0?0:Math.round((Math.random()*2-1)*a);return{message:s,delayMs:Math.max(0,l+u)}})}var atr={type:"spring",stiffness:400,damping:35},PO=1024,str=40,otr=2e3;function hot(e,t){const r=t?.typingSpeedMs??str,n=t?.pauseAfterMs??otr,i=e.join("\0"),[a,s]=Fe.useState(0),[o,l]=Fe.useState(()=>e.length>0?1:0),[u,h]=Fe.useState("typing"),d=e.length>0?e[a%e.length]:"",f=d.slice(0,o);return Fe.useEffect(()=>{if(e.length===0){s(0),l(0),h("typing");return}s(0),l(1),h("typing")},[i,e.length]),Fe.useEffect(()=>{if(e.length!==0){if(u==="paused"){const p=setTimeout(()=>{s(g=>(g+1)%e.length),l(1),h("typing")},n);return()=>clearTimeout(p)}if(o<d.length){const p=setTimeout(()=>l(g=>g+1),r);return()=>clearTimeout(p)}h("paused")}},[e.length,a,o,d.length,u,r,n]),f}function dot(e){const t=Fe.useRef(null);return Fe.useEffect(()=>{e.length>0&&(t.current=e)},[e]),e.length>0?e:t.current??[]}function ltr(e,t=3e3){const[r,n]=Fe.useState(0);return Fe.useEffect(()=>{if(e.length<=1)return;const i=setInterval(()=>{n(a=>(a+1)%e.length)},t);return()=>clearInterval(i)},[e.length,t]),e.length>0?e[r%e.length]:""}function ale({agentName:e="Assistant",agentAvatarUrl:t,appearance:r,statusText:n="Online",className:i,onStopConversation:a,stopDisabled:s=!1,onClose:o}){const l=a!=null||o!=null;return(0,rt.jsxs)("div",{className:on("flex items-center gap-2 w-full",i),children:[(0,rt.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,rt.jsxs)(JB,{size:"lg",style:t?void 0:eP(r),children:[t?(0,rt.jsx)(e$,{src:t,alt:e}):null,(0,rt.jsx)(t$,{className:on(r?"bg-transparent text-white":void 0),children:e.slice(0,2).toUpperCase()})]}),(0,rt.jsxs)("div",{className:"min-w-0",children:[(0,rt.jsx)("div",{className:"truncate text-sm font-semibold",children:e}),(0,rt.jsx)("div",{className:"text-xs text-muted-foreground",children:n})]})]}),l&&(0,rt.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[a!=null&&(0,rt.jsx)(tf,{variant:"ghost",size:"icon","aria-label":"Stop conversation",title:"Stop conversation",disabled:s,onClick:a,children:(0,rt.jsx)(W1t,{})}),o!=null&&(0,rt.jsx)(tf,{variant:"ghost",size:"icon","aria-label":"Close",title:"Close",onClick:o,children:(0,rt.jsx)(K1t,{})})]})]})}function ctr({className:e}){return(0,rt.jsx)("div",{className:"w-full flex",children:(0,rt.jsx)("div",{className:on("max-w-[85%] rounded-2xl px-3 py-2 text-sm leading-relaxed","bg-muted text-foreground",e),children:(0,rt.jsx)("div",{className:"flex items-center gap-1 py-0.5","aria-label":"Thinking",children:[0,1,2].map(t=>(0,rt.jsx)(ef.span,{className:"size-1.5 rounded-full bg-current opacity-60",animate:{y:[0,-4,0]},transition:{duration:.5,repeat:1/0,delay:t*.12,ease:"easeInOut"}},t))})})})}function sle({messages:e,isTyping:t=!1,status:r="idle",errorMessage:n,appearance:i,onConfirmationDecision:a,onLinkClick:s,className:o,emptyTitle:l=Aht,emptyDescription:u=Lht,emptyAction:h}){const{scrollClassName:d,contentClassName:f}=_yt(),p=Fe.useMemo(()=>Cyt(e),[e]);return(0,rt.jsxs)(myt,{className:on("relative size-full",o),children:[(0,rt.jsx)(yyt,{scrollClassName:d,className:f,children:e.length===0&&!t?r==="error"?(0,rt.jsx)("div",{className:"state error",children:n??"Something went wrong."}):(0,rt.jsx)("div",{className:"flex min-h-full flex-1 items-center justify-center px-4 py-6",children:(0,rt.jsxs)(vyt,{className:"w-full max-w-[280px]",children:[(0,rt.jsx)("div",{className:"flex size-16 items-center justify-center rounded-2xl border border-border/70 bg-background/90 shadow-sm",children:(0,rt.jsx)(j1t,{className:"size-7 text-foreground"})}),(0,rt.jsxs)("div",{children:[(0,rt.jsx)("p",{className:"text-lg font-semibold leading-tight text-foreground",children:l}),(0,rt.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:u})]}),h&&(0,rt.jsx)(tf,{size:"lg",disabled:h.disabled,onClick:h.onClick,className:"rounded-full bg-black px-6 text-white hover:bg-black/90",children:h.label})]})}):(0,rt.jsxs)(rt.Fragment,{children:[p.map(g=>{if(g.type==="confirmation")return(0,rt.jsx)(cot,{from:"assistant",children:(0,rt.jsx)("div",{className:"flex w-fit max-w-[85%] shrink-0 flex-col gap-2",children:(0,rt.jsx)(uot,{confirmation:g.latestEnvelope,confirmationPrompt:g.envelope.prompt,confirmationActionsDisabled:r==="sending",onConfirmationDecision:a})})},g.message.id);const y=g.message;return(0,rt.jsx)(cot,{from:y.role,children:(0,rt.jsxs)("div",{className:"flex w-fit max-w-[85%] shrink-0 flex-col gap-2",children:[(0,rt.jsx)(ntr,{className:on("whitespace-pre-wrap",y.role==="user"?"text-white":"bg-muted text-foreground"),style:y.role==="user"?Xv(i):void 0,children:y.role==="assistant"?(0,rt.jsx)(uot,{onLinkClick:s,children:y.content}):y.content}),y.actions&&y.actions.length>0&&(0,rt.jsx)("div",{className:"flex flex-wrap gap-2 px-1",children:y.actions.map((b,T)=>(0,rt.jsx)(tf,{size:"sm",variant:b.variant??"outline",onClick:b.onClick,children:b.label},T))})]})},y.id)}),t&&(0,rt.jsx)(ef.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:"w-full",children:(0,rt.jsx)(ctr,{})})]})}),(0,rt.jsx)(byt,{})]})}var utr=2;function ole({placeholder:e=_ht,value:t,onChange:r,onSubmit:n,appearance:i,disabled:a=!1,className:s}){const o=t!==void 0&&r!==void 0,[l,u]=Fe.useState(""),h=o?t:l,d=Fe.useRef(null),f=y=>{const b=y.target.value;o?r(b):u(b)},p=()=>{const y=h.trim();!y||!n||(n(y),o&&r?r(""):u(""),d.current?.focus())},g=y=>{y.key==="Enter"&&(y.shiftKey||(y.preventDefault(),p()))};return(0,rt.jsxs)("div",{className:on("flex items-end gap-2",s),children:[(0,rt.jsx)(D1t,{ref:d,placeholder:e,value:h,onChange:f,onKeyDown:g,rows:utr,disabled:a,className:on("min-h-10 max-h-32 flex-1 resize-none py-2.5","focus-visible:ring-2")}),(0,rt.jsx)(tf,{type:"button",size:"icon",className:"h-10 w-10 shrink-0 text-white",style:Xv(i),"aria-label":"Send",disabled:a||!n,onClick:p,children:(0,rt.jsx)(eyt,{className:"size-4"})})]})}function lle({text:e="Powered by Mana Agents",className:t}){return(0,rt.jsx)("div",{className:on("text-center text-xs text-muted-foreground",t),children:e})}function cle({open:e,onOpenChange:t,children:r,desktopClassName:n,desktopStyle:i,portalContainer:a}){const s=BO(),o=htr(e,s);return s?(0,rt.jsx)(ayt,{open:e,onOpenChange:t,children:(0,rt.jsxs)(lyt,{container:a,showCloseButton:!1,"aria-describedby":void 0,style:{"--chat-widget-fullscreen-height":o!=null?`${o}px`:"100svh"},className:on("z-50 flex fixed! inset-0! h-(--chat-widget-fullscreen-height)! max-h-(--chat-widget-fullscreen-height)! w-screen! max-w-none translate-x-0! translate-y-0! flex-col gap-0 rounded-none border-0 p-0 shadow-lg","data-[state=open]:zoom-in-100 data-[state=closed]:zoom-out-100"),children:[(0,rt.jsx)(cyt,{className:"sr-only",children:"Chat"}),r]})}):(0,rt.jsx)(ef.div,{className:on(n,"z-10 flex h-112.5 flex-col"),style:{...i,pointerEvents:e?"auto":"none"},initial:!1,animate:{opacity:e?1:0,visibility:e?"visible":"hidden",scale:e?1:.96},transition:atr,children:r})}function BO(){const[e,t]=Fe.useState(()=>typeof window<"u"&&window.innerWidth<PO);return Fe.useEffect(()=>{const r=window.matchMedia(`(max-width: ${PO-1}px)`),n=()=>{t(window.innerWidth<PO)};return r.addEventListener("change",n),t(window.innerWidth<PO),()=>r.removeEventListener("change",n)},[]),e}function htr(e,t){const[r,n]=Fe.useState(null);return Fe.useEffect(()=>{if(!e||!t){n(null);return}const i=window.visualViewport?.height??window.innerHeight;n(Math.round(i))},[e,t]),r}var dtr=360,$O=56,ftr=8,ptr=12,gtr={duration:.4};function fot({agentName:e=kht,agentAvatarUrl:t,appearance:r,spotlightMessages:n=[],messages:i=[],poweredBy:a=J9,headerStatus:s="Online",errorMessage:o,status:l="idle",sendDisabled:u=!1,onSendMessage:h,isTyping:d,onSuggestion:f,onLauncherClick:p,className:g,open:y,defaultOpen:b=!1,onOpenChange:T,previewOnly:w=!1,onStopConversation:x,stopDisabled:C,onConfirmationDecision:R,onLinkClick:_,emptyAction:S,portalContainer:A}){const[M,O]=Fe.useState(w?!1:b),[P,H]=Fe.useState(""),L=n.length>0?n:[...Rw],$=ltr(L,3e3),I=w?!1:y??M,B=Fe.useCallback(F=>{if(T){T(F);return}O(F)},[T]),D=BO()&&I;return(0,rt.jsxs)("div",{className:on("relative",g),style:{width:L.length>0?260:$O,height:L.length>0?$O+ftr+56:$O},children:[L.length>0&&!I&&(0,rt.jsx)(Sgt,{mode:"wait",children:(0,rt.jsxs)(ef.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:gtr,className:"absolute right-0 bottom-[calc(56px+SPOTLIGHT_GAP)] flex w-full max-w-65 flex-col items-end",children:[(0,rt.jsx)("div",{className:"rounded-2xl border bg-background/95 px-4 py-3 text-right shadow-lg backdrop-blur-sm dark:bg-background/90",children:(0,rt.jsx)("p",{className:"text-sm leading-relaxed text-foreground",children:$})}),(0,rt.jsx)("div",{className:"flex w-full justify-end pr-6","aria-hidden":!0,children:(0,rt.jsx)("span",{className:"border-[6px] border-transparent border-t-background/95 bg-transparent dark:border-t-background/90"})})]},$)}),!w&&(0,rt.jsxs)(cle,{open:I,onOpenChange:B,portalContainer:A,desktopClassName:"absolute right-0 overflow-hidden rounded-2xl border bg-background shadow-xl",desktopStyle:{width:dtr,bottom:$O+ptr},children:[(0,rt.jsx)("div",{className:"flex shrink-0 border-b p-4",children:(0,rt.jsx)(ale,{agentName:e,agentAvatarUrl:t,appearance:r,statusText:s,onStopConversation:x??void 0,stopDisabled:C,onClose:()=>B(!1)})}),(0,rt.jsx)("div",{className:"flex min-h-0 flex-1 flex-col p-4 overflow-hidden",children:(0,rt.jsx)(sle,{messages:i,isTyping:d??l==="sending",status:l,suggestions:L,errorMessage:o,appearance:r,onConfirmationDecision:R,onLinkClick:_,onSuggestion:F=>{H(F),f?.(F)},emptyAction:S})}),!(S&&i.length===0&&!d)&&(0,rt.jsxs)("div",{className:"shrink-0 border-t p-3",children:[(0,rt.jsx)(ole,{value:P,onChange:H,onSubmit:h,appearance:r,disabled:u||l==="booting"}),(0,rt.jsx)(lle,{text:a,className:"mt-2"})]})]}),!D&&(0,rt.jsx)(ef.button,{type:"button",onClick:w?void 0:()=>{p?.(),B(!I)},className:on("absolute bottom-0 right-0 flex size-14 shrink-0 items-center justify-center rounded-full text-white shadow-lg",w&&"pointer-events-none"),style:r?Xv(r):void 0,"aria-label":I?"Close chat":"Open chat","aria-expanded":I,animate:{scale:1},whileHover:w?void 0:{scale:1.02},whileTap:w?void 0:{scale:.98},children:I?(0,rt.jsx)(r$,{className:"size-6"}):(0,rt.jsxs)(JB,{className:"size-12",style:r?eP(r):void 0,children:[t?(0,rt.jsx)(e$,{src:t,alt:e}):null,(0,rt.jsx)(t$,{className:"bg-transparent text-white",children:e.slice(0,2).toUpperCase()})]})})]})}var mtr=360,ytr=12,pot=280,got=120,FO=56,vtr={type:"spring",stiffness:400,damping:35};function btr({agentName:e=wht,agentAvatarUrl:t,appearance:r,spotlightMessages:n=[],messages:i=[],poweredBy:a=J9,headerStatus:s="Online",errorMessage:o,status:l="idle",sendDisabled:u=!1,startChatLabel:h=Cht,onSendMessage:d,isTyping:f,onSuggestion:p,onLauncherClick:g,className:y,open:b,defaultOpen:T=!1,onOpenChange:w,previewOnly:x=!1,onStopConversation:C,stopDisabled:R,onConfirmationDecision:_,onLinkClick:S,emptyAction:A,portalContainer:M}){const[O,P]=Fe.useState(x?!1:T),[H,L]=Fe.useState(""),$=x?!1:b??O,I=Fe.useCallback(G=>{if(w){w(G);return}P(G)},[w]),B=dot(n),D=B.length>0?B:[...Rw],F=hot(D)||D[0]||Rw[0],V=$?FO:got,U=$?FO:pot,j=BO()&&$,W={width:FO,height:FO,...r?Xv(r):{},pointerEvents:$?"auto":"none"};return(0,rt.jsxs)("div",{className:on("relative",y),style:{width:U,height:V},children:[!x&&(0,rt.jsxs)(cle,{open:$,onOpenChange:I,portalContainer:M,desktopClassName:"absolute right-0 overflow-hidden rounded-2xl border bg-background shadow-xl",desktopStyle:{width:mtr,bottom:V+ytr},children:[(0,rt.jsx)("div",{className:"flex shrink-0 border-b p-4",children:(0,rt.jsx)(ale,{agentName:e,agentAvatarUrl:t,appearance:r,statusText:s,onStopConversation:C??void 0,stopDisabled:R,onClose:()=>I(!1)})}),(0,rt.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden p-4 md:max-h-90",children:(0,rt.jsx)(sle,{messages:i,isTyping:f??l==="sending",status:l,errorMessage:o,appearance:r,onConfirmationDecision:_,onLinkClick:S,onSuggestion:G=>{L(G),p?.(G)},emptyAction:A})}),!(A&&i.length===0&&!f)&&(0,rt.jsxs)("div",{className:"border-t p-3 shrink-0",children:[(0,rt.jsx)(ole,{value:H,onChange:L,onSubmit:d,appearance:r,disabled:u||l==="booting"}),(0,rt.jsx)(lle,{text:a,className:"mt-2"})]})]}),!$&&(0,rt.jsxs)(ef.div,{className:"absolute bottom-0 right-0 flex flex-col gap-4 rounded-2xl border bg-background p-4 shadow-xl",style:{width:pot,height:got},initial:!1,animate:{opacity:1},children:[(0,rt.jsxs)("div",{className:"flex flex-1 items-start gap-2",children:[(0,rt.jsxs)(JB,{className:"size-9 shrink-0",style:r?eP(r):void 0,children:[t?(0,rt.jsx)(e$,{src:t,alt:e}):null,(0,rt.jsx)(t$,{className:"bg-transparent text-white text-xs",children:e.slice(0,2).toUpperCase()})]}),F?(0,rt.jsx)("p",{className:"min-w-0 flex-1 text-sm leading-snug text-foreground",children:F}):null]}),(0,rt.jsx)(tf,{className:on("w-full rounded-full",x&&"pointer-events-none"),onClick:x?void 0:()=>{g?.(),I(!0)},style:r?Xv(r):void 0,children:r?.actionText?.trim()||h})]}),!x&&!j&&(0,rt.jsx)(ef.button,{type:"button",onClick:()=>I(!1),className:"absolute bottom-0 right-0 flex items-center justify-center rounded-full text-primary-foreground shadow-lg",style:W,"aria-label":"Close chat",initial:!1,animate:{opacity:$?1:0,visibility:$?"visible":"hidden"},transition:vtr,whileHover:$?{scale:1.02}:void 0,whileTap:$?{scale:.98}:void 0,children:(0,rt.jsx)(r$,{className:"size-6"})})]})}var ule=560,mot=320,hle=48,xtr=48,Ttr=10,wtr={type:"spring",stiffness:400,damping:35};function ktr({agentName:e=Eht,agentAvatarUrl:t,appearance:r,spotlightMessages:n=[],messages:i=[],poweredBy:a=J9,headerStatus:s="Online",errorMessage:o,status:l="idle",sendDisabled:u=!1,launcherLabel:h="Ask",onSendMessage:d,isTyping:f,onSuggestion:p,onLauncherClick:g,className:y,open:b,defaultOpen:T=!1,onOpenChange:w,previewOnly:x=!1,onStopConversation:C,stopDisabled:R,onConfirmationDecision:_,onLinkClick:S,emptyAction:A,portalContainer:M}){const[O,P]=Fe.useState(x?!1:T),[H,L]=Fe.useState(""),$=x?!1:b??O,I=BO()&&$,B=Fe.useCallback(G=>{if(w){w(G);return}P(G)},[w]),D=dot(n),F=D.length>0?D:[...Rw],V=hot(F)||F[0]||Rw[0],U=Fe.useRef(null),[j,W]=Fe.useState(ule);return Fe.useEffect(()=>{if($)return;const G=U.current;if(!G)return;const K=new ResizeObserver(Z=>{const ae=Z[0]?.contentRect.width;typeof ae=="number"&&W(ae)});return K.observe(G),()=>K.disconnect()},[$]),(0,rt.jsxs)("div",{className:on("relative w-full max-w-full shrink-0",y),style:{maxWidth:ule,minWidth:mot,minHeight:hle},children:[!x&&(0,rt.jsxs)(cle,{open:$,onOpenChange:B,portalContainer:M,desktopClassName:on("absolute left-0 right-0 mx-auto overflow-hidden rounded-2xl border bg-white/90 shadow-lg backdrop-blur-xl dark:bg-background/90"),desktopStyle:{width:"100%",minWidth:mot,maxWidth:ule,bottom:hle+Ttr},children:[(0,rt.jsx)("div",{className:"flex shrink-0 border-b p-4",children:(0,rt.jsx)(ale,{agentName:e,agentAvatarUrl:t,appearance:r,statusText:s,onStopConversation:C??void 0,stopDisabled:R,onClose:()=>B(!1)})}),(0,rt.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden p-4 md:p-2 md:max-h-85",children:(0,rt.jsx)(sle,{messages:i,isTyping:f??l==="sending",status:l,errorMessage:o,appearance:r,onConfirmationDecision:_,onLinkClick:S,onSuggestion:G=>{L(G),p?.(G)},emptyAction:A})}),!(A&&i.length===0&&!f)&&(0,rt.jsxs)("div",{className:"border-t p-3 shrink-0",children:[(0,rt.jsx)(ole,{value:H,onChange:L,onSubmit:d,appearance:r,disabled:u||l==="booting"}),(0,rt.jsx)(lle,{text:a,className:"mt-2"})]})]}),!I&&(0,rt.jsx)("div",{className:"absolute bottom-0 left-0 right-0 z-0 flex w-full justify-center",children:(0,rt.jsx)("div",{ref:U,className:"flex w-full max-w-full justify-center",children:(0,rt.jsx)(ef.button,{type:"button",onClick:x?void 0:()=>{$||g?.(),B(!$)},className:on("flex shrink-0 items-center gap-2.5 rounded-full border bg-white/80 px-4 py-3 shadow-lg backdrop-blur-xl dark:bg-white/10",$&&"justify-center",x&&"pointer-events-none","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),style:{height:hle},initial:!1,animate:{width:$?xtr:j,borderRadius:9999},transition:wtr,"aria-label":$?"Close chat":"Open chat","aria-expanded":$,whileHover:x?void 0:{scale:1.02},whileTap:x?void 0:{scale:.98},children:$?(0,rt.jsx)(r$,{className:"size-5 shrink-0 text-foreground"}):(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsx)(Z1t,{className:"size-5 shrink-0 text-muted-foreground"}),(0,rt.jsx)("span",{className:"min-w-0 flex-1 truncate text-left text-sm text-muted-foreground",children:V}),(0,rt.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium text-white",style:r?Xv(r):void 0,children:[(0,rt.jsx)(ryt,{className:"size-4"}),r?.actionText?.trim()||h]})]})})})})]})}var Etr=`
|
|
3454
3454
|
.widget-shell {
|
|
3455
3455
|
display: block;
|
|
3456
3456
|
box-sizing: border-box;
|
|
@@ -3476,7 +3476,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
|
|
|
3476
3476
|
max-width: none !important;
|
|
3477
3477
|
}
|
|
3478
3478
|
}
|
|
3479
|
-
`;function Ctr(e){return typeof e=="number"&&!Number.isNaN(e)&&e>=0}function Str(e,t){const r=document.getElementById(e);if(r instanceof HTMLElement)return t(r),()=>{};const n=document.body??document.documentElement;if(!n)return()=>{};let i=!1;const a=new MutationObserver(()=>{if(i)return;const s=document.getElementById(e);s instanceof HTMLElement&&(i=!0,a.disconnect(),t(s))});return a.observe(n,{childList:!0,subtree:!0}),()=>{i=!0,a.disconnect()}}function _tr(e){const[t,r]=(0,Fe.useState)(e==null);return(typeof window>"u"?Fe.useEffect:Fe.useLayoutEffect)(()=>{let n=!1;const i=()=>{n||r(!0)};if(!e)return r(!0),()=>{n=!0};r(!1);let a=()=>{};switch(e.triggerRuleType){case"time_delay":{if(!Ctr(e.timeDelay))return i(),()=>{n=!0};const s=window.setTimeout(i,e.timeDelay*1e3);a=()=>{window.clearTimeout(s)};break}case"scroll_to_bottom":{if(!e.scrollToBottom)return i(),()=>{n=!0};const s=()=>{const o=window.scrollY,l=window.innerHeight,u=document.documentElement.scrollHeight;o+l>=u-1&&i()};s(),window.addEventListener("scroll",s,{passive:!0}),window.addEventListener("resize",s),a=()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s)};break}case"element_displayed":{if(!e.elementDisplayed)return i(),()=>{n=!0};let s=null;const o=Str(e.elementDisplayed,l=>{s=new IntersectionObserver(u=>{u.some(h=>h.isIntersecting)&&i()}),s.observe(l)});a=()=>{s?.disconnect(),o()};break}case"element_clicked":{if(!e.elementClicked)return i(),()=>{n=!0};const s=`#${CSS.escape(e.elementClicked)}`,o=l=>{const u=l.target;u instanceof Element&&u.closest(s)&&i()};document.addEventListener("click",o,!0),a=()=>{document.removeEventListener("click",o,!0)};break}default:return i(),()=>{n=!0}}return()=>{n=!0,a()}},[e]),{ready:t||e==null}}var Atr={default:fot,box:btr,chatbar:ktr};function Ltr({mode:e,agentId:t,variant:r,placement:n,appearance:i,agentAvatarUrl:a,widgetTitle:s,spotlights:o,open:l,status:u,messages:h,errorMessage:d,triggerRule:f,emptyAction:p,sendDisabled:g=!1,onOpenChange:y,onSendMessage:b,onStopConversation:T,onConfirmationDecision:w,portalContainer:x,onWidgetVisible:C,onLinkClick:R,onLauncherClick:_}){const{ready:S}=_tr(f),{horizontal:A,vertical:M}=wue(n),O=Atr[r]??fot,P=Rtr(e,n),H=a?.trim()||void 0,L=Syt(h)!=null,$=L||u==="booting"||u==="sending",I=g||L||u==="booting",B=Fe.useRef(!1);return Fe.useEffect(()=>{e!=="embed"||!S||B.current||(B.current=!0,C?.(f?.triggerRuleType??null))},[e,C,S,f]),S?(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsx)("style",{children:Etr}),(0,rt.jsx)("div",{"data-agent-id":t,"data-mode":e,"data-horizontal":A,"data-vertical":M,"data-variant":r,"data-open":String(l),"data-status":u,style:P,className:"widget-shell",children:(0,rt.jsx)("div",{style:{pointerEvents:"auto"},children:(0,rt.jsx)(O,{agentName:s,agentAvatarUrl:H,appearance:i,spotlightMessages:o,messages:h,status:u,errorMessage:d,emptyAction:p,sendDisabled:I,onSendMessage:b,open:l,onOpenChange:y,onStopConversation:T,stopDisabled:$,onConfirmationDecision:w,onLauncherClick:_,onLinkClick:R,portalContainer:x})})})]}):null}function Rtr(e,t){const r={pointerEvents:"none"};if(e==="preview"){const{horizontal:n,vertical:i}=wue(t);return Object.assign(r,{position:"relative",display:"flex",width:"100%",minHeight:"720px",padding:"24px",overflow:"hidden",alignItems:i==="top"?"flex-start":"flex-end",justifyContent:n==="left"?"flex-start":n==="center"?"center":"flex-end"}),r}switch(Object.assign(r,{position:"fixed",zIndex:2147483646}),t){case"top-left":Object.assign(r,{left:"24px",top:"24px"});break;case"top-center":Object.assign(r,{left:"50%",top:"24px",transform:"translateX(-50%)"});break;case"top-right":Object.assign(r,{right:"24px",top:"24px"});break;case"bottom-left":Object.assign(r,{left:"24px",bottom:"24px"});break;case"bottom-center":Object.assign(r,{left:"50%",bottom:"24px",transform:"translateX(-50%)"});break;default:Object.assign(r,{right:"24px",bottom:"24px"});break}return r}function yot(e){const t=e?.trim();return t?t.replace(/\/+$/,""):null}function vot(){const e="https://api-dev.usereq.com",t=globalThis.__SITEMANA_WIDGET_API_BASE__;return yot(e)??yot(t)??"http://localhost:4000"}async function YT(e,t){const r=await fetch(new URL(e,`${vot()}/`).toString(),{...t,headers:{"Content-Type":"application/json",...t.headers??{}},credentials:"omit"}),n=await r.text(),i=n?JSON.parse(n):null;if(!r.ok)throw new Error(typeof i=="object"&&i&&"error"in i?String(i.error??r.statusText):r.statusText);return i}async function Ntr(e){return YT("/api/widget/sessions",{method:"POST",body:JSON.stringify(e)})}async function Dtr(e){return YT("/api/conversations/public/start",{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`},body:JSON.stringify({agentId:e.agentId})})}async function Itr(e){return YT(`/api/conversations/public/${encodeURIComponent(e.conversationId)}/messages`,{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`},body:JSON.stringify({content:e.content})})}async function Mtr(e){return YT(`/api/conversations/public/${encodeURIComponent(e.conversationId)}/messages`,{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`},body:JSON.stringify({content:e.content})})}async function Otr(e){return YT("/api/conversations/public/current",{method:"GET",headers:{Authorization:`Bearer ${e}`}})}async function Ptr(e){const t=new URLSearchParams;return e.cursor&&t.set("cursor",e.cursor),YT(`/api/conversations/public/${encodeURIComponent(e.conversationId)}/messages?${t.toString()}`,{method:"GET",headers:{Authorization:`Bearer ${e.sessionToken}`}})}function dle(e){return`sitemana-widget:${e}`}function Btr(e){try{const t=sessionStorage.getItem(dle(e));if(!t)return null;const r=JSON.parse(t);return!r?.sessionToken||!r?.expiresAt||!r?.widgetConfig?.agentId||!r?.widgetConfig?.name?null:r}catch{return null}}function zO(e,t){sessionStorage.setItem(dle(e),JSON.stringify(t))}function $tr(e){sessionStorage.removeItem(dle(e))}function UO(e){return[...e].sort((t,r)=>new Date(t.createdAt).getTime()-new Date(r.createdAt).getTime())}var bot={loadSession:Btr,saveSession:zO,mintWidgetSession:Ntr,getCurrentConversation:Otr,listConversationMessages:Ptr,getOrigin:()=>window.location.origin,now:()=>Date.now()};function Ftr(e,t=Date.now()){if(!e)return!1;const r=new Date(e.expiresAt).getTime();return Number.isFinite(r)&&r>t}async function HO(e,t=bot){const r=t.loadSession(e.agentId);if(Ftr(r,t.now()))return r;const n=await t.mintWidgetSession({agentId:e.agentId,origin:t.getOrigin(),pageUrl:e.pageUrl,referrer:e.referrer}),i={sessionToken:n.sessionToken,expiresAt:n.expiresAt,widgetConfig:n.widgetConfig};return t.saveSession(e.agentId,i),i}async function ztr(e,t){const r=await HO(e,t);let n=r.conversationId,i=[];if(n)try{i=UO((await t.listConversationMessages({conversationId:n,sessionToken:r.sessionToken})).data)}catch{n=void 0,i=[]}else try{n=(await t.getCurrentConversation(r.sessionToken)).conversation?.id??void 0,n&&(i=UO((await t.listConversationMessages({conversationId:n,sessionToken:r.sessionToken})).data))}catch{n=void 0,i=[]}const a={...r,conversationId:n};return t.saveSession(e.agentId,a),{session:a,conversationId:n,messages:i}}async function Utr(e){return ztr(e,bot)}async function Htr(e){const t=await HO({agentId:e.agentId,pageUrl:window.location.href,referrer:document.referrer||void 0});if(!t.conversationId)throw new Error("Widget conversation not started");const r=await Itr({conversationId:t.conversationId,sessionToken:t.sessionToken,content:e.content}),n={...t,conversationId:t.conversationId};return zO(e.agentId,n),{session:n,conversationId:t.conversationId,messages:UO([r.userMessage,...r.assistantMessages]),userMessage:r.userMessage,assistantMessages:r.assistantMessages}}async function xot(e){const t=await HO({agentId:e.agentId,pageUrl:window.location.href,referrer:document.referrer||void 0});if(!t.conversationId)throw new Error("Widget conversation not started");const r=e.decision!=null?Eyt({confirmationId:e.confirmationId,decision:e.decision}):kyt({confirmationId:e.confirmationId,prompt:e.prompt}),n=await Mtr({conversationId:t.conversationId,sessionToken:t.sessionToken,content:r}),i={...t,conversationId:t.conversationId};return zO(e.agentId,i),{session:i,conversationId:t.conversationId,confirmationMessage:n.confirmationMessage}}async function Vtr(e){const t=await HO({agentId:e.agentId,pageUrl:window.location.href,referrer:document.referrer||void 0}),r=await Dtr({agentId:e.agentId,sessionToken:t.sessionToken}),n={...t,conversationId:r.conversation.id};return zO(e.agentId,n),{session:n,conversationId:r.conversation.id,messages:UO([r.welcomeMessage]),welcomeMessage:r.welcomeMessage}}async function qtr(e){$tr(e)}var Gtr="/api/widget/events/batch",Wtr=10,Ytr=2500,Tot="sitemana-widget:unique-script-loaded:",jtr=class{mode;agentId;getSession;getConversationId;batchSize;flushIntervalMs;uniqueScriptSeen=new Set;flushTimer=null;queue=[];disposed=!1;constructor(e){this.mode=e.mode,this.agentId=e.agentId,this.getSession=e.getSession,this.getConversationId=e.getConversationId,this.batchSize=Math.max(1,e.batchSize??Wtr),this.flushIntervalMs=Math.max(200,e.flushIntervalMs??Ytr),this.mode==="embed"&&(window.addEventListener("pagehide",this.handlePageHide,{capture:!0}),document.addEventListener("visibilitychange",this.handleVisibilityChange,!0))}dispose(){this.disposed||(this.disposed=!0,this.clearFlushTimer(),window.removeEventListener("pagehide",this.handlePageHide,!0),document.removeEventListener("visibilitychange",this.handleVisibilityChange,!0),this.flush({transport:"beacon"}))}trackScriptLoaded(){this.track({eventType:"SCRIPT_LOADED"})}trackUniqueScriptLoaded(){const e=this.getSession()?.sessionToken?.trim();if(!e)return;const t=`${this.agentId}:${e}`;if(!this.uniqueScriptSeen.has(t)){if(this.hasSessionUniqueScriptLoaded(t)){this.uniqueScriptSeen.add(t);return}this.uniqueScriptSeen.add(t),this.setSessionUniqueScriptLoaded(t),this.track({eventType:"UNIQUE_SCRIPT_LOADED"})}}trackView(e){this.track({eventType:"VIEW",triggerRuleType:e}),e==="element_displayed"&&this.track({eventType:"DISPLAY_AFTER_ELEMENT_SHOWED",triggerRuleType:e})}trackClick(){this.track({eventType:"CLICK"})}trackLinkClicked(e){const t=e.trim();t&&(this.track({eventType:"LINK_CLICKED",linkUrl:t}),this.flush({transport:"beacon"}))}track(e){if(this.disposed||this.mode!=="embed")return;const t=this.getSession()?.sessionToken?.trim();if(!t)return;const{occurredAt:r,conversationId:n,triggerRuleType:i,linkUrl:a,...s}=e,o=n??this.getConversationId(),l={...s,occurredAt:r??new Date().toISOString(),...o?{conversationId:o}:{},...i?{triggerRuleType:i}:{},...a?{linkUrl:a}:{}};if(this.queue.push({event:l,sessionToken:t}),this.queue.length>=this.batchSize){this.flush();return}this.scheduleFlush()}async flush(e){if(this.disposed||this.queue.length===0)return;this.clearFlushTimer();const t=e?.transport??"default",r=this.queue;this.queue=[];const n=new Map;for(const a of r){const s=n.get(a.sessionToken);s?s.push(a.event):n.set(a.sessionToken,[a.event])}const i=[];for(const[a,s]of n.entries())if(!await this.sendBatch({events:s,sessionToken:a,transport:t}))for(const o of s)i.push({event:o,sessionToken:a});i.length>0&&(this.queue=[...i,...this.queue],this.scheduleFlush())}async sendBatch(e){if(e.events.length===0)return!0;const t=new URL(Gtr,`${vot()}/`).toString(),r={events:e.events.map(n=>{const{conversationId:i,triggerRuleType:a,linkUrl:s,...o}=n;return{...o,...i?{conversationId:i}:{},...a?{triggerRuleType:a}:{},...s?{linkUrl:s}:{}}}),pageUrl:window.location.href,referrer:document.referrer||void 0,sessionToken:e.sessionToken};if(e.transport==="beacon"&&typeof navigator.sendBeacon=="function"){const n=new Blob([JSON.stringify(r)],{type:"application/json"});if(navigator.sendBeacon(t,n))return!0}try{return(await fetch(t,{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`,"Content-Type":"application/json"},body:JSON.stringify(r),credentials:"omit",keepalive:e.transport==="beacon"})).ok}catch{return!1}}scheduleFlush(){this.flushTimer==null&&(this.flushTimer=window.setTimeout(()=>{this.flushTimer=null,this.flush()},this.flushIntervalMs))}clearFlushTimer(){this.flushTimer!=null&&(window.clearTimeout(this.flushTimer),this.flushTimer=null)}hasSessionUniqueScriptLoaded(e){try{return sessionStorage.getItem(`${Tot}${e}`)==="1"}catch{return!1}}setSessionUniqueScriptLoaded(e){try{sessionStorage.setItem(`${Tot}${e}`,"1")}catch{}}handlePageHide=()=>{this.flush({transport:"beacon"})};handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this.flush({transport:"beacon"})}};function Xtr(e){return new jtr(e)}var Ktr=`
|
|
3479
|
+
`;function Ctr(e){return typeof e=="number"&&!Number.isNaN(e)&&e>=0}function Str(e,t){const r=document.getElementById(e);if(r instanceof HTMLElement)return t(r),()=>{};const n=document.body??document.documentElement;if(!n)return()=>{};let i=!1;const a=new MutationObserver(()=>{if(i)return;const s=document.getElementById(e);s instanceof HTMLElement&&(i=!0,a.disconnect(),t(s))});return a.observe(n,{childList:!0,subtree:!0}),()=>{i=!0,a.disconnect()}}function _tr(e){const[t,r]=(0,Fe.useState)(e==null);return(typeof window>"u"?Fe.useEffect:Fe.useLayoutEffect)(()=>{let n=!1;const i=()=>{n||r(!0)};if(!e)return r(!0),()=>{n=!0};r(!1);let a=()=>{};switch(e.triggerRuleType){case"time_delay":{if(!Ctr(e.timeDelay))return i(),()=>{n=!0};const s=window.setTimeout(i,e.timeDelay*1e3);a=()=>{window.clearTimeout(s)};break}case"scroll_to_bottom":{if(!e.scrollToBottom)return i(),()=>{n=!0};const s=()=>{const o=window.scrollY,l=window.innerHeight,u=document.documentElement.scrollHeight;o+l>=u-1&&i()};s(),window.addEventListener("scroll",s,{passive:!0}),window.addEventListener("resize",s),a=()=>{window.removeEventListener("scroll",s),window.removeEventListener("resize",s)};break}case"element_displayed":{if(!e.elementDisplayed)return i(),()=>{n=!0};let s=null;const o=Str(e.elementDisplayed,l=>{s=new IntersectionObserver(u=>{u.some(h=>h.isIntersecting)&&i()}),s.observe(l)});a=()=>{s?.disconnect(),o()};break}case"element_clicked":{if(!e.elementClicked)return i(),()=>{n=!0};const s=`#${CSS.escape(e.elementClicked)}`,o=l=>{const u=l.target;u instanceof Element&&u.closest(s)&&i()};document.addEventListener("click",o,!0),a=()=>{document.removeEventListener("click",o,!0)};break}default:return i(),()=>{n=!0}}return()=>{n=!0,a()}},[e]),{ready:t||e==null}}var Atr={default:fot,box:btr,chatbar:ktr};function Ltr({mode:e,agentId:t,variant:r,placement:n,appearance:i,agentAvatarUrl:a,widgetTitle:s,spotlights:o,open:l,status:u,messages:h,errorMessage:d,triggerRule:f,emptyAction:p,sendDisabled:g=!1,onOpenChange:y,onSendMessage:b,onStopConversation:T,onConfirmationDecision:w,portalContainer:x,onWidgetVisible:C,onLinkClick:R,onLauncherClick:_}){const{ready:S}=_tr(f),{horizontal:A,vertical:M}=wue(n),O=Atr[r]??fot,P=Rtr(e,n),H=a?.trim()||void 0,L=Syt(h)!=null,$=L||u==="booting"||u==="sending",I=g||L||u==="booting",B=Fe.useRef(!1);return Fe.useEffect(()=>{e!=="embed"||!S||B.current||(B.current=!0,C?.(f?.triggerRuleType??null))},[e,C,S,f]),S?(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsx)("style",{children:Etr}),(0,rt.jsx)("div",{"data-agent-id":t,"data-mode":e,"data-horizontal":A,"data-vertical":M,"data-variant":r,"data-open":String(l),"data-status":u,style:P,className:"widget-shell",children:(0,rt.jsx)("div",{style:{pointerEvents:"auto"},children:(0,rt.jsx)(O,{agentName:s,agentAvatarUrl:H,appearance:i,spotlightMessages:o,messages:h,status:u,errorMessage:d,emptyAction:p,sendDisabled:I,onSendMessage:b,open:l,onOpenChange:y,onStopConversation:T,stopDisabled:$,onConfirmationDecision:w,onLauncherClick:_,onLinkClick:R,portalContainer:x})})})]}):null}function Rtr(e,t){const r={pointerEvents:"none"};if(e==="preview"){const{horizontal:n,vertical:i}=wue(t);return Object.assign(r,{position:"relative",display:"flex",width:"100%",minHeight:"720px",padding:"24px",overflow:"hidden",alignItems:i==="top"?"flex-start":"flex-end",justifyContent:n==="left"?"flex-start":n==="center"?"center":"flex-end"}),r}switch(Object.assign(r,{position:"fixed",zIndex:2147483646}),t){case"top-left":Object.assign(r,{left:"24px",top:"24px"});break;case"top-center":Object.assign(r,{left:"50%",top:"24px",transform:"translateX(-50%)"});break;case"top-right":Object.assign(r,{right:"24px",top:"24px"});break;case"bottom-left":Object.assign(r,{left:"24px",bottom:"24px"});break;case"bottom-center":Object.assign(r,{left:"50%",bottom:"24px",transform:"translateX(-50%)"});break;default:Object.assign(r,{right:"24px",bottom:"24px"});break}return r}function yot(e){const t=e?.trim();return t?t.replace(/\/+$/,""):null}function vot(){const e="https://api-dev.usereq.com",t=globalThis.__SITEMANA_WIDGET_API_BASE__;return yot(e)??yot(t)??"http://localhost:4000"}async function YT(e,t){const r=await fetch(new URL(e,`${vot()}/`).toString(),{...t,headers:{"Content-Type":"application/json",...t.headers??{}},credentials:"omit"}),n=await r.text(),i=n?JSON.parse(n):null;if(!r.ok)throw new Error(typeof i=="object"&&i&&"error"in i?String(i.error??r.statusText):r.statusText);return i}async function Ntr(e){return YT("/api/widget/sessions",{method:"POST",body:JSON.stringify(e)})}async function Dtr(e){return YT("/api/conversations/public/start",{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`},body:JSON.stringify({agentId:e.agentId})})}async function Itr(e){return YT(`/api/conversations/public/${encodeURIComponent(e.conversationId)}/messages`,{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`},body:JSON.stringify({content:e.content})})}async function Mtr(e){return YT(`/api/conversations/public/${encodeURIComponent(e.conversationId)}/messages`,{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`},body:JSON.stringify({content:e.content})})}async function Otr(e){return YT("/api/conversations/public/current",{method:"GET",headers:{Authorization:`Bearer ${e}`}})}async function Ptr(e){const t=new URLSearchParams;return e.cursor&&t.set("cursor",e.cursor),YT(`/api/conversations/public/${encodeURIComponent(e.conversationId)}/messages?${t.toString()}`,{method:"GET",headers:{Authorization:`Bearer ${e.sessionToken}`}})}function dle(e){return`sitemana-widget:${e}`}function Btr(e){try{const t=sessionStorage.getItem(dle(e));if(!t)return null;const r=JSON.parse(t);return!r?.sessionToken||!r?.expiresAt||!r?.widgetConfig?.agentId||!r?.widgetConfig?.name?null:r}catch{return null}}function zO(e,t){sessionStorage.setItem(dle(e),JSON.stringify(t))}function $tr(e){sessionStorage.removeItem(dle(e))}function UO(e){return[...e].sort((t,r)=>new Date(t.createdAt).getTime()-new Date(r.createdAt).getTime())}var bot={loadSession:Btr,saveSession:zO,mintWidgetSession:Ntr,getCurrentConversation:Otr,listConversationMessages:Ptr,getOrigin:()=>window.location.origin,now:()=>Date.now()};function Ftr(e,t=Date.now()){if(!e)return!1;const r=new Date(e.expiresAt).getTime();return Number.isFinite(r)&&r>t}async function HO(e,t=bot,r){const n=t.loadSession(e.agentId),i=Ftr(n,t.now());if(i&&!r?.refreshWidgetConfig)return n;if(i&&r?.refreshWidgetConfig)try{const o=await t.mintWidgetSession({agentId:e.agentId,origin:t.getOrigin(),pageUrl:e.pageUrl,referrer:e.referrer}),l={...n,widgetConfig:o.widgetConfig};return t.saveSession(e.agentId,l),l}catch{return n}const a=await t.mintWidgetSession({agentId:e.agentId,origin:t.getOrigin(),pageUrl:e.pageUrl,referrer:e.referrer}),s={sessionToken:a.sessionToken,expiresAt:a.expiresAt,widgetConfig:a.widgetConfig};return t.saveSession(e.agentId,s),s}async function ztr(e,t){const r=await HO(e,t,{refreshWidgetConfig:!0});let n=r.conversationId,i=[];if(n)try{i=UO((await t.listConversationMessages({conversationId:n,sessionToken:r.sessionToken})).data)}catch{n=void 0,i=[]}else try{n=(await t.getCurrentConversation(r.sessionToken)).conversation?.id??void 0,n&&(i=UO((await t.listConversationMessages({conversationId:n,sessionToken:r.sessionToken})).data))}catch{n=void 0,i=[]}const a={...r,conversationId:n};return t.saveSession(e.agentId,a),{session:a,conversationId:n,messages:i}}async function Utr(e){return ztr(e,bot)}async function Htr(e){const t=await HO({agentId:e.agentId,pageUrl:window.location.href,referrer:document.referrer||void 0});if(!t.conversationId)throw new Error("Widget conversation not started");const r=await Itr({conversationId:t.conversationId,sessionToken:t.sessionToken,content:e.content}),n={...t,conversationId:t.conversationId};return zO(e.agentId,n),{session:n,conversationId:t.conversationId,messages:UO([r.userMessage,...r.assistantMessages]),userMessage:r.userMessage,assistantMessages:r.assistantMessages}}async function xot(e){const t=await HO({agentId:e.agentId,pageUrl:window.location.href,referrer:document.referrer||void 0});if(!t.conversationId)throw new Error("Widget conversation not started");const r=e.decision!=null?Eyt({confirmationId:e.confirmationId,decision:e.decision}):kyt({confirmationId:e.confirmationId,prompt:e.prompt}),n=await Mtr({conversationId:t.conversationId,sessionToken:t.sessionToken,content:r}),i={...t,conversationId:t.conversationId};return zO(e.agentId,i),{session:i,conversationId:t.conversationId,confirmationMessage:n.confirmationMessage}}async function Vtr(e){const t=await HO({agentId:e.agentId,pageUrl:window.location.href,referrer:document.referrer||void 0}),r=await Dtr({agentId:e.agentId,sessionToken:t.sessionToken}),n={...t,conversationId:r.conversation.id};return zO(e.agentId,n),{session:n,conversationId:r.conversation.id,messages:UO([r.welcomeMessage]),welcomeMessage:r.welcomeMessage}}async function qtr(e){$tr(e)}var Gtr="/api/widget/events/batch",Wtr=10,Ytr=2500,Tot="sitemana-widget:unique-script-loaded:",jtr=class{mode;agentId;getSession;getConversationId;batchSize;flushIntervalMs;uniqueScriptSeen=new Set;flushTimer=null;queue=[];disposed=!1;constructor(e){this.mode=e.mode,this.agentId=e.agentId,this.getSession=e.getSession,this.getConversationId=e.getConversationId,this.batchSize=Math.max(1,e.batchSize??Wtr),this.flushIntervalMs=Math.max(200,e.flushIntervalMs??Ytr),this.mode==="embed"&&(window.addEventListener("pagehide",this.handlePageHide,{capture:!0}),document.addEventListener("visibilitychange",this.handleVisibilityChange,!0))}dispose(){this.disposed||(this.disposed=!0,this.clearFlushTimer(),window.removeEventListener("pagehide",this.handlePageHide,!0),document.removeEventListener("visibilitychange",this.handleVisibilityChange,!0),this.flush({transport:"beacon"}))}trackScriptLoaded(){this.track({eventType:"SCRIPT_LOADED"})}trackUniqueScriptLoaded(){const e=this.getSession()?.sessionToken?.trim();if(!e)return;const t=`${this.agentId}:${e}`;if(!this.uniqueScriptSeen.has(t)){if(this.hasSessionUniqueScriptLoaded(t)){this.uniqueScriptSeen.add(t);return}this.uniqueScriptSeen.add(t),this.setSessionUniqueScriptLoaded(t),this.track({eventType:"UNIQUE_SCRIPT_LOADED"})}}trackView(e){this.track({eventType:"VIEW",triggerRuleType:e}),e==="element_displayed"&&this.track({eventType:"DISPLAY_AFTER_ELEMENT_SHOWED",triggerRuleType:e})}trackClick(){this.track({eventType:"CLICK"})}trackLinkClicked(e){const t=e.trim();t&&(this.track({eventType:"LINK_CLICKED",linkUrl:t}),this.flush({transport:"beacon"}))}track(e){if(this.disposed||this.mode!=="embed")return;const t=this.getSession()?.sessionToken?.trim();if(!t)return;const{occurredAt:r,conversationId:n,triggerRuleType:i,linkUrl:a,...s}=e,o=n??this.getConversationId(),l={...s,occurredAt:r??new Date().toISOString(),...o?{conversationId:o}:{},...i?{triggerRuleType:i}:{},...a?{linkUrl:a}:{}};if(this.queue.push({event:l,sessionToken:t}),this.queue.length>=this.batchSize){this.flush();return}this.scheduleFlush()}async flush(e){if(this.disposed||this.queue.length===0)return;this.clearFlushTimer();const t=e?.transport??"default",r=this.queue;this.queue=[];const n=new Map;for(const a of r){const s=n.get(a.sessionToken);s?s.push(a.event):n.set(a.sessionToken,[a.event])}const i=[];for(const[a,s]of n.entries())if(!await this.sendBatch({events:s,sessionToken:a,transport:t}))for(const o of s)i.push({event:o,sessionToken:a});i.length>0&&(this.queue=[...i,...this.queue],this.scheduleFlush())}async sendBatch(e){if(e.events.length===0)return!0;const t=new URL(Gtr,`${vot()}/`).toString(),r={events:e.events.map(n=>{const{conversationId:i,triggerRuleType:a,linkUrl:s,...o}=n;return{...o,...i?{conversationId:i}:{},...a?{triggerRuleType:a}:{},...s?{linkUrl:s}:{}}}),pageUrl:window.location.href,referrer:document.referrer||void 0,sessionToken:e.sessionToken};if(e.transport==="beacon"&&typeof navigator.sendBeacon=="function"){const n=new Blob([JSON.stringify(r)],{type:"application/json"});if(navigator.sendBeacon(t,n))return!0}try{return(await fetch(t,{method:"POST",headers:{Authorization:`Bearer ${e.sessionToken}`,"Content-Type":"application/json"},body:JSON.stringify(r),credentials:"omit",keepalive:e.transport==="beacon"})).ok}catch{return!1}}scheduleFlush(){this.flushTimer==null&&(this.flushTimer=window.setTimeout(()=>{this.flushTimer=null,this.flush()},this.flushIntervalMs))}clearFlushTimer(){this.flushTimer!=null&&(window.clearTimeout(this.flushTimer),this.flushTimer=null)}hasSessionUniqueScriptLoaded(e){try{return sessionStorage.getItem(`${Tot}${e}`)==="1"}catch{return!1}}setSessionUniqueScriptLoaded(e){try{sessionStorage.setItem(`${Tot}${e}`,"1")}catch{}}handlePageHide=()=>{this.flush({transport:"beacon"})};handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this.flush({transport:"beacon"})}};function Xtr(e){return new jtr(e)}var Ktr=`
|
|
3480
3480
|
:host {
|
|
3481
3481
|
color-scheme: light;
|
|
3482
3482
|
--tw-border-style: solid;
|