import{a as p,b as C}from"./chunk-F4ENGDCK.mjs";import"./chunk-LYT2GSGQ.mjs";import{a as l,b as q}from"./chunk-VNGDFILB.mjs";import{a as M,b as g}from"./chunk-4CC4CF3L.mjs";import"./chunk-VAX7AB37.mjs";import h,{Fragment as U,memo as E,useMemo as H}from"react";import{array as T,custom as G,object as J,optional as w,pipe as B,readonly as b,safeParse as K}from"valibot";var Q=B(J({children:w(M()),middleware:w(B(T(G(e=>typeof e=="function")),b()))}),b()),V=w(T(G(e=>e[p]===p)));function Y(e){let{children:r,middleware:t}=g(Q,e);return H(()=>{K(V,t).success||console.warn('botframework-webchat: "middleware" props passed to <DecoratorComposer> should be created using createXXXMiddleware() functions.',{middleware:t})},[t]),t?h.createElement(q,{middleware:t,priority:"normal"},r):h.createElement(U,null,r)}var Z=E(Y);import{useContext as _}from"react";function I(e){let r=_(e)?.request;if(!r)throw new Error(`useDecoratorRequest must be used within a ${e}Provider`);return r}import{getActivityLivestreamingMetadata as ce}from"botframework-webchat-core";import se,{memo as ye,useMemo as ue}from"react";import ee,{Fragment as re,memo as te}from"react";function oe({children:e}){return ee.createElement(re,null,e)}var m=te(oe);import y,{memo as D,useContext as N,useMemo as P}from"react";import{createChainOfResponsibility as ie}from"react-chain-of-responsibility";var ae=ie();function x(e,r,t=m){function a(d,o){function i(c){let n=N(r)?.request;return y.createElement(d,{...c,Next:o,request:n})}return i.displayName=`ChainNext(Next ${e})`,D(i)}function u(d){let o=i=>i!==e?!1:c=>()=>{let n=c(void 0);return n&&a(d,n)};return o[p]=p,o}let{Provider:v,useBuildComponentCallback:z}=ae;function R(d){let o=z(),i=P(()=>o(void 0,{fallbackComponent:t}),[o]);return i&&y.createElement(i,{...d})}R.displayName=`DecoratorChain(Chain ${e})`;let L=D(R);function A(d){let{request:o}=d,{middleware:i}=N(l),c=P(()=>i.map(s=>s(e)).filter(s=>s).map(s=>()=>s),[i]),n=P(()=>({request:o}),[o]);return y.createElement(r.Provider,{value:n},y.createElement(v,{init:e,middleware:c},y.createElement(L,{...d})))}return A.displayName=`DecoratorProxy(Decorator ${e})`,{createMiddleware:u,Proxy:D(A),"~types":void 0}}import{createContext as de}from"react";var ne=de(Object.freeze({request:Object.freeze({from:void 0,livestreamingState:void 0})})),f=ne;var pe=x("activity border",f),{createMiddleware:F,Proxy:k}=pe;var le=["bot","channel","user",void 0];function me({activity:e,children:r}){let t=ue(()=>{let{type:a}=ce(e)||{};return{from:le.includes(e?.from?.role)?e?.from?.role:void 0,livestreamingState:a==="final activity"?"completing":a==="informative message"?"preparing":a==="interim activity"?"ongoing":void 0}},[e]);return se.createElement(k,{request:t},r)}var fe=ye(me);import j,{memo as we,useContext as De,useMemo as X}from"react";var ve=C("activity grouping"),{createMiddleware:S,extractMiddleware:W,Provider:O,Proxy:$}=ve;function Pe({activities:e,children:r,groupingName:t}){let a=X(()=>({groupingName:t}),[t]),{middleware:u}=De(l),v=X(()=>W(u),[u]);return j.createElement(O,{middleware:v},j.createElement($,{activities:e,fallbackComponent:m,request:a},r))}var xe=we(Pe);export{fe as ActivityBorderDecorator,f as ActivityBorderDecoratorRequest,xe as ActivityGroupingDecorator,Z as DecoratorComposer,F as createActivityBorderMiddleware,S as createActivityGroupingMiddleware,I as useDecoratorRequest};
//# sourceMappingURL=botframework-webchat-api.decorator.mjs.map