@inkeep/cxkit-primitives 0.5.52 → 0.5.55
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/atoms/cmdk/index.cjs +1 -1
- package/dist/atoms/cmdk/index.js +56 -55
- package/dist/components/embedded-chat.cjs +2 -2
- package/dist/components/embedded-chat.js +661 -648
- package/dist/components/modal.cjs +1 -1
- package/dist/components/modal.js +12 -12
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +1 -1
- package/dist/providers/user-provider.cjs +1 -1
- package/dist/providers/user-provider.js +21 -22
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),D=require("../dialog.cjs"),G=require("react"),ke=require("./command-score.cjs"),I=require("@radix-ui/react-primitive"),T=require("@radix-ui/react-id"),je=require("../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs"),Pe=require("../../constants/search.cjs"),Ae=require("../../utils/compose-event-handlers.cjs"),_e=require("../shadow/context.cjs");function Me(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const c=Me(G),O='[cmdk-group=""]',ee='[cmdk-group-items=""]',Le='[cmdk-group-heading=""]',de='[cmdk-item=""]',ae=`${de}:not([aria-disabled="true"])`,te="cmdk-item-select",_="data-value",fe=(t,r,n)=>ke.commandScore(t,r,n??[]),me=c.createContext(void 0),V=()=>c.useContext(me),ve=c.createContext(void 0),K=()=>c.useContext(ve),he=c.createContext(void 0),ne=c.forwardRef((t,r)=>{const n=M(()=>new Set),s=M(()=>new Map),a=M(()=>new Map),f=M(()=>new Set),i=ye(t),{label:h,children:d,value:S,onValueChange:E,filter:y,shouldFilter:C,loop:w,disablePointerSelection:A=!1,vimBindings:B=!0,defaultSearch:re,...$}=t,g=M(()=>({search:re??"",value:t.value??t.defaultValue??"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),U=T.useId(),z=T.useId(),H=T.useId(),R=c.useRef(null),b=Fe();j(()=>{if(S!==void 0){const e=S.trim();g.current.value=e,x.emit()}},[S]),j(()=>{b(6,ce)},[]);const F=_e.useShadow(),x=c.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>g.current,setState:(e,l,o)=>{if(!Object.is(g.current[e],l)){if(g.current[e]=l,e==="search")X(),J(),b(1,Q);else if(e==="value"&&(F?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input")||b(1,()=>{k()?.focus()}),b(7,()=>{g.current.selectedItemId=k()?.id,x.emit()}),o||b(5,ce),i.current?.value!==void 0)){const p=l??"";i.current.onValueChange?.(p);return}x.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),W=c.useMemo(()=>({value:(e,l,o)=>{l!==a.current.get(e)?.value&&(a.current.set(e,{value:l,keywords:o}),g.current.filtered.items.set(e,oe(l,o)),b(2,()=>{J(),x.emit()}))},item:(e,l)=>(n.current.add(e),l&&(s.current.has(l)?s.current?.get(l)?.add(e):s.current.set(l,new Set([e]))),b(3,()=>{X(),J(),g.current.value||Q(),x.emit()}),()=>{a.current.delete(e),n.current.delete(e),g.current.filtered.items.delete(e);const o=k();b(4,()=>{X(),o?.getAttribute("id")===e&&Q(),x.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{a.current.delete(e),s.current.delete(e)}),filter:()=>!!i.current.shouldFilter,label:h||t["aria-label"]||"",getDisablePointerSelection:()=>!!i.current.disablePointerSelection,listId:U,inputId:H,labelId:z,listInnerRef:R}),[]);function oe(e,l){const o=i.current?.filter??fe;return e?o?.(e,g.current.search,l):0}function J(){if(!g.current.search||i.current.shouldFilter===!1)return;const e=g.current.filtered.items,l=[];g.current.filtered.groups.forEach(u=>{const m=s.current.get(u);let p=0;m.forEach(Z=>{const Re=e.get(Z);p=Math.max(Re,p)}),l.push([u,p])});const o=R.current;L().sort((u,m)=>{const p=u.getAttribute("id"),Z=m.getAttribute("id");return(e.get(Z)??0)-(e.get(p)??0)}).forEach(u=>{const m=u.closest(ee);if(m){const p=u.parentElement===m?u:u.closest(`${ee} > *`);p&&m.appendChild(p)}else{const p=u.parentElement===o?u:u.closest(`${ee} > *`);p&&o?.appendChild(p)}}),l.sort((u,m)=>m[1]-u[1]).forEach(u=>{const m=R.current?.querySelector(`${O}[${_}="${encodeURIComponent(u[0])}"]`);m?.parentElement?.appendChild(m)})}function Q(){const l=L().find(o=>o.getAttribute("aria-disabled")!=="true"&&o.getAttribute("data-value")!==Pe.ASK_AI_TRIGGER_VALUE)?.getAttribute(_);x.setState("value",l||void 0)}function X(){if(!g.current.search||i.current.shouldFilter===!1){g.current.filtered.count=n.current.size;return}g.current.filtered.groups=new Set;let e=0;for(const l of n.current){const o=a.current.get(l)?.value??"",u=a.current.get(l)?.keywords??[],m=oe(o,u);g.current.filtered.items.set(l,m),m>0&&e++}for(const[l,o]of s.current)for(const u of o){const m=g.current.filtered.items.get(u);if(m&&m>0){g.current.filtered.groups.add(l);break}}g.current.filtered.count=e}function ce(){const e=k();e&&(e.parentElement?.firstChild===e&&e.closest(O)?.querySelector(Le)?.scrollIntoView({block:"nearest"}),e.scrollIntoView({block:"nearest"}))}function k(){return R.current?.querySelector(`${de}[aria-selected="true"]`)}function L(){return Array.from(R.current?.querySelectorAll(ae)||[])}function se(e){const o=L()[e];o&&x.setState("value",o.getAttribute(_))}function Y(e){const l=k(),o=L(),u=o.findIndex(p=>p===l);let m=o[u+e];i.current?.loop&&(m=u+e<0?o[o.length-1]:u+e===o.length?o[0]:o[u+e]),m&&x.setState("value",m.getAttribute(_))}function ie(e){let o=k()?.closest(O),u;for(;o&&!u;)o=e>0?qe(o,O):Ve(o,O),u=o?.querySelector(ae);u?x.setState("value",u.getAttribute(_)):Y(e)}const Ie=()=>se(L().length-1),le=e=>{e.preventDefault(),e.metaKey?Ie():e.altKey?ie(1):Y(1)},ue=e=>{e.preventDefault(),e.metaKey?se(0):e.altKey?ie(-1):Y(-1)};return v.jsxs(I.Primitive.div,{ref:r,tabIndex:-1,...$,"cmdk-root":"",onKeyDown:e=>{if($.onKeyDown?.(e),!e.defaultPrevented)switch(e.key){case"n":case"j":{B&&e.ctrlKey&&le(e);break}case"ArrowDown":{le(e);break}case"p":case"k":{B&&e.ctrlKey&&ue(e);break}case"ArrowUp":{ue(e);break}case"Enter":if(!e.nativeEvent.isComposing&&e.keyCode!==229){e.preventDefault();const l=k();if(l){const o=new Event(te);l.dispatchEvent(o)}}}},style:{display:"contents"},children:[v.jsx("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Ge,children:h}),N(t,e=>v.jsx(ve.Provider,{value:x,children:v.jsx(me.Provider,{value:W,children:e})}))]})}),ge=c.forwardRef((t,r)=>{const{id:n}=t,s=c.useRef(null),a=c.useContext(he),f=V(),i=ye(t),h=i.current?.forceMount??a?.forceMount;j(()=>{if(!h)return f.item(n,a?.id)},[h]);const d=we(n,s,[t.value,t.children,s],t.keywords),S=K(),E=P(b=>b.value&&b.value===d.current),y=P(b=>h||f.filter()===!1?!0:b.search?b.filtered.items.get(n)>0:!0);c.useEffect(()=>{const b=s.current;if(!b||t.disabled)return;const F=()=>w("keyboard");return b.addEventListener(te,F),()=>b.removeEventListener(te,F)},[y,t.onSelect,t.disabled]);const C=G.useCallback(()=>{S.setState("value",d.current,!0)},[S,d]),w=G.useCallback((b="click")=>{C(),i.current.onSelect?.({value:d.current,trigger:b})},[C,i,d]);if(!y)return null;const{disabled:A,value:B,onSelect:re,forceMount:$,keywords:g,onClick:U,...z}=t,H=G.useMemo(()=>q([s,r]),[s,r]),R=Ae.composeEventHandlers(U,w);return v.jsx(I.Primitive.div,{ref:H,...z,id:n,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!E,"data-disabled":!!A,"data-selected":!!E,onPointerMove:A||f.getDisablePointerSelection()?void 0:C,onClick:A?void 0:R,onFocus:A?void 0:C,children:t.children})}),Oe=c.forwardRef((t,r)=>{const{heading:n,children:s,forceMount:a,...f}=t,i=T.useId(),h=c.useRef(null),d=c.useRef(null),S=T.useId(),E=V(),y=P(w=>a||E.filter()===!1?!0:w.search?w.filtered.groups.has(i):!0);j(()=>E.group(i),[]),we(i,h,[t.value,t.heading,d]);const C=c.useMemo(()=>({id:i,forceMount:a}),[a]);return v.jsxs(I.Primitive.div,{ref:q([h,r]),...f,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0,children:[n&&v.jsx("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:S,children:n}),N(t,w=>v.jsx("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?S:void 0,children:v.jsx(he.Provider,{value:C,children:w})}))]})}),be=c.forwardRef((t,r)=>{const{alwaysRender:n,...s}=t,a=c.useRef(null),f=P(i=>!i.search);return!n&&!f?null:v.jsx(I.Primitive.div,{ref:q([a,r]),...s,"cmdk-separator":"",role:"separator"})}),pe=c.forwardRef((t,r)=>{const{onValueChange:n,...s}=t,a=t.value!=null,f=K(),i=P(d=>d.search),h=V();return c.useEffect(()=>{t.value!=null&&f.setState("search",t.value)},[t.value]),v.jsx(I.Primitive.input,{ref:r,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,id:h.inputId,type:"text",value:a?t.value:i,onChange:d=>{a||f.setState("search",d.target.value),n?.(d.target.value)}})}),Se=c.forwardRef((t,r)=>{const{children:n,label:s="Suggestions",...a}=t,f=c.useRef(null),i=c.useRef(null),h=V();return c.useEffect(()=>{if(i.current&&f.current){const d=i.current,S=f.current;let E;const y=new ResizeObserver(()=>{E=requestAnimationFrame(()=>{const C=d.offsetHeight;S.style.setProperty("--cmdk-list-height",C.toFixed(1)+"px")})});return y.observe(d),()=>{cancelAnimationFrame(E),y.unobserve(d)}}},[]),v.jsx(I.Primitive.div,{ref:q([f,r]),...a,"cmdk-list":"",tabIndex:-1,"aria-label":s,id:h.listId,children:N(t,d=>v.jsx("div",{ref:q([i,h.listInnerRef]),"cmdk-list-sizer":"",children:d}))})}),xe=c.forwardRef((t,r)=>{const{open:n,onOpenChange:s,overlayClassName:a,contentClassName:f,container:i,...h}=t;return v.jsx(D.Root,{open:n,onOpenChange:s,children:v.jsxs(D.Portal,{container:i,children:[v.jsx(D.Overlay,{"cmdk-overlay":"",className:a}),v.jsx(D.Content,{"aria-label":t.label,"cmdk-dialog":"",className:f,children:v.jsx(ne,{ref:r,...h})})]})})}),Ee=c.forwardRef((t,r)=>P(s=>s.filtered.count===0)?v.jsx(I.Primitive.div,{ref:r,...t,"cmdk-empty":"",role:"presentation"}):null),Ce=c.forwardRef((t,r)=>{const{progress:n,children:s,label:a="Loading...",...f}=t;return v.jsx(I.Primitive.div,{ref:r,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a,children:N(t,i=>v.jsx("div",{"aria-hidden":!0,children:i}))})}),Te=Object.assign(ne,{List:Se,Item:ge,Input:pe,Group:Oe,Separator:be,Dialog:xe,Empty:Ee,Loading:Ce});function qe(t,r){let n=t.nextElementSibling;for(;n;){if(n.matches(r))return n;n=n.nextElementSibling}}function Ve(t,r){let n=t.previousElementSibling;for(;n;){if(n.matches(r))return n;n=n.previousElementSibling}}function ye(t){const r=c.useRef(t);return j(()=>{r.current=t}),r}const j=typeof window>"u"?c.useEffect:c.useLayoutEffect;function M(t){const r=c.useRef(void 0);return r.current===void 0&&(r.current=t()),r}function q(t){return r=>{t.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}function P(t){const r=K(),n=()=>t(r.snapshot());return je.shimExports.useSyncExternalStore(r.subscribe,n,n)}function we(t,r,n,s=[]){const a=c.useRef(void 0),f=V();return j(()=>{const i=(()=>{for(const d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?d.current.textContent?.trim():a.current}})(),h=s.map(d=>d.trim());f.value(t,i,h),r.current?.setAttribute(_,i),a.current=i}),a}const Fe=()=>{const[t,r]=c.useState(),n=M(()=>new Map);return j(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,a)=>{n.current.set(s,a),r({})}};function De(t){const r=t.type;return typeof r=="function"?r(t.props):"render"in r?r.render(t.props):t}function N({asChild:t,children:r},n){return t&&c.isValidElement(r)?c.cloneElement(De(r),{ref:r.ref},n(r.props.children)):n(r)}const Ge={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};exports.Command=Te;exports.CommandDialog=xe;exports.CommandEmpty=Ee;exports.CommandInput=pe;exports.CommandItem=ge;exports.CommandList=Se;exports.CommandLoading=Ce;exports.CommandRoot=ne;exports.CommandSeparator=be;exports.defaultFilter=fe;exports.useCommandState=P;exports.useCommandStore=K;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),D=require("../dialog.cjs"),G=require("react"),je=require("./command-score.cjs"),I=require("@radix-ui/react-primitive"),q=require("@radix-ui/react-id"),Pe=require("../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs"),Ae=require("../../constants/search.cjs"),_e=require("../../utils/compose-event-handlers.cjs"),Me=require("../../providers/widget-provider.cjs"),Le=require("../shadow/context.cjs");function Oe(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const c=Oe(G),O='[cmdk-group=""]',ee='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',de='[cmdk-item=""]',ae=`${de}:not([aria-disabled="true"])`,te="cmdk-item-select",_="data-value",fe=(t,n,r)=>je.commandScore(t,n,r??[]),me=c.createContext(void 0),V=()=>c.useContext(me),ve=c.createContext(void 0),K=()=>c.useContext(ve),he=c.createContext(void 0),re=c.forwardRef((t,n)=>{const r=M(()=>new Set),s=M(()=>new Map),a=M(()=>new Map),f=M(()=>new Set),i=we(t),{label:h,children:d,value:S,onValueChange:E,filter:w,shouldFilter:C,loop:y,disablePointerSelection:A=!1,vimBindings:B=!0,defaultSearch:ne,...$}=t,g=M(()=>({search:ne??"",value:t.value??t.defaultValue??"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),U=q.useId(),z=q.useId(),H=q.useId(),R=c.useRef(null),b=Ge();j(()=>{if(S!==void 0){const e=S.trim();g.current.value=e,x.emit()}},[S]),j(()=>{b(6,ce)},[]);const F=Le.useShadow(),x=c.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>g.current,setState:(e,l,o)=>{if(!Object.is(g.current[e],l)){if(g.current[e]=l,e==="search")X(),J(),b(1,Q);else if(e==="value"&&(F?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input")||b(1,()=>{k()?.focus()}),b(7,()=>{g.current.selectedItemId=k()?.id,x.emit()}),o||b(5,ce),i.current?.value!==void 0)){const p=l??"";i.current.onValueChange?.(p);return}x.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),W=c.useMemo(()=>({value:(e,l,o)=>{l!==a.current.get(e)?.value&&(a.current.set(e,{value:l,keywords:o}),g.current.filtered.items.set(e,oe(l,o)),b(2,()=>{J(),x.emit()}))},item:(e,l)=>(r.current.add(e),l&&(s.current.has(l)?s.current?.get(l)?.add(e):s.current.set(l,new Set([e]))),b(3,()=>{X(),J(),g.current.value||Q(),x.emit()}),()=>{a.current.delete(e),r.current.delete(e),g.current.filtered.items.delete(e);const o=k();b(4,()=>{X(),o?.getAttribute("id")===e&&Q(),x.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{a.current.delete(e),s.current.delete(e)}),filter:()=>!!i.current.shouldFilter,label:h||t["aria-label"]||"",getDisablePointerSelection:()=>!!i.current.disablePointerSelection,listId:U,inputId:H,labelId:z,listInnerRef:R}),[]);function oe(e,l){const o=i.current?.filter??fe;return e?o?.(e,g.current.search,l):0}function J(){if(!g.current.search||i.current.shouldFilter===!1)return;const e=g.current.filtered.items,l=[];g.current.filtered.groups.forEach(u=>{const m=s.current.get(u);let p=0;m.forEach(Z=>{const ke=e.get(Z);p=Math.max(ke,p)}),l.push([u,p])});const o=R.current;L().sort((u,m)=>{const p=u.getAttribute("id"),Z=m.getAttribute("id");return(e.get(Z)??0)-(e.get(p)??0)}).forEach(u=>{const m=u.closest(ee);if(m){const p=u.parentElement===m?u:u.closest(`${ee} > *`);p&&m.appendChild(p)}else{const p=u.parentElement===o?u:u.closest(`${ee} > *`);p&&o?.appendChild(p)}}),l.sort((u,m)=>m[1]-u[1]).forEach(u=>{const m=R.current?.querySelector(`${O}[${_}="${encodeURIComponent(u[0])}"]`);m?.parentElement?.appendChild(m)})}function Q(){const l=L().find(o=>o.getAttribute("aria-disabled")!=="true"&&o.getAttribute("data-value")!==Ae.ASK_AI_TRIGGER_VALUE)?.getAttribute(_);x.setState("value",l||void 0)}function X(){if(!g.current.search||i.current.shouldFilter===!1){g.current.filtered.count=r.current.size;return}g.current.filtered.groups=new Set;let e=0;for(const l of r.current){const o=a.current.get(l)?.value??"",u=a.current.get(l)?.keywords??[],m=oe(o,u);g.current.filtered.items.set(l,m),m>0&&e++}for(const[l,o]of s.current)for(const u of o){const m=g.current.filtered.items.get(u);if(m&&m>0){g.current.filtered.groups.add(l);break}}g.current.filtered.count=e}function ce(){const e=k();e&&(e.parentElement?.firstChild===e&&e.closest(O)?.querySelector(qe)?.scrollIntoView({block:"nearest"}),e.scrollIntoView({block:"nearest"}))}function k(){return R.current?.querySelector(`${de}[aria-selected="true"]`)}function L(){return Array.from(R.current?.querySelectorAll(ae)||[])}function se(e){const o=L()[e];o&&x.setState("value",o.getAttribute(_))}function Y(e){const l=k(),o=L(),u=o.findIndex(p=>p===l);let m=o[u+e];i.current?.loop&&(m=u+e<0?o[o.length-1]:u+e===o.length?o[0]:o[u+e]),m&&x.setState("value",m.getAttribute(_))}function ie(e){let o=k()?.closest(O),u;for(;o&&!u;)o=e>0?Fe(o,O):De(o,O),u=o?.querySelector(ae);u?x.setState("value",u.getAttribute(_)):Y(e)}const Ie=()=>se(L().length-1),le=e=>{e.preventDefault(),e.metaKey?Ie():e.altKey?ie(1):Y(1)},ue=e=>{e.preventDefault(),e.metaKey?se(0):e.altKey?ie(-1):Y(-1)},Re=Me.useWidget();return v.jsxs(I.Primitive.div,{ref:n,tabIndex:-1,...$,"cmdk-root":"",onKeyDown:e=>{if(Re?.view==="search"&&($.onKeyDown?.(e),!e.defaultPrevented))switch(e.key){case"n":case"j":{B&&e.ctrlKey&&le(e);break}case"ArrowDown":{le(e);break}case"p":case"k":{B&&e.ctrlKey&&ue(e);break}case"ArrowUp":{ue(e);break}case"Enter":if(!e.nativeEvent.isComposing&&e.keyCode!==229){e.preventDefault();const l=k();if(l){const o=new Event(te);l.dispatchEvent(o)}}}},style:{display:"contents"},children:[v.jsx("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Ne,children:h}),N(t,e=>v.jsx(ve.Provider,{value:x,children:v.jsx(me.Provider,{value:W,children:e})}))]})}),ge=c.forwardRef((t,n)=>{const{id:r}=t,s=c.useRef(null),a=c.useContext(he),f=V(),i=we(t),h=i.current?.forceMount??a?.forceMount;j(()=>{if(!h)return f.item(r,a?.id)},[h]);const d=ye(r,s,[t.value,t.children,s],t.keywords),S=K(),E=P(b=>b.value&&b.value===d.current),w=P(b=>h||f.filter()===!1?!0:b.search?b.filtered.items.get(r)>0:!0);c.useEffect(()=>{const b=s.current;if(!b||t.disabled)return;const F=()=>y("keyboard");return b.addEventListener(te,F),()=>b.removeEventListener(te,F)},[w,t.onSelect,t.disabled]);const C=G.useCallback(()=>{S.setState("value",d.current,!0)},[S,d]),y=G.useCallback((b="click")=>{C(),i.current.onSelect?.({value:d.current,trigger:b})},[C,i,d]);if(!w)return null;const{disabled:A,value:B,onSelect:ne,forceMount:$,keywords:g,onClick:U,...z}=t,H=G.useMemo(()=>T([s,n]),[s,n]),R=_e.composeEventHandlers(U,y);return v.jsx(I.Primitive.div,{ref:H,...z,id:r,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!E,"data-disabled":!!A,"data-selected":!!E,onPointerMove:A||f.getDisablePointerSelection()?void 0:C,onClick:A?void 0:R,onFocus:A?void 0:C,children:t.children})}),Te=c.forwardRef((t,n)=>{const{heading:r,children:s,forceMount:a,...f}=t,i=q.useId(),h=c.useRef(null),d=c.useRef(null),S=q.useId(),E=V(),w=P(y=>a||E.filter()===!1?!0:y.search?y.filtered.groups.has(i):!0);j(()=>E.group(i),[]),ye(i,h,[t.value,t.heading,d]);const C=c.useMemo(()=>({id:i,forceMount:a}),[a]);return v.jsxs(I.Primitive.div,{ref:T([h,n]),...f,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0,children:[r&&v.jsx("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:S,children:r}),N(t,y=>v.jsx("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?S:void 0,children:v.jsx(he.Provider,{value:C,children:y})}))]})}),be=c.forwardRef((t,n)=>{const{alwaysRender:r,...s}=t,a=c.useRef(null),f=P(i=>!i.search);return!r&&!f?null:v.jsx(I.Primitive.div,{ref:T([a,n]),...s,"cmdk-separator":"",role:"separator"})}),pe=c.forwardRef((t,n)=>{const{onValueChange:r,...s}=t,a=t.value!=null,f=K(),i=P(d=>d.search),h=V();return c.useEffect(()=>{t.value!=null&&f.setState("search",t.value)},[t.value]),v.jsx(I.Primitive.input,{ref:n,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,id:h.inputId,type:"text",value:a?t.value:i,onChange:d=>{a||f.setState("search",d.target.value),r?.(d.target.value)}})}),Se=c.forwardRef((t,n)=>{const{children:r,label:s="Suggestions",...a}=t,f=c.useRef(null),i=c.useRef(null),h=V();return c.useEffect(()=>{if(i.current&&f.current){const d=i.current,S=f.current;let E;const w=new ResizeObserver(()=>{E=requestAnimationFrame(()=>{const C=d.offsetHeight;S.style.setProperty("--cmdk-list-height",C.toFixed(1)+"px")})});return w.observe(d),()=>{cancelAnimationFrame(E),w.unobserve(d)}}},[]),v.jsx(I.Primitive.div,{ref:T([f,n]),...a,"cmdk-list":"",tabIndex:-1,"aria-label":s,id:h.listId,children:N(t,d=>v.jsx("div",{ref:T([i,h.listInnerRef]),"cmdk-list-sizer":"",children:d}))})}),xe=c.forwardRef((t,n)=>{const{open:r,onOpenChange:s,overlayClassName:a,contentClassName:f,container:i,...h}=t;return v.jsx(D.Root,{open:r,onOpenChange:s,children:v.jsxs(D.Portal,{container:i,children:[v.jsx(D.Overlay,{"cmdk-overlay":"",className:a}),v.jsx(D.Content,{"aria-label":t.label,"cmdk-dialog":"",className:f,children:v.jsx(re,{ref:n,...h})})]})})}),Ee=c.forwardRef((t,n)=>P(s=>s.filtered.count===0)?v.jsx(I.Primitive.div,{ref:n,...t,"cmdk-empty":"",role:"presentation"}):null),Ce=c.forwardRef((t,n)=>{const{progress:r,children:s,label:a="Loading...",...f}=t;return v.jsx(I.Primitive.div,{ref:n,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a,children:N(t,i=>v.jsx("div",{"aria-hidden":!0,children:i}))})}),Ve=Object.assign(re,{List:Se,Item:ge,Input:pe,Group:Te,Separator:be,Dialog:xe,Empty:Ee,Loading:Ce});function Fe(t,n){let r=t.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function De(t,n){let r=t.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function we(t){const n=c.useRef(t);return j(()=>{n.current=t}),n}const j=typeof window>"u"?c.useEffect:c.useLayoutEffect;function M(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=t()),n}function T(t){return n=>{t.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}function P(t){const n=K(),r=()=>t(n.snapshot());return Pe.shimExports.useSyncExternalStore(n.subscribe,r,r)}function ye(t,n,r,s=[]){const a=c.useRef(void 0),f=V();return j(()=>{const i=(()=>{for(const d of r){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?d.current.textContent?.trim():a.current}})(),h=s.map(d=>d.trim());f.value(t,i,h),n.current?.setAttribute(_,i),a.current=i}),a}const Ge=()=>{const[t,n]=c.useState(),r=M(()=>new Map);return j(()=>{r.current.forEach(s=>s()),r.current=new Map},[t]),(s,a)=>{r.current.set(s,a),n({})}};function Ke(t){const n=t.type;return typeof n=="function"?n(t.props):"render"in n?n.render(t.props):t}function N({asChild:t,children:n},r){return t&&c.isValidElement(n)?c.cloneElement(Ke(n),{ref:n.ref},r(n.props.children)):r(n)}const Ne={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};exports.Command=Ve;exports.CommandDialog=xe;exports.CommandEmpty=Ee;exports.CommandInput=pe;exports.CommandItem=ge;exports.CommandList=Se;exports.CommandLoading=Ce;exports.CommandRoot=re;exports.CommandSeparator=be;exports.defaultFilter=fe;exports.useCommandState=P;exports.useCommandStore=K;
|
package/dist/atoms/cmdk/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsxs as Z, jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import { Root as
|
|
2
|
+
import { Root as Ee, Portal as Ce, Overlay as we, Content as ye } from "../dialog.js";
|
|
3
3
|
import * as c from "react";
|
|
4
|
-
import { useCallback as le, useMemo as
|
|
5
|
-
import { commandScore as
|
|
4
|
+
import { useCallback as le, useMemo as Ie } from "react";
|
|
5
|
+
import { commandScore as Re } from "./command-score.js";
|
|
6
6
|
import { Primitive as R } from "@radix-ui/react-primitive";
|
|
7
7
|
import { useId as F } from "@radix-ui/react-id";
|
|
8
|
-
import { s as
|
|
9
|
-
import { ASK_AI_TRIGGER_VALUE as
|
|
10
|
-
import { composeEventHandlers as
|
|
11
|
-
import {
|
|
12
|
-
|
|
8
|
+
import { s as ke } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
|
|
9
|
+
import { ASK_AI_TRIGGER_VALUE as xe } from "../../constants/search.js";
|
|
10
|
+
import { composeEventHandlers as Ae } from "../../utils/compose-event-handlers.js";
|
|
11
|
+
import { useWidget as _e } from "../../providers/widget-provider.js";
|
|
12
|
+
import { useShadow as Le } from "../shadow/context.js";
|
|
13
|
+
const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', Me = '[cmdk-group-heading=""]', ae = '[cmdk-item=""]', ue = `${ae}:not([aria-disabled="true"])`, Y = "cmdk-item-select", L = "data-value", Pe = (t, n, r) => Re(t, n, r ?? []), de = c.createContext(void 0), D = () => c.useContext(de), fe = c.createContext(void 0), ee = () => c.useContext(fe), me = c.createContext(void 0), he = c.forwardRef((t, n) => {
|
|
13
14
|
const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), a = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = ve(t), {
|
|
14
15
|
label: h,
|
|
15
16
|
children: d,
|
|
@@ -37,7 +38,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
37
38
|
/** Set of groups with at least one visible item. */
|
|
38
39
|
groups: /* @__PURE__ */ new Set()
|
|
39
40
|
}
|
|
40
|
-
})), U = F(), $ = F(), j = F(), k = c.useRef(null), g =
|
|
41
|
+
})), U = F(), $ = F(), j = F(), k = c.useRef(null), g = $e();
|
|
41
42
|
A(() => {
|
|
42
43
|
if (S !== void 0) {
|
|
43
44
|
const e = S.trim();
|
|
@@ -46,7 +47,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
46
47
|
}, [S]), A(() => {
|
|
47
48
|
g(6, ne);
|
|
48
49
|
}, []);
|
|
49
|
-
const G =
|
|
50
|
+
const G = Le(), E = c.useMemo(() => ({
|
|
50
51
|
subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
|
|
51
52
|
snapshot: () => v.current,
|
|
52
53
|
setState: (e, l, o) => {
|
|
@@ -101,7 +102,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
101
102
|
[]
|
|
102
103
|
);
|
|
103
104
|
function re(e, l) {
|
|
104
|
-
const o = s.current?.filter ??
|
|
105
|
+
const o = s.current?.filter ?? Pe;
|
|
105
106
|
return e ? o?.(e, v.current.search, l) : 0;
|
|
106
107
|
}
|
|
107
108
|
function z() {
|
|
@@ -113,8 +114,8 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
113
114
|
const m = i.current.get(u);
|
|
114
115
|
let b = 0;
|
|
115
116
|
m.forEach((Q) => {
|
|
116
|
-
const
|
|
117
|
-
b = Math.max(
|
|
117
|
+
const Se = e.get(Q);
|
|
118
|
+
b = Math.max(Se, b);
|
|
118
119
|
}), l.push([u, b]);
|
|
119
120
|
});
|
|
120
121
|
const o = k.current;
|
|
@@ -139,7 +140,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
139
140
|
}
|
|
140
141
|
function H() {
|
|
141
142
|
const l = V().find(
|
|
142
|
-
(o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !==
|
|
143
|
+
(o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !== xe
|
|
143
144
|
)?.getAttribute(L);
|
|
144
145
|
E.setState("value", l || void 0);
|
|
145
146
|
}
|
|
@@ -167,7 +168,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
167
168
|
}
|
|
168
169
|
function ne() {
|
|
169
170
|
const e = x();
|
|
170
|
-
e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(
|
|
171
|
+
e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(Me)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
|
|
171
172
|
}
|
|
172
173
|
function x() {
|
|
173
174
|
return k.current?.querySelector(`${ae}[aria-selected="true"]`);
|
|
@@ -187,14 +188,14 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
187
188
|
function ce(e) {
|
|
188
189
|
let o = x()?.closest(T), u;
|
|
189
190
|
for (; o && !u; )
|
|
190
|
-
o = e > 0 ?
|
|
191
|
+
o = e > 0 ? Ne(o, T) : Ue(o, T), u = o?.querySelector(ue);
|
|
191
192
|
u ? E.setState("value", u.getAttribute(L)) : J(e);
|
|
192
193
|
}
|
|
193
194
|
const pe = () => oe(V().length - 1), se = (e) => {
|
|
194
195
|
e.preventDefault(), e.metaKey ? pe() : e.altKey ? ce(1) : J(1);
|
|
195
196
|
}, ie = (e) => {
|
|
196
197
|
e.preventDefault(), e.metaKey ? oe(0) : e.altKey ? ce(-1) : J(-1);
|
|
197
|
-
};
|
|
198
|
+
}, be = _e();
|
|
198
199
|
return /* @__PURE__ */ Z(
|
|
199
200
|
R.div,
|
|
200
201
|
{
|
|
@@ -203,7 +204,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
203
204
|
...N,
|
|
204
205
|
"cmdk-root": "",
|
|
205
206
|
onKeyDown: (e) => {
|
|
206
|
-
if (N.onKeyDown?.(e), !e.defaultPrevented)
|
|
207
|
+
if (be?.view === "search" && (N.onKeyDown?.(e), !e.defaultPrevented))
|
|
207
208
|
switch (e.key) {
|
|
208
209
|
case "n":
|
|
209
210
|
case "j": {
|
|
@@ -244,7 +245,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
244
245
|
"cmdk-label": "",
|
|
245
246
|
htmlFor: q.inputId,
|
|
246
247
|
id: q.labelId,
|
|
247
|
-
style:
|
|
248
|
+
style: qe,
|
|
248
249
|
children: h
|
|
249
250
|
}
|
|
250
251
|
),
|
|
@@ -252,7 +253,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
252
253
|
]
|
|
253
254
|
}
|
|
254
255
|
);
|
|
255
|
-
}),
|
|
256
|
+
}), Ve = c.forwardRef((t, n) => {
|
|
256
257
|
const { id: r } = t, i = c.useRef(null), a = c.useContext(me), f = D(), s = ve(t), h = s.current?.forceMount ?? a?.forceMount;
|
|
257
258
|
A(() => {
|
|
258
259
|
if (!h)
|
|
@@ -284,7 +285,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
284
285
|
keywords: v,
|
|
285
286
|
onClick: U,
|
|
286
287
|
...$
|
|
287
|
-
} = t, j =
|
|
288
|
+
} = t, j = Ie(() => O([i, n]), [i, n]), k = Ae(U, I);
|
|
288
289
|
return /* @__PURE__ */ p(
|
|
289
290
|
R.div,
|
|
290
291
|
{
|
|
@@ -303,7 +304,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
303
304
|
children: t.children
|
|
304
305
|
}
|
|
305
306
|
);
|
|
306
|
-
}),
|
|
307
|
+
}), Te = c.forwardRef((t, n) => {
|
|
307
308
|
const { heading: r, children: i, forceMount: a, ...f } = t, s = F(), h = c.useRef(null), d = c.useRef(null), S = F(), C = D(), y = P(
|
|
308
309
|
(I) => a || C.filter() === !1 ? !0 : I.search ? I.filtered.groups.has(s) : !0
|
|
309
310
|
);
|
|
@@ -326,7 +327,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
326
327
|
]
|
|
327
328
|
}
|
|
328
329
|
);
|
|
329
|
-
}),
|
|
330
|
+
}), Fe = c.forwardRef((t, n) => {
|
|
330
331
|
const { alwaysRender: r, ...i } = t, a = c.useRef(null), f = P((s) => !s.search);
|
|
331
332
|
return !r && !f ? null : /* @__PURE__ */ p(
|
|
332
333
|
R.div,
|
|
@@ -337,7 +338,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
337
338
|
role: "separator"
|
|
338
339
|
}
|
|
339
340
|
);
|
|
340
|
-
}),
|
|
341
|
+
}), Oe = c.forwardRef((t, n) => {
|
|
341
342
|
const { onValueChange: r, ...i } = t, a = t.value != null, f = ee(), s = P((d) => d.search), h = D();
|
|
342
343
|
return c.useEffect(() => {
|
|
343
344
|
t.value != null && f.setState("search", t.value);
|
|
@@ -363,7 +364,7 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
366
|
);
|
|
366
|
-
}),
|
|
367
|
+
}), De = c.forwardRef((t, n) => {
|
|
367
368
|
const { children: r, label: i = "Suggestions", ...a } = t, f = c.useRef(null), s = c.useRef(null), h = D();
|
|
368
369
|
return c.useEffect(() => {
|
|
369
370
|
if (s.current && f.current) {
|
|
@@ -391,13 +392,13 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
391
392
|
children: K(t, (d) => /* @__PURE__ */ p("div", { ref: O([s, h.listInnerRef]), "cmdk-list-sizer": "", children: d }))
|
|
392
393
|
}
|
|
393
394
|
);
|
|
394
|
-
}),
|
|
395
|
+
}), Ge = c.forwardRef((t, n) => {
|
|
395
396
|
const { open: r, onOpenChange: i, overlayClassName: a, contentClassName: f, container: s, ...h } = t;
|
|
396
|
-
return /* @__PURE__ */ p(
|
|
397
|
-
/* @__PURE__ */ p(
|
|
398
|
-
/* @__PURE__ */ p(
|
|
397
|
+
return /* @__PURE__ */ p(Ee, { open: r, onOpenChange: i, children: /* @__PURE__ */ Z(Ce, { container: s, children: [
|
|
398
|
+
/* @__PURE__ */ p(we, { "cmdk-overlay": "", className: a }),
|
|
399
|
+
/* @__PURE__ */ p(ye, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(he, { ref: n, ...h }) })
|
|
399
400
|
] }) });
|
|
400
|
-
}),
|
|
401
|
+
}), Ke = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(R.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Be = c.forwardRef((t, n) => {
|
|
401
402
|
const { progress: r, children: i, label: a = "Loading...", ...f } = t;
|
|
402
403
|
return /* @__PURE__ */ p(
|
|
403
404
|
R.div,
|
|
@@ -413,24 +414,24 @@ const T = '[cmdk-group=""]', X = '[cmdk-group-items=""]', _e = '[cmdk-group-head
|
|
|
413
414
|
children: K(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
|
|
414
415
|
}
|
|
415
416
|
);
|
|
416
|
-
}),
|
|
417
|
-
List:
|
|
418
|
-
Item:
|
|
419
|
-
Input:
|
|
420
|
-
Group:
|
|
421
|
-
Separator:
|
|
422
|
-
Dialog:
|
|
423
|
-
Empty:
|
|
424
|
-
Loading:
|
|
417
|
+
}), nt = Object.assign(he, {
|
|
418
|
+
List: De,
|
|
419
|
+
Item: Ve,
|
|
420
|
+
Input: Oe,
|
|
421
|
+
Group: Te,
|
|
422
|
+
Separator: Fe,
|
|
423
|
+
Dialog: Ge,
|
|
424
|
+
Empty: Ke,
|
|
425
|
+
Loading: Be
|
|
425
426
|
});
|
|
426
|
-
function
|
|
427
|
+
function Ne(t, n) {
|
|
427
428
|
let r = t.nextElementSibling;
|
|
428
429
|
for (; r; ) {
|
|
429
430
|
if (r.matches(n)) return r;
|
|
430
431
|
r = r.nextElementSibling;
|
|
431
432
|
}
|
|
432
433
|
}
|
|
433
|
-
function
|
|
434
|
+
function Ue(t, n) {
|
|
434
435
|
let r = t.previousElementSibling;
|
|
435
436
|
for (; r; ) {
|
|
436
437
|
if (r.matches(n)) return r;
|
|
@@ -457,7 +458,7 @@ function O(t) {
|
|
|
457
458
|
}
|
|
458
459
|
function P(t) {
|
|
459
460
|
const n = ee(), r = () => t(n.snapshot());
|
|
460
|
-
return
|
|
461
|
+
return ke.useSyncExternalStore(n.subscribe, r, r);
|
|
461
462
|
}
|
|
462
463
|
function ge(t, n, r, i = []) {
|
|
463
464
|
const a = c.useRef(void 0), f = D();
|
|
@@ -473,7 +474,7 @@ function ge(t, n, r, i = []) {
|
|
|
473
474
|
f.value(t, s, h), n.current?.setAttribute(L, s), a.current = s;
|
|
474
475
|
}), a;
|
|
475
476
|
}
|
|
476
|
-
const
|
|
477
|
+
const $e = () => {
|
|
477
478
|
const [t, n] = c.useState(), r = M(() => /* @__PURE__ */ new Map());
|
|
478
479
|
return A(() => {
|
|
479
480
|
r.current.forEach((i) => i()), r.current = /* @__PURE__ */ new Map();
|
|
@@ -481,19 +482,19 @@ const Ne = () => {
|
|
|
481
482
|
r.current.set(i, a), n({});
|
|
482
483
|
};
|
|
483
484
|
};
|
|
484
|
-
function
|
|
485
|
+
function je(t) {
|
|
485
486
|
const n = t.type;
|
|
486
487
|
return typeof n == "function" ? n(t.props) : "render" in n ? n.render(t.props) : t;
|
|
487
488
|
}
|
|
488
489
|
function K({ asChild: t, children: n }, r) {
|
|
489
490
|
return t && c.isValidElement(n) ? c.cloneElement(
|
|
490
|
-
|
|
491
|
+
je(n),
|
|
491
492
|
{ ref: n.ref },
|
|
492
493
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
493
494
|
r(n.props.children)
|
|
494
495
|
) : r(n);
|
|
495
496
|
}
|
|
496
|
-
const
|
|
497
|
+
const qe = {
|
|
497
498
|
position: "absolute",
|
|
498
499
|
width: "1px",
|
|
499
500
|
height: "1px",
|
|
@@ -505,16 +506,16 @@ const $e = {
|
|
|
505
506
|
borderWidth: "0"
|
|
506
507
|
};
|
|
507
508
|
export {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
509
|
+
nt as Command,
|
|
510
|
+
Ge as CommandDialog,
|
|
511
|
+
Ke as CommandEmpty,
|
|
512
|
+
Oe as CommandInput,
|
|
513
|
+
Ve as CommandItem,
|
|
514
|
+
De as CommandList,
|
|
515
|
+
Be as CommandLoading,
|
|
515
516
|
he as CommandRoot,
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
Fe as CommandSeparator,
|
|
518
|
+
Pe as defaultFilter,
|
|
518
519
|
P as useCommandState,
|
|
519
520
|
ee as useCommandStore
|
|
520
521
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Ask me anything about \`${c}\`.`:`
|
|
6
6
|
|
|
7
|
-
Let me know how I can help.`,b={content:r.introMessage??`${m}${l}`,id:Na,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),un=a.ikp("div",{_id:"aiChatMessageHeader"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,...t})},Cn=a.ikp("div",{_id:"aiChatMessageLoading"}),Ye=t=>{const{isLoading:e,isStreaming:i,messages:r}=g.useChat(),{message:s}=P.useMessage();return!(r.at(-1)?.id===s?.id)||s.role!=="assistant"||!e||i?null:n.jsx(Cn,{children:"Thinking...",...t})},pn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Je=t=>{const{message:e}=P.useMessage();return n.jsx(pn,{"data-role":e.role,...t})},vn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Xe=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(vn,{"data-username":h.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},bn=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ze=v.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(bn,{"data-role":i.role,children:h.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),et=v.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=Da.useColorModeValue(c,m),[p,b]=v.useState(l);v.useEffect(()=>{b(l)},[l]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(pe,{"data-type":"image","data-role":o.role,src:r.userAvatar,...t}):n.jsx(fa.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(xa.default,{"data-type":"icon","data-role":o.role,...t})}),gn=a.ikp("span",{_id:"aiChatMessageName"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(gn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},Pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),it=t=>{const{message:e}=P.useMessage();return n.jsx(Pn,{"data-role":e.role,...t})},_n=a.ikp("div",{_id:"aiChatMessageContent"}),at=t=>{const{message:e}=P.useMessage();return n.jsx(_n,{"data-role":e.role,...t})},An=a.ikp("div",{_id:"aiChatMessageAttachments"}),nt=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(An,{...t})})},En=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),rt=t=>{const{children:e,...i}=t,{message:r}=P.useMessage(),s=r.metadata?.attributes?.attachments;return s?n.jsx(En,{children:h.maybeRender(e,s),...i}):null},Fn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),st=t=>{const{attachment:e,onClick:i,...r}=t,{selectItem:s,onOpen:o}=q.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Fn,{onClick:u.composeEventHandlers(i,d),...r})})},kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(kn,{iconSettings:i,...t}):null},In=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),dt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(In,{children:e.title,...t})},Mn=a.ikp(_.Root,{_id:"aiChatMessageAttachmentsPreview"}),ct=t=>{const{onOpenChange:e,...i}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(Mn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},mt=a.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),lt=a.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),Sn=a.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Sn,{children:e?.title||"Attachment",...t})},ut=a.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),xn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),Ct=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(xn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),pt=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...r}=t,{message:s}=P.useMessage(),{logEvent:o}=V.useChatEvents(),d=h.getMessageContent(s),{conversation:c}=O.useInkeepConversation();return s.role==="user"?n.jsx(ve,{"data-role":s.role,children:d,...r}):n.jsx(ve,{"data-role":s.role,...r,children:n.jsx(ae.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},fn=a.ikp("div",{_id:"aiChatMessageToolbar"}),vt=t=>{const{isLoading:e,messages:i}=g.useChat(),{message:r}=P.useMessage();return i.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(fn,{...t})},Bn=a.ikp("div",{_id:"aiChatMessageToolActions"}),bt=t=>{const{children:e,...i}=t,{message:r}=P.useMessage(),{messageButtons:s}=g.useChat(),o=s[r.id]||[];return n.jsx(Bn,{children:h.maybeRender(e,o),...i})},gt=t=>{const{onClick:e,action:i,...r}=t,{handleAction:s}=re.useChatAction(i),o=()=>{s()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]}),m=i.action.type,l=a.ikp(m==="open_link"?"a":"button",{_id:"aiChatMessageToolAction",children:c,"data-type":i.action.type,...m==="open_link"&&{href:i.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(e,o)});return n.jsx(l,{...r})},Tn=a.ikp("button",{_id:"aiChatMessageAction"}),Pt=t=>{const{action:e,onClick:i,className:r,...s}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=g.useChat(),[l,p]=ee.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:Y}=V.useChatEvents(),[N,J]=ya.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:X}=he,ue=m.at(-1)?.id===d?.id,Z=d.role==="assistant";if(ue&&c||!Z||{copy:!1,upvote:X,downvote:X}[e])return null;const H={copy(){p(h.getMessageContent(d)),Y({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{J()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(E.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(E.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(E.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(b[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(Tn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${r} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...s})},jn=a.ikp("div",{_id:"aiChatMessageSources"}),_t=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(jn,{...t})},yn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),At=t=>n.jsx(yn,{children:"Sources",...t}),Hn=a.ikp("div",{_id:"aiChatMessageSources__List"}),Et=t=>{const{message:e}=P.useMessage(),{children:i,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const p=Ra.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:s}),b=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:b}});return n.jsx(Hn,{children:h.maybeRender(i,m),...r})},wn=a.ikp(Ba.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),Ft=t=>{const{source:e,onClick:i,...r}=t,{logEvent:s}=V.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(f.SourceItemProvider,{source:e,children:n.jsx(wn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...r})})},Ln=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),kt=t=>{const{source:e}=f.useSourceItem();return e.breadcrumbs?.length?n.jsx(Ln,{"data-type":e.type,...t}):null},Dn=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),On=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),It=t=>{const{source:e}=f.useSourceItem();return n.jsx(On,{iconSettings:e.icon,"data-type":e.type,...t})},qn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Mt=t=>{const{source:e}=f.useSourceItem();return n.jsx(qn,{"data-type":e.type,children:e.title,...t})},Rn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),St=t=>{const{source:e}=f.useSourceItem();return n.jsx(Rn,{"data-type":e.type,...t})},Wn=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),xt=t=>{const{source:e}=f.useSourceItem(),{children:i,...r}=t,s=v.useMemo(()=>e.description?La.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx(Wn,{"data-type":e.type,children:h.maybeRender(i,s),...r}):null},Nn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),ft=t=>{const{part:e,...i}=t,{source:r}=f.useSourceItem();return typeof e=="string"?e:n.jsx(Nn,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...i})},$n=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Bt=t=>{const{source:e}=f.useSourceItem();return n.jsx($n,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Tt=a.ikp("div",{_id:"aiChatFooter"}),jt=a.ikp("div",{_id:"aiChatInput__Fieldset"}),yt=a.ikp("div",{_id:"aiChatInput__Group"}),Qn=a.ikp("textarea",{_id:"aiChatInput"}),Ht=v.forwardRef(({onChange:t,onKeyDown:e,...i},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=g.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),b=se.useComposedRefs(r,l),k=ge.useModal();return v.useEffect(()=>{requestAnimationFrame(()=>{m&&l?.current&&(l.current.focus(),l.current.selectionStart=l.current.value.length)})},[m,l,k?.isOpen]),n.jsx(Qn,{asChild:!0,ref:b,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,s),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ie,{})})}),Vn=a.ikp("button",{_id:"aiChatInput__SendButton"}),wt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:r}=g.useChat(),{aiChatSettings:s}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Vn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!r||s.isViewOnly,...d})},Lt=a.ikp(E.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),Un=a.ikp("div",{_id:"aiChatAttachmentsBar"}),Dt=t=>{const{selectedWorkflow:e}=g.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx(Un,{...t})})},Kn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Ot=t=>{const{children:e,...i}=t,{messageAttachments:r}=g.useChat();return n.jsx(Kn,{children:h.maybeRender(e,r),...i})},zn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),qt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(zn,{...i})})},Gn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Rt=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Gn,{iconSettings:i,...t}):null},Yn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Wt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(Yn,{children:e.title,...t})},Jn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Nt=t=>{const{onClick:e,...i}=t,{attachment:r}=w.useAttachmentItem(),{setMessageAttachments:s}=g.useChat(),o=()=>{s(d=>d.filter(c=>c.id!==r.id))};return n.jsx(Jn,{"aria-label":"Remove attachment",children:n.jsx(E.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},$t=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Qt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Vt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(E.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ut=a.ikp(j.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),Xn=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Kt=t=>{const{children:e,...i}=t,{selectedWorkflow:r}=g.useChat();return r?.supportedInputs?n.jsx(Xn,{children:h.maybeRender(e,r.supportedInputs),...i}):null},Zn=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),zt=t=>{const{input:e,onClick:i,...r}=t,{selectedWorkflow:s,messageAttachments:o,setMessageAttachments:d}=g.useChat(),{selectInput:c,onOpen:m}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(Zn,{children:e.displayName,onClick:u.composeEventHandlers(i,l),...r})},Gt=a.ikp(Sa.IoAdd,{_id:"aiChatAttachmentsBar__InputIcon"}),er=a.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Yt=t=>{const{onOpenChange:e,...i}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=F.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(er,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},Jt=a.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Xt=a.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Zt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),tr=a.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),ei=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(tr,{children:i,...t})},ir=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),ti=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(ir,{children:i,...t}):null},ar=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),ii=t=>{const{children:e,...i}=t,{selectedInput:r}=F.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(ar,{asChild:!e,children:e||s,...i}):null},ai=a.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),ni=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),nr=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ri=t=>{const{onSubmit:e,...i}=t,{form:r}=F.useAttachmentsBar();return n.jsx(nr,{onSubmit:u.composeEventHandlers(e,r.onSubmit),...i})},si=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),rr=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),oi=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(rr,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},sr=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),di=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(sr,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:u.composeEventHandlers(e,r.onChange),...i})},or=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(or,{"aria-live":"polite",children:e.errors.title,...t}):null},mi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),dr=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),li=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(dr,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},cr=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),hi=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(cr,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:u.composeEventHandlers(e,r.onChange),...i,children:n.jsx(ie,{maxRows:10})})},mr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ui=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(mr,{"aria-live":"polite",children:e.errors.content,...t}):null},Ci=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),pi=a.ikp("div",{_id:"aiChatActionBar"}),vi=a.ikp("div",{_id:"aiChat__ChatActions"}),bi=a.ikp("div",{_id:"aiChatTagline__Container"}),gi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),Pi=a.ikp(ja.default,{_id:"aiChatTagline__Logo"}),_i=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),lr=a.ikp("div",{_id:"aiChat__ChatAction"}),z=t=>{const{action:e,onClick:i,className:r,...s}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:l}=g.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=V.useChatEvents(),[W,Y]=ee.useCopyToClipboard(),[N,J]=ee.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!p.id||!!l||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const Z={help:()=>{},copy:()=>{const $=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(H),S=Ta.stringifyAttachments(H.metadata?.attributes?.attachments),Q=S?`
|
|
7
|
+
Let me know how I can help.`,b={content:r.introMessage??`${m}${l}`,id:Na,...e,role:"assistant",links:[]};return n.jsx(ce,{message:b,...i})}),un=a.ikp("div",{_id:"aiChatMessageHeader"}),Ge=t=>{const{message:e}=P.useMessage();return n.jsx(un,{"data-role":e.role,...t})},Cn=a.ikp("div",{_id:"aiChatMessageLoading"}),Ye=t=>{const{isLoading:e,isStreaming:i,messages:r}=g.useChat(),{message:s}=P.useMessage();return!(r.at(-1)?.id===s?.id)||s.role!=="assistant"||!e||i?null:n.jsx(Cn,{children:"Thinking...",...t})},pn=a.ikp("div",{_id:"aiChatMessageAvatar"}),Je=t=>{const{message:e}=P.useMessage();return n.jsx(pn,{"data-role":e.role,...t})},vn=a.ikp(de.Root,{_id:"aiChatMessageAvatarContent"}),Xe=t=>{const{message:e}=P.useMessage(),{baseSettings:i}=C.useInkeepConfig();return n.jsx(vn,{"data-username":h.dataAttr(e.role==="user"&&!!i.userProperties.name),"data-role":e.role,...t})},bn=a.ikp(de.Fallback,{_id:"aiChatMessageAvatarFallback"}),Ze=v.memo(t=>{const{baseSettings:e}=C.useInkeepConfig(),{message:i}=P.useMessage();return e.userProperties.name?n.jsx(bn,{"data-role":i.role,children:h.getInitials(e.userProperties.name),...t}):null}),pe=a.ikp(de.Image,{_id:"aiChatMessageAvatarImage"}),et=v.memo(t=>{const{onLoadingStatusChange:e,...i}=t,{aiChatSettings:r,baseSettings:{userProperties:s}}=C.useInkeepConfig(),{message:o}=P.useMessage(),{aiAssistantAvatar:d}=r??{},c=typeof d=="string"?d:d?.light,m=(typeof d=="string"?d:d?.dark)??c,l=Da.useColorModeValue(c,m),[p,b]=v.useState(l);v.useEffect(()=>{b(l)},[l]);const k=y=>{y==="error"&&b(null)};return o.role==="user"?s.name?null:r.userAvatar?n.jsx(pe,{"data-type":"image","data-role":o.role,src:r.userAvatar,...t}):n.jsx(fa.default,{"data-type":"icon","data-role":o.role,...t}):p?n.jsx(pe,{src:p,"data-type":"image","data-role":o.role,onLoadingStatusChange:u.composeEventHandlers(e,k),...i}):n.jsx(xa.default,{"data-type":"icon","data-role":o.role,...t})}),gn=a.ikp("span",{_id:"aiChatMessageName"}),tt=t=>{const{message:e}=P.useMessage();return n.jsx(gn,{"data-role":e.role,children:e.role==="user"?"You":"AI assistant",...t})},Pn=a.ikp("div",{_id:"aiChatMessageContentWrapper"}),it=t=>{const{message:e}=P.useMessage();return n.jsx(Pn,{"data-role":e.role,...t})},_n=a.ikp("div",{_id:"aiChatMessageContent"}),at=t=>{const{message:e}=P.useMessage();return n.jsx(_n,{"data-role":e.role,...t})},An=a.ikp("div",{_id:"aiChatMessageAttachments"}),nt=t=>{const{message:e}=P.useMessage(),i=e.metadata?.attributes?.attachments;return e.role!=="user"||!i?.length?null:n.jsx(q.MessageAttachmentsProvider,{children:n.jsx(An,{...t})})},En=a.ikp("div",{_id:"aiChatMessageAttachments__List"}),rt=t=>{const{children:e,...i}=t,{message:r}=P.useMessage(),s=r.metadata?.attributes?.attachments;return s?n.jsx(En,{children:h.maybeRender(e,s),...i}):null},Fn=a.ikp("div",{_id:"aiChatMessageAttachments__Item"}),st=t=>{const{attachment:e,onClick:i,...r}=t,{selectItem:s,onOpen:o}=q.useMessageAttachments(),d=()=>{s(e),o()};return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Fn,{onClick:u.composeEventHandlers(i,d),...r})})},kn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageAttachments__ItemIcon"}),ot=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(kn,{iconSettings:i,...t}):null},In=a.ikp("span",{_id:"aiChatMessageAttachments__ItemTitle"}),dt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(In,{children:e.title,...t})},Mn=a.ikp(_.Root,{_id:"aiChatMessageAttachmentsPreview"}),ct=t=>{const{onOpenChange:e,...i}=t,{selectItem:r,isOpen:s,onClose:o,selectedItem:d}=q.useMessageAttachments(),c=m=>{m||(o(),r(null))};return n.jsx(Mn,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},mt=a.ikp(_.Overlay,{_id:"aiChatMessageAttachmentsPreview__Overlay"}),lt=a.ikp(_.Content,{_id:"aiChatMessageAttachmentsPreview__Content","aria-describedby":void 0}),Sn=a.ikp(_.Title,{_id:"aiChatMessageAttachmentsPreview__Header"}),ht=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(Sn,{children:e?.title||"Attachment",...t})},ut=a.ikp(_.Close,{_id:"aiChatMessageAttachmentsPreview__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),xn=a.ikp("p",{_id:"aiChatMessageAttachmentsPreview__Body"}),Ct=t=>{const{selectedItem:e}=q.useMessageAttachments();return n.jsx(xn,{children:e?.content,...t})},ve=a.ikp("div",{_id:"aiChatMessage"}),pt=t=>{const{aiChatSettings:e}=C.useInkeepConfig(),{componentStyles:i,...r}=t,{message:s}=P.useMessage(),{logEvent:o}=V.useChatEvents(),d=h.getMessageContent(s),{conversation:c}=O.useInkeepConversation();return s.role==="user"?n.jsx(ve,{"data-role":s.role,children:d,...r}):n.jsx(ve,{"data-role":s.role,...r,children:n.jsx(ae.Markdown,{children:d,componentStyles:i,shouldOpenLinksInNewTab:e.shouldOpenLinksInNewTab,onLinkClick:(m,l)=>{o({eventName:"assistant_message_inline_link_opened",properties:{title:l?.toString(),url:m}})},onCodeCopy:(m,l)=>{o({eventName:"assistant_code_block_copied",properties:{conversation:c,language:m,code:l}})}})})},fn=a.ikp("div",{_id:"aiChatMessageToolbar"}),vt=t=>{const{isLoading:e,messages:i}=g.useChat(),{message:r}=P.useMessage();return i.at(-1)?.id===r?.id&&e||r.role==="user"?null:n.jsx(fn,{...t})},Bn=a.ikp("div",{_id:"aiChatMessageToolActions"}),bt=t=>{const{children:e,...i}=t,{message:r}=P.useMessage(),{messageButtons:s}=g.useChat(),o=s[r.id]||[];return n.jsx(Bn,{children:h.maybeRender(e,o),...i})},Tn=a.ikp("a",{_id:"aiChatMessageToolAction"}),jn=a.ikp("button",{_id:"aiChatMessageToolAction"}),gt=t=>{const{onClick:e,action:i,...r}=t,{handleAction:s}=re.useChatAction(i),o=()=>{s()},d=i.label||"Contact Support",c=n.jsxs(n.Fragment,{children:[i.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:i.icon}),d]});return i.action.type==="open_link"?n.jsx(Tn,{href:i.action.url,target:"_blank",rel:"noopener","data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...r}):n.jsx(jn,{"data-type":i.action.type,onClick:u.composeEventHandlers(e,o),children:c,...r})},yn=a.ikp("button",{_id:"aiChatMessageAction"}),Pt=t=>{const{action:e,onClick:i,className:r,...s}=t,{conversation:o}=O.useInkeepConversation(),{message:d}=P.useMessage(),{isStreaming:c,messages:m}=g.useChat(),[l,p]=ee.useCopyToClipboard(),{feedback:b,submitPositiveFeedback:k,setCurrentFeedback:y,currentFeedback:W}=ne.useMessageFeedback(),{logEvent:Y}=V.useChatEvents(),[N,J]=ya.useSettleAction(),{baseSettings:{privacyPreferences:he}}=C.useInkeepConfig(),{optOutAllAnalytics:X}=he,ue=m.at(-1)?.id===d?.id,Z=d.role==="assistant";if(ue&&c||!Z||{copy:!1,upvote:X,downvote:X}[e])return null;const H={copy(){p(h.getMessageContent(d)),Y({eventName:"assistant_message_copied",properties:{conversation:o}})},upvote(){k(d.id).then(()=>{J()})},downvote(){y(d.id)}},D={copy:"Copy Message",upvote:"Upvote Message",downvote:"Downvote Message"},M={copy:n.jsx(E.CustomIcon,{iconKey:l?"messageCopied":"messageCopy"}),upvote:n.jsx(E.CustomIcon,{iconKey:N?"messageCopied":"thumbsUp"}),downvote:n.jsx(E.CustomIcon,{iconKey:"thumbsDown"})},S={copy:{"data-copied":h.dataAttr(l)},upvote:{"data-upvoted":h.dataAttr(b[d.id]?.type==="positive")},downvote:{"data-downvoted":h.dataAttr(b[d.id]?.type==="negative"),"data-state":W===null?"closed":"open"}};return n.jsx(yn,{"data-action":e,...S[e],children:M[e],"aria-label":D[e],className:`${r} ${e}`,onClick:u.composeEventHandlers(i,H[e]),...s})},Hn=a.ikp("div",{_id:"aiChatMessageSources"}),_t=t=>{const{message:e}=P.useMessage();return e.role!=="assistant"||!e.links?.length?null:n.jsx(Hn,{...t})},wn=a.ikp("div",{_id:"aiChatMessageSources__Header"}),At=t=>n.jsx(wn,{children:"Sources",...t}),Ln=a.ikp("div",{_id:"aiChatMessageSources__List"}),Et=t=>{const{message:e}=P.useMessage(),{children:i,...r}=t,{baseSettings:{transformSource:s,organizationDisplayName:o},aiChatSettings:{shouldOpenLinksInNewTab:d},searchSettings:{tabs:c}}=C.useInkeepConfig();if(e.role!=="assistant")return null;const m=e.links.map(l=>{const p=Ra.transformInkeepSource(l,"chatSourceItem",{organizationDisplayName:o,tabs:c,transformSource:s}),b=p.shouldOpenInNewTab!==void 0?p.shouldOpenInNewTab:d;return{...p,isExternal:b}});return n.jsx(Ln,{children:h.maybeRender(i,m),...r})},Dn=a.ikp(Ba.LinkWithQueryParams,{_id:"aiChatMessageSourceItem"}),Ft=t=>{const{source:e,onClick:i,...r}=t,{logEvent:s}=V.useChatEvents(),{conversation:o}=O.useInkeepConversation(),d=()=>{s({eventName:"assistant_source_item_clicked",properties:{conversation:o,link:e}})};return n.jsx(f.SourceItemProvider,{source:e,children:n.jsx(Dn,{"data-type":e.type,appendToUrl:e.appendToUrl,isExternal:e.isExternal,"data-breadcrumbs":!!e.breadcrumbs?.length,onClick:u.composeEventHandlers(i,d),...r})})},On=a.ikp("div",{_id:"aiChatMessageSourceItem__Breadcrumbs"}),kt=t=>{const{source:e}=f.useSourceItem();return e.breadcrumbs?.length?n.jsx(On,{"data-type":e.type,...t}):null},qn=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__BreadcrumbIcon",iconKey:"breadcrumbSeparator"}),Rn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatMessageSourceItem__Icon"}),It=t=>{const{source:e}=f.useSourceItem();return n.jsx(Rn,{iconSettings:e.icon,"data-type":e.type,...t})},Wn=a.ikp("span",{_id:"aiChatMessageSourceItem__Title"}),Mt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Wn,{"data-type":e.type,children:e.title,...t})},Nn=a.ikp("span",{_id:"aiChatMessageSourceItem__Tag"}),St=t=>{const{source:e}=f.useSourceItem();return n.jsx(Nn,{"data-type":e.type,...t})},$n=a.ikp("span",{_id:"aiChatMessageSourceItem__Description"}),xt=t=>{const{source:e}=f.useSourceItem(),{children:i,...r}=t,s=v.useMemo(()=>e.description?La.highlightEmphasis(e.description):[],[e.description]);return s.length?n.jsx($n,{"data-type":e.type,children:h.maybeRender(i,s),...r}):null},Qn=a.ikp("span",{_id:"aiChatMessageSourceItem__DescriptionPart"}),ft=t=>{const{part:e,...i}=t,{source:r}=f.useSourceItem();return typeof e=="string"?e:n.jsx(Qn,{"data-type":r.type,children:e.content,"data-highlighted":h.dataAttr(e.highlighted),...i})},Vn=a.ikp(E.CustomIcon,{_id:"aiChatMessageSourceItem__Indicator"}),Bt=t=>{const{source:e}=f.useSourceItem();return n.jsx(Vn,{iconKey:e.isExternal?"openLinkInNewTab":"openLinkInSameTab",...t})},Tt=a.ikp("div",{_id:"aiChatFooter"}),jt=a.ikp("div",{_id:"aiChatInput__Fieldset"}),yt=a.ikp("div",{_id:"aiChatInput__Group"}),Un=a.ikp("textarea",{_id:"aiChatInput"}),Ht=v.forwardRef(({onChange:t,onKeyDown:e,...i},r)=>{const{handleInputChange:s,handleInputKeyDown:o,input:d,error:c,shouldAutoFocusInput:m,inputRef:l}=g.useChat(),{aiChatSettings:p}=C.useInkeepConfig(),b=se.useComposedRefs(r,l),k=ge.useModal();return v.useEffect(()=>{requestAnimationFrame(()=>{m&&l?.current&&(l.current.focus(),l.current.selectionStart=l.current.value.length)})},[m,l,k?.isOpen]),n.jsx(Un,{asChild:!0,ref:b,maxLength:99999,placeholder:p.placeholder,value:d,onChange:u.composeEventHandlers(t,s),onKeyDown:u.composeEventHandlers(e,o),disabled:!!c||p.isViewOnly,...i,children:n.jsx(ie,{})})}),Kn=a.ikp("button",{_id:"aiChatInput__SendButton"}),wt=t=>{const{handleSubmit:e,isSubmitDisabled:i,error:r}=g.useChat(),{aiChatSettings:s}=C.useInkeepConfig(),{onClick:o,...d}=t;return n.jsx(Kn,{onClick:u.composeEventHandlers(o,()=>e()),"aria-label":"Send message",disabled:i||!!r||s.isViewOnly,...d})},Lt=a.ikp(E.CustomIcon,{_id:"aiChatInput__SendButtonIcon",iconKey:"chatSubmit"}),zn=a.ikp("div",{_id:"aiChatAttachmentsBar"}),Dt=t=>{const{selectedWorkflow:e}=g.useChat();return!e||!e.supportedInputs?.length?null:n.jsx(F.AttachmentsBarProvider,{children:n.jsx(zn,{...t})})},Gn=a.ikp("div",{_id:"aiChatAttachmentsBar__List"}),Ot=t=>{const{children:e,...i}=t,{messageAttachments:r}=g.useChat();return n.jsx(Gn,{children:h.maybeRender(e,r),...i})},Yn=a.ikp("div",{_id:"aiChatAttachmentsBar__Attachment"}),qt=t=>{const{attachment:e,...i}=t;return n.jsx(w.AttachmentItemProvider,{attachment:e,children:n.jsx(Yn,{...i})})},Jn=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatAttachmentsBar__AttachmentIcon"}),Rt=t=>{const{attachment:e}=w.useAttachmentItem(),i=e.contentType?.attachmentIcon;return i?n.jsx(Jn,{iconSettings:i,...t}):null},Xn=a.ikp("span",{_id:"aiChatAttachmentsBar__AttachmentTitle"}),Wt=t=>{const{attachment:e}=w.useAttachmentItem();return n.jsx(Xn,{children:e.title,...t})},Zn=a.ikp("button",{_id:"aiChatAttachmentsBar__AttachmentDelete"}),Nt=t=>{const{onClick:e,...i}=t,{attachment:r}=w.useAttachmentItem(),{setMessageAttachments:s}=g.useChat(),o=()=>{s(d=>d.filter(c=>c.id!==r.id))};return n.jsx(Zn,{"aria-label":"Remove attachment",children:n.jsx(E.CustomIcon,{iconKey:"close"}),onClick:u.composeEventHandlers(e,o),...i})},$t=a.ikp("div",{_id:"aiChatAttachmentsBar__Actions"}),Qt=a.ikp(j.Tooltip,{_id:"aiChatAttachmentsBar__InfoTip",delayDuration:0}),Vt=a.ikp(j.Trigger,{_id:"aiChatAttachmentsBar__InfoTipIcon",children:n.jsx(E.CustomIcon,{iconKey:"info"})}),me=a.ikp(j.Arrow,{_id:"aiChatAttachmentsBar__InfoTipArrow"}),Ut=a.ikp(j.Content,{_id:"aiChatAttachmentsBar__InfoTipText",side:"bottom",sideOffset:3,align:"center",children:n.jsxs(n.Fragment,{children:[n.jsx(me,{}),"Attachments will be kept in context for the entire conversation."]})}),er=a.ikp("div",{_id:"aiChatAttachmentsBar__Inputs"}),Kt=t=>{const{children:e,...i}=t,{selectedWorkflow:r}=g.useChat();return r?.supportedInputs?n.jsx(er,{children:h.maybeRender(e,r.supportedInputs),...i}):null},tr=a.ikp("button",{_id:"aiChatAttachmentsBar__Input"}),zt=t=>{const{input:e,onClick:i,...r}=t,{selectedWorkflow:s,messageAttachments:o,setMessageAttachments:d}=g.useChat(),{selectInput:c,onOpen:m}=F.useAttachmentsBar(),l=()=>{if(e.type==="FUNCTIONAL_MULTI_ATTACHMENT")return s?e.onInvoke(s,e,d,[...o]):void 0;c(e),m()};return n.jsx(tr,{children:e.displayName,onClick:u.composeEventHandlers(i,l),...r})},Gt=a.ikp(Sa.IoAdd,{_id:"aiChatAttachmentsBar__InputIcon"}),ir=a.ikp(_.Root,{_id:"aiChatAttachmentsBar__Modal"}),Yt=t=>{const{onOpenChange:e,...i}=t,{selectInput:r,isOpen:s,onClose:o,selectedInput:d}=F.useAttachmentsBar(),c=m=>{m||(o(),r(null))};return n.jsx(ir,{open:s&&d!==null,onOpenChange:u.composeEventHandlers(e,c),...i})},Jt=a.ikp(_.Overlay,{_id:"aiChatAttachmentsBar__ModalOverlay"}),Xt=a.ikp(_.Content,{_id:"aiChatAttachmentsBar__ModalContent","aria-describedby":void 0}),Zt=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHeader"}),ar=a.ikp(_.Title,{_id:"aiChatAttachmentsBar__ModalHeading"}),ei=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=`Add ${e?.displayName}`;return n.jsx(ar,{children:i,...t})},nr=a.ikp("span",{_id:"aiChatAttachmentsBar__ModalDescription"}),ti=t=>{const{selectedInput:e}=F.useAttachmentsBar(),i=e?.workflowModalProps?.modalHelpText;return i?n.jsx(nr,{children:i,...t}):null},rr=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalHelp"}),ii=t=>{const{children:e,...i}=t,{selectedInput:r}=F.useAttachmentsBar(),s=r?.workflowModalProps?.modalHelpElement;return s?n.jsx(rr,{asChild:!e,children:e||s,...i}):null},ai=a.ikp(_.Close,{_id:"aiChatAttachmentsBar__ModalClose",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),ni=a.ikp("div",{_id:"aiChatAttachmentsBar__ModalBody"}),sr=a.ikp("form",{_id:"aiChatAttachmentsBar__Form"}),ri=t=>{const{onSubmit:e,...i}=t,{form:r}=F.useAttachmentsBar();return n.jsx(sr,{onSubmit:u.composeEventHandlers(e,r.onSubmit),...i})},si=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),or=a.ikp("label",{_id:"aiChatAttachmentsBar__FormTitleLabel"}),oi=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(or,{htmlFor:`${i?.id}-title`,children:e.labels.title,...t})},dr=a.ikp("input",{_id:"aiChatAttachmentsBar__FormTitleInput"}),di=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(dr,{name:"title",value:r.data.title,id:`${s?.id}-title`,"data-invalid":h.dataAttr(!!r.errors.title),"aria-invalid":!!r.errors.title,onChange:u.composeEventHandlers(e,r.onChange),...i})},cr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormTitleError"}),ci=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.title?n.jsx(cr,{"aria-live":"polite",children:e.errors.title,...t}):null},mi=a.ikp("div",{_id:"aiChatAttachmentsBar__FormTitle",role:"group"}),mr=a.ikp("label",{_id:"aiChatAttachmentsBar__FormContentLabel"}),li=t=>{const{form:e,selectedInput:i}=F.useAttachmentsBar();return n.jsx(mr,{htmlFor:`${i?.id}-content`,children:e.labels.content,...t})},lr=a.ikp("textarea",{_id:"aiChatAttachmentsBar__FormTitleInput"}),hi=t=>{const{onChange:e,...i}=t,{form:r,selectedInput:s}=F.useAttachmentsBar();return n.jsx(lr,{asChild:!0,rows:4,name:"content",value:r.data.content,id:`${s?.id}-content`,"data-invalid":h.dataAttr(!!r.errors.content),"aria-invalid":!!r.errors.content,onChange:u.composeEventHandlers(e,r.onChange),...i,children:n.jsx(ie,{maxRows:10})})},hr=a.ikp("span",{_id:"aiChatAttachmentsBar__FormContentError"}),ui=t=>{const{form:e}=F.useAttachmentsBar();return e.errors.content?n.jsx(hr,{"aria-live":"polite",children:e.errors.content,...t}):null},Ci=a.ikp("button",{_id:"aiChatAttachmentsBar__FormSubmitButton",children:"Upload",type:"submit"}),pi=a.ikp("div",{_id:"aiChatActionBar"}),vi=a.ikp("div",{_id:"aiChat__ChatActions"}),bi=a.ikp("div",{_id:"aiChatTagline__Container"}),gi=a.ikp("span",{_id:"aiChatTagline__Text",children:"Powered by"}),Pi=a.ikp(ja.default,{_id:"aiChatTagline__Logo"}),_i=a.ikp("a",{_id:"aiChatTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"}),ur=a.ikp(j.Trigger,{_id:"aiChat__ChatAction"}),z=t=>{const{action:e,onClick:i,className:r,...s}=t,{clear:o,stop:d,isLoading:c,messages:m,selectedWorkflow:l}=g.useChat(),{conversation:p}=O.useInkeepConversation(),{aiChatSettings:b,baseSettings:k}=C.useInkeepConfig(),{logEvent:y}=V.useChatEvents(),[W,Y]=ee.useCopyToClipboard(),[N,J]=ee.useCopyToClipboard();if({help:!1,copy:m.length===0||!b.isCopyChatButtonVisible||c,share:m.length===0||!b.isShareButtonVisible||!p.id||!!l||c,clear:m.length===0||b.isViewOnly||c,stop:!c}[e])return null;const Z={help:()=>{},copy:()=>{const $=m.map(H=>{const D=`**${H.role==="assistant"?"AI Assistant":"User"}**`,M=h.getMessageContent(H),S=Ta.stringifyAttachments(H.metadata?.attributes?.attachments),Q=S?`
|
|
8
8
|
|
|
9
9
|
**Attachments**
|
|
10
10
|
|
|
@@ -14,4 +14,4 @@ ${M}${Q}`}).join(`
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
`);Y($)},share:async()=>{const $={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,createdAt:void 0,updatedAt:void 0,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:H,analyticsApiBaseUrl:D}=k,M=await qa.logConversation("",$,H,D);if(M){const Q=`${b.shareChatUrlBasePath}?${O.SHARE_QUERY_PARAM}=${M?.id}`;J(Q),y({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:Q,conversation:M}})}},clear:o,stop:d},Ce={copy:W,share:N};return n.jsx(j.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(lr,{"data-type":e,"data-copied":h.dataAttr(W||N),className:`${r} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(i,Z[e]),...s})})},hr=a.ikp(j.Trigger,{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...i}=t,{aiChatSettings:r}=C.useInkeepConfig(),s=r.toolbarButtonLabels??{},o={help:s.getHelp??"Get Help",copy:s.copyChat??"Copy",share:s.share??"Share",clear:s.clear??"Clear",stop:s.stop??"Stop"};return n.jsx(hr,{children:o[e],...i})},ur=a.ikp(j.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),Ai=t=>{const{action:e,children:i,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(ur,{sideOffset:5,...r,children:[n.jsx(j.Arrow,{}),i||s[e]]})},Cr=a.ikp(T.Root,{_id:"aiChatHelpActions"}),Ei=t=>{const{children:e,...i}=t,{aiChatSettings:r}=C.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:o,_unpinned:d}=s.reduce((p,b)=>{const k=b.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[k]:[...p[k],b]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,l=te.useHelpMenuState();return n.jsx(te.HelpMenuProvider,{value:l,children:n.jsx(Cr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...i})})},pr=a.ikp(z,{_id:"aiChatHelpAction",action:"help"}),vr=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Fi=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=re.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{s(),o()}),...r};return d==="open_link"?n.jsx(vr,{href:e.action.url,...c}):n.jsx(pr,{...c})},br=a.ikp(T.Trigger,{_id:"aiChatHelpActions__Trigger"}),ki=v.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(z,{action:"help",...t,asChild:!0,children:n.jsx(br,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),gr=a.ikp(T.Content,{_id:"aiChatHelpActions__Menu"}),Ii=t=>n.jsx(gr,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Mi=a.ikp(T.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Si=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=re.useChatAction(e),{setOpen:d}=te.useHelpMenu(),c=()=>{s({onOpenForm:()=>d(!1)}),o()},m=e.action.type,l=a.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(i,c)});return n.jsx(l,{...r})},Pr=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),xi=t=>{const{action:e,...i}=t;return e.icon?n.jsx(Pr,{iconSettings:e.icon,...i}):null},_r=a.ikp(_.Root,{_id:"aiChatFeedbackModal"}),fi=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:r,setCurrentFeedback:s}=ne.useMessageFeedback();return n.jsx(_r,{open:r!==null,onOpenChange:u.composeEventHandlers(e,()=>s(null)),...i})},Bi=a.ikp(_.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Ti=a.ikp(_.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ji=a.ikp(_.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),yi=a.ikp(_.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Hi=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),Ar=a.ikp("form",{_id:"aiChatFeedbackForm"}),wi=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:o}=ne.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,l=new FormData(m),p=Object.fromEntries(l.entries());s&&(r(s,p),o(null))};return n.jsx(Ar,{onSubmit:u.composeEventHandlers(e,d),...i})},Er=a.ikp("div",{_id:"aiChatFeedbackItem"}),Li=t=>{const{name:e,...i}=t;return n.jsx(U.FeedbackItemProvider,{name:e,children:n.jsx(Er,{...i})})},Fr=a.ikp(K.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Di=t=>{const{name:e,focusItem:i}=U.useFeedbackItem(),{onCheckedChange:r,...s}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(Fr,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(r,o),...s})},Oi=a.ikp(K.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),kr=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),qi=t=>{const{name:e}=U.useFeedbackItem(),i={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(kr,{htmlFor:`feedback-${e}`,children:i[e],...t})},Ir=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Ri=t=>{const{name:e,focusItem:i}=U.useFeedbackItem();return n.jsx(Ir,{ref:i,name:`${e}:description`,...t})},Wi=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),Mr=a.ikp("div",{_id:"aiChatForm__Wrapper"}),Ni=t=>{const{form:e}=A.useChatForm();return e?n.jsx(Mr,{...t}):null},Sr=a.ikp("form",{_id:"aiChatForm"}),$i=t=>{const{onSubmit:e,...i}=t,{handleSubmit:r,isSuccess:s}=A.useChatForm();return s?null:n.jsx(Sr,{onSubmit:u.composeEventHandlers(e,r),...i})},xr=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Qi=t=>{const{onClick:e,...i}=t,{closeForm:r}=A.useChatForm();return n.jsx(xr,{onClick:u.composeEventHandlers(e,r),...i})},Vi=a.ikp("div",{_id:"aiChatForm__Header"}),fr=a.ikp("h2",{_id:"aiChatForm__Heading"}),Ui=t=>{const{form:e}=A.useChatForm();return e?.heading?n.jsx(fr,{children:e.heading,...t}):null},Br=a.ikp("span",{_id:"aiChatForm__Description"}),Ki=t=>{const{form:e}=A.useChatForm();return e?.description?n.jsx(Br,{children:e.description,...t}):null},Tr=a.ikp("div",{_id:"aiChatForm__Content"}),zi=t=>{const{children:e,...i}=t,{fields:r=[]}=A.useChatForm();return n.jsx(Tr,{children:h.maybeRender(e,r),...i})},jr=a.ikp("div",{_id:"aiChatForm__Field"}),Gi=t=>{const{field:e,autoFocus:i,...r}=t,{control:s,errors:o}=A.useChatForm();return n.jsx(wa.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(B.FormFieldProvider,{"data-invalid":h.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(jr,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},yr=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Yi=t=>{const{field:e}=B.useFormField();return n.jsx(yr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},Hr=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),G=t=>{const{field:e,error:i,fieldProps:{onChange:r,onBlur:s,...o},autoFocus:d}=B.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(Hr,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!i),onChange:u.composeEventHandlers(c,r),onBlur:u.composeEventHandlers(m,s),...o,...l})},Ji=a.ikp(G,{_id:"aiChatForm__FieldEmail",type:"email"}),wr=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Xi=t=>{const{field:e,error:i,fieldProps:{value:r,onChange:s,onBlur:o,...d},autoFocus:c}=B.useFormField(),{onChange:m,onBlur:l,...p}=t,b=k=>{const y=k.target.files;s(y)};return n.jsx(wr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!i),...p,...d,onChange:u.composeEventHandlers(m,b),onBlur:u.composeEventHandlers(l,o)})},Zi=a.ikp(G,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ie,{maxRows:8})}),Lr=a.ikp(K.Root,{_id:"aiChatForm__FieldCheckbox"}),ea=t=>{const{field:e,error:i,fieldProps:r,autoFocus:s}=B.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Lr,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!i),checked:r.value,onCheckedChange:u.composeEventHandlers(o,r.onChange),...d})},ta=a.ikp(K.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Dr=a.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),ia=t=>{const{field:e,error:i,fieldProps:r}=B.useFormField(),{onValueChange:s,...o}=t;return n.jsx(Dr,{name:e.name,"data-invalid":h.dataAttr(!!i),value:r.value,onValueChange:u.composeEventHandlers(s,r.onChange),...o})},aa=a.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Or=a.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),na=t=>{const{field:e}=B.useFormField();return n.jsx(Or,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ra=a.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),sa=a.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),oa=a.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),da=a.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ca=a.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ma=a.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),qr=a.ikp("span",{_id:"aiChatForm__FieldError"}),la=t=>{const{error:e}=B.useFormField();return e?n.jsx(qr,{children:e.message?.toString(),...t}):null},Rr=a.ikp("span",{_id:"aiChatForm__Error"}),ha=t=>{const{formError:e}=A.useChatForm();return e?n.jsx(Rr,{children:e.message,...t}):null},ua=a.ikp("div",{_id:"aiChatForm__Footer"}),Wr=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),Ca=t=>{const{onClick:e,...i}=t,{closeForm:r}=A.useChatForm();return n.jsx(Wr,{onClick:u.composeEventHandlers(e,r),...i})},Nr=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),pa=t=>{const{onClick:e,...i}=t,{isSubmitting:r}=A.useChatForm();return n.jsx(Nr,{disabled:r,...i})},$r=a.ikp("div",{_id:"aiChatForm__Success"}),va=t=>{const{isSuccess:e}=A.useChatForm();return e?n.jsx($r,{...t}):null},Qr=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ba=t=>{const{form:e}=A.useChatForm();return n.jsx(Qr,{children:e?.successView.heading,...t})},Vr=a.ikp(ae.Markdown,{_id:"aiChatForm__SuccessMessage"}),ga=t=>{const{form:e}=A.useChatForm();return n.jsx(Vr,{children:e?.successView.message,...t})},Ur=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),Pa=t=>{const{onClick:e,...i}=t,{form:r,closeForm:s}=A.useChatForm(),o=r?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx(Ur,{onClick:u.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=g.ChatProvider;exports.ActionBar=pi;exports.Actions=vi;exports.AttachmentsBar=Dt;exports.AttachmentsBarActions=$t;exports.AttachmentsBarAttachment=qt;exports.AttachmentsBarAttachmentDelete=Nt;exports.AttachmentsBarAttachmentIcon=Rt;exports.AttachmentsBarAttachmentTitle=Wt;exports.AttachmentsBarForm=ri;exports.AttachmentsBarFormContent=mi;exports.AttachmentsBarFormContentError=ui;exports.AttachmentsBarFormContentInput=hi;exports.AttachmentsBarFormContentLabel=li;exports.AttachmentsBarFormSubmitButton=Ci;exports.AttachmentsBarFormTitle=si;exports.AttachmentsBarFormTitleError=ci;exports.AttachmentsBarFormTitleInput=di;exports.AttachmentsBarFormTitleLabel=oi;exports.AttachmentsBarInfoTip=Qt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Vt;exports.AttachmentsBarInfoTipText=Ut;exports.AttachmentsBarInput=zt;exports.AttachmentsBarInputIcon=Gt;exports.AttachmentsBarInputs=Kt;exports.AttachmentsBarList=Ot;exports.AttachmentsBarModal=Yt;exports.AttachmentsBarModalBody=ni;exports.AttachmentsBarModalClose=ai;exports.AttachmentsBarModalContent=Xt;exports.AttachmentsBarModalDescription=ti;exports.AttachmentsBarModalHeader=Zt;exports.AttachmentsBarModalHeading=ei;exports.AttachmentsBarModalHelp=ii;exports.AttachmentsBarModalOverlay=Jt;exports.ChatAction=z;exports.ChatActionFeedback=Ai;exports.ChatActionLabel=le;exports.ChatHelpAction=Fi;exports.Content=Ie;exports.ContentScrollArea=Me;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=xe;exports.ContentScrollAreaThumb=fe;exports.ContentScrollAreaViewport=Se;exports.ConversationLoading=_e;exports.Disclaimer=je;exports.DisclaimerArrow=De;exports.DisclaimerContent=we;exports.DisclaimerLabel=ye;exports.DisclaimerText=Le;exports.DisclaimerTrigger=He;exports.EmbeddedChatPrimitiveActionBar=pi;exports.EmbeddedChatPrimitiveActions=vi;exports.EmbeddedChatPrimitiveAttachmentsBar=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=$t;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=qt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=ui;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=hi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=Ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=oi;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInput=zt;exports.EmbeddedChatPrimitiveAttachmentsBarInputIcon=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ni;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ai;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=ii;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Jt;exports.EmbeddedChatPrimitiveChatAction=z;exports.EmbeddedChatPrimitiveChatActionFeedback=Ai;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Fi;exports.EmbeddedChatPrimitiveContent=Ie;exports.EmbeddedChatPrimitiveContentScrollArea=Me;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=xe;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=fe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Se;exports.EmbeddedChatPrimitiveConversationLoading=_e;exports.EmbeddedChatPrimitiveDisclaimer=je;exports.EmbeddedChatPrimitiveDisclaimerArrow=De;exports.EmbeddedChatPrimitiveDisclaimerContent=we;exports.EmbeddedChatPrimitiveDisclaimerLabel=ye;exports.EmbeddedChatPrimitiveDisclaimerText=Le;exports.EmbeddedChatPrimitiveDisclaimerTrigger=He;exports.EmbeddedChatPrimitiveExampleQuestion=We;exports.EmbeddedChatPrimitiveExampleQuestionButton=Ne;exports.EmbeddedChatPrimitiveExampleQuestions=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=qe;exports.EmbeddedChatPrimitiveExampleQuestionsList=Re;exports.EmbeddedChatPrimitiveFeedbackForm=wi;exports.EmbeddedChatPrimitiveFeedbackItem=Li;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Di;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=Oi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Ri;exports.EmbeddedChatPrimitiveFeedbackItemLabel=qi;exports.EmbeddedChatPrimitiveFeedbackModal=fi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Hi;exports.EmbeddedChatPrimitiveFeedbackModalClose=yi;exports.EmbeddedChatPrimitiveFeedbackModalContent=Ti;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ji;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Bi;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Wi;exports.EmbeddedChatPrimitiveFooter=Tt;exports.EmbeddedChatPrimitiveForm=$i;exports.EmbeddedChatPrimitiveFormCancel=Ca;exports.EmbeddedChatPrimitiveFormClose=Qi;exports.EmbeddedChatPrimitiveFormContent=zi;exports.EmbeddedChatPrimitiveFormDescription=Ki;exports.EmbeddedChatPrimitiveFormError=ha;exports.EmbeddedChatPrimitiveFormField=Gi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=ea;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=ta;exports.EmbeddedChatPrimitiveFormFieldEmail=Ji;exports.EmbeddedChatPrimitiveFormFieldError=la;exports.EmbeddedChatPrimitiveFormFieldFile=Xi;exports.EmbeddedChatPrimitiveFormFieldLabel=Yi;exports.EmbeddedChatPrimitiveFormFieldSelect=ia;exports.EmbeddedChatPrimitiveFormFieldSelectContent=sa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ra;exports.EmbeddedChatPrimitiveFormFieldSelectItem=da;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ma;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ca;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=aa;exports.EmbeddedChatPrimitiveFormFieldSelectValue=na;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=oa;exports.EmbeddedChatPrimitiveFormFieldText=G;exports.EmbeddedChatPrimitiveFormFieldTextArea=Zi;exports.EmbeddedChatPrimitiveFormFooter=ua;exports.EmbeddedChatPrimitiveFormHeader=Vi;exports.EmbeddedChatPrimitiveFormHeading=Ui;exports.EmbeddedChatPrimitiveFormSubmit=pa;exports.EmbeddedChatPrimitiveFormSuccess=va;exports.EmbeddedChatPrimitiveFormSuccessButton=Pa;exports.EmbeddedChatPrimitiveFormSuccessHeading=ba;exports.EmbeddedChatPrimitiveFormSuccessMessage=ga;exports.EmbeddedChatPrimitiveFormWrapper=Ni;exports.EmbeddedChatPrimitiveHeaderToolbar=Ee;exports.EmbeddedChatPrimitiveHelpActions=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenu=Ii;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Mi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Si;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=xi;exports.EmbeddedChatPrimitiveHelpActionsTrigger=ki;exports.EmbeddedChatPrimitiveInput=Ht;exports.EmbeddedChatPrimitiveInputFieldset=jt;exports.EmbeddedChatPrimitiveInputGroup=yt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=ze;exports.EmbeddedChatPrimitiveMessage=pt;exports.EmbeddedChatPrimitiveMessageAction=Pt;exports.EmbeddedChatPrimitiveMessageAttachments=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=dt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=Ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=ut;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=mt;exports.EmbeddedChatPrimitiveMessageAvatar=Je;exports.EmbeddedChatPrimitiveMessageAvatarContent=Xe;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Ze;exports.EmbeddedChatPrimitiveMessageAvatarImage=et;exports.EmbeddedChatPrimitiveMessageContent=at;exports.EmbeddedChatPrimitiveMessageContentWrapper=it;exports.EmbeddedChatPrimitiveMessageHeader=Ge;exports.EmbeddedChatPrimitiveMessageLoading=Ye;exports.EmbeddedChatPrimitiveMessageName=tt;exports.EmbeddedChatPrimitiveMessageSourceItem=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=kt;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=xt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=ft;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=It;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=Bt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=St;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Mt;exports.EmbeddedChatPrimitiveMessageSources=_t;exports.EmbeddedChatPrimitiveMessageSourcesHeader=At;exports.EmbeddedChatPrimitiveMessageSourcesList=Et;exports.EmbeddedChatPrimitiveMessageToolAction=gt;exports.EmbeddedChatPrimitiveMessageToolActions=bt;exports.EmbeddedChatPrimitiveMessageToolbar=vt;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=Te;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=wt;exports.EmbeddedChatPrimitiveSendButtonIcon=Lt;exports.EmbeddedChatPrimitiveTaglineBrandName=_i;exports.EmbeddedChatPrimitiveTaglineContainer=bi;exports.EmbeddedChatPrimitiveTaglineLogo=Pi;exports.EmbeddedChatPrimitiveTaglineText=gi;exports.EmbeddedChatPrimitiveToolbarHeader=ke;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ue;exports.EmbeddedChatPrimitiveWorkflowIcon=Ke;exports.EmbeddedChatPrimitiveWorkflows=$e;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=Ve;exports.EmbeddedChatPrimitiveWrapper=Pe;exports.ExampleQuestion=We;exports.ExampleQuestionButton=Ne;exports.ExampleQuestions=Oe;exports.ExampleQuestionsLabel=qe;exports.ExampleQuestionsList=Re;exports.FeedbackForm=wi;exports.FeedbackItem=Li;exports.FeedbackItemCheckbox=Di;exports.FeedbackItemCheckboxIndicator=Oi;exports.FeedbackItemDescription=Ri;exports.FeedbackItemLabel=qi;exports.FeedbackModal=fi;exports.FeedbackModalBody=Hi;exports.FeedbackModalClose=yi;exports.FeedbackModalContent=Ti;exports.FeedbackModalHeader=ji;exports.FeedbackModalOverlay=Bi;exports.FeedbackSubmitButton=Wi;exports.Footer=Tt;exports.Form=$i;exports.FormCancel=Ca;exports.FormClose=Qi;exports.FormContent=zi;exports.FormDescription=Ki;exports.FormError=ha;exports.FormField=Gi;exports.FormFieldCheckbox=ea;exports.FormFieldCheckboxIndicator=ta;exports.FormFieldEmail=Ji;exports.FormFieldError=la;exports.FormFieldFile=Xi;exports.FormFieldLabel=Yi;exports.FormFieldSelect=ia;exports.FormFieldSelectContent=sa;exports.FormFieldSelectIcon=ra;exports.FormFieldSelectItem=da;exports.FormFieldSelectItemIndicator=ma;exports.FormFieldSelectItemText=ca;exports.FormFieldSelectTrigger=aa;exports.FormFieldSelectValue=na;exports.FormFieldSelectViewport=oa;exports.FormFieldText=G;exports.FormFieldTextArea=Zi;exports.FormFooter=ua;exports.FormHeader=Vi;exports.FormHeading=Ui;exports.FormSubmit=pa;exports.FormSuccess=va;exports.FormSuccessButton=Pa;exports.FormSuccessHeading=ba;exports.FormSuccessMessage=ga;exports.FormWrapper=Ni;exports.Header=Ua;exports.HeaderToolbar=Ee;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Ei;exports.HelpActionsMenu=Ii;exports.HelpActionsMenuArrow=Mi;exports.HelpActionsMenuItem=Si;exports.HelpActionsMenuItemIcon=xi;exports.HelpActionsTrigger=ki;exports.Input=Ht;exports.InputFieldset=jt;exports.InputGroup=yt;exports.IntroMessageWrapper=ze;exports.Message=pt;exports.MessageAction=Pt;exports.MessageAttachments=nt;exports.MessageAttachmentsItem=st;exports.MessageAttachmentsItemIcon=ot;exports.MessageAttachmentsItemTitle=dt;exports.MessageAttachmentsList=rt;exports.MessageAttachmentsPreview=ct;exports.MessageAttachmentsPreviewBody=Ct;exports.MessageAttachmentsPreviewClose=ut;exports.MessageAttachmentsPreviewContent=lt;exports.MessageAttachmentsPreviewHeader=ht;exports.MessageAttachmentsPreviewOverlay=mt;exports.MessageAvatar=Je;exports.MessageAvatarContent=Xe;exports.MessageAvatarFallback=Ze;exports.MessageAvatarImage=et;exports.MessageContent=at;exports.MessageContentWrapper=it;exports.MessageHeader=Ge;exports.MessageLoading=Ye;exports.MessageName=tt;exports.MessageSourceItem=Ft;exports.MessageSourceItemBreadcrumbIcon=Dn;exports.MessageSourceItemBreadcrumbs=kt;exports.MessageSourceItemDescription=xt;exports.MessageSourceItemDescriptionPart=ft;exports.MessageSourceItemIcon=It;exports.MessageSourceItemIndicator=Bt;exports.MessageSourceItemTag=St;exports.MessageSourceItemTitle=Mt;exports.MessageSources=_t;exports.MessageSourcesHeader=At;exports.MessageSourcesList=Et;exports.MessageToolAction=gt;exports.MessageToolActions=bt;exports.MessageToolbar=vt;exports.MessageWrapper=ce;exports.Messages=Te;exports.Root=Ae;exports.SendButton=wt;exports.SendButtonIcon=Lt;exports.TaglineBrandName=_i;exports.TaglineContainer=bi;exports.TaglineLogo=Pi;exports.TaglineText=gi;exports.ToolbarHeader=ke;exports.Workflow=Ue;exports.WorkflowIcon=Ke;exports.Workflows=$e;exports.WorkflowsLabel=Qe;exports.WorkflowsList=Ve;exports.Wrapper=Pe;
|
|
17
|
+
`);Y($)},share:async()=>{const $={visibility:"public",tags:[],userProperties:{},messages:p.messages.map(S=>({...S,createdAt:void 0,updatedAt:void 0,id:Date.now().toString()+S.id,conversationId:void 0}))},{apiKey:H,analyticsApiBaseUrl:D}=k,M=await qa.logConversation("",$,H,D);if(M){const Q=`${b.shareChatUrlBasePath}?${O.SHARE_QUERY_PARAM}=${M?.id}`;J(Q),y({eventName:"chat_share_button_clicked",properties:{sharedConversationId:M?.id,originalConversationId:p.id,sharedChatUrl:Q,conversation:M}})}},clear:o,stop:d},Ce={copy:W,share:N};return n.jsx(j.Tooltip,{delayDuration:0,open:Ce[e],children:n.jsx(ur,{"data-type":e,"data-copied":h.dataAttr(W||N),className:`${r} ${e}`,children:n.jsx(le,{action:e}),onClick:u.composeEventHandlers(i,Z[e]),...s})})},Cr=a.ikp("span",{_id:"aiChat__ChatActionLabel"}),le=t=>{const{action:e,...i}=t,{aiChatSettings:r}=C.useInkeepConfig(),s=r.toolbarButtonLabels??{},o={help:s.getHelp??"Get Help",copy:s.copyChat??"Copy",share:s.share??"Share",clear:s.clear??"Clear",stop:s.stop??"Stop"};return n.jsx(Cr,{children:o[e],...i})},pr=a.ikp(j.TooltipContent,{_id:"aiChat__ChatActionFeeback"}),Ai=t=>{const{action:e,children:i,...r}=t,s={copy:"Copied!",share:"Link copied!"};return n.jsxs(pr,{sideOffset:5,...r,children:[n.jsx(j.Arrow,{}),i||s[e]]})},vr=a.ikp(T.Root,{_id:"aiChatHelpActions"}),Ei=t=>{const{children:e,...i}=t,{aiChatSettings:r}=C.useInkeepConfig(),{getHelpOptions:s}=r;if(!s||(s??[]).length===0)return null;const{_pinned:o,_unpinned:d}=s.reduce((p,b)=>{const k=b.isPinnedToToolbar?"_pinned":"_unpinned";return{...p,[k]:[...p[k],b]}},{_pinned:[],_unpinned:[]}),c=d.length===1?[...o,d[0]]:o,m=d.length===1?[]:d,l=te.useHelpMenuState();return n.jsx(te.HelpMenuProvider,{value:l,children:n.jsx(vr,{open:l.open,onOpenChange:l.setOpen,children:h.maybeRender(e,{pinned:c,unpinned:m}),...i})})},br=a.ikp(z,{_id:"aiChatHelpAction",action:"help"}),gr=a.ikp("a",{_id:"aiChatHelpAction",target:"_blank",rel:"noreferrer"}),Fi=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=re.useChatAction(e),d=e.action.type,c={"aria-label":e.name,"data-name":e.name,children:e.name,onClick:u.composeEventHandlers(i,()=>{s(),o()}),...r};return d==="open_link"?n.jsx(gr,{href:e.action.url,...c}):n.jsx(br,{...c})},Pr=a.ikp(T.Trigger,{_id:"aiChatHelpActions__Trigger"}),ki=v.memo(t=>{const{aiChatSettings:e}=C.useInkeepConfig();return n.jsx(z,{action:"help",...t,asChild:!0,children:n.jsx(Pr,{children:e.toolbarButtonLabels?.getHelp??"Get Help"})})}),_r=a.ikp(T.Content,{_id:"aiChatHelpActions__Menu"}),Ii=t=>n.jsx(_r,{side:"top",sideOffset:8,align:"center",alignOffset:-10,...t}),Mi=a.ikp(T.Arrow,{_id:"aiChatHelpActions__MenuArrow"}),Si=t=>{const{action:e,onClick:i,...r}=t,{handleAction:s,logHelpAction:o}=re.useChatAction(e),{setOpen:d}=te.useHelpMenu(),c=()=>{s({onOpenForm:()=>d(!1)}),o()},m=e.action.type,l=a.ikp(m==="open_link"?"a":"button",{_id:"aiChatHelpActions__MenuItem",children:e.name,"aria-label":e.name,"data-name":e.name,"data-type":e.action.type,...m==="open_link"&&{href:e.action.url,target:"_blank",rel:"noopener"},onClick:u.composeEventHandlers(i,c)});return n.jsx(l,{...r})},Ar=a.ikp(x.BuiltInIconRenderer,{_id:"aiChatHelpActions_MenuItemIcon"}),xi=t=>{const{action:e,...i}=t;return e.icon?n.jsx(Ar,{iconSettings:e.icon,...i}):null},Er=a.ikp(_.Root,{_id:"aiChatFeedbackModal"}),fi=t=>{const{onOpenChange:e,...i}=t,{currentFeedback:r,setCurrentFeedback:s}=ne.useMessageFeedback();return n.jsx(Er,{open:r!==null,onOpenChange:u.composeEventHandlers(e,()=>s(null)),...i})},Bi=a.ikp(_.Overlay,{_id:"aiChatFeedbackModal__Overlay"}),Ti=a.ikp(_.Content,{_id:"aiChatFeedbackModal__Content","aria-describedby":void 0}),ji=a.ikp(_.Title,{_id:"aiChatFeedbackModal__Header",children:"Help improve my answers!"}),yi=a.ikp(_.Close,{_id:"aiChatFeedbackModal__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Hi=a.ikp("div",{_id:"aiChatFeedbackModal__Body"}),Fr=a.ikp("form",{_id:"aiChatFeedbackForm"}),wi=t=>{const{onSubmit:e,...i}=t,{submitNegativeFeedback:r,currentFeedback:s,setCurrentFeedback:o}=ne.useMessageFeedback(),d=c=>{c.preventDefault();const m=c.target,l=new FormData(m),p=Object.fromEntries(l.entries());s&&(r(s,p),o(null))};return n.jsx(Fr,{onSubmit:u.composeEventHandlers(e,d),...i})},kr=a.ikp("div",{_id:"aiChatFeedbackItem"}),Li=t=>{const{name:e,...i}=t;return n.jsx(U.FeedbackItemProvider,{name:e,children:n.jsx(kr,{...i})})},Ir=a.ikp(K.Root,{_id:"aiChatFeedbackItem__Checkbox"}),Di=t=>{const{name:e,focusItem:i}=U.useFeedbackItem(),{onCheckedChange:r,...s}=t,o=d=>{d&&i?.current?.focus()};return n.jsx(Ir,{id:`feedback-${e}`,name:e,onCheckedChange:u.composeEventHandlers(r,o),...s})},Oi=a.ikp(K.Indicator,{_id:"aiChatFeedbackItem__CheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),Mr=a.ikp("label",{_id:"aiChatFeedbackItem__Label"}),qi=t=>{const{name:e}=U.useFeedbackItem(),i={unrelated_response:"Didn't answer my question",inaccurate_statement:"Inaccurate statement",inaccurate_code_snippet:"Inaccurate code snippet",irrelevant_citations:"Irrelevant citations"};return n.jsx(Mr,{htmlFor:`feedback-${e}`,children:i[e],...t})},Sr=a.ikp("textarea",{_id:"aiChatFeedbackItem__Description",placeholder:"Please describe"}),Ri=t=>{const{name:e,focusItem:i}=U.useFeedbackItem();return n.jsx(Sr,{ref:i,name:`${e}:description`,...t})},Wi=a.ikp("button",{_id:"aiChatFeedbackForm__SubmitButton",children:"Submit",type:"submit"}),xr=a.ikp("div",{_id:"aiChatForm__Wrapper"}),Ni=t=>{const{form:e}=A.useChatForm();return e?n.jsx(xr,{...t}):null},fr=a.ikp("form",{_id:"aiChatForm"}),$i=t=>{const{onSubmit:e,...i}=t,{handleSubmit:r,isSuccess:s}=A.useChatForm();return s?null:n.jsx(fr,{onSubmit:u.composeEventHandlers(e,r),...i})},Br=a.ikp("button",{_id:"aiChatForm__Close",children:n.jsx(E.CustomIcon,{iconKey:"close"})}),Qi=t=>{const{onClick:e,...i}=t,{closeForm:r}=A.useChatForm();return n.jsx(Br,{onClick:u.composeEventHandlers(e,r),...i})},Vi=a.ikp("div",{_id:"aiChatForm__Header"}),Tr=a.ikp("h2",{_id:"aiChatForm__Heading"}),Ui=t=>{const{form:e}=A.useChatForm();return e?.heading?n.jsx(Tr,{children:e.heading,...t}):null},jr=a.ikp("span",{_id:"aiChatForm__Description"}),Ki=t=>{const{form:e}=A.useChatForm();return e?.description?n.jsx(jr,{children:e.description,...t}):null},yr=a.ikp("div",{_id:"aiChatForm__Content"}),zi=t=>{const{children:e,...i}=t,{fields:r=[]}=A.useChatForm();return n.jsx(yr,{children:h.maybeRender(e,r),...i})},Hr=a.ikp("div",{_id:"aiChatForm__Field"}),Gi=t=>{const{field:e,autoFocus:i,...r}=t,{control:s,errors:o}=A.useChatForm();return n.jsx(wa.Controller,{name:e.name,control:s,rules:{required:e.isRequired?`${e.label} is required.`:void 0},render:({field:d})=>{const c=d.value!==void 0||e.inputType==="file";return n.jsx(B.FormFieldProvider,{"data-invalid":h.dataAttr(!!o[e.name]),field:e,fieldProps:d,autoFocus:i,children:c&&n.jsx(Hr,{"data-input-type":e.inputType,"data-hidden":h.dataAttr(e.isHidden),...r})})}})},wr=a.ikp("label",{_id:"aiChatForm__FieldLabel"}),Yi=t=>{const{field:e}=B.useFormField();return n.jsx(wr,{"data-required":h.dataAttr(e.isRequired),htmlFor:e.name,children:e.label,...t})},Lr=a.ikp("input",{_id:"aiChatForm__FieldText",type:"text"}),G=t=>{const{field:e,error:i,fieldProps:{onChange:r,onBlur:s,...o},autoFocus:d}=B.useFormField(),{onChange:c,onBlur:m,...l}=t;return n.jsx(Lr,{id:e.name,autoFocus:d,placeholder:"placeholder"in e?e.placeholder:void 0,"data-invalid":h.dataAttr(!!i),onChange:u.composeEventHandlers(c,r),onBlur:u.composeEventHandlers(m,s),...o,...l})},Ji=a.ikp(G,{_id:"aiChatForm__FieldEmail",type:"email"}),Dr=a.ikp("input",{_id:"aiChatForm__FieldFile",type:"file",multiple:!0}),Xi=t=>{const{field:e,error:i,fieldProps:{value:r,onChange:s,onBlur:o,...d},autoFocus:c}=B.useFormField(),{onChange:m,onBlur:l,...p}=t,b=k=>{const y=k.target.files;s(y)};return n.jsx(Dr,{id:e.name,autoFocus:c,"data-value":r,"data-invalid":h.dataAttr(!!i),...p,...d,onChange:u.composeEventHandlers(m,b),onBlur:u.composeEventHandlers(l,o)})},Zi=a.ikp(G,{_id:"aiChatForm__FieldTextArea",type:"textarea",asChild:!0,children:n.jsx(ie,{maxRows:8})}),Or=a.ikp(K.Root,{_id:"aiChatForm__FieldCheckbox"}),ea=t=>{const{field:e,error:i,fieldProps:r,autoFocus:s}=B.useFormField(),{onCheckedChange:o,...d}=t;return n.jsx(Or,{id:e.name,name:e.name,autoFocus:s,"data-invalid":h.dataAttr(!!i),checked:r.value,onCheckedChange:u.composeEventHandlers(o,r.onChange),...d})},ta=a.ikp(K.Indicator,{_id:"aiChatForm__FieldCheckboxIndicator",children:n.jsx(be.CheckboxIcon,{})}),qr=a.ikp(I.Root,{_id:"aiChatForm__FieldSelect"}),ia=t=>{const{field:e,error:i,fieldProps:r}=B.useFormField(),{onValueChange:s,...o}=t;return n.jsx(qr,{name:e.name,"data-invalid":h.dataAttr(!!i),value:r.value,onValueChange:u.composeEventHandlers(s,r.onChange),...o})},aa=a.ikp(I.Trigger,{_id:"aiChatForm__FieldSelect__Trigger"}),Rr=a.ikp(I.Value,{_id:"aiChatForm__FieldSelect__Value"}),na=t=>{const{field:e}=B.useFormField();return n.jsx(Rr,{placeholder:"placeholder"in e?e.placeholder:void 0,...t})},ra=a.ikp(I.Icon,{_id:"aiChatForm__FieldSelect__Icon",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuChevronDown"}})}),sa=a.ikp(I.Content,{_id:"aiChatForm__FieldSelect__Content",position:"popper"}),oa=a.ikp(I.Viewport,{_id:"aiChatForm__FieldSelect__Viewport"}),da=a.ikp(I.Item,{_id:"aiChatForm__FieldSelect__Item"}),ca=a.ikp(I.ItemText,{_id:"aiChatForm__FieldSelect__ItemText"}),ma=a.ikp(I.ItemIndicator,{_id:"aiChatForm__FieldSelect__ItemIndicator",asChild:!0,children:n.jsx(x.BuiltInIconRenderer,{iconSettings:{builtIn:"LuCheck"}})}),Wr=a.ikp("span",{_id:"aiChatForm__FieldError"}),la=t=>{const{error:e}=B.useFormField();return e?n.jsx(Wr,{children:e.message?.toString(),...t}):null},Nr=a.ikp("span",{_id:"aiChatForm__Error"}),ha=t=>{const{formError:e}=A.useChatForm();return e?n.jsx(Nr,{children:e.message,...t}):null},ua=a.ikp("div",{_id:"aiChatForm__Footer"}),$r=a.ikp("button",{_id:"aiChatForm__Cancel",children:"Cancel"}),Ca=t=>{const{onClick:e,...i}=t,{closeForm:r}=A.useChatForm();return n.jsx($r,{onClick:u.composeEventHandlers(e,r),...i})},Qr=a.ikp("button",{_id:"aiChatForm__Submit",children:"Submit",type:"submit"}),pa=t=>{const{onClick:e,...i}=t,{isSubmitting:r}=A.useChatForm();return n.jsx(Qr,{disabled:r,...i})},Vr=a.ikp("div",{_id:"aiChatForm__Success"}),va=t=>{const{isSuccess:e}=A.useChatForm();return e?n.jsx(Vr,{...t}):null},Ur=a.ikp("h2",{_id:"aiChatForm__SuccessHeading"}),ba=t=>{const{form:e}=A.useChatForm();return n.jsx(Ur,{children:e?.successView.heading,...t})},Kr=a.ikp(ae.Markdown,{_id:"aiChatForm__SuccessMessage"}),ga=t=>{const{form:e}=A.useChatForm();return n.jsx(Kr,{children:e?.successView.message,...t})},zr=a.ikp("button",{_id:"aiChatForm__SuccessButton"}),Pa=t=>{const{onClick:e,...i}=t,{form:r,closeForm:s}=A.useChatForm(),o=r?.successView?.doneButton;if(!o)return null;const d=o.icon&&n.jsx(x.BuiltInIconRenderer,{iconSettings:o.icon}),c=o.label;return n.jsx(zr,{onClick:u.composeEventHandlers(e,s),children:n.jsxs(n.Fragment,{children:[d,c]}),...i})};exports.Provider=g.ChatProvider;exports.ActionBar=pi;exports.Actions=vi;exports.AttachmentsBar=Dt;exports.AttachmentsBarActions=$t;exports.AttachmentsBarAttachment=qt;exports.AttachmentsBarAttachmentDelete=Nt;exports.AttachmentsBarAttachmentIcon=Rt;exports.AttachmentsBarAttachmentTitle=Wt;exports.AttachmentsBarForm=ri;exports.AttachmentsBarFormContent=mi;exports.AttachmentsBarFormContentError=ui;exports.AttachmentsBarFormContentInput=hi;exports.AttachmentsBarFormContentLabel=li;exports.AttachmentsBarFormSubmitButton=Ci;exports.AttachmentsBarFormTitle=si;exports.AttachmentsBarFormTitleError=ci;exports.AttachmentsBarFormTitleInput=di;exports.AttachmentsBarFormTitleLabel=oi;exports.AttachmentsBarInfoTip=Qt;exports.AttachmentsBarInfoTipArrow=me;exports.AttachmentsBarInfoTipIcon=Vt;exports.AttachmentsBarInfoTipText=Ut;exports.AttachmentsBarInput=zt;exports.AttachmentsBarInputIcon=Gt;exports.AttachmentsBarInputs=Kt;exports.AttachmentsBarList=Ot;exports.AttachmentsBarModal=Yt;exports.AttachmentsBarModalBody=ni;exports.AttachmentsBarModalClose=ai;exports.AttachmentsBarModalContent=Xt;exports.AttachmentsBarModalDescription=ti;exports.AttachmentsBarModalHeader=Zt;exports.AttachmentsBarModalHeading=ei;exports.AttachmentsBarModalHelp=ii;exports.AttachmentsBarModalOverlay=Jt;exports.ChatAction=z;exports.ChatActionFeedback=Ai;exports.ChatActionLabel=le;exports.ChatHelpAction=Fi;exports.Content=Ie;exports.ContentScrollArea=Me;exports.ContentScrollAreaCorner=Be;exports.ContentScrollAreaScrollbar=xe;exports.ContentScrollAreaThumb=fe;exports.ContentScrollAreaViewport=Se;exports.ConversationLoading=_e;exports.Disclaimer=je;exports.DisclaimerArrow=De;exports.DisclaimerContent=we;exports.DisclaimerLabel=ye;exports.DisclaimerText=Le;exports.DisclaimerTrigger=He;exports.EmbeddedChatPrimitiveActionBar=pi;exports.EmbeddedChatPrimitiveActions=vi;exports.EmbeddedChatPrimitiveAttachmentsBar=Dt;exports.EmbeddedChatPrimitiveAttachmentsBarActions=$t;exports.EmbeddedChatPrimitiveAttachmentsBarAttachment=qt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentDelete=Nt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentIcon=Rt;exports.EmbeddedChatPrimitiveAttachmentsBarAttachmentTitle=Wt;exports.EmbeddedChatPrimitiveAttachmentsBarForm=ri;exports.EmbeddedChatPrimitiveAttachmentsBarFormContent=mi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentError=ui;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentInput=hi;exports.EmbeddedChatPrimitiveAttachmentsBarFormContentLabel=li;exports.EmbeddedChatPrimitiveAttachmentsBarFormSubmitButton=Ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitle=si;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleError=ci;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleInput=di;exports.EmbeddedChatPrimitiveAttachmentsBarFormTitleLabel=oi;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTip=Qt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipArrow=me;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipIcon=Vt;exports.EmbeddedChatPrimitiveAttachmentsBarInfoTipText=Ut;exports.EmbeddedChatPrimitiveAttachmentsBarInput=zt;exports.EmbeddedChatPrimitiveAttachmentsBarInputIcon=Gt;exports.EmbeddedChatPrimitiveAttachmentsBarInputs=Kt;exports.EmbeddedChatPrimitiveAttachmentsBarList=Ot;exports.EmbeddedChatPrimitiveAttachmentsBarModal=Yt;exports.EmbeddedChatPrimitiveAttachmentsBarModalBody=ni;exports.EmbeddedChatPrimitiveAttachmentsBarModalClose=ai;exports.EmbeddedChatPrimitiveAttachmentsBarModalContent=Xt;exports.EmbeddedChatPrimitiveAttachmentsBarModalDescription=ti;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeader=Zt;exports.EmbeddedChatPrimitiveAttachmentsBarModalHeading=ei;exports.EmbeddedChatPrimitiveAttachmentsBarModalHelp=ii;exports.EmbeddedChatPrimitiveAttachmentsBarModalOverlay=Jt;exports.EmbeddedChatPrimitiveChatAction=z;exports.EmbeddedChatPrimitiveChatActionFeedback=Ai;exports.EmbeddedChatPrimitiveChatActionLabel=le;exports.EmbeddedChatPrimitiveChatHelpAction=Fi;exports.EmbeddedChatPrimitiveContent=Ie;exports.EmbeddedChatPrimitiveContentScrollArea=Me;exports.EmbeddedChatPrimitiveContentScrollAreaCorner=Be;exports.EmbeddedChatPrimitiveContentScrollAreaScrollbar=xe;exports.EmbeddedChatPrimitiveContentScrollAreaThumb=fe;exports.EmbeddedChatPrimitiveContentScrollAreaViewport=Se;exports.EmbeddedChatPrimitiveConversationLoading=_e;exports.EmbeddedChatPrimitiveDisclaimer=je;exports.EmbeddedChatPrimitiveDisclaimerArrow=De;exports.EmbeddedChatPrimitiveDisclaimerContent=we;exports.EmbeddedChatPrimitiveDisclaimerLabel=ye;exports.EmbeddedChatPrimitiveDisclaimerText=Le;exports.EmbeddedChatPrimitiveDisclaimerTrigger=He;exports.EmbeddedChatPrimitiveExampleQuestion=We;exports.EmbeddedChatPrimitiveExampleQuestionButton=Ne;exports.EmbeddedChatPrimitiveExampleQuestions=Oe;exports.EmbeddedChatPrimitiveExampleQuestionsLabel=qe;exports.EmbeddedChatPrimitiveExampleQuestionsList=Re;exports.EmbeddedChatPrimitiveFeedbackForm=wi;exports.EmbeddedChatPrimitiveFeedbackItem=Li;exports.EmbeddedChatPrimitiveFeedbackItemCheckbox=Di;exports.EmbeddedChatPrimitiveFeedbackItemCheckboxIndicator=Oi;exports.EmbeddedChatPrimitiveFeedbackItemDescription=Ri;exports.EmbeddedChatPrimitiveFeedbackItemLabel=qi;exports.EmbeddedChatPrimitiveFeedbackModal=fi;exports.EmbeddedChatPrimitiveFeedbackModalBody=Hi;exports.EmbeddedChatPrimitiveFeedbackModalClose=yi;exports.EmbeddedChatPrimitiveFeedbackModalContent=Ti;exports.EmbeddedChatPrimitiveFeedbackModalHeader=ji;exports.EmbeddedChatPrimitiveFeedbackModalOverlay=Bi;exports.EmbeddedChatPrimitiveFeedbackSubmitButton=Wi;exports.EmbeddedChatPrimitiveFooter=Tt;exports.EmbeddedChatPrimitiveForm=$i;exports.EmbeddedChatPrimitiveFormCancel=Ca;exports.EmbeddedChatPrimitiveFormClose=Qi;exports.EmbeddedChatPrimitiveFormContent=zi;exports.EmbeddedChatPrimitiveFormDescription=Ki;exports.EmbeddedChatPrimitiveFormError=ha;exports.EmbeddedChatPrimitiveFormField=Gi;exports.EmbeddedChatPrimitiveFormFieldCheckbox=ea;exports.EmbeddedChatPrimitiveFormFieldCheckboxIndicator=ta;exports.EmbeddedChatPrimitiveFormFieldEmail=Ji;exports.EmbeddedChatPrimitiveFormFieldError=la;exports.EmbeddedChatPrimitiveFormFieldFile=Xi;exports.EmbeddedChatPrimitiveFormFieldLabel=Yi;exports.EmbeddedChatPrimitiveFormFieldSelect=ia;exports.EmbeddedChatPrimitiveFormFieldSelectContent=sa;exports.EmbeddedChatPrimitiveFormFieldSelectIcon=ra;exports.EmbeddedChatPrimitiveFormFieldSelectItem=da;exports.EmbeddedChatPrimitiveFormFieldSelectItemIndicator=ma;exports.EmbeddedChatPrimitiveFormFieldSelectItemText=ca;exports.EmbeddedChatPrimitiveFormFieldSelectTrigger=aa;exports.EmbeddedChatPrimitiveFormFieldSelectValue=na;exports.EmbeddedChatPrimitiveFormFieldSelectViewport=oa;exports.EmbeddedChatPrimitiveFormFieldText=G;exports.EmbeddedChatPrimitiveFormFieldTextArea=Zi;exports.EmbeddedChatPrimitiveFormFooter=ua;exports.EmbeddedChatPrimitiveFormHeader=Vi;exports.EmbeddedChatPrimitiveFormHeading=Ui;exports.EmbeddedChatPrimitiveFormSubmit=pa;exports.EmbeddedChatPrimitiveFormSuccess=va;exports.EmbeddedChatPrimitiveFormSuccessButton=Pa;exports.EmbeddedChatPrimitiveFormSuccessHeading=ba;exports.EmbeddedChatPrimitiveFormSuccessMessage=ga;exports.EmbeddedChatPrimitiveFormWrapper=Ni;exports.EmbeddedChatPrimitiveHeaderToolbar=Ee;exports.EmbeddedChatPrimitiveHelpActions=Ei;exports.EmbeddedChatPrimitiveHelpActionsMenu=Ii;exports.EmbeddedChatPrimitiveHelpActionsMenuArrow=Mi;exports.EmbeddedChatPrimitiveHelpActionsMenuItem=Si;exports.EmbeddedChatPrimitiveHelpActionsMenuItemIcon=xi;exports.EmbeddedChatPrimitiveHelpActionsTrigger=ki;exports.EmbeddedChatPrimitiveInput=Ht;exports.EmbeddedChatPrimitiveInputFieldset=jt;exports.EmbeddedChatPrimitiveInputGroup=yt;exports.EmbeddedChatPrimitiveIntroMessageWrapper=ze;exports.EmbeddedChatPrimitiveMessage=pt;exports.EmbeddedChatPrimitiveMessageAction=Pt;exports.EmbeddedChatPrimitiveMessageAttachments=nt;exports.EmbeddedChatPrimitiveMessageAttachmentsItem=st;exports.EmbeddedChatPrimitiveMessageAttachmentsItemIcon=ot;exports.EmbeddedChatPrimitiveMessageAttachmentsItemTitle=dt;exports.EmbeddedChatPrimitiveMessageAttachmentsList=rt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreview=ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewBody=Ct;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewClose=ut;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewContent=lt;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewHeader=ht;exports.EmbeddedChatPrimitiveMessageAttachmentsPreviewOverlay=mt;exports.EmbeddedChatPrimitiveMessageAvatar=Je;exports.EmbeddedChatPrimitiveMessageAvatarContent=Xe;exports.EmbeddedChatPrimitiveMessageAvatarFallback=Ze;exports.EmbeddedChatPrimitiveMessageAvatarImage=et;exports.EmbeddedChatPrimitiveMessageContent=at;exports.EmbeddedChatPrimitiveMessageContentWrapper=it;exports.EmbeddedChatPrimitiveMessageHeader=Ge;exports.EmbeddedChatPrimitiveMessageLoading=Ye;exports.EmbeddedChatPrimitiveMessageName=tt;exports.EmbeddedChatPrimitiveMessageSourceItem=Ft;exports.EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs=kt;exports.EmbeddedChatPrimitiveMessageSourceItemDescription=xt;exports.EmbeddedChatPrimitiveMessageSourceItemDescriptionPart=ft;exports.EmbeddedChatPrimitiveMessageSourceItemIcon=It;exports.EmbeddedChatPrimitiveMessageSourceItemIndicator=Bt;exports.EmbeddedChatPrimitiveMessageSourceItemTag=St;exports.EmbeddedChatPrimitiveMessageSourceItemTitle=Mt;exports.EmbeddedChatPrimitiveMessageSources=_t;exports.EmbeddedChatPrimitiveMessageSourcesHeader=At;exports.EmbeddedChatPrimitiveMessageSourcesList=Et;exports.EmbeddedChatPrimitiveMessageToolAction=gt;exports.EmbeddedChatPrimitiveMessageToolActions=bt;exports.EmbeddedChatPrimitiveMessageToolbar=vt;exports.EmbeddedChatPrimitiveMessageWrapper=ce;exports.EmbeddedChatPrimitiveMessages=Te;exports.EmbeddedChatPrimitiveRoot=Ae;exports.EmbeddedChatPrimitiveSendButton=wt;exports.EmbeddedChatPrimitiveSendButtonIcon=Lt;exports.EmbeddedChatPrimitiveTaglineBrandName=_i;exports.EmbeddedChatPrimitiveTaglineContainer=bi;exports.EmbeddedChatPrimitiveTaglineLogo=Pi;exports.EmbeddedChatPrimitiveTaglineText=gi;exports.EmbeddedChatPrimitiveToolbarHeader=ke;exports.EmbeddedChatPrimitiveToolbarHeaderWrapper=Fe;exports.EmbeddedChatPrimitiveWorkflow=Ue;exports.EmbeddedChatPrimitiveWorkflowIcon=Ke;exports.EmbeddedChatPrimitiveWorkflows=$e;exports.EmbeddedChatPrimitiveWorkflowsLabel=Qe;exports.EmbeddedChatPrimitiveWorkflowsList=Ve;exports.EmbeddedChatPrimitiveWrapper=Pe;exports.ExampleQuestion=We;exports.ExampleQuestionButton=Ne;exports.ExampleQuestions=Oe;exports.ExampleQuestionsLabel=qe;exports.ExampleQuestionsList=Re;exports.FeedbackForm=wi;exports.FeedbackItem=Li;exports.FeedbackItemCheckbox=Di;exports.FeedbackItemCheckboxIndicator=Oi;exports.FeedbackItemDescription=Ri;exports.FeedbackItemLabel=qi;exports.FeedbackModal=fi;exports.FeedbackModalBody=Hi;exports.FeedbackModalClose=yi;exports.FeedbackModalContent=Ti;exports.FeedbackModalHeader=ji;exports.FeedbackModalOverlay=Bi;exports.FeedbackSubmitButton=Wi;exports.Footer=Tt;exports.Form=$i;exports.FormCancel=Ca;exports.FormClose=Qi;exports.FormContent=zi;exports.FormDescription=Ki;exports.FormError=ha;exports.FormField=Gi;exports.FormFieldCheckbox=ea;exports.FormFieldCheckboxIndicator=ta;exports.FormFieldEmail=Ji;exports.FormFieldError=la;exports.FormFieldFile=Xi;exports.FormFieldLabel=Yi;exports.FormFieldSelect=ia;exports.FormFieldSelectContent=sa;exports.FormFieldSelectIcon=ra;exports.FormFieldSelectItem=da;exports.FormFieldSelectItemIndicator=ma;exports.FormFieldSelectItemText=ca;exports.FormFieldSelectTrigger=aa;exports.FormFieldSelectValue=na;exports.FormFieldSelectViewport=oa;exports.FormFieldText=G;exports.FormFieldTextArea=Zi;exports.FormFooter=ua;exports.FormHeader=Vi;exports.FormHeading=Ui;exports.FormSubmit=pa;exports.FormSuccess=va;exports.FormSuccessButton=Pa;exports.FormSuccessHeading=ba;exports.FormSuccessMessage=ga;exports.FormWrapper=Ni;exports.Header=Ua;exports.HeaderToolbar=Ee;exports.HeaderToolbarWrapper=Fe;exports.HelpActions=Ei;exports.HelpActionsMenu=Ii;exports.HelpActionsMenuArrow=Mi;exports.HelpActionsMenuItem=Si;exports.HelpActionsMenuItemIcon=xi;exports.HelpActionsTrigger=ki;exports.Input=Ht;exports.InputFieldset=jt;exports.InputGroup=yt;exports.IntroMessageWrapper=ze;exports.Message=pt;exports.MessageAction=Pt;exports.MessageAttachments=nt;exports.MessageAttachmentsItem=st;exports.MessageAttachmentsItemIcon=ot;exports.MessageAttachmentsItemTitle=dt;exports.MessageAttachmentsList=rt;exports.MessageAttachmentsPreview=ct;exports.MessageAttachmentsPreviewBody=Ct;exports.MessageAttachmentsPreviewClose=ut;exports.MessageAttachmentsPreviewContent=lt;exports.MessageAttachmentsPreviewHeader=ht;exports.MessageAttachmentsPreviewOverlay=mt;exports.MessageAvatar=Je;exports.MessageAvatarContent=Xe;exports.MessageAvatarFallback=Ze;exports.MessageAvatarImage=et;exports.MessageContent=at;exports.MessageContentWrapper=it;exports.MessageHeader=Ge;exports.MessageLoading=Ye;exports.MessageName=tt;exports.MessageSourceItem=Ft;exports.MessageSourceItemBreadcrumbIcon=qn;exports.MessageSourceItemBreadcrumbs=kt;exports.MessageSourceItemDescription=xt;exports.MessageSourceItemDescriptionPart=ft;exports.MessageSourceItemIcon=It;exports.MessageSourceItemIndicator=Bt;exports.MessageSourceItemTag=St;exports.MessageSourceItemTitle=Mt;exports.MessageSources=_t;exports.MessageSourcesHeader=At;exports.MessageSourcesList=Et;exports.MessageToolAction=gt;exports.MessageToolActions=bt;exports.MessageToolbar=vt;exports.MessageWrapper=ce;exports.Messages=Te;exports.Root=Ae;exports.SendButton=wt;exports.SendButtonIcon=Lt;exports.TaglineBrandName=_i;exports.TaglineContainer=bi;exports.TaglineLogo=Pi;exports.TaglineText=gi;exports.ToolbarHeader=ke;exports.Workflow=Ue;exports.WorkflowIcon=Ke;exports.Workflows=$e;exports.WorkflowsLabel=Qe;exports.WorkflowsList=Ve;exports.Wrapper=Pe;
|