@rustic-ai/ui-components 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/elementRenderer/elementRenderer.d.ts +1 -1
- package/dist/components/elementRenderer/elementRenderer.d.ts.map +1 -1
- package/dist/components/elementRenderer/index.d.ts +1 -0
- package/dist/components/elementRenderer/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/baseInput/baseInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/messageCanvas/index.d.ts +1 -0
- package/dist/components/messageCanvas/index.d.ts.map +1 -1
- package/dist/components/messageSpace/index.d.ts +1 -0
- package/dist/components/messageSpace/index.d.ts.map +1 -1
- package/dist/components/types.d.ts +6 -0
- package/dist/components/types.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elementRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/elementRenderer/elementRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE9E,
|
|
1
|
+
{"version":3,"file":"elementRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/elementRenderer/elementRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE9E,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,eAAe,CAAA;IACpB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,iBAAiB,EAAE,YAAY,CAAA;CAChC;AAED,QAAA,MAAM,eAAe,GAAI,OAAO,oBAAoB,4CAyBnD,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/elementRenderer/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,eAAe,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/elementRenderer/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,eAAe,eAAe,CAAA;AAE9B,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -37,7 +37,7 @@ import VegaLiteViz from './visualization/vegaLiteViz/vegaLiteViz';
|
|
|
37
37
|
import Weather from './weather/weather';
|
|
38
38
|
export { Action, ChatCompletion, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Icon, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageArchive, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PlotlyGraph, PopoverMenu, PromptBuilder, Prompts, Question, Sound, StreamingText, Table, Text, TextInput, TextToSpeech, Timestamp, UniformsForm, Uploader, VegaLiteViz, Video, Weather, };
|
|
39
39
|
export * from '../rusticTheme';
|
|
40
|
-
export { getCombinedMessages } from './helper';
|
|
40
|
+
export { formatDateAndTime, getCombinedMessages } from './helper';
|
|
41
41
|
export type * from './types';
|
|
42
42
|
export { ParticipantRole, ParticipantType } from './types';
|
|
43
43
|
export type * from './visualization/mermaidViz/mermaidViz.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAA;AAC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,OAAO,EACP,QAAQ,EACR,KAAK,EACL,aAAa,EACb,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,OAAO,GACR,CAAA;AAED,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACjE,mBAAmB,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC1D,mBAAmB,6CAA6C,CAAA;AAChE,mBAAmB,+CAA+C,CAAA;AAClE,mBAAmB,+CAA+C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,oBAAoB,CAAA;AAmB3B,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,oBAAoB,CAAA;AAmB3B,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;AAufvE,QAAA,MAAM,SAAS;;wCAA+B,CAAA;AAE9C,eAAe,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e,t,n={9767:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(8732),o=(n(2015),function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:o({},t),children:e.name})}},3110:(e,t,n)=>{n.d(t,{default:()=>r});const r=n(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var a=Object.create(null);o.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var c=2&r&&n;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>i[e]=()=>n[e]);return i.default=()=>n,o.d(a,i),a},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};o.r(a),o.d(a,{MessageProcessStatus:()=>Se,ParticipantRole:()=>Oe,ParticipantType:()=>Ce,default:()=>Fe});var i=o(8732);const c=require("@mui/material/Box");var l=o.n(c);const s=require("@mui/material/styles");var u=o(2015);const d=require("uuid");var p;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const f=require("@mui/material/Avatar");var m=o.n(f);const h=require("@mui/material/CircularProgress");var v=o.n(h);const g=require("@mui/material/IconButton");var x=o.n(g);const b=require("@mui/material/InputAdornment");var y=o.n(b);const j=require("@mui/material/MenuItem");var w=o.n(j);const S=require("@mui/material/MenuList");var O=o.n(S);const C=require("@mui/material/Popover");var N=o.n(C);const k=require("@mui/material/TextField");var F=o.n(k);const P=require("@mui/material/Tooltip");var E=o.n(P);const I=require("@mui/material/Typography");var q=o.n(I),T=o(8342),A=o(9767);const R=function(e){var t=(0,s.useTheme)(),n=(0,u.useRef)(null),r=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],l=a[1],d={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function p(){l(!1)}function f(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),p()}return(0,u.useEffect)(function(){r.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then(function(n){var o=new(0,n.Picker)({dataSource:e.dataSource}),a="dark"===t.palette.mode?"dark":"light";o.classList.add(a),Object.keys(d).forEach(function(e){o.style.setProperty(e,d[e])}),r.current=o}).catch(function(e){console.error("Failed to load emoji picker",e)})},[]),(0,u.useEffect)(function(){return r.current&&r.current.addEventListener("emoji-click",f),function(){var e;null===(e=r.current)||void 0===e||e.removeEventListener("emoji-click",f)}},[c,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(E(),{title:"Emoji",children:(0,i.jsx)(x(),{size:"small",ref:n,onClick:function(){l(function(e){return!e})},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(A.A,{name:"Mood"})})}),r.current&&(0,i.jsx)(N(),{open:c,anchorEl:n.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&r.current&&!e.contains(r.current)&&e.appendChild(r.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function L(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function M(e){return(0,i.jsxs)(l(),{className:"rustic-participant-profile",children:[(0,i.jsx)(m(),{src:e.icon,className:"rustic-participant-avatar"}),(0,i.jsx)(q(),{variant:"body1Bold",children:e.displayName})]})}function U(e){var t=e.items,n=e.isOpen,r=e.onClose,o=e.onSelect,a=e.renderItem,c=e.anchorEl,l=e.selectedIndex;return(0,i.jsx)(N(),{disableAutoFocus:!0,open:n&&t.length>0,anchorEl:c,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,i.jsx)(O(),{children:t.map(function(e,t){return(0,i.jsx)(w(),{onClick:function(){return o(e)},selected:t===l,children:a(e)},t)})})})}const _=(0,u.forwardRef)(function(e,t){var n=e.multiline,r=void 0===n||n,o=e.fullWidth,a=void 0===o||o,c=e.maxRows,s=void 0===c?6:c,p=e.enableSpeechToText,f=void 0!==p&&p,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,u.useState)(""),j=b[0],w=b[1],S=(0,u.useState)(!1),O=S[0],C=S[1],N=(0,u.useState)(!1),k=N[0],P=N[1],I=(0,u.useState)(!1),_=I[0],z=I[1],H=(0,u.useState)(""),B=H[0],$=H[1],W=(0,u.useState)([]),K=W[0],G=W[1],Q=(0,u.useState)(!1),V=Q[0],Y=Q[1],Z=(0,u.useState)(0),J=Z[0],X=Z[1],ee=(0,u.useRef)(null),te=new T.Database({dataSource:g.emojiDataSource}),ne=!j.trim().length,re="".concat(O?"Stop":"Start"," speech to text"),oe=k?"primary.main":"primary.light",ae=O?"error.main":oe,ie=O?"stop_circle":"speech_to_text",ce=(0,u.useState)([]),le=ce[0],se=ce[1],ue=(0,u.useState)(!1),de=ue[0],pe=ue[1],fe=f&&"undefined"!=typeof window&&!!window.webkitSpeechRecognition;function me(){return"boolean"==typeof g.isSendEnabled?!g.isSendEnabled:ne}function he(e,t){if(ee.current){var n=ee.current,r=n.selectionStart,o=n.selectionEnd;if("number"==typeof r&&"number"==typeof o){var a,i=j||"",c=i.substring(0,r),l=i.substring(o),s=void 0;t?(s=c.replace(t,e)+l,a=c.replace(t,e).length):(s=c+e+l,a=r+e.length),w(s),setTimeout(function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(a,a)},0)}}}function ve(e){he("@".concat(e," "),/@(\w*)$/),se([])}function ge(e,t){void 0===t&&(t=!1),he(e,t?/:(\w+)$/:void 0),Y(!1)}var xe=_?(0,i.jsx)(v(),{size:24}):(0,i.jsx)(E(),{title:re,children:(0,i.jsx)(x(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,O?(e.stop(),z(!0),C(!1)):(e.start(),$(""),C(!0)),e.onstart=function(){C(!0)},e.onresult=function(e){var t,n=e.results[0][0].transcript;j.length>0?w(j+" "+n):w(n),null===(t=ee.current)||void 0===t||t.focus(),C(!1)},e.onerror=function(e){var t=D[e.error];$(t),C(!1)},e.onend=function(){z(!1),C(!1)}},size:"small",sx:{color:ae,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(A.A,{name:ie})})});function be(){var e,t,n=(new Date).toISOString(),r={id:(0,d.v4)(),timestamp:n,sender:g.sender,conversationId:g.conversationId,format:"chatCompletionRequest",data:{text:j},inReplyTo:null===(e=g.lastMsg)||void 0===e?void 0:e.id,messageHistory:null===(t=g.lastMsg)||void 0===t?void 0:t.messageHistory};g.send(r),w(""),$("")}return(0,i.jsxs)(l(),{className:"rustic-base-input",ref:t,children:[(0,i.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(l(),{className:"rustic-error-container",children:(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:B})}),(0,i.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:k?"secondary.main":"action.disabled",backgroundColor:"background.paper"},children:[K.length>0&&ee.current&&(0,i.jsx)(U,{anchorEl:ee.current,items:K.filter(function(e){return"unicode"in e}),isOpen:V,onClose:function(){Y(!1),X(0)},onSelect:function(e){return ge(e.unicode,!0)},selectedIndex:J,renderItem:L}),le.length>0&&ee.current&&(0,i.jsx)(U,{anchorEl:ee.current,items:le,isOpen:de,onClose:function(){pe(!1),X(0)},onSelect:function(e){return ve(e.displayName)},renderItem:M,selectedIndex:J}),(0,i.jsx)(F(),{className:"rustic-text-field",variant:"outlined",value:j,label:g.label,placeholder:g.placeholder,maxRows:s,multiline:r,fullWidth:a,onKeyDown:function(e){var t,n="ArrowDown"===e.key,r="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),V&&K.length>0&&"unicode"in K[J]?ge(K[J].unicode,!0):de&&le.length>0?ve(le[J].displayName):e.shiftKey||me()||be();else{if(n||r)return e.preventDefault(),t=n?1:-1,void(V?X(function(e){return(e+t+K.length)%K.length}):de&&X(function(e){return(e+t+le.length)%le.length}));0!==J&&X(0)}},onChange:function(e){$("");var t=e.target.value;w(t),function(e){var t=e.match(/@(\w*)$/);if(t&&g.getMembers){var n=t[1].toLowerCase();g.getMembers().then(function(e){var t=e.filter(function(e){return e.displayName.toLowerCase().startsWith(n)});se(t),t.length>0?pe(!0):pe(!1)})}else se([])}(t);var n,r=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(r){var a=r[0].replace(/:/g,"");te.getEmojiByShortcode(a).then(function(e){if(e&&"unicode"in e){var n=t.replace(r[0],e.unicode);w(n)}else w(t)}).catch(function(){w(t)}),Y(!1)}else o?(n=o[0].replace(":",""),te.getEmojiBySearchQuery(n).then(function(e){e.length?(G(e.slice(0,h)),Y(!0)):(G([]),Y(!1))}).catch(function(){G([]),Y(!1)})):Y(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(y(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(R,{dataSource:g.emojiDataSource,onEmojiClick:ge,buttonColor:oe}),fe&&xe]})},inputLabel:{className:k?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(l(),{className:"rustic-input-actions",children:[g.children,(0,i.jsx)(E(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(x(),{"aria-label":"send message",onClick:be,disabled:me(),color:"secondary",children:(0,i.jsx)(A.A,{name:"send"})})})})]})]})}),z=require("@mui/material/LinearProgress");var H=o.n(z);const B=require("axios");var $=o.n(B);const W=require("react-dom"),K=require("@mui/material/Card");var G=o.n(K);const Q=require("@mui/material/Modal");var V=o.n(Q);const Y=require("@mui/material/useMediaQuery");var Z=o.n(Y);const J=require("@mui/system/Stack");var X=o.n(J);const ee=require("@mui/system/useTheme");var te=o.n(ee);const ne=require("pdfjs-dist"),re=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},n=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(E(),{title:n.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(x(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(A.A,{name:n.symbol})})})})};var oe={pdf:function(e){var t,n=(0,u.useRef)(null),r=(0,u.useState)(1),o=r[0],a=r[1],c=(0,u.useState)(1),s=c[0],d=c[1],p=(0,u.useState)(1),f=p[0],m=p[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=te()(),w=Z()(j.breakpoints.down("sm")),S=Z()(j.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,u.useState)(function(){return w?.5:S?1:1.5}),C=O[0],N=O[1];function k(t){ne.getDocument({url:e.url,httpHeaders:t}).promise.then(function(e){d(e.numPages),function(e){e.getPage(o).then(function(e){var t=e.getViewport({scale:C}),r=n.current;if(r){var o=r.getContext("2d");if(o){var a=window.devicePixelRatio||1;r.style.width="".concat(t.width,"px"),r.style.height="".concat(t.height,"px"),r.width=t.width*a,r.height=t.height*a;var i={canvasContext:o,viewport:t,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(i);y(c),c.promise.then(function(){y(void 0)}).catch(function(e){console.error(e)})}}})}(e)}).catch(function(){g(!0)})}return(0,u.useEffect)(function(){ne.GlobalWorkerOptions.workerSrc||(ne.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ne.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then(function(e){return k(e.headers)}).catch(function(){return g(!0)}):k()},[e.url,o,C]),v?(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(G(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(re,{action:"zoomOut",onClick:function(){N(function(e){return Math.max(e-.2,.2)})}}),(0,i.jsx)(re,{action:"zoomIn",onClick:function(){N(function(e){return e+.2})}})]}),(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:n})})}),(0,i.jsxs)(X(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(re,{action:"previousPage",onClick:function(){o>1&&(a(o-1),m(o-1))},isDisabled:1===o}),(0,i.jsx)(q(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(F(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);m(t),!isNaN(t)&&t>=1&&t<=s&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(q(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,i.jsx)(re,{action:"nextPage",onClick:function(){o<s&&(a(o+1),m(o+1))},isDisabled:o===s})]})]})}};function ae(e){var t=e.supportedViewers,n=void 0===t?oe:t,r=e.showFullName,o=void 0===r||r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["supportedViewers","showFullName"]),c=(0,s.useTheme)(),l=(0,u.useState)(!1),d=l[0],p=l[1];function f(){p(!1)}var m,h,v=a.file.url&&(m=a.file.url.split("."))[m.length-1].toLowerCase(),g=v&&n?n[v]:null,b=!!g,y=b?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(o?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=o?a.file.name:(h=a.file.name).length<=15?h:h.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(G(),{className:j,variant:"outlined",sx:{boxShadow:c.shadows[1]},onClick:function(){p(!0)},children:[(0,i.jsx)(q(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:a.children})]}),b&&(0,i.jsx)(V(),{open:d,onClose:f,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(E(),{title:"Close",children:(0,i.jsx)(x(),{onClick:f,className:"rustic-close-button",children:(0,i.jsx)(A.A,{name:"close"})})}),a.file.url&&(0,i.jsx)(g,{url:a.file.url,getAuthHeaders:a.getAuthHeaders})]})})]})}var ie=o(3110);const ce=require("@mui/material"),le=require("@mui/material/Button");var se=o.n(le);const ue=require("@mui/material/Drawer");var de=o.n(ue);const pe=require("@mui/material/ListItemText");var fe=o.n(pe);const me=require("@mui/material/Menu");var he=o.n(me);const ve=require("@mui/system");var ge=function(){return ge=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ge.apply(this,arguments)};function xe(e){var t=(0,u.useState)(!1),n=t[0],r=t[1],o=(0,u.useRef)(null),a=(0,s.useTheme)(),c=(0,ce.useMediaQuery)(a.breakpoints.down("md")),l=c?de():he(),d={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(fe(),{children:(0,i.jsx)(q(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(d=ge(ge({},d),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var f=e.menuItems.map(function(e){return e.href?(0,i.jsx)(w(),{component:"a",onClick:function(){return r(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(w(),{onClick:function(t){e.onClick&&e.onClick(t),r(!1)},disabled:!e.onClick,children:p(e)},e.label)});var m,h,v=c?{}:{anchorEl:o.current};return(0,i.jsxs)(i.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),r(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},h=(0,i.jsx)(A.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(se(),ge({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(E(),{title:e.ariaLabel,children:(0,i.jsx)(x(),ge({},m,{children:e.icon?e.icon:h}))})),(0,i.jsx)(l,ge({open:n,onClose:function(){return r(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":ge(ge({},d),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:f}))]})}var be=function(){return be=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},be.apply(this,arguments)},ye=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};function je(e){for(var t=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<t.length-1;)e/=1024,n++;var r=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(r," ").concat(t[n])}const we=function(e){var t,n=(0,u.useState)([]),r=n[0],o=n[1],a=(0,u.useState)([]),c=a[0],s=a[1],p=(0,u.useState)({}),f=p[0],m=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)(function(){o([]),s([]),h.current={}},[e.messageId]);var g=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function b(e,t,n){var r;h.current=be(be({},h.current),((r={})[e]=h.current[e]--,r)),function(e,t,n){s(function(t){return ye(ye([],t,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)}),o(function(e){return e.filter(function(e){return e.id!==t})})}(e,t,n)}var y=(0,i.jsx)(l(),{className:"rustic-files rustic-padding-16",children:r.map(function(t,n){return(0,i.jsx)(ae,{file:{name:t.name},showFullName:e.showFullName,children:(0,i.jsxs)(l(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,i.jsx)(H(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(E(),{title:"Delete",children:(0,i.jsx)(x(),{color:"primary",onClick:function(){return function(t,n){var r,a;s([]);var i=t.name;if(h.current=be(be({},h.current),((r={})[i]=h.current[i]--,r)),e.onFileUpdate("remove",i),100===t.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);g.then(function(t){$().delete(c,be({},t)).then(function(){return o(function(e){return e.filter(function(e,t){return t!==n})})}).catch(function(){return e.onFileUpdate("add",i),s(function(e){return ye(ye([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)})})})}else t.abortController.abort(),o(function(e){return e.filter(function(e,t){return t!==n})}),h.current=be(be({},h.current),((a={})[i]=h.current[i]++,a))}(t,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)})}),j=(0,i.jsx)(l(),{children:c.map(function(e,t){return(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)})});function w(e,t){return t?(0,W.createPortal)(e,t):e}var S=null===(t=e.uploadOptions)||void 0===t?void 0:t.map(function(t){return{label:t.label,onClick:function(){return function(t){m(t.metadata);var n=document.getElementById(v);n&&(n.accept=t.acceptedFileTypes||e.acceptedFileTypes),n.click()}(t)},startDecorator:t.iconName&&(0,i.jsx)(ie.default,{name:t.iconName})}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==S?void 0:S.length)?(0,i.jsx)(xe,{ariaLabel:"Upload",icon:(0,i.jsx)(ie.default,{name:"upload_2"}),menuItems:S}):(0,i.jsx)(E(),{title:"Upload",children:(0,i.jsx)(x(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,i.jsx)("input",{type:"file",id:v,onChange:function(t){s([]);var n=t.target.files&&Array.from(t.target.files),a=r.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&s(function(t){return ye(ye([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)});var i=n&&function(e,t,n){return n?t<=n?e:e.slice(0,n-t):e}(n,a,e.maxFileCount);i&&i.forEach(function(t){!function(t){var n;e.maxFileSize&&t.size>e.maxFileSize?(n=t.name,s(function(t){return ye(ye([],t,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&je(e.maxFileSize),".")],!1)})):function(t){var n=new FormData,r=new AbortController,a=function(e){var t,n,r=e.name,o=h.current[r];if(o){var a=o+1,i=r.lastIndexOf("."),c=r.substring(0,i),l=r.substring(i);r="".concat(c,"(").concat(o,")").concat(l),h.current=be(be({},h.current),((t={})[e.name]=a,t))}else h.current=be(be({},h.current),((n={})[e.name]=1,n));return r}(t),i=new File([t],a,{type:t.type});if(e.getUploadData||f){var c=e.getUploadData?e.getUploadData(a):{},l=be(be({},c),f);Object.keys(l).forEach(function(e){var t=l[e];n.append(e,"object"==typeof t?JSON.stringify(t):t)})}n.append("file",i);var s=(0,d.v4)(),u={name:a,loadingProgress:0,abortController:r,id:s};function p(e){var t,n;e.total&&(t=e.loaded/e.total*100,n=u.id,o(function(e){var r=e.map(function(e){return e.id===n?be(be({},e),{loadingProgress:t}):e});return r}))}o(function(e){return ye(ye([],e,!0),[u],!1)}),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function i(){return g.then(function(c){return $().post(m,n,be(be({},c),{onUploadProgress:p,signal:r.signal})).then(function(t){var r,a,i=n.get("file");t.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,t.data.url),t.data.fileId&&(r=t.data,a=u.id,o(function(e){var t=e.findIndex(function(e){return e.id===a});if(-1!==t){var n=ye([],e,!0);return n[t]=be(be({},n[t]),{id:r.fileId}),n}return e}))}).catch(function(r){var c,l,d=n.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,f,m,h;409===(null===(c=r.response)||void 0===c?void 0:c.status)&&e.listFiles?(p=a.lastIndexOf("."),f=a.substring(0,p),m=a.substring(p),h=new RegExp("^".concat(f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(m,"$"),"i"),e.listFiles?e.listFiles().then(function(e){for(var t=0,n=0,r=e;n<r.length;n++){var o=r[n];if(h.test(o.name)){var a=o.name.match(h),i=a&&a[1]?parseInt(a[1].slice(1,-1),10):0;t=Math.max(t,i)}}return"".concat(f,"(").concat(t+1,")").concat(m)}):Promise.resolve(a)).then(function(r){e.onFileUpdate("add",r);var a=new File([t],r,{type:t.type});n.set("file",a),o(function(e){return e.map(function(e){return e.id===s?be(be({},e),{name:r,loadingProgress:0}):e})}),i()}).catch(function(){var e;b(t.name,u.id,null===(e=r.response)||void 0===e?void 0:e.data)}):b(t.name,u.id,null===(l=r.response)||void 0===l?void 0:l.data)})})}()}(t)}(t)}),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&w(j,e.errorMessagesContainer),r.length>0&&w(y,e.filePreviewsContainer)]})};var Se,Oe,Ce,Ne=function(){return Ne=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ne.apply(this,arguments)},ke=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(Se||(Se={})),function(e){e.Owner="owner",e.Member="member"}(Oe||(Oe={})),function(e){e.Human="human",e.Agent="agent"}(Ce||(Ce={}));const Fe=function(e){var t=e.maxFileSize,n=void 0===t?2097152:t,r=e.maxFileCount,o=void 0===r?1:r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["maxFileSize","maxFileCount"]),c=(0,u.useState)({uploaded:[],fileList:[]}),p=c[0],f=c[1],m=(0,u.useState)((0,d.v4)()),h=m[0],v=m[1],g=(0,u.useState)(),x=g[0],b=g[1],y=(0,u.useState)(),j=y[0],w=y[1],S=(0,u.useRef)(null),O=(0,s.useTheme)(),C=p.fileList.length>0,N=p.uploaded.length===p.fileList.length&&p.uploaded.length>0;return(0,u.useEffect)(function(){S.current&&(w(S.current.querySelector(".rustic-error-container")),b(S.current.querySelector(".rustic-input-extras")))}),(0,i.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(O.palette.action.disabled),borderRadius:"".concat(O.shape.borderRadius,"px"),":focus-within":{borderColor:O.palette.secondary.main},background:O.palette.background.paper},children:(0,i.jsx)(_,Ne({},a,{send:function(e){e.data=function(e,t,n){var r=e.id,o=[];if(t&&(null==t?void 0:t.trim().length)&&o.push({type:"text",text:t}),n&&n.length>0)for(var a=0;a<(null==n?void 0:n.length);a++)o.push({type:"file_url",file_url:{url:n[a].url,name:n[a].name}});return{messages:[{content:o,role:"user",name:r}]}}(e.sender,e.data.text,p.uploaded.map(function(e){return{url:e.url,name:e.name}})),e.id=h,a.ws.send(e),v((0,d.v4)()),f({uploaded:[],fileList:[]})},isSendEnabled:C?N:void 0,ref:S,children:(0,i.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(we,{acceptedFileTypes:a.acceptedFileTypes,maxFileCount:o,maxFileSize:n,uploadFileEndpoint:a.uploadFileEndpoint,deleteFileEndpoint:a.deleteFileEndpoint,onFileUpdate:function(e,t,n){if("add"===e)f(function(e){return Ne(Ne({},e),{fileList:ke(ke([],e.fileList,!0),[{name:t}],!1)})});else if("update"===e){if(!n)return void console.error("URL is required for the 'update' action");f(function(e){var r=e.fileList.findIndex(function(e){return e.name===t}),o=ke(ke(ke([],e.uploaded.slice(0,r),!0),[{name:t,url:n}],!1),e.uploaded.slice(r),!0);return Ne(Ne({},e),{uploaded:o})})}else f(function(e){return{uploaded:e.uploaded.filter(function(e){return e.name!==t}),fileList:e.fileList.filter(function(e){return e.name!==t})}})},messageId:h,filePreviewsContainer:x,errorMessagesContainer:j,showFullName:a.showFullName,getUploadData:a.getUploadData,uploadOptions:a.uploadOptions,listFiles:a.listFiles,getUploadHeaders:a.getUploadHeaders})})}))})};return a})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e,t,n={9767:(e,t,n)=>{n.d(t,{A:()=>a});var r=n(8732),o=(n(2015),function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:o({},t),children:e.name})}},3110:(e,t,n)=>{n.d(t,{default:()=>r});const r=n(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var a=Object.create(null);o.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var c=2&r&&n;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>i[e]=()=>n[e]);return i.default=()=>n,o.d(a,i),a},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};o.r(a),o.d(a,{MessageProcessStatus:()=>Se,ParticipantRole:()=>Oe,ParticipantType:()=>Ce,default:()=>ke});var i=o(8732);const c=require("@mui/material/Box");var l=o.n(c);const s=require("@mui/material/styles");var u=o(2015);const d=require("uuid");var p;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const f=require("@mui/material/Avatar");var m=o.n(f);const h=require("@mui/material/CircularProgress");var v=o.n(h);const g=require("@mui/material/IconButton");var x=o.n(g);const b=require("@mui/material/InputAdornment");var y=o.n(b);const j=require("@mui/material/MenuItem");var w=o.n(j);const S=require("@mui/material/MenuList");var O=o.n(S);const C=require("@mui/material/Popover");var N=o.n(C);const F=require("@mui/material/TextField");var k=o.n(F);const P=require("@mui/material/Tooltip");var E=o.n(P);const I=require("@mui/material/Typography");var q=o.n(I),T=o(8342),A=o(9767);const R=function(e){var t=(0,s.useTheme)(),n=(0,u.useRef)(null),r=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],l=a[1],d={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function p(){l(!1)}function f(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),p()}return(0,u.useEffect)(function(){r.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then(function(n){var o=new(0,n.Picker)({dataSource:e.dataSource}),a="dark"===t.palette.mode?"dark":"light";o.classList.add(a),Object.keys(d).forEach(function(e){o.style.setProperty(e,d[e])}),r.current=o}).catch(function(e){console.error("Failed to load emoji picker",e)})},[]),(0,u.useEffect)(function(){return r.current&&r.current.addEventListener("emoji-click",f),function(){var e;null===(e=r.current)||void 0===e||e.removeEventListener("emoji-click",f)}},[c,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(E(),{title:"Emoji",children:(0,i.jsx)(x(),{size:"small",ref:n,onClick:function(){l(function(e){return!e})},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(A.A,{name:"Mood"})})}),r.current&&(0,i.jsx)(N(),{open:c,anchorEl:n.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&r.current&&!e.contains(r.current)&&e.appendChild(r.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function L(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function M(e){return(0,i.jsxs)(l(),{className:"rustic-participant-profile",children:[(0,i.jsx)(m(),{src:e.icon,className:"rustic-participant-avatar"}),(0,i.jsx)(q(),{variant:"body1Bold",children:e.displayName})]})}function U(e){var t=e.items,n=e.isOpen,r=e.onClose,o=e.onSelect,a=e.renderItem,c=e.anchorEl,l=e.selectedIndex;return(0,i.jsx)(N(),{disableAutoFocus:!0,open:n&&t.length>0,anchorEl:c,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,i.jsx)(O(),{children:t.map(function(e,t){return(0,i.jsx)(w(),{onClick:function(){return o(e)},selected:t===l,children:a(e)},t)})})})}const _=(0,u.forwardRef)(function(e,t){var n=e.multiline,r=void 0===n||n,o=e.fullWidth,a=void 0===o||o,c=e.maxRows,s=void 0===c?6:c,p=e.enableSpeechToText,f=void 0!==p&&p,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,u.useState)(""),j=b[0],w=b[1],S=(0,u.useState)(!1),O=S[0],C=S[1],N=(0,u.useState)(!1),F=N[0],P=N[1],I=(0,u.useState)(!1),_=I[0],z=I[1],H=(0,u.useState)(""),B=H[0],$=H[1],W=(0,u.useState)([]),K=W[0],G=W[1],Q=(0,u.useState)(!1),V=Q[0],Y=Q[1],Z=(0,u.useState)(0),J=Z[0],X=Z[1],ee=(0,u.useRef)(null),te=new T.Database({dataSource:g.emojiDataSource}),ne=!j.trim().length,re="".concat(O?"Stop":"Start"," speech to text"),oe=F?"primary.main":"primary.light",ae=O?"error.main":oe,ie=O?"stop_circle":"speech_to_text",ce=(0,u.useState)([]),le=ce[0],se=ce[1],ue=(0,u.useState)(!1),de=ue[0],pe=ue[1],fe=f&&"undefined"!=typeof window&&!!window.webkitSpeechRecognition;function me(){return"boolean"==typeof g.isSendEnabled?!g.isSendEnabled:ne}function he(e,t){if(ee.current){var n=ee.current,r=n.selectionStart,o=n.selectionEnd;if("number"==typeof r&&"number"==typeof o){var a,i=j||"",c=i.substring(0,r),l=i.substring(o),s=void 0;t?(s=c.replace(t,e)+l,a=c.replace(t,e).length):(s=c+e+l,a=r+e.length),w(s),setTimeout(function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(a,a)},0)}}}function ve(e){he("@".concat(e," "),/@(\w*)$/),se([])}function ge(e,t){void 0===t&&(t=!1),he(e,t?/:(\w+)$/:void 0),Y(!1)}var xe=_?(0,i.jsx)(v(),{size:24}):(0,i.jsx)(E(),{title:re,children:(0,i.jsx)(x(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,O?(e.stop(),z(!0),C(!1)):(e.start(),$(""),C(!0)),e.onstart=function(){C(!0)},e.onresult=function(e){var t,n=e.results[0][0].transcript;j.length>0?w(j+" "+n):w(n),null===(t=ee.current)||void 0===t||t.focus(),C(!1)},e.onerror=function(e){var t=D[e.error];$(t),C(!1)},e.onend=function(){z(!1),C(!1)}},size:"small",sx:{color:ae,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(A.A,{name:ie})})});function be(){var e,t,n=(new Date).toISOString(),r={id:(0,d.v4)(),timestamp:n,sender:g.sender,conversationId:g.conversationId,format:"chatCompletionRequest",data:{text:j},inReplyTo:null===(e=g.lastMsg)||void 0===e?void 0:e.id,messageHistory:null===(t=g.lastMsg)||void 0===t?void 0:t.messageHistory};g.send(r),w(""),$("")}return(0,i.jsxs)(l(),{className:"rustic-base-input",ref:t,children:[(0,i.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(l(),{className:"rustic-error-container",children:(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:B})}),(0,i.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:F?"secondary.main":"action.disabled",backgroundColor:"background.paper"},children:[K.length>0&&ee.current&&(0,i.jsx)(U,{anchorEl:ee.current,items:K.filter(function(e){return"unicode"in e}),isOpen:V,onClose:function(){Y(!1),X(0)},onSelect:function(e){return ge(e.unicode,!0)},selectedIndex:J,renderItem:L}),le.length>0&&ee.current&&(0,i.jsx)(U,{anchorEl:ee.current,items:le,isOpen:de,onClose:function(){pe(!1),X(0)},onSelect:function(e){return ve(e.displayName)},renderItem:M,selectedIndex:J}),(0,i.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:j,label:g.label,placeholder:g.placeholder,maxRows:s,multiline:r,fullWidth:a,onKeyDown:function(e){var t,n="ArrowDown"===e.key,r="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),V&&K.length>0&&"unicode"in K[J]?ge(K[J].unicode,!0):de&&le.length>0?ve(le[J].displayName):e.shiftKey||me()||be();else{if(n||r)return e.preventDefault(),t=n?1:-1,void(V?X(function(e){return(e+t+K.length)%K.length}):de&&X(function(e){return(e+t+le.length)%le.length}));0!==J&&X(0)}},onChange:function(e){$("");var t=e.target.value;w(t),function(e){var t=e.match(/@(\w*)$/);if(t&&g.getMembers){var n=t[1].toLowerCase();g.getMembers().then(function(e){var t=e.filter(function(e){return e.displayName.toLowerCase().startsWith(n)});se(t),t.length>0?pe(!0):pe(!1)})}else se([])}(t);var n,r=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(r){var a=r[0].replace(/:/g,"");te.getEmojiByShortcode(a).then(function(e){if(e&&"unicode"in e){var n=t.replace(r[0],e.unicode);w(n)}else w(t)}).catch(function(){w(t)}),Y(!1)}else o?(n=o[0].replace(":",""),te.getEmojiBySearchQuery(n).then(function(e){e.length?(G(e.slice(0,h)),Y(!0)):(G([]),Y(!1))}).catch(function(){G([]),Y(!1)})):Y(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",autoFocus:g.autoFocus,slotProps:{input:{endAdornment:(0,i.jsxs)(y(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(R,{dataSource:g.emojiDataSource,onEmojiClick:ge,buttonColor:oe}),fe&&xe]})},inputLabel:{className:F?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(l(),{className:"rustic-input-actions",children:[g.children,(0,i.jsx)(E(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(x(),{"aria-label":"send message",onClick:be,disabled:me(),color:"secondary",children:(0,i.jsx)(A.A,{name:"send"})})})})]})]})}),z=require("@mui/material/LinearProgress");var H=o.n(z);const B=require("axios");var $=o.n(B);const W=require("react-dom"),K=require("@mui/material/Card");var G=o.n(K);const Q=require("@mui/material/Modal");var V=o.n(Q);const Y=require("@mui/material/useMediaQuery");var Z=o.n(Y);const J=require("@mui/system/Stack");var X=o.n(J);const ee=require("@mui/system/useTheme");var te=o.n(ee);const ne=require("pdfjs-dist"),re=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},n=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(E(),{title:n.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(x(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(A.A,{name:n.symbol})})})})};var oe={pdf:function(e){var t,n=(0,u.useRef)(null),r=(0,u.useState)(1),o=r[0],a=r[1],c=(0,u.useState)(1),s=c[0],d=c[1],p=(0,u.useState)(1),f=p[0],m=p[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=te()(),w=Z()(j.breakpoints.down("sm")),S=Z()(j.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,u.useState)(function(){return w?.5:S?1:1.5}),C=O[0],N=O[1];function F(t){ne.getDocument({url:e.url,httpHeaders:t}).promise.then(function(e){d(e.numPages),function(e){e.getPage(o).then(function(e){var t=e.getViewport({scale:C}),r=n.current;if(r){var o=r.getContext("2d");if(o){var a=window.devicePixelRatio||1;r.style.width="".concat(t.width,"px"),r.style.height="".concat(t.height,"px"),r.width=t.width*a,r.height=t.height*a;var i={canvasContext:o,viewport:t,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(i);y(c),c.promise.then(function(){y(void 0)}).catch(function(e){console.error(e)})}}})}(e)}).catch(function(){g(!0)})}return(0,u.useEffect)(function(){ne.GlobalWorkerOptions.workerSrc||(ne.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ne.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then(function(e){return F(e.headers)}).catch(function(){return g(!0)}):F()},[e.url,o,C]),v?(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(G(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(re,{action:"zoomOut",onClick:function(){N(function(e){return Math.max(e-.2,.2)})}}),(0,i.jsx)(re,{action:"zoomIn",onClick:function(){N(function(e){return e+.2})}})]}),(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:n})})}),(0,i.jsxs)(X(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(re,{action:"previousPage",onClick:function(){o>1&&(a(o-1),m(o-1))},isDisabled:1===o}),(0,i.jsx)(q(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(k(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);m(t),!isNaN(t)&&t>=1&&t<=s&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(q(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,i.jsx)(re,{action:"nextPage",onClick:function(){o<s&&(a(o+1),m(o+1))},isDisabled:o===s})]})]})}};function ae(e){var t=e.supportedViewers,n=void 0===t?oe:t,r=e.showFullName,o=void 0===r||r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["supportedViewers","showFullName"]),c=(0,s.useTheme)(),l=(0,u.useState)(!1),d=l[0],p=l[1];function f(){p(!1)}var m,h,v=a.file.url&&(m=a.file.url.split("."))[m.length-1].toLowerCase(),g=v&&n?n[v]:null,b=!!g,y=b?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(o?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=o?a.file.name:(h=a.file.name).length<=15?h:h.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(G(),{className:j,variant:"outlined",sx:{boxShadow:c.shadows[1]},onClick:function(){p(!0)},children:[(0,i.jsx)(q(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:a.children})]}),b&&(0,i.jsx)(V(),{open:d,onClose:f,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(E(),{title:"Close",children:(0,i.jsx)(x(),{onClick:f,className:"rustic-close-button",children:(0,i.jsx)(A.A,{name:"close"})})}),a.file.url&&(0,i.jsx)(g,{url:a.file.url,getAuthHeaders:a.getAuthHeaders})]})})]})}var ie=o(3110);const ce=require("@mui/material"),le=require("@mui/material/Button");var se=o.n(le);const ue=require("@mui/material/Drawer");var de=o.n(ue);const pe=require("@mui/material/ListItemText");var fe=o.n(pe);const me=require("@mui/material/Menu");var he=o.n(me);const ve=require("@mui/system");var ge=function(){return ge=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ge.apply(this,arguments)};function xe(e){var t=(0,u.useState)(!1),n=t[0],r=t[1],o=(0,u.useRef)(null),a=(0,s.useTheme)(),c=(0,ce.useMediaQuery)(a.breakpoints.down("md")),l=c?de():he(),d={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(fe(),{children:(0,i.jsx)(q(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(d=ge(ge({},d),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var f=e.menuItems.map(function(e){return e.href?(0,i.jsx)(w(),{component:"a",onClick:function(){return r(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(w(),{onClick:function(t){e.onClick&&e.onClick(t),r(!1)},disabled:!e.onClick,children:p(e)},e.label)});var m,h,v=c?{}:{anchorEl:o.current};return(0,i.jsxs)(i.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),r(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},h=(0,i.jsx)(A.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(se(),ge({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(E(),{title:e.ariaLabel,children:(0,i.jsx)(x(),ge({},m,{children:e.icon?e.icon:h}))})),(0,i.jsx)(l,ge({open:n,onClose:function(){return r(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":ge(ge({},d),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:f}))]})}var be=function(){return be=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},be.apply(this,arguments)},ye=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};function je(e){for(var t=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<t.length-1;)e/=1024,n++;var r=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(r," ").concat(t[n])}const we=function(e){var t,n=(0,u.useState)([]),r=n[0],o=n[1],a=(0,u.useState)([]),c=a[0],s=a[1],p=(0,u.useState)({}),f=p[0],m=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)(function(){o([]),s([]),h.current={}},[e.messageId]);var g=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function b(e,t,n){var r;h.current=be(be({},h.current),((r={})[e]=h.current[e]--,r)),function(e,t,n){s(function(t){return ye(ye([],t,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)}),o(function(e){return e.filter(function(e){return e.id!==t})})}(e,t,n)}var y=(0,i.jsx)(l(),{className:"rustic-files rustic-padding-16",children:r.map(function(t,n){return(0,i.jsx)(ae,{file:{name:t.name},showFullName:e.showFullName,children:(0,i.jsxs)(l(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,i.jsx)(H(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(E(),{title:"Delete",children:(0,i.jsx)(x(),{color:"primary",onClick:function(){return function(t,n){var r,a;s([]);var i=t.name;if(h.current=be(be({},h.current),((r={})[i]=h.current[i]--,r)),e.onFileUpdate("remove",i),100===t.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);g.then(function(t){$().delete(c,be({},t)).then(function(){return o(function(e){return e.filter(function(e,t){return t!==n})})}).catch(function(){return e.onFileUpdate("add",i),s(function(e){return ye(ye([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)})})})}else t.abortController.abort(),o(function(e){return e.filter(function(e,t){return t!==n})}),h.current=be(be({},h.current),((a={})[i]=h.current[i]++,a))}(t,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)})}),j=(0,i.jsx)(l(),{children:c.map(function(e,t){return(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)})});function w(e,t){return t?(0,W.createPortal)(e,t):e}var S=null===(t=e.uploadOptions)||void 0===t?void 0:t.map(function(t){return{label:t.label,onClick:function(){return function(t){m(t.metadata);var n=document.getElementById(v);n&&(n.accept=t.acceptedFileTypes||e.acceptedFileTypes),n.click()}(t)},startDecorator:t.iconName&&(0,i.jsx)(ie.default,{name:t.iconName})}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==S?void 0:S.length)?(0,i.jsx)(xe,{ariaLabel:"Upload",icon:(0,i.jsx)(ie.default,{name:"upload_2"}),menuItems:S}):(0,i.jsx)(E(),{title:"Upload",children:(0,i.jsx)(x(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,i.jsx)("input",{type:"file",id:v,onChange:function(t){s([]);var n=t.target.files&&Array.from(t.target.files),a=r.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&s(function(t){return ye(ye([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)});var i=n&&function(e,t,n){return n?t<=n?e:e.slice(0,n-t):e}(n,a,e.maxFileCount);i&&i.forEach(function(t){!function(t){var n;e.maxFileSize&&t.size>e.maxFileSize?(n=t.name,s(function(t){return ye(ye([],t,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&je(e.maxFileSize),".")],!1)})):function(t){var n=new FormData,r=new AbortController,a=function(e){var t,n,r=e.name,o=h.current[r];if(o){var a=o+1,i=r.lastIndexOf("."),c=r.substring(0,i),l=r.substring(i);r="".concat(c,"(").concat(o,")").concat(l),h.current=be(be({},h.current),((t={})[e.name]=a,t))}else h.current=be(be({},h.current),((n={})[e.name]=1,n));return r}(t),i=new File([t],a,{type:t.type});if(e.getUploadData||f){var c=e.getUploadData?e.getUploadData(a):{},l=be(be({},c),f);Object.keys(l).forEach(function(e){var t=l[e];n.append(e,"object"==typeof t?JSON.stringify(t):t)})}n.append("file",i);var s=(0,d.v4)(),u={name:a,loadingProgress:0,abortController:r,id:s};function p(e){var t,n;e.total&&(t=e.loaded/e.total*100,n=u.id,o(function(e){var r=e.map(function(e){return e.id===n?be(be({},e),{loadingProgress:t}):e});return r}))}o(function(e){return ye(ye([],e,!0),[u],!1)}),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function i(){return g.then(function(c){return $().post(m,n,be(be({},c),{onUploadProgress:p,signal:r.signal})).then(function(t){var r,a,i=n.get("file");t.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,t.data.url),t.data.fileId&&(r=t.data,a=u.id,o(function(e){var t=e.findIndex(function(e){return e.id===a});if(-1!==t){var n=ye([],e,!0);return n[t]=be(be({},n[t]),{id:r.fileId}),n}return e}))}).catch(function(r){var c,l,d=n.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,f,m,h;409===(null===(c=r.response)||void 0===c?void 0:c.status)&&e.listFiles?(p=a.lastIndexOf("."),f=a.substring(0,p),m=a.substring(p),h=new RegExp("^".concat(f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(m,"$"),"i"),e.listFiles?e.listFiles().then(function(e){for(var t=0,n=0,r=e;n<r.length;n++){var o=r[n];if(h.test(o.name)){var a=o.name.match(h),i=a&&a[1]?parseInt(a[1].slice(1,-1),10):0;t=Math.max(t,i)}}return"".concat(f,"(").concat(t+1,")").concat(m)}):Promise.resolve(a)).then(function(r){e.onFileUpdate("add",r);var a=new File([t],r,{type:t.type});n.set("file",a),o(function(e){return e.map(function(e){return e.id===s?be(be({},e),{name:r,loadingProgress:0}):e})}),i()}).catch(function(){var e;b(t.name,u.id,null===(e=r.response)||void 0===e?void 0:e.data)}):b(t.name,u.id,null===(l=r.response)||void 0===l?void 0:l.data)})})}()}(t)}(t)}),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&w(j,e.errorMessagesContainer),r.length>0&&w(y,e.filePreviewsContainer)]})};var Se,Oe,Ce,Ne=function(){return Ne=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ne.apply(this,arguments)},Fe=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(Se||(Se={})),function(e){e.Owner="owner",e.Member="member"}(Oe||(Oe={})),function(e){e.Human="human",e.Agent="agent"}(Ce||(Ce={}));const ke=function(e){var t=e.maxFileSize,n=void 0===t?2097152:t,r=e.maxFileCount,o=void 0===r?1:r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["maxFileSize","maxFileCount"]),c=(0,u.useState)({uploaded:[],fileList:[]}),p=c[0],f=c[1],m=(0,u.useState)((0,d.v4)()),h=m[0],v=m[1],g=(0,u.useState)(),x=g[0],b=g[1],y=(0,u.useState)(),j=y[0],w=y[1],S=(0,u.useRef)(null),O=(0,s.useTheme)(),C=p.fileList.length>0,N=p.uploaded.length===p.fileList.length&&p.uploaded.length>0;return(0,u.useEffect)(function(){S.current&&(w(S.current.querySelector(".rustic-error-container")),b(S.current.querySelector(".rustic-input-extras")))}),(0,i.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(O.palette.action.disabled),borderRadius:"".concat(O.shape.borderRadius,"px"),":focus-within":{borderColor:O.palette.secondary.main},background:O.palette.background.paper},children:(0,i.jsx)(_,Ne({},a,{send:function(e){e.data=function(e,t,n){var r=e.id,o=[];if(t&&(null==t?void 0:t.trim().length)&&o.push({type:"text",text:t}),n&&n.length>0)for(var a=0;a<(null==n?void 0:n.length);a++)o.push({type:"file_url",file_url:{url:n[a].url,name:n[a].name}});return{messages:[{content:o,role:"user",name:r}]}}(e.sender,e.data.text,p.uploaded.map(function(e){return{url:e.url,name:e.name}})),e.id=h,a.ws.send(e),v((0,d.v4)()),f({uploaded:[],fileList:[]})},isSendEnabled:C?N:void 0,ref:S,children:(0,i.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(we,{acceptedFileTypes:a.acceptedFileTypes,maxFileCount:o,maxFileSize:n,uploadFileEndpoint:a.uploadFileEndpoint,deleteFileEndpoint:a.deleteFileEndpoint,onFileUpdate:function(e,t,n){if("add"===e)f(function(e){return Ne(Ne({},e),{fileList:Fe(Fe([],e.fileList,!0),[{name:t}],!1)})});else if("update"===e){if(!n)return void console.error("URL is required for the 'update' action");f(function(e){var r=e.fileList.findIndex(function(e){return e.name===t}),o=Fe(Fe(Fe([],e.uploaded.slice(0,r),!0),[{name:t,url:n}],!1),e.uploaded.slice(r),!0);return Ne(Ne({},e),{uploaded:o})})}else f(function(e){return{uploaded:e.uploaded.filter(function(e){return e.name!==t}),fileList:e.fileList.filter(function(e){return e.name!==t})}})},messageId:h,filePreviewsContainer:x,errorMessagesContainer:j,showFullName:a.showFullName,getUploadData:a.getUploadData,uploadOptions:a.uploadOptions,listFiles:a.listFiles,getUploadHeaders:a.getUploadHeaders})})}))})};return a})());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e,t,n={8342:e=>{e.exports=require("emoji-picker-element")}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&r&&n;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>n[e]);return a.default=()=>n,o.d(i,a),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{MessageProcessStatus:()=>F,ParticipantRole:()=>W,ParticipantType:()=>K,default:()=>$});const a=require("react/jsx-runtime"),c=require("react");var s;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(s||(s={}));const u=require("@mui/material/Avatar");var l=o.n(u);const d=require("@mui/material/Box");var p=o.n(d);const m=require("@mui/material/CircularProgress");var f=o.n(m);const h=require("@mui/material/IconButton");var v=o.n(h);const g=require("@mui/material/InputAdornment");var y=o.n(g);const b=require("@mui/material/MenuItem");var j=o.n(b);const x=require("@mui/material/MenuList");var w=o.n(x);const O=require("@mui/material/Popover");var S=o.n(O);const k=require("@mui/material/TextField");var E=o.n(k);const C=require("@mui/material/Tooltip");var N=o.n(C);const P=require("@mui/material/Typography");var T=o.n(P),R=o(8342);const q=require("uuid");var _=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function M(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:_({},t),children:e.name})}const I=require("@mui/material/styles"),A=function(e){var t=(0,I.useTheme)(),n=(0,c.useRef)(null),r=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function d(){u(!1)}function p(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),d()}return(0,c.useEffect)(function(){r.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then(function(n){var o=new(0,n.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach(function(e){o.style.setProperty(e,l[e])}),r.current=o}).catch(function(e){console.error("Failed to load emoji picker",e)})},[]),(0,c.useEffect)(function(){return r.current&&r.current.addEventListener("emoji-click",p),function(){var e;null===(e=r.current)||void 0===e||e.removeEventListener("emoji-click",p)}},[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(N(),{title:"Emoji",children:(0,a.jsx)(v(),{size:"small",ref:n,onClick:function(){u(function(e){return!e})},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:"Mood"})})}),r.current&&(0,a.jsx)(S(),{open:s,anchorEl:n.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&r.current&&!e.contains(r.current)&&e.appendChild(r.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function z(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function H(e){return(0,a.jsxs)(p(),{className:"rustic-participant-profile",children:[(0,a.jsx)(l(),{src:e.icon,className:"rustic-participant-avatar"}),(0,a.jsx)(T(),{variant:"body1Bold",children:e.displayName})]})}function L(e){var t=e.items,n=e.isOpen,r=e.onClose,o=e.onSelect,i=e.renderItem,c=e.anchorEl,s=e.selectedIndex;return(0,a.jsx)(S(),{disableAutoFocus:!0,open:n&&t.length>0,anchorEl:c,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,a.jsx)(w(),{children:t.map(function(e,t){return(0,a.jsx)(j(),{onClick:function(){return o(e)},selected:t===s,children:i(e)},t)})})})}const B=(0,c.forwardRef)(function(e,t){var n=e.multiline,r=void 0===n||n,o=e.fullWidth,i=void 0===o||o,s=e.maxRows,u=void 0===s?6:s,l=e.enableSpeechToText,d=void 0!==l&&l,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,c.useState)(""),j=b[0],x=b[1],w=(0,c.useState)(!1),O=w[0],S=w[1],k=(0,c.useState)(!1),C=k[0],P=k[1],_=(0,c.useState)(!1),I=_[0],B=_[1],F=(0,c.useState)(""),W=F[0],K=F[1],U=(0,c.useState)([]),$=U[0],Q=U[1],G=(0,c.useState)(!1),J=G[0],V=G[1],X=(0,c.useState)(0),Y=X[0],Z=X[1],ee=(0,c.useRef)(null),te=new R.Database({dataSource:g.emojiDataSource}),ne=!j.trim().length,re="".concat(O?"Stop":"Start"," speech to text"),oe=C?"primary.main":"primary.light",ie=O?"error.main":oe,ae=O?"stop_circle":"speech_to_text",ce=(0,c.useState)([]),se=ce[0],ue=ce[1],le=(0,c.useState)(!1),de=le[0],pe=le[1],me=d&&"undefined"!=typeof window&&!!window.webkitSpeechRecognition;function fe(){return"boolean"==typeof g.isSendEnabled?!g.isSendEnabled:ne}function he(e,t){if(ee.current){var n=ee.current,r=n.selectionStart,o=n.selectionEnd;if("number"==typeof r&&"number"==typeof o){var i,a=j||"",c=a.substring(0,r),s=a.substring(o),u=void 0;t?(u=c.replace(t,e)+s,i=c.replace(t,e).length):(u=c+e+s,i=r+e.length),x(u),setTimeout(function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(i,i)},0)}}}function ve(e){he("@".concat(e," "),/@(\w*)$/),ue([])}function ge(e,t){void 0===t&&(t=!1),he(e,t?/:(\w+)$/:void 0),V(!1)}var ye=I?(0,a.jsx)(f(),{size:24}):(0,a.jsx)(N(),{title:re,children:(0,a.jsx)(v(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,O?(e.stop(),B(!0),S(!1)):(e.start(),K(""),S(!0)),e.onstart=function(){S(!0)},e.onresult=function(e){var t,n=e.results[0][0].transcript;j.length>0?x(j+" "+n):x(n),null===(t=ee.current)||void 0===t||t.focus(),S(!1)},e.onerror=function(e){var t=D[e.error];K(t),S(!1)},e.onend=function(){B(!1),S(!1)}},size:"small",sx:{color:ie,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:ae})})});function be(){var e,t,n=(new Date).toISOString(),r={id:(0,q.v4)(),timestamp:n,sender:g.sender,conversationId:g.conversationId,format:"chatCompletionRequest",data:{text:j},inReplyTo:null===(e=g.lastMsg)||void 0===e?void 0:e.id,messageHistory:null===(t=g.lastMsg)||void 0===t?void 0:t.messageHistory};g.send(r),x(""),K("")}return(0,a.jsxs)(p(),{className:"rustic-base-input",ref:t,children:[(0,a.jsxs)(p(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(p(),{className:"rustic-error-container",children:(0,a.jsx)(T(),{variant:"caption",color:"error",className:"rustic-error-message",children:W})}),(0,a.jsxs)(p(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:C?"secondary.main":"action.disabled",backgroundColor:"background.paper"},children:[$.length>0&&ee.current&&(0,a.jsx)(L,{anchorEl:ee.current,items:$.filter(function(e){return"unicode"in e}),isOpen:J,onClose:function(){V(!1),Z(0)},onSelect:function(e){return ge(e.unicode,!0)},selectedIndex:Y,renderItem:z}),se.length>0&&ee.current&&(0,a.jsx)(L,{anchorEl:ee.current,items:se,isOpen:de,onClose:function(){pe(!1),Z(0)},onSelect:function(e){return ve(e.displayName)},renderItem:H,selectedIndex:Y}),(0,a.jsx)(E(),{className:"rustic-text-field",variant:"outlined",value:j,label:g.label,placeholder:g.placeholder,maxRows:u,multiline:r,fullWidth:i,onKeyDown:function(e){var t,n="ArrowDown"===e.key,r="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),J&&$.length>0&&"unicode"in $[Y]?ge($[Y].unicode,!0):de&&se.length>0?ve(se[Y].displayName):e.shiftKey||fe()||be();else{if(n||r)return e.preventDefault(),t=n?1:-1,void(J?Z(function(e){return(e+t+$.length)%$.length}):de&&Z(function(e){return(e+t+se.length)%se.length}));0!==Y&&Z(0)}},onChange:function(e){K("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&g.getMembers){var n=t[1].toLowerCase();g.getMembers().then(function(e){var t=e.filter(function(e){return e.displayName.toLowerCase().startsWith(n)});ue(t),t.length>0?pe(!0):pe(!1)})}else ue([])}(t);var n,r=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(r){var i=r[0].replace(/:/g,"");te.getEmojiByShortcode(i).then(function(e){if(e&&"unicode"in e){var n=t.replace(r[0],e.unicode);x(n)}else x(t)}).catch(function(){x(t)}),V(!1)}else o?(n=o[0].replace(":",""),te.getEmojiBySearchQuery(n).then(function(e){e.length?(Q(e.slice(0,h)),V(!0)):(Q([]),V(!1))}).catch(function(){Q([]),V(!1)})):V(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,a.jsxs)(y(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(A,{dataSource:g.emojiDataSource,onEmojiClick:ge,buttonColor:oe}),me&&ye]})},inputLabel:{className:C?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(p(),{className:"rustic-input-actions",children:[g.children,(0,a.jsx)(N(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(v(),{"aria-label":"send message",onClick:be,disabled:fe(),color:"secondary",children:(0,a.jsx)(M,{name:"send"})})})})]})]})});var F,W,K,U=function(){return U=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},U.apply(this,arguments)};!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(F||(F={})),function(e){e.Owner="owner",e.Member="member"}(W||(W={})),function(e){e.Human="human",e.Agent="agent"}(K||(K={}));const $=function(e){var t=e.ws,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["ws"]);return(0,a.jsx)(B,U({},n,{send:function(e){var n,r,o,i;e.data=(n=e.sender,r=e.data.text,o=n.id,i=[],r&&(null==r?void 0:r.trim().length)&&i.push({type:"text",text:r}),{messages:[{content:i,role:"user",name:o}]}),t.send(e)}}))};return i})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e,t,n={8342:e=>{e.exports=require("emoji-picker-element")}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&r&&n;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach(e=>a[e]=()=>n[e]);return a.default=()=>n,o.d(i,a),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{MessageProcessStatus:()=>B,ParticipantRole:()=>W,ParticipantType:()=>K,default:()=>$});const a=require("react/jsx-runtime"),c=require("react");var s;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(s||(s={}));const u=require("@mui/material/Avatar");var l=o.n(u);const d=require("@mui/material/Box");var p=o.n(d);const m=require("@mui/material/CircularProgress");var f=o.n(m);const h=require("@mui/material/IconButton");var v=o.n(h);const g=require("@mui/material/InputAdornment");var y=o.n(g);const b=require("@mui/material/MenuItem");var j=o.n(b);const x=require("@mui/material/MenuList");var w=o.n(x);const O=require("@mui/material/Popover");var S=o.n(O);const k=require("@mui/material/TextField");var E=o.n(k);const C=require("@mui/material/Tooltip");var N=o.n(C);const P=require("@mui/material/Typography");var T=o.n(P),R=o(8342);const q=require("uuid");var _=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function M(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:_({},t),children:e.name})}const I=require("@mui/material/styles"),A=function(e){var t=(0,I.useTheme)(),n=(0,c.useRef)(null),r=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function d(){u(!1)}function p(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),d()}return(0,c.useEffect)(function(){r.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then(function(n){var o=new(0,n.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach(function(e){o.style.setProperty(e,l[e])}),r.current=o}).catch(function(e){console.error("Failed to load emoji picker",e)})},[]),(0,c.useEffect)(function(){return r.current&&r.current.addEventListener("emoji-click",p),function(){var e;null===(e=r.current)||void 0===e||e.removeEventListener("emoji-click",p)}},[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(N(),{title:"Emoji",children:(0,a.jsx)(v(),{size:"small",ref:n,onClick:function(){u(function(e){return!e})},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:"Mood"})})}),r.current&&(0,a.jsx)(S(),{open:s,anchorEl:n.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&r.current&&!e.contains(r.current)&&e.appendChild(r.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function z(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function F(e){return(0,a.jsxs)(p(),{className:"rustic-participant-profile",children:[(0,a.jsx)(l(),{src:e.icon,className:"rustic-participant-avatar"}),(0,a.jsx)(T(),{variant:"body1Bold",children:e.displayName})]})}function H(e){var t=e.items,n=e.isOpen,r=e.onClose,o=e.onSelect,i=e.renderItem,c=e.anchorEl,s=e.selectedIndex;return(0,a.jsx)(S(),{disableAutoFocus:!0,open:n&&t.length>0,anchorEl:c,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,a.jsx)(w(),{children:t.map(function(e,t){return(0,a.jsx)(j(),{onClick:function(){return o(e)},selected:t===s,children:i(e)},t)})})})}const L=(0,c.forwardRef)(function(e,t){var n=e.multiline,r=void 0===n||n,o=e.fullWidth,i=void 0===o||o,s=e.maxRows,u=void 0===s?6:s,l=e.enableSpeechToText,d=void 0!==l&&l,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,g=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,c.useState)(""),j=b[0],x=b[1],w=(0,c.useState)(!1),O=w[0],S=w[1],k=(0,c.useState)(!1),C=k[0],P=k[1],_=(0,c.useState)(!1),I=_[0],L=_[1],B=(0,c.useState)(""),W=B[0],K=B[1],U=(0,c.useState)([]),$=U[0],Q=U[1],G=(0,c.useState)(!1),J=G[0],V=G[1],X=(0,c.useState)(0),Y=X[0],Z=X[1],ee=(0,c.useRef)(null),te=new R.Database({dataSource:g.emojiDataSource}),ne=!j.trim().length,re="".concat(O?"Stop":"Start"," speech to text"),oe=C?"primary.main":"primary.light",ie=O?"error.main":oe,ae=O?"stop_circle":"speech_to_text",ce=(0,c.useState)([]),se=ce[0],ue=ce[1],le=(0,c.useState)(!1),de=le[0],pe=le[1],me=d&&"undefined"!=typeof window&&!!window.webkitSpeechRecognition;function fe(){return"boolean"==typeof g.isSendEnabled?!g.isSendEnabled:ne}function he(e,t){if(ee.current){var n=ee.current,r=n.selectionStart,o=n.selectionEnd;if("number"==typeof r&&"number"==typeof o){var i,a=j||"",c=a.substring(0,r),s=a.substring(o),u=void 0;t?(u=c.replace(t,e)+s,i=c.replace(t,e).length):(u=c+e+s,i=r+e.length),x(u),setTimeout(function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(i,i)},0)}}}function ve(e){he("@".concat(e," "),/@(\w*)$/),ue([])}function ge(e,t){void 0===t&&(t=!1),he(e,t?/:(\w+)$/:void 0),V(!1)}var ye=I?(0,a.jsx)(f(),{size:24}):(0,a.jsx)(N(),{title:re,children:(0,a.jsx)(v(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,O?(e.stop(),L(!0),S(!1)):(e.start(),K(""),S(!0)),e.onstart=function(){S(!0)},e.onresult=function(e){var t,n=e.results[0][0].transcript;j.length>0?x(j+" "+n):x(n),null===(t=ee.current)||void 0===t||t.focus(),S(!1)},e.onerror=function(e){var t=D[e.error];K(t),S(!1)},e.onend=function(){L(!1),S(!1)}},size:"small",sx:{color:ie,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:ae})})});function be(){var e,t,n=(new Date).toISOString(),r={id:(0,q.v4)(),timestamp:n,sender:g.sender,conversationId:g.conversationId,format:"chatCompletionRequest",data:{text:j},inReplyTo:null===(e=g.lastMsg)||void 0===e?void 0:e.id,messageHistory:null===(t=g.lastMsg)||void 0===t?void 0:t.messageHistory};g.send(r),x(""),K("")}return(0,a.jsxs)(p(),{className:"rustic-base-input",ref:t,children:[(0,a.jsxs)(p(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(p(),{className:"rustic-error-container",children:(0,a.jsx)(T(),{variant:"caption",color:"error",className:"rustic-error-message",children:W})}),(0,a.jsxs)(p(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:C?"secondary.main":"action.disabled",backgroundColor:"background.paper"},children:[$.length>0&&ee.current&&(0,a.jsx)(H,{anchorEl:ee.current,items:$.filter(function(e){return"unicode"in e}),isOpen:J,onClose:function(){V(!1),Z(0)},onSelect:function(e){return ge(e.unicode,!0)},selectedIndex:Y,renderItem:z}),se.length>0&&ee.current&&(0,a.jsx)(H,{anchorEl:ee.current,items:se,isOpen:de,onClose:function(){pe(!1),Z(0)},onSelect:function(e){return ve(e.displayName)},renderItem:F,selectedIndex:Y}),(0,a.jsx)(E(),{className:"rustic-text-field",variant:"outlined",value:j,label:g.label,placeholder:g.placeholder,maxRows:u,multiline:r,fullWidth:i,onKeyDown:function(e){var t,n="ArrowDown"===e.key,r="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),J&&$.length>0&&"unicode"in $[Y]?ge($[Y].unicode,!0):de&&se.length>0?ve(se[Y].displayName):e.shiftKey||fe()||be();else{if(n||r)return e.preventDefault(),t=n?1:-1,void(J?Z(function(e){return(e+t+$.length)%$.length}):de&&Z(function(e){return(e+t+se.length)%se.length}));0!==Y&&Z(0)}},onChange:function(e){K("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&g.getMembers){var n=t[1].toLowerCase();g.getMembers().then(function(e){var t=e.filter(function(e){return e.displayName.toLowerCase().startsWith(n)});ue(t),t.length>0?pe(!0):pe(!1)})}else ue([])}(t);var n,r=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(r){var i=r[0].replace(/:/g,"");te.getEmojiByShortcode(i).then(function(e){if(e&&"unicode"in e){var n=t.replace(r[0],e.unicode);x(n)}else x(t)}).catch(function(){x(t)}),V(!1)}else o?(n=o[0].replace(":",""),te.getEmojiBySearchQuery(n).then(function(e){e.length?(Q(e.slice(0,h)),V(!0)):(Q([]),V(!1))}).catch(function(){Q([]),V(!1)})):V(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",autoFocus:g.autoFocus,slotProps:{input:{endAdornment:(0,a.jsxs)(y(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(A,{dataSource:g.emojiDataSource,onEmojiClick:ge,buttonColor:oe}),me&&ye]})},inputLabel:{className:C?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(p(),{className:"rustic-input-actions",children:[g.children,(0,a.jsx)(N(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(v(),{"aria-label":"send message",onClick:be,disabled:fe(),color:"secondary",children:(0,a.jsx)(M,{name:"send"})})})})]})]})});var B,W,K,U=function(){return U=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},U.apply(this,arguments)};!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(B||(B={})),function(e){e.Owner="owner",e.Member="member"}(W||(W={})),function(e){e.Human="human",e.Agent="agent"}(K||(K={}));const $=function(e){var t=e.ws,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["ws"]);return(0,a.jsx)(L,U({},n,{send:function(e){var n,r,o,i;e.data=(n=e.sender,r=e.data.text,o=n.id,i=[],r&&(null==r?void 0:r.trim().length)&&i.push({type:"text",text:r}),{messages:[{content:i,role:"user",name:o}]}),t.send(e)}}))};return i})());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/messageCanvas/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,eAAe,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/messageCanvas/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,eAAe,aAAa,CAAA;AAE5B,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/messageSpace/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,eAAe,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/messageSpace/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,eAAe,YAAY,CAAA;AAE3B,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -18,6 +18,10 @@ export interface ProcessEntry {
|
|
|
18
18
|
agent: AgentTag;
|
|
19
19
|
origin: string;
|
|
20
20
|
result: string;
|
|
21
|
+
processor: string;
|
|
22
|
+
from_topic?: string;
|
|
23
|
+
to_topics?: string[];
|
|
24
|
+
reason?: string[];
|
|
21
25
|
}
|
|
22
26
|
export declare enum MessageProcessStatus {
|
|
23
27
|
Running = "running",
|
|
@@ -241,6 +245,8 @@ export interface BaseInputProps {
|
|
|
241
245
|
getMembers?: () => Promise<Participant[]>;
|
|
242
246
|
/** Used to set inReplyTo and messageHistory */
|
|
243
247
|
lastMsg?: Message;
|
|
248
|
+
/** If the input should be focused automatically **/
|
|
249
|
+
autoFocus?: boolean;
|
|
244
250
|
}
|
|
245
251
|
export interface TextInputProps extends Omit<BaseInputProps, 'send' | 'isSendEnabled'> {
|
|
246
252
|
/** WebSocket connection to send and receive messages to and from a backend.*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAGpE,MAAM,MAAM,WAAW,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAA;AAEhD,uEAAuE;AACvE,MAAM,WAAW,MAAM;IACrB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,QAAQ,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EA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 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e,t,r={9528:(e,t,r)=>{r.d(t,{UniformsForm:()=>h});var n=r(8732),a=r(6989),i=r.n(a),o=r(785),s=r.n(o);const c=require("ajv");var l=r.n(c),u=r(2015);const d=require("uniforms-bridge-json-schema"),p=require("uniforms-mui");var m=r(3903),f=r(227);function h(e){var t=(0,u.useState)(e.data),r=t[0],a=t[1];(0,u.useEffect)(function(){e.data&&a(e.data)},[e.data]);var o,c,h=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),v=(o=e.schema,c=h.compile(o),function(e){var t;return c(e),(null===(t=c.errors)||void 0===t?void 0:t.length)?{details:c.errors}:null}),g=new d.JSONSchemaBridge({schema:e.schema,validator:v});return(0,n.jsxs)(i(),{className:"rustic-form",children:[e.title&&(0,n.jsx)(s(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(f.A,{text:e.description}),(0,n.jsx)(p.AutoForm,{schema:g,onSubmit:function(t){return function(t){var r,n=(new Date).toISOString(),i={id:(0,m.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"formResponse",data:{data:t,inReplyTo:e.messageId}};a(t),null===(r=e.ws)||void 0===r||r.send(i)}(t)},model:r,disabled:!!r||!e.ws})]})}},9767:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(8732),a=(r(2015),function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(4409),r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>d,L:()=>u});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o),c=r(3840),l=r(2015);function u(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=c.marked.parse(t,{async:!1});return s().sanitize(r)}const d=function(e){var t=(0,l.useState)(u(e.text)),r=t[0],a=t[1];return(0,l.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(u(t))}},[e.text,e.updatedData]),(0,n.jsx)(i(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:r}})}},4409:(e,t,r)=>{r.d(t,{A:()=>u});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(2015),l=r(227);const u=function(e){var t=(0,c.useState)((0,l.L)(e.text)),r=t[0],a=t[1],o=(0,c.useState)(""),u=o[0],d=o[1];return(0,c.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,n=e.updatedData;r<n.length;r++){var i=n[r];"string"!=typeof i.text?(t+=" [MISSING TEXT]",d("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=i.text}a((0,l.L)(t))}},[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),u&&(0,n.jsx)(i(),{severity:"error",children:u})]})}},4445:(e,t,r)=>{r.d(t,{default:()=>c});var n=r(8732),a=r(909),i=r.n(a),o=r(4603),s=r.n(o);r(2015),r(7159);const c=function(e){return(0,n.jsx)(s(),{title:e.label,children:(0,n.jsx)(i(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},7159:(e,t,r)=>{var n,a,i;r.d(t,{sW:()=>a,yJ:()=>i}),function(e){e.Running="running",e.Completed="completed",e.Error="error"}(n||(n={})),function(e){e.Owner="owner",e.Member="member"}(a||(a={})),function(e){e.Human="human",e.Agent="agent"}(i||(i={}))},9517:(e,t,r)=>{r.d(t,{generateTheme:()=>m,rusticDarkTheme:()=>h,rusticLightTheme:()=>f});var n=r(6182);const a=require("lodash");var i=r.n(a),o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o.apply(this,arguments)},s=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function c(e){var t={};return Object.keys(e).forEach(function(r){var n=r.match(/^([a-z]+)([A-Z].*)$/);if(n){n[0];var a=n[1],o=n[2],s="".concat(a.toLowerCase(),".").concat(i().camelCase(o));i().set(t,s,e[r])}else i().set(t,r.toLowerCase(),e[r])}),t}var l={lightMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#FFFFFF",backgroundDefault:"#F4F4F4",textPrimary:"#1E0C04",textSecondary:"#4E443F",textDisabled:"#727272",actionActive:"rgba(0, 0, 0, 0.56)",actionHover:"rgba(0, 0, 0, 0.08)",actionSelected:"rgba(0, 0, 0, 0.16)",actionFocus:"rgba(0, 0, 0, 0.12)",actionDisabledBackground:"rgba(0, 0, 0, 0.12)",actionDisabled:"rgba(0, 0, 0, 0.38)",primaryMain:"#2D2825",primaryLight:"rgba(45, 40, 37, 0.60)",primaryDark:"#000000",primaryContrastText:"#FFFFFF",primaryHover:"rgba(45, 40, 37, 0.08)",primarySelected:"rgba(45, 40, 37, 0.16)",primaryFocus:"rgba(45, 40, 37, 0.12)",primaryFocusVisible:"rgba(45, 40, 37, 0.30)",primaryOutlinedBorder:"rgba(45, 40, 37, 0.50)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrast:"#FFFFFF",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#007F51",successDark:"#014F33",successLight:"#00D788",successContrastText:"#000000",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"#000000",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"#000000",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"#000000"},darkMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#202020",backgroundDefault:"#2C2C2C",textPrimary:"#FFFFFF",textSecondary:"rgba(255, 255, 255, 0.70)",textDisabled:"rgba(255, 255, 255, 0.38)",actionActive:"rgba(255, 255, 255, 0.60)",actionHover:"rgba(255, 255, 255, 0.30)",actionSelected:"rgba(255, 255, 255, 0.16)",actionFocus:"rgba(255, 255, 255, 0.12)",actionDisabledBackground:"rgba(255, 255, 255, 0.12)",actionDisabled:"rgba(255, 255, 255, 0.38)",primaryMain:"#FFFCFB",primaryLight:"rgba(255, 252, 251, 0.60)",primaryDark:"#FFFFFF",primaryContrastText:"rgba(0, 0, 0, 0.87)",primaryOutlinedBorder:"rgba(255, 252, 251, 0.50)",primaryFocus:"rgba(255, 252, 251, 0.12)",primaryFocusVisible:"rgba(255, 252, 251, 0.30)",primaryHover:"rgba(255, 252, 251, 0.08)",primarySelected:"rgba(255, 252, 251, 0.16)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrastText:"rgba(0, 0, 0, 0.87)",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#00B775",successDark:"#01784D",successLight:"#00E390",successContrastText:"rgba(0, 0, 0, 0.87)",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"rgba(0, 0, 0, 0.87)",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"rgba(0, 0, 0, 0.87)",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"rgba(0, 0, 0, 0.87)"}},u={fontSize:"12px",lineHeight:1.5,letterSpacing:"0.5px",padding:"0 12px",minHeight:"26px"},d={fontSize:"14px",lineHeight:1.43,letterSpacing:"0.25px",padding:"0 16px",minHeight:"40px"},p={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"};function m(e,t){var r="light"===e?t.lightMode:t.darkMode;return{shape:{borderRadius:16},typography:{fontFamily:"Inter",h1:{fontStyle:"normal",fontWeight:300,fontSize:"94px",lineHeight:1.167,letterSpacing:"-1.5px"},h2:{fontStyle:"normal",fontWeight:300,fontSize:"59px",letterSpacing:"-2px",lineHeight:1.2},h3:{fontStyle:"normal",fontWeight:400,fontSize:"47px",letterSpacing:"0px",lineHeight:1.167},h4:{fontStyle:"normal",fontWeight:400,fontSize:"33px",letterSpacing:"0px",lineHeight:1.235},h5:{fontStyle:"normal",fontWeight:400,fontSize:"24px",letterSpacing:"0px",lineHeight:1.334},h6:{fontStyle:"normal",fontWeight:500,fontSize:"20px",letterSpacing:"0px",lineHeight:1.6},body1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body1Bold:{fontStyle:"normal",fontWeight:600,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body2:{fontStyle:"normal",fontWeight:400,fontSize:"14px",letterSpacing:"0px",lineHeight:1.43},subtitle1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.75},subtitle2:{fontStyle:"normal",fontWeight:500,fontSize:"14px",letterSpacing:"0px",lineHeight:1.57},overline:{fontStyle:"normal",fontWeight:400,fontSize:"10px",letterSpacing:"0px",lineHeight:1.5,textTransform:"uppercase"},caption:{fontStyle:"normal",fontWeight:400,fontSize:"12px",letterSpacing:"0px",lineHeight:1.66},button:{textTransform:"none",fontWeight:700}},shadows:s([],(0,n.createTheme)({}).shadows.map(function(e,t){return 1===t?"0 4px 5px rgba(0, 0, 0, 0.05)":2===t?"0 4px 10px rgba(0, 0, 0, 0.1)":3===t?"0 4px 15px rgba(0, 0, 0, 0.15)":"none"}),!0),palette:o({mode:e},c(r)),components:{MuiTooltip:{styleOverrides:{tooltip:"light"===e?{backgroundColor:r.commonBlack,color:r.commonWhite}:{backgroundColor:r.commonWhite,color:r.commonBlack}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:r.actionFocus},root:{borderBottom:"1px solid ".concat(r.divider),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:r.textPrimary}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(r.divider),backgroundImage:"none"}}},MuiButton:{styleOverrides:{root:{"&.MuiButton-sizeSmall":o({},u),"&.MuiButton-sizeMedium":o({borderRadius:"24px"},d),"&.MuiButton-sizeLarge":o({borderRadius:"32px"},p),"&.Mui-disabled":{background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},containedPrimary:{background:r.primaryMain,color:r.primaryContrastText,"&:hover":{background:r.primaryLight},"&:active":{background:r.primaryMain,outline:"2px solid ".concat(r.primaryLight)}},containedSecondary:{"&:hover":{background:r.secondaryLight},"&:active":{background:r.secondaryMain,outline:"2px solid ".concat(r.secondaryLight)}},outlinedSecondary:{color:r.textPrimary,"&:hover":{border:"1px solid ".concat(r.secondaryDark),background:r.secondaryFocus},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}},textSecondary:{color:r.textPrimary,"&:hover":{background:r.secondaryFocus},"&.Mui-disabled":{border:"none"}}}},MuiChip:{styleOverrides:{root:{"& .MuiChip-icon":{margin:"0px 8px 0px 0px"},"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"},"&.MuiChip-sizeSmall":o({},u),"&.MuiChip-sizeMedium":o({borderRadius:"24px"},d),"&.MuiChip-sizeLarge":o({borderRadius:"32px"},p),color:r.textPrimary,background:r.backgroundPaper,"&.Mui-disabled":{opacity:1,background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},colorPrimary:{border:"1px solid ".concat(r.textPrimary),"&:hover":{color:r.primaryContrastText},"&:active":{outline:"2px solid ".concat(r.primaryLight)}},colorSecondary:{border:"1px solid ".concat(r.secondaryMain),"&:hover":{color:r.primaryContrastText,background:r.secondaryMain},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}}}}}}}var f=(0,n.createTheme)(m("light",l)),h=(0,n.createTheme)(m("dark",l));f=(0,n.responsiveFontSizes)(f),h=(0,n.responsiveFontSizes)(h)},5642:e=>{e.exports=require("@mui/material/Alert")},6989:e=>{e.exports=require("@mui/material/Box")},909:e=>{e.exports=require("@mui/material/IconButton")},4603:e=>{e.exports=require("@mui/material/Tooltip")},785:e=>{e.exports=require("@mui/material/Typography")},6182:e=>{e.exports=require("@mui/material/styles")},7447:e=>{e.exports=require("dompurify")},8342:e=>{e.exports=require("emoji-picker-element")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")},3903:e=>{e.exports=require("uuid")}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,a),i.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);a.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach(e=>o[e]=()=>r[e]);return o.default=()=>r,a.d(i,o),i},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.r(i),a.d(i,{Action:()=>Zt.default,ChatCompletion:()=>lr,CodeSnippet:()=>P,CopyText:()=>er,ElementRenderer:()=>I,FCCalendar:()=>O,Icon:()=>L.A,Image:()=>Q,MarkedMarkdown:()=>w.A,MarkedStreamingMarkdown:()=>wt.A,MermaidViz:()=>pn,MessageArchive:()=>Xt,MessageCanvas:()=>$t,MessageSpace:()=>ar,MultimodalInput:()=>at,Multipart:()=>ur,OpenLayersMap:()=>jt,PDFViewer:()=>Ie,ParticipantRole:()=>Sr.sW,ParticipantType:()=>Sr.yJ,ParticipantsContainer:()=>Or,PerspectiveViz:()=>vn,PlotlyGraph:()=>bn,PopoverMenu:()=>$e,PromptBuilder:()=>Ir,Prompts:()=>Rr,Question:()=>Mr,Sound:()=>qt,StreamingText:()=>sn,Table:()=>nn,Text:()=>cn,TextInput:()=>st,TextToSpeech:()=>tr,Timestamp:()=>Qt,UniformsForm:()=>A.UniformsForm,Uploader:()=>Ze,VegaLiteViz:()=>En,Video:()=>zt,Weather:()=>Cn,generateTheme:()=>Nn.generateTheme,getCombinedMessages:()=>V,rusticDarkTheme:()=>Nn.rusticDarkTheme,rusticLightTheme:()=>Nn.rusticLightTheme});var o=a(8732);const s=require("@fullcalendar/daygrid");var c=a.n(s);const l=require("@fullcalendar/react");var u=a.n(l);const d=require("@fullcalendar/timegrid");var p=a.n(d),m=a(6989),f=a.n(m),h=a(6182),v=a(785),g=a.n(v);const x=require("@mui/material/useMediaQuery");var y=a.n(x),b=a(2015),j=a.n(b),w=a(227),S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},S.apply(this,arguments)};function k(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function O(e){var t=(0,h.useTheme)(),r=y()(t.breakpoints.up("md"));return(0,o.jsxs)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":S({},t.typography.h6),".fc .fc-scrollgrid-liquid":{borderRadius:"".concat(t.shape.borderRadius,"px")},".fc td":{borderRadius:"0 0 ".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px")},".fc .fc-scrollgrid-section-header > th":{borderRadius:"".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px 0 0")},".fc .fc-button, .fc .fc-button:active":{color:t.palette.primary.main,backgroundColor:t.palette.background.paper,border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),"&:hover":{backgroundColor:t.palette.secondary.light,border:"1px solid ".concat(t.palette.divider)}},".fc .fc-button-group .fc-button.fc-button-active":{backgroundColor:t.palette.secondary.main,border:"1px solid ".concat(t.palette.divider)},".fc a, .fc .fc-event-title, .fc .fc-button, .fc .fc-timegrid-slot":S({},t.typography.caption)},children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(u(),{plugins:[p(),c()],initialView:r?"dayGridMonth":"timeGridDay",headerToolbar:{left:"title",right:"prev,next dayGridMonth,timeGridWeek,timeGridDay"},eventColor:t.palette.secondary.main,displayEventTime:!1,titleFormat:{year:"numeric",month:"long"},views:{dayGridMonth:{dayHeaderFormat:{weekday:r?"long":"narrow"}},timeGridWeek:{dayHeaderFormat:{weekday:"short",day:"numeric"}},timeGridDay:{dayHeaderFormat:{weekday:"long",day:"numeric"}}},allDaySlot:!1,initialDate:e.events[0].start,events:e.events.map(k)})]})}const F=require("@codemirror/language"),E=require("@codemirror/language-data"),C=require("@codemirror/state"),N=require("@codemirror/view"),T=require("@mui/system");function P(e){var t=(0,b.useRef)(null),r=(0,b.useRef)(),n=new C.Compartment,a=[C.EditorState.readOnly.of(!0),(0,N.highlightSpecialChars)(),(0,F.syntaxHighlighting)(F.defaultHighlightStyle,{fallback:!0}),n.of([])],i=E.languages.find(function(t){return t.name.toLowerCase()===e.language.toLowerCase()});return(0,b.useEffect)(function(){if(t.current&&!r.current){var o=t.current,s=C.EditorState.create({doc:e.code,extensions:a});r.current=new N.EditorView({state:s,parent:o}),i&&r.current&&i.load().then(function(e){var t;null===(t=r.current)||void 0===t||t.dispatch({effects:n.reconfigure(e.extension)})})}},[]),(0,o.jsxs)(T.Box,{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(T.Box,{className:"rustic-code-snippet",sx:{backgroundColor:"background.default"},"aria-label":"code snippet",ref:t,children:(0,o.jsx)(g(),{variant:"body2","aria-label":"language type",children:e.language})})]})}var A=a(9528),D=function(){return D=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},D.apply(this,arguments)};const I=function(e){var t=e.messages[0],r=e.messages.slice(1),n=e.supportedElements[t.format];return(0,o.jsx)(o.Fragment,{children:n?j().createElement(n,D(D({sender:e.sender,ws:e.ws,messageId:t.id,conversationId:t.conversationId},t.data),r.length>0&&{updatedData:r.map(function(e){return e.data})})):(0,o.jsxs)(g(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var L=a(9767);const R=require("@mui/material/CircularProgress");var M,q=a.n(R),B=function(){return B=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},B.apply(this,arguments)},_=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},z=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function H(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),a=t>0?"".concat(t,":"):"",i="".concat(t>0?r.toString().padStart(2,"0"):r),o=n.toString().padStart(2,"0");return"".concat(a).concat(i,":").concat(o)}function U(e){var t=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:t,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[t]}}function W(e,t,r){var n=e.id,a=[];if(t&&(null==t?void 0:t.trim().length)&&a.push({type:"text",text:t}),r&&r.length>0)for(var i=0;i<(null==r?void 0:r.length);i++)a.push({type:"file_url",file_url:{url:r[i].url,name:r[i].name}});return{messages:[{content:a,role:"user",name:n}]}}function V(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.data.inReplyTo:t.id))return e;var n=B({},e),a=(n[r]||[])[0];return t.format.includes("update")&&a&&a.sender.id!==t.sender.id&&(r=t.id),n[r]||(n[r]=[]),t.format.includes("Response")&&a?n[r]=[B(B({},a),{data:B(B({},a.data),t.data)}),t]:n[r]=_(_([],n[r],!0),[t],!1),n}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(M||(M={}));var G=function(){return G=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},G.apply(this,arguments)},K=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function Q(e){var t,r,n,a=e.alt,i=void 0===a?"An image is displayed":a,s=K(e,["alt"]),c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(""),p=d[0],m=d[1],f=(0,b.useState)(""),h=f[0],v=f[1];return(0,b.useEffect)(function(){s.getAuthHeaders&&(u(!0),s.getAuthHeaders().then(function(e){return fetch(s.src,{headers:e.headers})}).then(function(e){return e.blob()}).then(function(e){var t=URL.createObjectURL(e);v(t)}).catch(function(){m("Image failed to load"),u(!1)}))},[s.src,s.getAuthHeaders]),p.length>0?(0,o.jsx)(g(),{variant:"body2",children:p}):(0,o.jsxs)("figure",{children:[l&&(0,o.jsx)(q(),{}),s.title&&(0,o.jsx)(g(),{variant:"h6",children:s.title}),(!s.getAuthHeaders||h)&&(0,o.jsx)("img",G({},(t=s.width,r=s.height,n={},t&&(n={width:t}),r&&(n=B(B({},n),{height:r})),t||r||(n={className:"rustic-fit-container"}),n),{src:s.getAuthHeaders?h:s.src,alt:i,onError:function(){m("Image failed to load"),u(!1)},onLoad:function(){u(!1)}})),s.description&&(0,o.jsx)("figcaption",{children:(0,o.jsx)(w.A,{text:s.description})})]})}var $=a(3903);const J=require("@mui/material/Avatar");var Y=a.n(J),X=a(909),Z=a.n(X);const ee=require("@mui/material/InputAdornment");var te=a.n(ee);const re=require("@mui/material/MenuItem");var ne=a.n(re);const ae=require("@mui/material/MenuList");var ie=a.n(ae);const oe=require("@mui/material/Popover");var se=a.n(oe);const ce=require("@mui/material/TextField");var le=a.n(ce),ue=a(4603),de=a.n(ue),pe=a(8342);const me=function(e){var t=(0,h.useTheme)(),r=(0,b.useRef)(null),n=(0,b.useRef)(null),i=(0,b.useState)(!1),s=i[0],c=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function u(){c(!1)}function d(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),u()}return(0,b.useEffect)(function(){n.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then(function(r){var a=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";a.classList.add(i),Object.keys(l).forEach(function(e){a.style.setProperty(e,l[e])}),n.current=a}).catch(function(e){console.error("Failed to load emoji picker",e)})},[]),(0,b.useEffect)(function(){return n.current&&n.current.addEventListener("emoji-click",d),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",d)}},[s,e.onEmojiClick]),(0,o.jsxs)("div",{children:[(0,o.jsx)(de(),{title:"Emoji",children:(0,o.jsx)(Z(),{size:"small",ref:r,onClick:function(){c(function(e){return!e})},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(L.A,{name:"Mood"})})}),n.current&&(0,o.jsx)(se(),{open:s,anchorEl:r.current,onClose:u,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,o.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var fe={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function he(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function ve(e){return(0,o.jsxs)(f(),{className:"rustic-participant-profile",children:[(0,o.jsx)(Y(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"body1Bold",children:e.displayName})]})}function ge(e){var t=e.items,r=e.isOpen,n=e.onClose,a=e.onSelect,i=e.renderItem,s=e.anchorEl,c=e.selectedIndex;return(0,o.jsx)(se(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:s,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,o.jsx)(ie(),{children:t.map(function(e,t){return(0,o.jsx)(ne(),{onClick:function(){return a(e)},selected:t===c,children:i(e)},t)})})})}const xe=(0,b.forwardRef)(function(e,t){var r=e.multiline,n=void 0===r||r,a=e.fullWidth,i=void 0===a||a,s=e.maxRows,c=void 0===s?6:s,l=e.enableSpeechToText,u=void 0!==l&&l,d=e.maximumEmojiSearchResults,p=void 0===d?5:d,m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),h=(0,b.useState)(""),v=h[0],x=h[1],y=(0,b.useState)(!1),j=y[0],w=y[1],S=(0,b.useState)(!1),k=S[0],O=S[1],F=(0,b.useState)(!1),E=F[0],C=F[1],N=(0,b.useState)(""),T=N[0],P=N[1],A=(0,b.useState)([]),D=A[0],I=A[1],R=(0,b.useState)(!1),M=R[0],B=R[1],_=(0,b.useState)(0),z=_[0],H=_[1],U=(0,b.useRef)(null),W=new pe.Database({dataSource:m.emojiDataSource}),V=!v.trim().length,G="".concat(j?"Stop":"Start"," speech to text"),K=k?"primary.main":"primary.light",Q=j?"error.main":K,J=j?"stop_circle":"speech_to_text",Y=(0,b.useState)([]),X=Y[0],ee=Y[1],re=(0,b.useState)(!1),ne=re[0],ae=re[1],ie=u&&"undefined"!=typeof window&&!!window.webkitSpeechRecognition;function oe(){return"boolean"==typeof m.isSendEnabled?!m.isSendEnabled:V}function se(e,t){if(U.current){var r=U.current,n=r.selectionStart,a=r.selectionEnd;if("number"==typeof n&&"number"==typeof a){var i,o=v||"",s=o.substring(0,n),c=o.substring(a),l=void 0;t?(l=s.replace(t,e)+c,i=s.replace(t,e).length):(l=s+e+c,i=n+e.length),x(l),setTimeout(function(){var e,t;null===(e=U.current)||void 0===e||e.focus(),null===(t=U.current)||void 0===t||t.setSelectionRange(i,i)},0)}}}function ce(e){se("@".concat(e," "),/@(\w*)$/),ee([])}function ue(e,t){void 0===t&&(t=!1),se(e,t?/:(\w+)$/:void 0),B(!1)}var xe=E?(0,o.jsx)(q(),{size:24}):(0,o.jsx)(de(),{title:G,children:(0,o.jsx)(Z(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,j?(e.stop(),C(!0),w(!1)):(e.start(),P(""),w(!0)),e.onstart=function(){w(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;v.length>0?x(v+" "+r):x(r),null===(t=U.current)||void 0===t||t.focus(),w(!1)},e.onerror=function(e){var t=fe[e.error];P(t),w(!1)},e.onend=function(){C(!1),w(!1)}},size:"small",sx:{color:Q,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(L.A,{name:J})})});function ye(){var e,t,r=(new Date).toISOString(),n={id:(0,$.v4)(),timestamp:r,sender:m.sender,conversationId:m.conversationId,format:"chatCompletionRequest",data:{text:v},inReplyTo:null===(e=m.lastMsg)||void 0===e?void 0:e.id,messageHistory:null===(t=m.lastMsg)||void 0===t?void 0:t.messageHistory};m.send(n),x(""),P("")}return(0,o.jsxs)(f(),{className:"rustic-base-input",ref:t,children:[(0,o.jsxs)(f(),{className:"rustic-error-and-input-container",children:[(0,o.jsx)(f(),{className:"rustic-error-container",children:(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:T})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:k?"secondary.main":"action.disabled",backgroundColor:"background.paper"},children:[D.length>0&&U.current&&(0,o.jsx)(ge,{anchorEl:U.current,items:D.filter(function(e){return"unicode"in e}),isOpen:M,onClose:function(){B(!1),H(0)},onSelect:function(e){return ue(e.unicode,!0)},selectedIndex:z,renderItem:he}),X.length>0&&U.current&&(0,o.jsx)(ge,{anchorEl:U.current,items:X,isOpen:ne,onClose:function(){ae(!1),H(0)},onSelect:function(e){return ce(e.displayName)},renderItem:ve,selectedIndex:z}),(0,o.jsx)(le(),{className:"rustic-text-field",variant:"outlined",value:v,label:m.label,placeholder:m.placeholder,maxRows:c,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),M&&D.length>0&&"unicode"in D[z]?ue(D[z].unicode,!0):ne&&X.length>0?ce(X[z].displayName):e.shiftKey||oe()||ye();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(M?H(function(e){return(e+t+D.length)%D.length}):ne&&H(function(e){return(e+t+X.length)%X.length}));0!==z&&H(0)}},onChange:function(e){P("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&m.getMembers){var r=t[1].toLowerCase();m.getMembers().then(function(e){var t=e.filter(function(e){return e.displayName.toLowerCase().startsWith(r)});ee(t),t.length>0?ae(!0):ae(!1)})}else ee([])}(t);var r,n=t.match(/:(\w{2,}):/g),a=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");W.getEmojiByShortcode(i).then(function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)}).catch(function(){x(t)}),B(!1)}else a?(r=a[0].replace(":",""),W.getEmojiBySearchQuery(r).then(function(e){e.length?(I(e.slice(0,p)),B(!0)):(I([]),B(!1))}).catch(function(){I([]),B(!1)})):B(!1)},onFocus:function(){return O(!0)},onBlur:function(){return O(!1)},inputRef:U,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(te(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(me,{dataSource:m.emojiDataSource,onEmojiClick:ue,buttonColor:K}),ie&&xe]})},inputLabel:{className:k?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(f(),{className:"rustic-input-actions",children:[m.children,(0,o.jsx)(de(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(Z(),{"aria-label":"send message",onClick:ye,disabled:oe(),color:"secondary",children:(0,o.jsx)(L.A,{name:"send"})})})})]})]})}),ye=require("@mui/material/LinearProgress");var be=a.n(ye);const je=require("axios");var we=a.n(je);const Se=require("react-dom"),ke=require("@mui/material/Card");var Oe=a.n(ke);const Fe=require("@mui/material/Modal");var Ee=a.n(Fe);const Ce=require("@mui/system/Stack");var Ne=a.n(Ce);const Te=require("@mui/system/useTheme");var Pe=a.n(Te);const Ae=require("pdfjs-dist"),De=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,o.jsx)(de(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(Z(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(L.A,{name:r.symbol})})})})},Ie=function(e){var t,r=(0,b.useRef)(null),n=(0,b.useState)(1),a=n[0],i=n[1],s=(0,b.useState)(1),c=s[0],l=s[1],u=(0,b.useState)(1),d=u[0],p=u[1],m=(0,b.useState)(!1),h=m[0],v=m[1],x=(0,b.useState)(),j=x[0],w=x[1],S=Pe()(),k=y()(S.breakpoints.down("sm")),O=y()(S.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var F=(0,b.useState)(function(){return k?.5:O?1:1.5}),E=F[0],C=F[1];function N(t){Ae.getDocument({url:e.url,httpHeaders:t}).promise.then(function(e){l(e.numPages),function(e){e.getPage(a).then(function(e){var t=e.getViewport({scale:E}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};j&&j.cancel();var s=e.render(o);w(s),s.promise.then(function(){w(void 0)}).catch(function(e){console.error(e)})}}})}(e)}).catch(function(){v(!0)})}return(0,b.useEffect)(function(){Ae.GlobalWorkerOptions.workerSrc||(Ae.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Ae.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then(function(e){return N(e.headers)}).catch(function(){return v(!0)}):N()},[e.url,a,E]),h?(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(f(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(De,{action:"zoomOut",onClick:function(){C(function(e){return Math.max(e-.2,.2)})}}),(0,o.jsx)(De,{action:"zoomIn",onClick:function(){C(function(e){return e+.2})}})]}),(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body",children:(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body-inner",children:(0,o.jsx)("canvas",{ref:r})})}),(0,o.jsxs)(Ne(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(De,{action:"previousPage",onClick:function(){a>1&&(i(a-1),p(a-1))},isDisabled:1===a}),(0,o.jsx)(g(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(le(),{type:"number",value:d,onChange:function(e){var t=parseInt(e.target.value);p(t),!isNaN(t)&&t>=1&&t<=c&&i(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(g(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(De,{action:"nextPage",onClick:function(){a<c&&(i(a+1),p(a+1))},isDisabled:a===c})]})]})};var Le=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Re={pdf:Ie};function Me(e){var t=e.supportedViewers,r=void 0===t?Re:t,n=e.showFullName,a=void 0===n||n,i=Le(e,["supportedViewers","showFullName"]),s=(0,h.useTheme)(),c=(0,b.useState)(!1),l=c[0],u=c[1];function d(){u(!1)}var p,m,f=i.file.url&&(p=i.file.url.split("."))[p.length-1].toLowerCase(),v=f&&r?r[f]:null,x=!!v,y=x?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(a?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=a?i.file.name:(m=i.file.name).length<=15?m:m.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(Oe(),{className:j,variant:"outlined",sx:{boxShadow:s.shadows[1]},onClick:function(){u(!0)},children:[(0,o.jsx)(g(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:i.children})]}),x&&(0,o.jsx)(Ee(),{open:l,onClose:d,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(de(),{title:"Close",children:(0,o.jsx)(Z(),{onClick:d,className:"rustic-close-button",children:(0,o.jsx)(L.A,{name:"close"})})}),i.file.url&&(0,o.jsx)(v,{url:i.file.url,getAuthHeaders:i.getAuthHeaders})]})})]})}var qe=a(3110);const Be=require("@mui/material"),_e=require("@mui/material/Button");var ze=a.n(_e);const He=require("@mui/material/Drawer");var Ue=a.n(He);const We=require("@mui/material/ListItemText");var Ve=a.n(We);const Ge=require("@mui/material/Menu");var Ke=a.n(Ge),Qe=function(){return Qe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Qe.apply(this,arguments)};function $e(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useRef)(null),i=(0,h.useTheme)(),s=(0,Be.useMediaQuery)(i.breakpoints.down("md")),c=s?Ue():Ke(),l={borderRadius:"".concat(i.shape.borderRadius,"px"),border:"1px solid ".concat(i.palette.divider)};function u(e){return(0,o.jsxs)(o.Fragment,{children:[e.startDecorator&&(0,o.jsx)(T.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,o.jsx)(Ve(),{children:(0,o.jsx)(g(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,o.jsx)(T.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(l=Qe(Qe({},l),{borderRadius:"".concat(i.shape.borderRadius,"px ").concat(i.shape.borderRadius,"px 0 0"),borderBottom:0}));var d=e.menuItems.map(function(e){return e.href?(0,o.jsx)(ne(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)(ne(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:u(e)},e.label)});var p,m,f=s?{}:{anchorEl:a.current};return(0,o.jsxs)(o.Fragment,{children:[(p={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},m=(0,o.jsx)(L.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(ze(),Qe({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(de(),{title:e.ariaLabel,children:(0,o.jsx)(Z(),Qe({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,Qe({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":Qe(Qe({},l),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:d}))]})}var Je=function(){return Je=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Je.apply(this,arguments)},Ye=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Xe(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const Ze=function(e){var t,r=(0,b.useState)([]),n=r[0],a=r[1],i=(0,b.useState)([]),s=i[0],c=i[1],l=(0,b.useState)({}),u=l[0],d=l[1],p=(0,b.useRef)({}),m=(0,$.v4)();(0,b.useEffect)(function(){a([]),c([]),p.current={}},[e.messageId]);var h=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function v(e,t,r){var n;p.current=Je(Je({},p.current),((n={})[e]=p.current[e]--,n)),function(e,t,r){c(function(t){return Ye(Ye([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)}),a(function(e){return e.filter(function(e){return e.id!==t})})}(e,t,r)}var x=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map(function(t,r){return(0,o.jsx)(Me,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(be(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(de(),{title:"Delete",children:(0,o.jsx)(Z(),{color:"primary",onClick:function(){return function(t,r){var n,i;c([]);var o=t.name;if(p.current=Je(Je({},p.current),((n={})[o]=p.current[o]--,n)),e.onFileUpdate("remove",o),100===t.loadingProgress){var s="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);h.then(function(t){we().delete(s,Je({},t)).then(function(){return a(function(e){return e.filter(function(e,t){return t!==r})})}).catch(function(){return e.onFileUpdate("add",o),c(function(e){return Ye(Ye([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)})})})}else t.abortController.abort(),a(function(e){return e.filter(function(e,t){return t!==r})}),p.current=Je(Je({},p.current),((i={})[o]=p.current[o]++,i))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)})}),y=(0,o.jsx)(f(),{children:s.map(function(e,t){return(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)})});function j(e,t){return t?(0,Se.createPortal)(e,t):e}var w=null===(t=e.uploadOptions)||void 0===t?void 0:t.map(function(t){return{label:t.label,onClick:function(){return function(t){d(t.metadata);var r=document.getElementById(m);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,o.jsx)(qe.default,{name:t.iconName})}});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(f(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:m,children:(null==w?void 0:w.length)?(0,o.jsx)($e,{ariaLabel:"Upload",icon:(0,o.jsx)(qe.default,{name:"upload_2"}),menuItems:w}):(0,o.jsx)(de(),{title:"Upload",children:(0,o.jsx)(Z(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,o.jsx)("input",{type:"file",id:m,onChange:function(t){c([]);var r=t.target.files&&Array.from(t.target.files),i=n.length+(r?r.length:0);e.maxFileCount&&i>e.maxFileCount&&c(function(t){return Ye(Ye([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)});var o=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,i,e.maxFileCount);o&&o.forEach(function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,c(function(t){return Ye(Ye([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&Xe(e.maxFileSize),".")],!1)})):function(t){var r=new FormData,n=new AbortController,i=function(e){var t,r,n=e.name,a=p.current[n];if(a){var i=a+1,o=n.lastIndexOf("."),s=n.substring(0,o),c=n.substring(o);n="".concat(s,"(").concat(a,")").concat(c),p.current=Je(Je({},p.current),((t={})[e.name]=i,t))}else p.current=Je(Je({},p.current),((r={})[e.name]=1,r));return n}(t),o=new File([t],i,{type:t.type});if(e.getUploadData||u){var s=e.getUploadData?e.getUploadData(i):{},c=Je(Je({},s),u);Object.keys(c).forEach(function(e){var t=c[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)})}r.append("file",o);var l=(0,$.v4)(),d={name:i,loadingProgress:0,abortController:n,id:l};function m(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=d.id,a(function(e){var n=e.map(function(e){return e.id===r?Je(Je({},e),{loadingProgress:t}):e});return n}))}a(function(e){return Ye(Ye([],e,!0),[d],!1)}),e.onFileUpdate("add",i);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId);!function o(){return h.then(function(s){return we().post(f,r,Je(Je({},s),{onUploadProgress:m,signal:n.signal})).then(function(t){var n,i,o=r.get("file");t.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,t.data.url),t.data.fileId&&(n=t.data,i=d.id,a(function(e){var t=e.findIndex(function(e){return e.id===i});if(-1!==t){var r=Ye([],e,!0);return r[t]=Je(Je({},r[t]),{id:n.fileId}),r}return e}))}).catch(function(n){var s,c,u=r.get("file");u instanceof File&&u.name&&e.onFileUpdate("remove",u.name);var p,m,f,h;409===(null===(s=n.response)||void 0===s?void 0:s.status)&&e.listFiles?(p=i.lastIndexOf("."),m=i.substring(0,p),f=i.substring(p),h=new RegExp("^".concat(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then(function(e){for(var t=0,r=0,n=e;r<n.length;r++){var a=n[r];if(h.test(a.name)){var i=a.name.match(h),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;t=Math.max(t,o)}}return"".concat(m,"(").concat(t+1,")").concat(f)}):Promise.resolve(i)).then(function(n){e.onFileUpdate("add",n);var i=new File([t],n,{type:t.type});r.set("file",i),a(function(e){return e.map(function(e){return e.id===l?Je(Je({},e),{name:n,loadingProgress:0}):e})}),o()}).catch(function(){var e;v(t.name,d.id,null===(e=n.response)||void 0===e?void 0:e.data)}):v(t.name,d.id,null===(c=n.response)||void 0===c?void 0:c.data)})})}()}(t)}(t)}),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),s.length>0&&j(y,e.errorMessagesContainer),n.length>0&&j(x,e.filePreviewsContainer)]})};var et=function(){return et=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},et.apply(this,arguments)},tt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},rt=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},nt=2097152;function at(e){var t=e.maxFileSize,r=void 0===t?nt:t,n=e.maxFileCount,a=void 0===n?1:n,i=tt(e,["maxFileSize","maxFileCount"]),s=(0,b.useState)({uploaded:[],fileList:[]}),c=s[0],l=s[1],u=(0,b.useState)((0,$.v4)()),d=u[0],p=u[1],m=(0,b.useState)(),v=m[0],g=m[1],x=(0,b.useState)(),y=x[0],j=x[1],w=(0,b.useRef)(null),S=(0,h.useTheme)(),k=c.fileList.length>0,O=c.uploaded.length===c.fileList.length&&c.uploaded.length>0;return(0,b.useEffect)(function(){w.current&&(j(w.current.querySelector(".rustic-error-container")),g(w.current.querySelector(".rustic-input-extras")))}),(0,o.jsx)(f(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(S.palette.action.disabled),borderRadius:"".concat(S.shape.borderRadius,"px"),":focus-within":{borderColor:S.palette.secondary.main},background:S.palette.background.paper},children:(0,o.jsx)(xe,et({},i,{send:function(e){e.data=W(e.sender,e.data.text,c.uploaded.map(function(e){return{url:e.url,name:e.name}})),e.id=d,i.ws.send(e),p((0,$.v4)()),l({uploaded:[],fileList:[]})},isSendEnabled:k?O:void 0,ref:w,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Ze,{acceptedFileTypes:i.acceptedFileTypes,maxFileCount:a,maxFileSize:r,uploadFileEndpoint:i.uploadFileEndpoint,deleteFileEndpoint:i.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)l(function(e){return et(et({},e),{fileList:rt(rt([],e.fileList,!0),[{name:t}],!1)})});else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");l(function(e){var n=e.fileList.findIndex(function(e){return e.name===t}),a=rt(rt(rt([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return et(et({},e),{uploaded:a})})}else l(function(e){return{uploaded:e.uploaded.filter(function(e){return e.name!==t}),fileList:e.fileList.filter(function(e){return e.name!==t})}})},messageId:d,filePreviewsContainer:v,errorMessagesContainer:y,showFullName:i.showFullName,getUploadData:i.getUploadData,uploadOptions:i.uploadOptions,listFiles:i.listFiles,getUploadHeaders:i.getUploadHeaders})})}))})}var it=function(){return it=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},it.apply(this,arguments)},ot=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function st(e){var t=e.ws,r=ot(e,["ws"]);return(0,o.jsx)(xe,it({},r,{send:function(e){e.data=W(e.sender,e.data.text),t.send(e)}}))}require("ol/ol.css");var ct=a(5642),lt=a.n(ct);const ut=require("ol/layer/Tile.js");var dt=a.n(ut);const pt=require("ol/Map.js");var mt=a.n(pt);const ft=require("ol/Overlay.js");var ht=a.n(ft);const vt=require("ol/proj.js"),gt=require("ol/source/OSM.js");var xt=a.n(gt);const yt=require("ol/View.js");var bt=a.n(yt);function jt(e){var t=(0,b.useState)(""),r=t[0],n=t[1],a=(0,b.useRef)(null),i=(0,b.useRef)(null);return(0,b.useEffect)(function(){if(n(""),e.latitude<-90||e.latitude>90||e.longitude<-180||e.longitude>180)return n("Invalid coordinates");if(a.current&&i.current){var t=new(mt())({layers:[new(dt())({source:new(xt())})],view:new(bt())({center:(0,vt.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(ht())({element:i.current,position:(0,vt.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return t.addOverlay(r),t.once("postrender",function(){var e;if(!(null===(e=a.current)||void 0===e?void 0:e.querySelector("canvas")))return n("An error occurred while loading the map")}),function(){t.setTarget(""),t.removeOverlay(r)}}},[]),(0,o.jsx)(o.Fragment,{children:r.length>0?(0,o.jsx)(lt(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(f(),{ref:i,children:(0,o.jsx)(L.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:a,className:"rustic-open-layers-map-canvas"})]})})}var wt=a(4409);const St=require("@mui/material/Slider");var kt=a.n(St);function Ot(e){var t,r={play:{symbol:"play_circle",label:"Play"},pause:{symbol:"pause_circle",label:"Pause"},forward:{symbol:"forward_10",label:"Forward ten seconds"},replay:{symbol:"replay_10",label:"Replay ten seconds"},volumeUp:{symbol:"volume_up",label:"Mute"},volumeOff:{symbol:"volume_off",label:"Unmute"},miniPlayer:{symbol:"picture_in_picture",label:"Mini player"},miniPlayerExit:{symbol:"picture_in_picture_off",label:"Exit mini player"},fullscreen:{symbol:"fullscreen",label:"Fullscreen"},fullscreenExit:{symbol:"fullscreen_exit",label:"Exit fullscreen"},captionsOn:{symbol:"closed_caption",label:"Show captions"},captionsOff:{symbol:"closed_caption_disabled",label:"Hide captions"}};return r[e.action].label.replaceAll(" ","-").toLowerCase(),(0,o.jsx)(de(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Z(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(L.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var Ft=100;function Et(e){var t="dark"===(0,Be.useTheme)().palette.mode,r=H(e.mediaElement.currentTime);return(0,o.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var r=e.mediaElement.buffered,n=0,a=r.length-1;a>=0;--a){var i=r.start(a),s=r.end(a);if(i<e.mediaElement.currentTime){n=s;break}}var c=n/e.mediaElement.duration*Ft;return(0,o.jsx)(be(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(kt(),{className:"rustic-progress-slider",size:"small","aria-label":"Time","aria-valuetext":"Current time: ".concat(r),max:e.mediaElement.duration,value:e.mediaElement.currentTime,onChange:function(t,r){e.mediaElement.currentTime=r},valueLabelDisplay:"auto",valueLabelFormat:function(e){return H(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function Ct(e){var t=(0,b.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,b.useState)(e.mediaElement.volume),i=a[0],s=a[1],c=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,o.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,o.jsx)(Ot,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(s(e.mediaElement.volume),n(0)):n(i)},className:"rustic-mute-button",action:c}),(0,o.jsx)(kt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*Ft,"%"),value:r,onChange:function(t,r){var a=r;e.mediaElement.muted=0===a,e.mediaElement.volume=a,n(e.mediaElement.volume)}})]})}function Nt(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(ze(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(L.A,{name:t}),children:(0,o.jsx)(g(),{variant:"overline",children:r})})}function Tt(e){var t=(0,b.useState)(!e.mediaElement.paused),r=t[0],n=t[1],a=r?"pause":"play";return e.mediaElement.onended=function(){n(!1)},e.mediaElement.onpause=function(){n(!1)},e.mediaElement.onplay=function(){n(!0)},(0,o.jsx)(Ot,{onClick:function(){r?e.mediaElement.pause():e.mediaElement.play().catch(function(t){e.onError("Failed to play the media. Error: ".concat(t.message))})},action:a,className:"rustic-pause-play-icon"})}function Pt(e){var t,r=(0,b.useState)(e.mediaElement.playbackRate),n=r[0],a=r[1];return(0,o.jsx)(de(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(ze(),{onClick:function(){var t=1;e.mediaElement.playbackRate<2&&(t=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=t,a(t)},className:"rustic-playback-rate-button",children:(0,o.jsxs)(g(),{variant:"body1",children:[n,"X"]})})})}function At(e){var t="replay"===e.movement,r=t?function(){e.mediaElement.currentTime-=10}:function(){e.mediaElement.currentTime+=10},n=t?"replay":"forward";return(0,o.jsx)(Ot,{onClick:r,action:n})}var Dt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function It(e){var t=e.style,r=void 0===t?"condensed":t,n=Dt(e,["style"]),a=H(n.elapsedTimeInSeconds),i=H(n.durationTimeInSeconds),s="".concat(a," / ").concat(i);return"wide"===r?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(g(),{variant:"overline",children:a}),(0,o.jsx)(g(),{variant:"overline",children:i})]}):(0,o.jsx)(g(),{variant:"overline",className:"rustic-time-display",children:s})}const Lt=require("@mui/material/Divider");var Rt=a.n(Lt);function Mt(e){var t=!!document.fullscreenElement;return(0,o.jsxs)(T.Box,{className:"rustic-transcript-container",children:[!t&&(0,o.jsx)(Rt(),{orientation:"vertical",flexItem:!0}),(0,o.jsx)(g(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function qt(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(0),p=d[0],m=d[1],f=(0,b.useState)(""),h=f[0],v=f[1],x=(0,b.useState)(""),y=x[0],j=x[1],S=(0,Be.useTheme)(),k=(0,b.useRef)(null),O=(0,Be.useMediaQuery)(S.breakpoints.down("md"));function F(){return(0,o.jsx)(g(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function E(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Ot,{action:t,onClick:function(){return s(!i)}})}}function C(){if(k.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(At,{mediaElement:k.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:k.current,onError:j}),(0,o.jsx)(At,{mediaElement:k.current,movement:"forward"})]})}function N(){if(e.transcript&&r)return(0,o.jsx)(Mt,{transcript:e.transcript})}function P(){if(e.transcript)return(0,o.jsx)(Nt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function A(){return(0,o.jsx)("video",{src:e.src,ref:k,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,b.useEffect)(function(){var e,t,r,n;function a(e){v(e)}null===(e=k.current)||void 0===e||e.addEventListener("timeupdate",function(){k.current&&m(k.current.currentTime)}),null===(t=k.current)||void 0===t||t.addEventListener("canplay",function(){v(""),u(!1)}),null===(r=k.current)||void 0===r||r.addEventListener("error",function(){return a("Failed to load the audio.")}),null===(n=k.current)||void 0===n||n.addEventListener("stalled",function(){return a("Failed to fetch audio data, but trying.")})},[]);var D=O?function(){if(k.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(It,{elapsedTimeInSeconds:p,durationTimeInSeconds:k.current.duration,style:"wide"}),(0,o.jsx)(Et,{mediaElement:k.current}),F(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-left",children:C()}),(0,o.jsx)(Ct,{mediaElement:k.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[P(),(0,o.jsxs)(T.Box,{children:[E(),(0,o.jsx)(Pt,{mediaElement:k.current})]})]})]}),N()]})}:function(){if(k.current)return(0,o.jsxs)(o.Fragment,{children:[F(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Et,{mediaElement:k.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-left",children:[C(),E(),(0,o.jsx)(Pt,{mediaElement:k.current}),(0,o.jsx)(Ct,{mediaElement:k.current}),(0,o.jsx)(It,{elapsedTimeInSeconds:p,durationTimeInSeconds:k.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:P()})]}),N()]})]})};return h.length>0?(0,o.jsx)(lt(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[A(),(0,o.jsx)(q(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[A(),D(),y.length>0&&(0,o.jsx)(lt(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:y})]})}function Bt(e){var t=(0,b.useState)(!!document.pictureInPictureElement),r=t[0],n=t[1],a=e.mediaElement,i=r?"miniPlayerExit":"miniPlayer";return a.onleavepictureinpicture=function(){n(!1)},(0,o.jsx)(Ot,{onClick:function(){r?document.exitPictureInPicture().then(function(){n(!1)}).catch(function(t){e.onError("Failed to exit mini player. Error: ".concat(t.message))}):a.requestPictureInPicture().then(function(){n(!0)}).catch(function(t){e.onError("Failed to enter mini player. Error: ".concat(t.message))})},action:i})}function _t(e){var t=(0,b.useState)(!!document.fullscreenElement),r=t[0],n=t[1],a=e.element,i=r?"fullscreenExit":"fullscreen";return a.onfullscreenchange=function(){n(!!document.fullscreenElement)},(0,o.jsx)(Ot,{onClick:function(){r?document.exitFullscreen().then(function(){n(!1)}).catch(function(t){e.onError("Failed to exit fullscreen mode. Error: ".concat(t.message))}):a.requestFullscreen().then(function(){n(!0)}).catch(function(t){e.onError("Failed to enter fullscreen mode. Error: ".concat(t.message))})},action:i})}function zt(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(!!document.fullscreenElement),p=d[0],m=d[1],f=(0,b.useState)(!1),h=f[0],v=f[1],x=(0,b.useState)(""),y=x[0],j=x[1],S=(0,b.useState)(""),k=S[0],O=S[1],F=(0,b.useState)(0),E=F[0],C=F[1],N=(0,b.useRef)(null),P=(0,b.useRef)(null),A=(0,Be.useTheme)(),D=(0,Be.useMediaQuery)(A.breakpoints.down("md"));(0,b.useEffect)(function(){var e,t,r,n,a,i,o,s;function c(e){O(e),u(!1)}function l(){clearTimeout(s),s=setTimeout(function(){return v(!1)},3e3)}null===(e=P.current)||void 0===e||e.addEventListener("timeupdate",function(){P.current&&C(P.current.currentTime)}),null===(t=P.current)||void 0===t||t.addEventListener("canplay",function(){O(""),u(!1)}),null===(r=P.current)||void 0===r||r.addEventListener("error",function(){return c("Failed to load the video.")}),null===(n=P.current)||void 0===n||n.addEventListener("stalled",function(){return c("Failed to fetch video data, but trying.")}),document.addEventListener("fullscreenchange",function(){m(!!document.fullscreenElement)}),null===(a=N.current)||void 0===a||a.addEventListener("mousemove",function(){v(!0),l()}),null===(i=N.current)||void 0===i||i.addEventListener("mouseleave",function(){v(!1)}),null===(o=N.current)||void 0===o||o.addEventListener("keydown",function(){v(!0),l()})},[]);var I={backgroundColor:A.palette.background.paper,opacity:h?1:0};function L(){if(e.transcript&&r)return(0,o.jsx)(Mt,{transcript:e.transcript})}function R(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Ot,{action:t,onClick:function(){return s(!i)}})}}function M(){if(e.transcript)return(0,o.jsx)(Nt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var B=D?function(){return p?(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:I,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(Tt,{mediaElement:P.current,onError:j}),(0,o.jsx)(Et,{mediaElement:P.current}),(0,o.jsx)(It,{elapsedTimeInSeconds:E,durationTimeInSeconds:P.current.duration})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(At,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(At,{mediaElement:P.current,movement:"forward"}),R(),(0,o.jsx)(Pt,{mediaElement:P.current})]}),M()]}),L()]})}):(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Tt,{mediaElement:P.current,onError:j}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[M(),(0,o.jsx)(_t,{element:N.current,onError:j})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:I,children:[(0,o.jsx)(Et,{mediaElement:P.current}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-left",children:[(0,o.jsx)(Tt,{mediaElement:P.current,onError:j}),(0,o.jsx)(At,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(At,{mediaElement:P.current,movement:"forward"}),R(),(0,o.jsx)(Pt,{mediaElement:P.current}),(0,o.jsx)(Ct,{mediaElement:P.current}),(0,o.jsx)(It,{elapsedTimeInSeconds:E,durationTimeInSeconds:P.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[M(),(0,o.jsx)(Bt,{mediaElement:P.current,onError:j}),(0,o.jsx)(_t,{element:N.current,onError:j})]})]}),p&&L()]})})};return k.length>0?(0,o.jsx)(lt(),{severity:"error",children:k}):(0,o.jsxs)(T.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(q(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(T.Box,{ref:N,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[y.length>0&&(0,o.jsx)(lt(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:y}),(!D||p)&&function(){if(P.current&&N.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:I,children:[(0,o.jsx)(g(),{variant:"body2",children:e.title}),p&&D&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(Bt,{mediaElement:P.current,onError:j}),(0,o.jsx)(_t,{element:N.current,onError:j})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:P,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),B()]}),!p&&L(),e.description&&(0,o.jsx)(w.A,{text:e.description})]})}const Ht=require("@mui/material/Chip");var Ut=a.n(Ht);const Wt=require("@mui/system/Box");var Vt=a.n(Wt);const Gt=require("@mui/material/Stack");var Kt=a.n(Gt);const Qt=function(e){return(0,o.jsx)(g(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),n=navigator.language,a={month:"short",day:"numeric"},i=new Date,s=r.getFullYear()!==i.getFullYear(),c=s?" at ":", ",s&&(a.year="numeric"),r.toLocaleDateString(n,a)+c+r.toLocaleTimeString(n,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,n,a,i,s,c},$t=(0,b.forwardRef)(function(e,t){var r=(0,Be.useTheme)(),n=e.inReplyTo?e.inReplyTo:e.message;return(0,o.jsxs)(Kt(),{id:n.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(Kt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(n),(0,o.jsx)(Qt,{timestamp:n.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(g(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,o.jsx)(Qt,{timestamp:e.message.timestamp})]})]})]})});var Jt=function(){return Jt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Jt.apply(this,arguments)},Yt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function Xt(e){var t=e.scrollDownLabel,r=void 0===t?"Scroll down":t,n=Yt(e,["scrollDownLabel"]),a=(0,b.useRef)(null),i=(0,b.useRef)(null),s=(0,b.useRef)(),c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(!0),p=d[0],m=d[1],f=(0,b.useState)(!1),h=f[0],v=f[1],g=(0,b.useState)({}),x=g[0],y=g[1],j=(0,b.useState)(!0),w=j[0],S=j[1],k=(0,b.useState)(""),O=k[0],F=k[1],E=Object.keys(x).length;function C(){var e=i.current,t=a.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;u(n-1<=r)}}function N(){if(function(){var e,t=null===(e=i.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every(function(e){return e.readyState>=1})}()){var e=i.current;v(!0),e&&setTimeout(function(){m(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(function(){m(!1)},2e3),e.scrollTop=e.scrollHeight,u(!0)},0)}else setTimeout(N,1)}return(0,b.useEffect)(function(){var e={};n.getHistoricMessages().then(function(t){t.forEach(function(t){var r=V(e,t);e=r}),y(e),S(!1)}).catch(function(e){var t,r,n,a=(null===(r=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===r?void 0:r.detail)||(null===(n=e.response)||void 0===n?void 0:n.data);F(a||"Failed to load messages"),S(!1)})},[n.getHistoricMessages]),(0,b.useEffect)(function(){!w&&x&&N();var e=i.current;if(e)return C(),e.addEventListener("scroll",C),window.addEventListener("resize",C),function(){e.removeEventListener("scroll",C),window.removeEventListener("resize",C)}},[w,x]),(0,b.useEffect)(function(){N()},[h]),w?(0,o.jsx)(Vt(),{className:"rustic-message-archive-loading",children:n.loadingIcon?n.loadingIcon:(0,o.jsx)(q(),{})}):(0,o.jsxs)(Vt(),{className:"rustic-message-archive",children:[n.infoMessage&&!O&&(0,o.jsx)(lt(),{severity:"warning",children:n.infoMessage}),O&&(0,o.jsx)(lt(),{severity:"error",children:O}),(0,o.jsxs)(Vt(),{ref:i,className:"rustic-message-container",children:[Object.keys(x).map(function(e,t){var r=x[e],i=r[r.length-1],s=i.format.includes("Response"),c=s&&{inReplyTo:r[0]};return(0,o.jsx)($t,Jt({message:i},c,{getActionsComponent:n.getActionsComponent,getProfileComponent:n.getProfileComponent,ref:t===E-1?a:null,children:(0,o.jsx)(I,{messages:s?[r[0]]:r,supportedElements:n.supportedElements})}),e)}),!l&&!p&&(0,o.jsx)(Ut(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:N,label:(0,o.jsxs)(o.Fragment,{children:[r,(0,o.jsx)(L.A,{name:"arrow_downward"})]})})]})]})}var Zt=a(4445);function er(e){var t=(0,b.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(Zt.default,{message:e.message,icon:(0,o.jsx)(L.A,{name:"file_copy"}),onClick:function(e){e.data.text&&navigator.clipboard.writeText(e.data.text).then(function(){n("Copied"),setTimeout(function(){n("Copy text")},2e3)}).catch(function(){n("Failed to copy")})},label:r})}function tr(e){var t=(0,b.useState)("Start reading aloud"),r=t[0],n=t[1],a=[e.message.data.title,e.message.data.description,e.message.data.alt,e.message.data.text,e.message.data.transcript].filter(Boolean).join(" "),i=new SpeechSynthesisUtterance(a);return(0,o.jsx)(Zt.default,{message:e.message,icon:(0,o.jsx)(L.A,{name:"text_to_speech"}),onClick:function(){window.speechSynthesis.speaking?(window.speechSynthesis.cancel(),n("Start reading aloud")):(i.onend=function(){n("Start reading aloud")},window.speechSynthesis.speak(i),n("Stop reading aloud"))},label:r})}var rr=function(){return rr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},rr.apply(this,arguments)},nr=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function ar(e){var t,r,n,a=e.scrollDownLabel,i=void 0===a?"Scroll down":a,s=nr(e,["scrollDownLabel"]),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(),d=(0,b.useState)(!0),p=d[0],m=d[1],f=(0,b.useState)(!0),h=f[0],v=f[1],g=(0,b.useState)(!1),x=g[0],y=g[1],j=(0,b.useState)({}),w=j[0],S=j[1],k=Object.keys(w).length,O=(r=k,n=(0,b.useRef)(0),(0,b.useEffect)(function(){n.current=r}),n.current);function F(){v(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(function(){v(!1)},2e3)}function E(){var e=l.current,t=c.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;m(n-1<=r)}}function C(){if(function(){var e,t=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every(function(e){return e.readyState>=1})}()){var e=l.current;y(!0),e&&setTimeout(function(){F(),e.scrollTop=e.scrollHeight},0)}else setTimeout(C,1)}function N(e){S(function(t){return V(t,e)})}return(0,b.useEffect)(function(){var e=l.current;if(E(),e)return e.addEventListener("scroll",E),window.addEventListener("resize",E),function(){e.removeEventListener("scroll",E),window.removeEventListener("resize",E)}},[p]),(0,b.useEffect)(function(){C()},[x]),(0,b.useEffect)(function(){p&&0!==O&&k>O&&(F(),C())},[p,Object.keys(w).length]),(0,b.useEffect)(function(){var e,t={};null===(e=s.receivedMessages)||void 0===e||e.forEach(function(e){var r=V(t,e);t=r}),S(t)},[null===(t=s.receivedMessages)||void 0===t?void 0:t.length]),(0,b.useEffect)(function(){s.ws.onReceive&&s.ws.onReceive(N)},[]),(0,o.jsxs)(Vt(),{className:"rustic-message-space",children:[(0,o.jsxs)(Vt(),{ref:l,className:"rustic-message-container",children:[Object.keys(w).map(function(e,t){var r,n=w[e],a=n[n.length-1],i=a.format.includes("Response"),l=i&&{inReplyTo:n[0]};return"prompts"!==a.format?(0,o.jsx)($t,rr({message:a},l,{getActionsComponent:s.getActionsComponent,getProfileComponent:s.getProfileComponent,ref:t===k-1?c:null,children:(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})}),e):"inConversation"===(null===(r=a.data)||void 0===r?void 0:r.position)?(0,o.jsx)("div",{ref:t===k-1?c:null,children:(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})},e):void 0}),!p&&!h&&(0,o.jsx)(Ut(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:C,label:(0,o.jsxs)(o.Fragment,{children:[i,(0,o.jsx)(L.A,{name:"arrow_downward"})]})})]}),function(e){var t,r=Object.values(e).flat(),n=r[r.length-1];return"prompts"===(null==n?void 0:n.format)&&"inConversation"!==(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.position)?(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:[n],supportedElements:s.supportedElements}):null}(w)]})}var ir=a(8010),or=function(){return or=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},or.apply(this,arguments)};function sr(e){return(0,o.jsx)(de(),{title:"Download",className:"rustic-shift-to-right-by-8",children:e.getAuthHeaders?(0,o.jsx)(Z(),{onClick:function(){(0,e.getAuthHeaders)().then(function(t){return fetch(e.url,or({},t))}).then(function(e){return e.blob()}).then(function(t){var r=window.URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e.fileName,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)}).catch(function(e){throw new Error("Error downloading file. "+e.message)})},children:(0,o.jsx)(L.A,{name:"download"})}):(0,o.jsx)(Z(),{component:"a",href:e.url,download:e.fileName,children:(0,o.jsx)(L.A,{name:"download"})})})}function cr(e){return new URL(e).pathname.split("/").pop()}function lr(e){return(0,o.jsxs)(f(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(ir.default,{text:e.description})]}),e.messages.map(function(t,r){return"string"==typeof t.content?(0,o.jsx)(ir.default,{text:t.content},r):function(t,r){var n=[],a="";return t.map(function(t){if("text"===t.type)a+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,i={url:r,name:t[t.type].name||cr(r)},s=(0,o.jsx)(Me,{file:i,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:i.url&&(0,o.jsx)(sr,{url:i.url,fileName:i.name,getAuthHeaders:e.getAuthHeaders})});n.push(s)}}),(0,o.jsxs)(j().Fragment,{children:[a.length>0&&(0,o.jsx)(ir.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]},r)}(t.content,r)})]})}function ur(e){return(0,o.jsxs)(Vt(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(ir.default,{text:e.description})]}),e.text&&(0,o.jsx)(ir.default,{text:e.text}),(t=e.files.map(function(t,r){return(0,o.jsx)(Me,{file:t,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:t.url&&(0,o.jsx)(sr,{url:t.url,fileName:t.name,getAuthHeaders:e.getAuthHeaders})},r)}),(0,o.jsx)(Vt(),{className:"rustic-files",children:t}))]});var t}const dr=require("@mui/material/Dialog");var pr=a.n(dr);const mr=require("@mui/material/DialogTitle");var fr=a.n(mr);const hr=require("@mui/material/List");var vr=a.n(hr);const gr=require("@mui/material/ListItem");var xr=a.n(gr);const yr=require("@mui/material/ListSubheader");var br=a.n(yr);const jr=require("pluralize");var wr=a.n(jr),Sr=a(7159);function kr(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(wr()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(g(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(vr(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(br(),{disableSticky:!0,className:"rustic-participant-list-subheader",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-list-subheader-title",children:[e.participantTypeIcon,(0,o.jsx)(g(),{variant:"subtitle2",color:"text.secondary",children:s})]}),a>3&&(0,o.jsx)(ze(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(L.A,{name:"keyboard_arrow_down"}),children:c})]}),children:i.map(function(e){return(0,o.jsxs)(xr(),{className:"rustic-participant-list-item",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-profile",children:[(0,o.jsx)(Y(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"subtitle2",children:e.displayName})]}),(0,o.jsx)(g(),{variant:e.participantRole===Sr.sW.Owner?"subtitle2":"caption",children:z(e.participantRole||Sr.sW.Member)})]},e.id)})})}const Or=function(e){function t(e,t){return function(e){return function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],e,!0).sort(function(e,t){return t.participantRole===Sr.sW.Owner?1:-1})}(e.filter(function(e){return e.participantType===t}))}var r=t(e.participants,Sr.yJ.Human),n=t(e.participants,Sr.yJ.Agent),a="".concat(wr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(pr(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(fr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:a}),(0,o.jsx)(kr,{participantType:"Human",participantTypeIcon:(0,o.jsx)(L.A,{name:"account_circle"}),participants:r}),n.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Rt(),{className:"rustic-participants-container-divider"}),(0,o.jsx)(kr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(L.A,{name:"smart_toy"}),participants:n})]})]})},Fr=require("@mui/material/DialogActions");var Er=a.n(Fr);const Cr=require("@mui/material/DialogContent");var Nr=a.n(Cr);const Tr=require("@mui/material/DialogContentText");var Pr=a.n(Tr),Ar=function(){return Ar=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ar.apply(this,arguments)},Dr=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Ir(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!1),l=c[0],u=c[1],d=(0,b.useState)(!1),p=d[0],m=d[1],f=(0,b.useState)([]),h=f[0],v=f[1],x=(0,b.useState)(null),y=x[0],j=x[1],w=(0,T.useTheme)(),S=h[h.length-1],k=Ar(Ar({},e.ws),{send:function(e){j(e)}});function O(e){v(function(t){return Dr(Dr([],t,!0),[e],!1)})}function F(){if(y){var t=Ar(Ar({},y),{threadId:e.messageId});e.ws.send(t)}}if((0,b.useEffect)(function(){e.ws.onReceive&&e.ws.onReceive(O)},[e.ws]),(0,b.useEffect)(function(){h.length>0&&(S&&S.sender.id!==e.sender.id&&s(!1),"promptBuilder"===S.format&&S.data.isLastQuestion&&n(!0))},[h.length]),0!==h.length)return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(pr(),{open:l,onClose:function(){return u(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(w.palette.divider)}},children:[(0,o.jsx)(fr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(Rt(),{}),(0,o.jsx)(Nr(),{children:(0,o.jsx)(Pr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(Er(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(ze(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(L.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(ze(),{variant:"contained",color:"primary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(g(),{color:"text.secondary",children:"Prompt Builder"}),(0,o.jsx)(Rt(),{className:"rustic-prompt-builder-divider"}),(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!p&&h.length>0)return h.map(function(t){if(t.sender.id!==e.sender.id&&"promptBuilder"!==t.format)return(0,o.jsx)(I,{ws:k,sender:e.sender,messages:[t],supportedElements:e.supportedElements},t.id)})}(),i&&(0,o.jsx)(q(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,o.jsx)(o.Fragment,{children:!p&&(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons",children:[(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,o.jsx)(ze(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(L.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(ze(),{variant:"outlined",color:"secondary",endIcon:(0,o.jsx)(L.A,{name:"chevron_right"}),onClick:function(){F(),j(null),s(!0)},disabled:!y,"aria-disabled":!y,children:"Next question"})]}),r&&(0,o.jsx)(T.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,o.jsx)(ze(),{variant:"contained",color:"primary",onClick:function(){F(),m(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}var Lr=function(){return Lr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Lr.apply(this,arguments)};function Rr(e){var t=Pe()(),r=e.prompts.map(function(r,n){return(0,o.jsx)(Ut(),{onClick:function(){return t=r,n=(new Date).toISOString(),a={id:(0,$.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:W(e.sender,t.toString())},void e.ws.send(a);var t,n,a},color:"secondary",size:"small",className:"rustic-prompt",sx:Lr(Lr({backgroundColor:t.palette.background.paper},"inConversation"===e.position&&{border:"1px solid ".concat(t.palette.divider)}),{"&:hover":{color:t.palette.text.primary,backgroundColor:t.palette.primary.hover}}),label:r},n)});return(0,o.jsx)(f(),{className:e.className,children:r})}function Mr(e){var t=(0,b.useState)(e.data||""),r=t[0],n=t[1],a=(0,Be.useTheme)(),i=(0,Be.useMediaQuery)(a.breakpoints.down("md"))?"column":"row",s=e.options.map(function(t,a){return(0,o.jsx)(Ut(),{onClick:function(){return function(t){var r;n(t);var a=(new Date).toISOString(),i={id:(0,$.v4)(),timestamp:a,sender:e.sender,conversationId:e.conversationId,format:"questionResponse",data:{data:t,inReplyTo:e.messageId}};null===(r=e.ws)||void 0===r||r.send(i)}(t)},color:"secondary",size:"small",sx:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r||!e.ws,"aria-disabled":!!r||!e.ws,label:t},a)});return(0,o.jsxs)(f(),{className:"rustic-question",children:[(e.title||e.description)&&(0,o.jsxs)(f(),{className:"rustic-question-text",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description})]}),(0,o.jsx)(Kt(),{direction:i,className:"rustic-options-container",children:s})]})}const qr=require("@mui/material/Table");var Br=a.n(qr);const _r=require("@mui/material/TableBody");var zr=a.n(_r);const Hr=require("@mui/material/TableCell");var Ur=a.n(Hr);const Wr=require("@mui/material/TableContainer");var Vr=a.n(Wr);const Gr=require("@mui/material/TableHead");var Kr=a.n(Gr);const Qr=require("@mui/material/TablePagination");var $r=a.n(Qr);const Jr=require("@mui/material/TableRow");var Yr=a.n(Jr);const Xr=require("@mui/material/TableSortLabel");var Zr,en=a.n(Xr),tn=10;function rn(){return(0,o.jsx)(L.A,{name:"expand_all"})}function nn(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>tn,i=(0,b.useState)({}),s=i[0],c=i[1],l=(0,b.useState)(a?tn:-1),u=l[0],d=l[1],p=(0,b.useState)(0),m=p[0],f=p[1],h=(0,Be.useTheme)(),v=Array.from(new Set(e.data.flatMap(function(e){return Object.keys(e)}))),x=e.headers||v.map(function(e){return{dataKey:e}}),y=(t=e.data,r=Object.keys(s)[0],n=s[r],r&&n?t.slice().sort(function(e,t){var r=Object.keys(s)[0],n=s[r];return e[r]<t[r]?n===Zr.Descending?1:-1:e[r]>t[r]?n===Zr.Descending?-1:1:0}):t),j=y.slice(m*u,m*u+u),S=u>0?j:y;function k(e){if(!s[e])return rn}return(0,o.jsxs)(Kt(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(Vr(),{className:"rustic-table-container",children:(0,o.jsxs)(Br(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[x.length>0&&(0,o.jsx)(Kr(),{children:(0,o.jsx)(Yr(),{children:x.map(function(e,t){return(0,o.jsx)(Ur(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(de(),{title:(r=e.dataKey,n=s[r],n?Object.keys(Zr)[Object.values(Zr).indexOf(n)]:"Sort"),children:(0,o.jsx)(en(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c(function(t){var r,n,a={};switch(t[e]){case Zr.Ascending:(r={})[e]=Zr.Descending,a=r;break;case Zr.Descending:a={};break;default:(n={})[e]=Zr.Ascending,a=n}return a})}(e.dataKey)},className:"rustic-table-header",IconComponent:k(e.dataKey),children:e.label||z(e.dataKey)})})},"header-".concat(t));var r,n})})}),(0,o.jsx)(zr(),{children:S.map(function(e,t){return(0,o.jsx)(Yr(),{children:x.map(function(r,n){return(0,o.jsx)(Ur(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))})},"row-".concat(t))})})]})}),a&&(0,o.jsx)($r(),{className:"rustic-table-pagination",component:"div",count:e.data.length,rowsPerPage:u,labelRowsPerPage:"Rows:",page:m,onPageChange:function(e,t){return f(t)},onRowsPerPageChange:function(e){d(+e.target.value),f(0)},sx:{"& .MuiTablePagination-selectLabel":{color:h.palette.text.disabled}},classes:{toolbar:"rustic-table-toolbar",input:"rustic-table-input",spacer:"rustic-table-spacer",displayedRows:"rustic-table-displayed-rows",actions:"rustic-table-actions"}})]})}!function(e){e.Ascending="asc",e.Descending="desc"}(Zr||(Zr={}));var an=a(7447),on=a.n(an);const sn=function(e){var t=(0,b.useState)(on().sanitize(e.text)),r=t[0],n=t[1],a=(0,b.useState)(""),i=a[0],s=a[1];return(0,b.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var i=a[r];"string"!=typeof i.text&&(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=i.text}n(on().sanitize(t))}},[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g(),{variant:"body2",children:r}),i&&(0,o.jsx)(lt(),{severity:"error",children:i})]})},cn=function(e){return(0,o.jsx)(g(),{variant:"body1",className:"rustic-text",children:on().sanitize(e.text)})},ln=require("mermaid");var un=a.n(ln),dn=function(){return dn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},dn.apply(this,arguments)};const pn=function(e){var t=(0,b.useRef)(null),r=(0,b.useState)(),n=r[0],a=r[1],i=Pe()(),s=(0,$.v4)();return(0,b.useEffect)(function(){var r="dark"===i.palette.mode?"dark":"neutral",n=i.typography.fontFamily;t.current&&(un().initialize(dn({theme:r,themeVariables:{fontFamily:n}},e.config)),un().render("mermaid-svg-".concat(s),e.diagram,t.current).then(function(e){t.current&&(t.current.innerHTML=e.svg),a("")}).catch(function(){var e;null===(e=t.current)||void 0===e||e.replaceChildren(),a("Failed to render the diagram.")}))}),(0,o.jsxs)(Kt(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(g(),{variant:"body2",children:n})]})};var mn;require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@finos/perspective"),require("@finos/perspective/dist/wasm/perspective-server.wasm"),require("@finos/perspective-viewer"),require("@finos/perspective-viewer/dist/wasm/perspective-viewer.wasm");var fn=function(){return fn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},fn.apply(this,arguments)};function hn(e){return e?e.reduce(function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e},{}):{}}const vn=function(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available."});var t=(0,b.useRef)(null),r=(0,h.useTheme)(),n=(0,b.useState)(!1),a=n[0],i=n[1],s=(0,b.useState)(mn),c=s[0],l=s[1],u=r.palette.mode,d="dark"===u?"Pro Dark":"Pro Light",p=hn(e.headers),m="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(r.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide border for aggregate Selector */\n .aggregate-selector:hover {\n border: none !important;\n }\n \n /* Input and Select Elements */\n input, select, .noselect, #add-expression, .dropdown-width-container, \n .pivot-column-border, .pivot-column, .column-selector-column-border {\n border-radius: 8px !important;\n }\n \n /* Change background color */\n #settings_panel, #column_settings_sidebar {\n background: ").concat("dark"===u?"dark":"white"," !important;\n background-image: none !important;\n }\n \n /* Expression Edit Button */\n .expression-edit-button {\n display: none;\n }\n \n /* Add padding to expression input */\n #editor-container, .editable {\n padding: 8px !important;\n }\n \n /* Change Button Font Size */\n .button select, .button {\n font-size: 12px !important;\n }\n \n /* Button and Icon Colors */\n #status_bar .hover-target:hover .button>span {\n display:none !important;\n }\n \n #status_bar .hover-target.modal-target .button>span {\n display:none !important;\n }\n \n .button select:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide unused buttons */\n #debug_open_button.sidebar_close_button, .reset-default-style-disabled, \n .expression-edit-button, #theme, #status, #status_bar .input-sizer {\n display: none !important;\n }\n \n #status_bar .hover-target:hover, #status_bar .hover-target.modal-target {\n height: fit-content !important;\n }\n\n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: auto !important;\n }\n\n #settings_button:hover {\n color: ").concat(r.palette.primary.contrastText," !important;\n background-color: ").concat(r.palette.primary.main," !important;\n }\n ");(0,b.useEffect)(function(){l(mn)},[mn]);var f,v,x,y,j,S,k,O,F,E=e.config&&(v=(f=e.config).groupBy,x=f.splitBy,y=f.aggregates,j=f.sort,S=f.filter,k=f.columns,O=null==j?void 0:j.map(function(e){return[p[e[0]]||e[0],e[1]]}),F=y&&Object.fromEntries(Object.entries(y).map(function(e){var t=e[0],r=e[1];return[p[t]||t,r]})),{group_by:null==v?void 0:v.map(function(e){return p[e]||e}),split_by:null==x?void 0:x.map(function(e){return p[e]||e}),aggregates:F,sort:O,filter:S&&function(e){return e.map(function(e){return[p[e[0]]||e[0],e[1],e[e.length-1]]})}(S),columns:null==k?void 0:k.map(function(e){return p[e]||e})});return(0,b.useEffect)(function(){var r=null,n=null,a=!0;if(c){var o=t.current;c.table(function(e,t){var r=hn(t);return e.map(function(e){for(var t={},n=0,a=Object.entries(e);n<a.length;n++){var i=a[n],o=i[0],s=i[1];t[r[o]||o]=s}return t})}(e.data,e.headers)).then(function(e){if(r=e,a){if(o){if(o.shadowRoot){var t=new CSSStyleSheet;t.replaceSync(m),o.shadowRoot.adoptedStyleSheets.push(t)}return o.load(r)}}else r&&(r.delete({lazy:!0}),r=null)}).then(function(){var t,r,n;if(a&&o){var i={date_format:{dateStyle:(null===(t=e.config)||void 0===t?void 0:t.dateStyle)||"medium"}},s={};return null===(n=null===(r=e.config)||void 0===r?void 0:r.dateColumns)||void 0===n||n.forEach(function(e){s[e]=i}),o.restore(fn(fn({},E),{theme:d,title:e.title,settings:!1,columns_config:s}))}}).then(function(){if(a&&o)return o.getView()}).then(function(r){var i;if(a){n=r;var o=null===(i=e.config)||void 0===i?void 0:i.expansionDepth;if("number"==typeof o&&n)return n.set_depth(o).then(function(){t.current&&t.current.resize()})}else r&&r.delete()}).catch(function(){i(!0)})}return function(){a=!1,n&&n.delete(),r&&r.delete({lazy:!0})}},[c,e.data,d,e.config]),a?(0,o.jsx)(g(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(Ne(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},gn=require("react-plotly.js");var xn=a.n(gn),yn=function(){return yn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},yn.apply(this,arguments)};const bn=function(e){var t=yn(yn({},e.plotParams),{className:"rustic-plotly"});return t.config=yn(yn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Vt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(xn(),yn({},t))]})},jn=require("react-dom/server"),wn=require("vega"),Sn=require("vega-embed");var kn=a.n(Sn),On=function(){return On=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},On.apply(this,arguments)},Fn="source_0";const En=function(e){var t=e.theme,r=void 0===t?{dark:"dark"}:t,n=e.refreshIntervalInMs,a=void 0===n?0:n,i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme","refreshIntervalInMs"]),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useState)(!1),u=l[0],d=l[1],p=Pe()(),m="dark"===p.palette.mode,f=p.typography.fontFamily,h=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(i.getAuthHeaders?i.getAuthHeaders().then(function(e){return r.headers=On(On({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return we()(e,t)}).then(function(e){return e.data})};function v(){var e=wn.loader();return i.getAuthHeaders&&(e.http=h),e}var x={backgroundColor:p.palette.primary.main,color:p.palette.background.paper,borderRadius:p.shape.borderRadius+"px",padding:"4px 8px",fontSize:p.typography.caption.fontSize,fontFamily:f,fontWeight:p.typography.caption.fontWeight},y={formatTooltip:function(e,t){return(0,jn.renderToStaticMarkup)((0,o.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:x,children:Object.entries(e).map(function(e){var r=e[0],n=e[1];return(0,o.jsxs)("div",{children:[(0,o.jsxs)("strong",{children:[t(r),":"]})," ",t(n)]},r)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},j=[{label:"Save as SVG"},{label:"Save as PNG"}];function S(){var e,t;if(s.current&&i.spec){var n=On(On({config:{font:f}},i.options),{theme:m?r.dark:r.light,tooltip:y,actions:!1,loader:v()});(null===(t=null===(e=i.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(n.config.font=f);var o=On(On({},i.spec),{name:Fn});delete o.title,kn()(s.current,o,n).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var i="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,i).then(function(e){j[a].href=e,j[a].downloadFileName="".concat(r,".").concat(n)})}),c.current=e.view,d(!1),a>0&&function(){var e=this;if(c.current&&i.spec){k.current&&(clearInterval(k.current),k.current=null);var t=i.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,i=function(){var e,r,n;return function(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((a=(a=i.trys).length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(a){switch(a.label){case 0:if(!c.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,v().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=wn.changeset().remove(function(){return!0}).insert(r),c.current.change(Fn,n).run(),[3,4];case 3:return a.sent(),d(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function o(e){try{c(i.next(e))}catch(e){t(e)}}function s(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(o,s)}c((i=i.apply(r,n||[])).next())});var r,n,a,i},a);k.current=r}}}()}).catch(function(){d(!0)})}}(0,b.useEffect)(function(){function e(){S()}return S(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[i.spec,m]),(0,b.useEffect)(function(){var e=setTimeout(function(){if(i.updatedData&&i.updatedData.length>0&&c.current){var e=(r=i.updatedData,n=[],null==r||r.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var r=e.spec.data.values;Array.isArray(r)&&n.push.apply(n,r)}}),n);if(e.length>0)try{var t=wn.changeset().insert(e);c.current.change(Fn,t).run()}catch(e){console.error("Failed to update streaming data:",e)}}var r,n},0);return function(){return clearTimeout(e)}},[i.updatedData]);var k=(0,b.useRef)(null);return(0,b.useEffect)(function(){return function(){k.current&&clearInterval(k.current)}},[]),u?(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(Ne(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Vt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)($e,{menuItems:j,ariaLabel:"Download options"})}),i.title&&(0,o.jsx)(g(),{variant:"h6",children:i.title}),i.description&&(0,o.jsx)(w.A,{text:i.description}),(0,o.jsxs)(Vt(),{textAlign:"center",mt:1,children:["string"==typeof i.spec.title&&(0,o.jsx)(g(),{variant:"subtitle2",children:i.spec.title}),i.spec.description&&(0,o.jsx)(g(),{variant:"caption",children:i.spec.description})]}),(0,o.jsx)("div",{ref:s,className:"rustic-vega-lite"})]})};function Cn(e){var t=(0,b.useState)(e.units),r=t[0],n=t[1];function a(t){return"metric"===e.units&&"imperial"===r?Math.round(1.8*t+32):"imperial"===e.units&&"metric"===r?Math.round(t*(5/9)-32):Math.round(t)}var i=new Date(1e3*e.weather[0].timestamp),s=U(e.weather[0].timestamp).shortName,c=i.getDate(),l=i.getFullYear().toString().slice(2),u="".concat(s," ").concat(c,"/").concat(l," TODAY"),d="HIGH: ".concat(a(e.weather[0].temp.high)," / LOW: ").concat(a(e.weather[0].temp.high)),p=e.weather.map(function(e,t){if(0!==t)return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(g(),{variant:"h5",component:"span",color:"text.secondary","aria-label":U(e.timestamp).fullName,children:U(e.timestamp).shortName}),(0,o.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)});return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)($e,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return n("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return n("imperial")}}]}),(0,o.jsxs)(Kt(),{alignItems:"center",children:[(0,o.jsx)(g(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(Kt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,o.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,o.jsx)(g(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(g(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[a(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(r)]}),(0,o.jsxs)(Kt(),{direction:"row",spacing:2,children:[(0,o.jsx)(g(),{variant:"overline",children:u}),(0,o.jsx)(g(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)(Kt(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(L.A,{name:"cloud"}),(0,o.jsx)(g(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}var Nn=a(9517);return i})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e,t,r={9528:(e,t,r)=>{r.d(t,{UniformsForm:()=>h});var n=r(8732),a=r(6989),i=r.n(a),o=r(785),s=r.n(o);const c=require("ajv");var l=r.n(c),u=r(2015);const d=require("uniforms-bridge-json-schema"),p=require("uniforms-mui");var m=r(3903),f=r(227);function h(e){var t=(0,u.useState)(e.data),r=t[0],a=t[1];(0,u.useEffect)(function(){e.data&&a(e.data)},[e.data]);var o,c,h=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),v=(o=e.schema,c=h.compile(o),function(e){var t;return c(e),(null===(t=c.errors)||void 0===t?void 0:t.length)?{details:c.errors}:null}),g=new d.JSONSchemaBridge({schema:e.schema,validator:v});return(0,n.jsxs)(i(),{className:"rustic-form",children:[e.title&&(0,n.jsx)(s(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(f.A,{text:e.description}),(0,n.jsx)(p.AutoForm,{schema:g,onSubmit:function(t){return function(t){var r,n=(new Date).toISOString(),i={id:(0,m.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"formResponse",data:{data:t,inReplyTo:e.messageId}};a(t),null===(r=e.ws)||void 0===r||r.send(i)}(t)},model:r,disabled:!!r||!e.ws})]})}},9767:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(8732),a=(r(2015),function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(4409),r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>d,L:()=>u});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o),c=r(3840),l=r(2015);function u(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=c.marked.parse(t,{async:!1});return s().sanitize(r)}const d=function(e){var t=(0,l.useState)(u(e.text)),r=t[0],a=t[1];return(0,l.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(u(t))}},[e.text,e.updatedData]),(0,n.jsx)(i(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:r}})}},4409:(e,t,r)=>{r.d(t,{A:()=>u});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(2015),l=r(227);const u=function(e){var t=(0,c.useState)((0,l.L)(e.text)),r=t[0],a=t[1],o=(0,c.useState)(""),u=o[0],d=o[1];return(0,c.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,n=e.updatedData;r<n.length;r++){var i=n[r];"string"!=typeof i.text?(t+=" [MISSING TEXT]",d("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=i.text}a((0,l.L)(t))}},[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),u&&(0,n.jsx)(i(),{severity:"error",children:u})]})}},4445:(e,t,r)=>{r.d(t,{default:()=>c});var n=r(8732),a=r(909),i=r.n(a),o=r(4603),s=r.n(o);r(2015),r(7159);const c=function(e){return(0,n.jsx)(s(),{title:e.label,children:(0,n.jsx)(i(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},7159:(e,t,r)=>{var n,a,i;r.d(t,{sW:()=>a,yJ:()=>i}),function(e){e.Running="running",e.Completed="completed",e.Error="error"}(n||(n={})),function(e){e.Owner="owner",e.Member="member"}(a||(a={})),function(e){e.Human="human",e.Agent="agent"}(i||(i={}))},9517:(e,t,r)=>{r.d(t,{generateTheme:()=>m,rusticDarkTheme:()=>h,rusticLightTheme:()=>f});var n=r(6182);const a=require("lodash");var i=r.n(a),o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o.apply(this,arguments)},s=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function c(e){var t={};return Object.keys(e).forEach(function(r){var n=r.match(/^([a-z]+)([A-Z].*)$/);if(n){n[0];var a=n[1],o=n[2],s="".concat(a.toLowerCase(),".").concat(i().camelCase(o));i().set(t,s,e[r])}else i().set(t,r.toLowerCase(),e[r])}),t}var l={lightMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#FFFFFF",backgroundDefault:"#F4F4F4",textPrimary:"#1E0C04",textSecondary:"#4E443F",textDisabled:"#727272",actionActive:"rgba(0, 0, 0, 0.56)",actionHover:"rgba(0, 0, 0, 0.08)",actionSelected:"rgba(0, 0, 0, 0.16)",actionFocus:"rgba(0, 0, 0, 0.12)",actionDisabledBackground:"rgba(0, 0, 0, 0.12)",actionDisabled:"rgba(0, 0, 0, 0.38)",primaryMain:"#2D2825",primaryLight:"rgba(45, 40, 37, 0.60)",primaryDark:"#000000",primaryContrastText:"#FFFFFF",primaryHover:"rgba(45, 40, 37, 0.08)",primarySelected:"rgba(45, 40, 37, 0.16)",primaryFocus:"rgba(45, 40, 37, 0.12)",primaryFocusVisible:"rgba(45, 40, 37, 0.30)",primaryOutlinedBorder:"rgba(45, 40, 37, 0.50)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrast:"#FFFFFF",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#007F51",successDark:"#014F33",successLight:"#00D788",successContrastText:"#000000",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"#000000",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"#000000",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"#000000"},darkMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#202020",backgroundDefault:"#2C2C2C",textPrimary:"#FFFFFF",textSecondary:"rgba(255, 255, 255, 0.70)",textDisabled:"rgba(255, 255, 255, 0.38)",actionActive:"rgba(255, 255, 255, 0.60)",actionHover:"rgba(255, 255, 255, 0.30)",actionSelected:"rgba(255, 255, 255, 0.16)",actionFocus:"rgba(255, 255, 255, 0.12)",actionDisabledBackground:"rgba(255, 255, 255, 0.12)",actionDisabled:"rgba(255, 255, 255, 0.38)",primaryMain:"#FFFCFB",primaryLight:"rgba(255, 252, 251, 0.60)",primaryDark:"#FFFFFF",primaryContrastText:"rgba(0, 0, 0, 0.87)",primaryOutlinedBorder:"rgba(255, 252, 251, 0.50)",primaryFocus:"rgba(255, 252, 251, 0.12)",primaryFocusVisible:"rgba(255, 252, 251, 0.30)",primaryHover:"rgba(255, 252, 251, 0.08)",primarySelected:"rgba(255, 252, 251, 0.16)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrastText:"rgba(0, 0, 0, 0.87)",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#00B775",successDark:"#01784D",successLight:"#00E390",successContrastText:"rgba(0, 0, 0, 0.87)",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"rgba(0, 0, 0, 0.87)",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"rgba(0, 0, 0, 0.87)",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"rgba(0, 0, 0, 0.87)"}},u={fontSize:"12px",lineHeight:1.5,letterSpacing:"0.5px",padding:"0 12px",minHeight:"26px"},d={fontSize:"14px",lineHeight:1.43,letterSpacing:"0.25px",padding:"0 16px",minHeight:"40px"},p={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"};function m(e,t){var r="light"===e?t.lightMode:t.darkMode;return{shape:{borderRadius:16},typography:{fontFamily:"Inter",h1:{fontStyle:"normal",fontWeight:300,fontSize:"94px",lineHeight:1.167,letterSpacing:"-1.5px"},h2:{fontStyle:"normal",fontWeight:300,fontSize:"59px",letterSpacing:"-2px",lineHeight:1.2},h3:{fontStyle:"normal",fontWeight:400,fontSize:"47px",letterSpacing:"0px",lineHeight:1.167},h4:{fontStyle:"normal",fontWeight:400,fontSize:"33px",letterSpacing:"0px",lineHeight:1.235},h5:{fontStyle:"normal",fontWeight:400,fontSize:"24px",letterSpacing:"0px",lineHeight:1.334},h6:{fontStyle:"normal",fontWeight:500,fontSize:"20px",letterSpacing:"0px",lineHeight:1.6},body1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body1Bold:{fontStyle:"normal",fontWeight:600,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body2:{fontStyle:"normal",fontWeight:400,fontSize:"14px",letterSpacing:"0px",lineHeight:1.43},subtitle1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.75},subtitle2:{fontStyle:"normal",fontWeight:500,fontSize:"14px",letterSpacing:"0px",lineHeight:1.57},overline:{fontStyle:"normal",fontWeight:400,fontSize:"10px",letterSpacing:"0px",lineHeight:1.5,textTransform:"uppercase"},caption:{fontStyle:"normal",fontWeight:400,fontSize:"12px",letterSpacing:"0px",lineHeight:1.66},button:{textTransform:"none",fontWeight:700}},shadows:s([],(0,n.createTheme)({}).shadows.map(function(e,t){return 1===t?"0 4px 5px rgba(0, 0, 0, 0.05)":2===t?"0 4px 10px rgba(0, 0, 0, 0.1)":3===t?"0 4px 15px rgba(0, 0, 0, 0.15)":"none"}),!0),palette:o({mode:e},c(r)),components:{MuiTooltip:{styleOverrides:{tooltip:"light"===e?{backgroundColor:r.commonBlack,color:r.commonWhite}:{backgroundColor:r.commonWhite,color:r.commonBlack}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:r.actionFocus},root:{borderBottom:"1px solid ".concat(r.divider),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:r.textPrimary}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(r.divider),backgroundImage:"none"}}},MuiButton:{styleOverrides:{root:{"&.MuiButton-sizeSmall":o({},u),"&.MuiButton-sizeMedium":o({borderRadius:"24px"},d),"&.MuiButton-sizeLarge":o({borderRadius:"32px"},p),"&.Mui-disabled":{background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},containedPrimary:{background:r.primaryMain,color:r.primaryContrastText,"&:hover":{background:r.primaryLight},"&:active":{background:r.primaryMain,outline:"2px solid ".concat(r.primaryLight)}},containedSecondary:{"&:hover":{background:r.secondaryLight},"&:active":{background:r.secondaryMain,outline:"2px solid ".concat(r.secondaryLight)}},outlinedSecondary:{color:r.textPrimary,"&:hover":{border:"1px solid ".concat(r.secondaryDark),background:r.secondaryFocus},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}},textSecondary:{color:r.textPrimary,"&:hover":{background:r.secondaryFocus},"&.Mui-disabled":{border:"none"}}}},MuiChip:{styleOverrides:{root:{"& .MuiChip-icon":{margin:"0px 8px 0px 0px"},"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"},"&.MuiChip-sizeSmall":o({},u),"&.MuiChip-sizeMedium":o({borderRadius:"24px"},d),"&.MuiChip-sizeLarge":o({borderRadius:"32px"},p),color:r.textPrimary,background:r.backgroundPaper,"&.Mui-disabled":{opacity:1,background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},colorPrimary:{border:"1px solid ".concat(r.textPrimary),"&:hover":{color:r.primaryContrastText},"&:active":{outline:"2px solid ".concat(r.primaryLight)}},colorSecondary:{border:"1px solid ".concat(r.secondaryMain),"&:hover":{color:r.primaryContrastText,background:r.secondaryMain},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}}}}}}}var f=(0,n.createTheme)(m("light",l)),h=(0,n.createTheme)(m("dark",l));f=(0,n.responsiveFontSizes)(f),h=(0,n.responsiveFontSizes)(h)},5642:e=>{e.exports=require("@mui/material/Alert")},6989:e=>{e.exports=require("@mui/material/Box")},909:e=>{e.exports=require("@mui/material/IconButton")},4603:e=>{e.exports=require("@mui/material/Tooltip")},785:e=>{e.exports=require("@mui/material/Typography")},6182:e=>{e.exports=require("@mui/material/styles")},7447:e=>{e.exports=require("dompurify")},8342:e=>{e.exports=require("emoji-picker-element")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")},3903:e=>{e.exports=require("uuid")}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,a),i.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);a.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach(e=>o[e]=()=>r[e]);return o.default=()=>r,a.d(i,o),i},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.r(i),a.d(i,{Action:()=>er.default,ChatCompletion:()=>ur,CodeSnippet:()=>P,CopyText:()=>tr,ElementRenderer:()=>I,FCCalendar:()=>k,Icon:()=>L.A,Image:()=>$,MarkedMarkdown:()=>w.A,MarkedStreamingMarkdown:()=>St.A,MermaidViz:()=>mn,MessageArchive:()=>Zt,MessageCanvas:()=>Jt,MessageSpace:()=>ir,MultimodalInput:()=>it,Multipart:()=>dr,OpenLayersMap:()=>wt,PDFViewer:()=>Le,ParticipantRole:()=>Fr.sW,ParticipantType:()=>Fr.yJ,ParticipantsContainer:()=>Or,PerspectiveViz:()=>gn,PlotlyGraph:()=>jn,PopoverMenu:()=>Je,PromptBuilder:()=>Lr,Prompts:()=>Mr,Question:()=>qr,Sound:()=>Bt,StreamingText:()=>cn,Table:()=>an,Text:()=>ln,TextInput:()=>ct,TextToSpeech:()=>rr,Timestamp:()=>$t,UniformsForm:()=>A.UniformsForm,Uploader:()=>et,VegaLiteViz:()=>Cn,Video:()=>Ht,Weather:()=>Nn,formatDateAndTime:()=>_,generateTheme:()=>Tn.generateTheme,getCombinedMessages:()=>G,rusticDarkTheme:()=>Tn.rusticDarkTheme,rusticLightTheme:()=>Tn.rusticLightTheme});var o=a(8732);const s=require("@fullcalendar/daygrid");var c=a.n(s);const l=require("@fullcalendar/react");var u=a.n(l);const d=require("@fullcalendar/timegrid");var p=a.n(d),m=a(6989),f=a.n(m),h=a(6182),v=a(785),g=a.n(v);const x=require("@mui/material/useMediaQuery");var y=a.n(x),b=a(2015),j=a.n(b),w=a(227),S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},S.apply(this,arguments)};function F(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function k(e){var t=(0,h.useTheme)(),r=y()(t.breakpoints.up("md"));return(0,o.jsxs)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":S({},t.typography.h6),".fc .fc-scrollgrid-liquid":{borderRadius:"".concat(t.shape.borderRadius,"px")},".fc td":{borderRadius:"0 0 ".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px")},".fc .fc-scrollgrid-section-header > th":{borderRadius:"".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px 0 0")},".fc .fc-button, .fc .fc-button:active":{color:t.palette.primary.main,backgroundColor:t.palette.background.paper,border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),"&:hover":{backgroundColor:t.palette.secondary.light,border:"1px solid ".concat(t.palette.divider)}},".fc .fc-button-group .fc-button.fc-button-active":{backgroundColor:t.palette.secondary.main,border:"1px solid ".concat(t.palette.divider)},".fc a, .fc .fc-event-title, .fc .fc-button, .fc .fc-timegrid-slot":S({},t.typography.caption)},children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(u(),{plugins:[p(),c()],initialView:r?"dayGridMonth":"timeGridDay",headerToolbar:{left:"title",right:"prev,next dayGridMonth,timeGridWeek,timeGridDay"},eventColor:t.palette.secondary.main,displayEventTime:!1,titleFormat:{year:"numeric",month:"long"},views:{dayGridMonth:{dayHeaderFormat:{weekday:r?"long":"narrow"}},timeGridWeek:{dayHeaderFormat:{weekday:"short",day:"numeric"}},timeGridDay:{dayHeaderFormat:{weekday:"long",day:"numeric"}}},allDaySlot:!1,initialDate:e.events[0].start,events:e.events.map(F)})]})}const O=require("@codemirror/language"),E=require("@codemirror/language-data"),C=require("@codemirror/state"),N=require("@codemirror/view"),T=require("@mui/system");function P(e){var t=(0,b.useRef)(null),r=(0,b.useRef)(),n=new C.Compartment,a=[C.EditorState.readOnly.of(!0),(0,N.highlightSpecialChars)(),(0,O.syntaxHighlighting)(O.defaultHighlightStyle,{fallback:!0}),n.of([])],i=E.languages.find(function(t){return t.name.toLowerCase()===e.language.toLowerCase()});return(0,b.useEffect)(function(){if(t.current&&!r.current){var o=t.current,s=C.EditorState.create({doc:e.code,extensions:a});r.current=new N.EditorView({state:s,parent:o}),i&&r.current&&i.load().then(function(e){var t;null===(t=r.current)||void 0===t||t.dispatch({effects:n.reconfigure(e.extension)})})}},[]),(0,o.jsxs)(T.Box,{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(T.Box,{className:"rustic-code-snippet",sx:{backgroundColor:"background.default"},"aria-label":"code snippet",ref:t,children:(0,o.jsx)(g(),{variant:"body2","aria-label":"language type",children:e.language})})]})}var A=a(9528),D=function(){return D=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},D.apply(this,arguments)};const I=function(e){var t=e.messages[0],r=e.messages.slice(1),n=e.supportedElements[t.format];return(0,o.jsx)(o.Fragment,{children:n?j().createElement(n,D(D({sender:e.sender,ws:e.ws,messageId:t.id,conversationId:t.conversationId},t.data),r.length>0&&{updatedData:r.map(function(e){return e.data})})):(0,o.jsxs)(g(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var L=a(9767);const R=require("@mui/material/CircularProgress");var M=a.n(R),q=function(){return q=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},q.apply(this,arguments)},B=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function _(e){var t=new Date(e),r=navigator.language,n={month:"short",day:"numeric"},a=new Date,i=t.getFullYear()!==a.getFullYear(),o=i?" at ":", ";return i&&(n.year="numeric"),t.toLocaleDateString(r,n)+o+t.toLocaleTimeString(r,{hour:"numeric",minute:"2-digit",hour12:!0})}var z,H=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function U(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),a=t>0?"".concat(t,":"):"",i="".concat(t>0?r.toString().padStart(2,"0"):r),o=n.toString().padStart(2,"0");return"".concat(a).concat(i,":").concat(o)}function W(e){var t=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:t,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[t]}}function V(e,t,r){var n=e.id,a=[];if(t&&(null==t?void 0:t.trim().length)&&a.push({type:"text",text:t}),r&&r.length>0)for(var i=0;i<(null==r?void 0:r.length);i++)a.push({type:"file_url",file_url:{url:r[i].url,name:r[i].name}});return{messages:[{content:a,role:"user",name:n}]}}function G(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.data.inReplyTo:t.id))return e;var n=q({},e),a=(n[r]||[])[0];return t.format.includes("update")&&a&&a.sender.id!==t.sender.id&&(r=t.id),n[r]||(n[r]=[]),t.format.includes("Response")&&a?n[r]=[q(q({},a),{data:q(q({},a.data),t.data)}),t]:n[r]=B(B([],n[r],!0),[t],!1),n}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(z||(z={}));var K=function(){return K=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},K.apply(this,arguments)},Q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function $(e){var t,r,n,a=e.alt,i=void 0===a?"An image is displayed":a,s=Q(e,["alt"]),c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(""),p=d[0],m=d[1],f=(0,b.useState)(""),h=f[0],v=f[1];return(0,b.useEffect)(function(){s.getAuthHeaders&&(u(!0),s.getAuthHeaders().then(function(e){return fetch(s.src,{headers:e.headers})}).then(function(e){return e.blob()}).then(function(e){var t=URL.createObjectURL(e);v(t)}).catch(function(){m("Image failed to load"),u(!1)}))},[s.src,s.getAuthHeaders]),p.length>0?(0,o.jsx)(g(),{variant:"body2",children:p}):(0,o.jsxs)("figure",{children:[l&&(0,o.jsx)(M(),{}),s.title&&(0,o.jsx)(g(),{variant:"h6",children:s.title}),(!s.getAuthHeaders||h)&&(0,o.jsx)("img",K({},(t=s.width,r=s.height,n={},t&&(n={width:t}),r&&(n=q(q({},n),{height:r})),t||r||(n={className:"rustic-fit-container"}),n),{src:s.getAuthHeaders?h:s.src,alt:i,onError:function(){m("Image failed to load"),u(!1)},onLoad:function(){u(!1)}})),s.description&&(0,o.jsx)("figcaption",{children:(0,o.jsx)(w.A,{text:s.description})})]})}var J=a(3903);const Y=require("@mui/material/Avatar");var X=a.n(Y),Z=a(909),ee=a.n(Z);const te=require("@mui/material/InputAdornment");var re=a.n(te);const ne=require("@mui/material/MenuItem");var ae=a.n(ne);const ie=require("@mui/material/MenuList");var oe=a.n(ie);const se=require("@mui/material/Popover");var ce=a.n(se);const le=require("@mui/material/TextField");var ue=a.n(le),de=a(4603),pe=a.n(de),me=a(8342);const fe=function(e){var t=(0,h.useTheme)(),r=(0,b.useRef)(null),n=(0,b.useRef)(null),i=(0,b.useState)(!1),s=i[0],c=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function u(){c(!1)}function d(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),u()}return(0,b.useEffect)(function(){n.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then(function(r){var a=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";a.classList.add(i),Object.keys(l).forEach(function(e){a.style.setProperty(e,l[e])}),n.current=a}).catch(function(e){console.error("Failed to load emoji picker",e)})},[]),(0,b.useEffect)(function(){return n.current&&n.current.addEventListener("emoji-click",d),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",d)}},[s,e.onEmojiClick]),(0,o.jsxs)("div",{children:[(0,o.jsx)(pe(),{title:"Emoji",children:(0,o.jsx)(ee(),{size:"small",ref:r,onClick:function(){c(function(e){return!e})},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(L.A,{name:"Mood"})})}),n.current&&(0,o.jsx)(ce(),{open:s,anchorEl:r.current,onClose:u,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,o.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var he={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function ve(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function ge(e){return(0,o.jsxs)(f(),{className:"rustic-participant-profile",children:[(0,o.jsx)(X(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"body1Bold",children:e.displayName})]})}function xe(e){var t=e.items,r=e.isOpen,n=e.onClose,a=e.onSelect,i=e.renderItem,s=e.anchorEl,c=e.selectedIndex;return(0,o.jsx)(ce(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:s,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,o.jsx)(oe(),{children:t.map(function(e,t){return(0,o.jsx)(ae(),{onClick:function(){return a(e)},selected:t===c,children:i(e)},t)})})})}const ye=(0,b.forwardRef)(function(e,t){var r=e.multiline,n=void 0===r||r,a=e.fullWidth,i=void 0===a||a,s=e.maxRows,c=void 0===s?6:s,l=e.enableSpeechToText,u=void 0!==l&&l,d=e.maximumEmojiSearchResults,p=void 0===d?5:d,m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),h=(0,b.useState)(""),v=h[0],x=h[1],y=(0,b.useState)(!1),j=y[0],w=y[1],S=(0,b.useState)(!1),F=S[0],k=S[1],O=(0,b.useState)(!1),E=O[0],C=O[1],N=(0,b.useState)(""),T=N[0],P=N[1],A=(0,b.useState)([]),D=A[0],I=A[1],R=(0,b.useState)(!1),q=R[0],B=R[1],_=(0,b.useState)(0),z=_[0],H=_[1],U=(0,b.useRef)(null),W=new me.Database({dataSource:m.emojiDataSource}),V=!v.trim().length,G="".concat(j?"Stop":"Start"," speech to text"),K=F?"primary.main":"primary.light",Q=j?"error.main":K,$=j?"stop_circle":"speech_to_text",Y=(0,b.useState)([]),X=Y[0],Z=Y[1],te=(0,b.useState)(!1),ne=te[0],ae=te[1],ie=u&&"undefined"!=typeof window&&!!window.webkitSpeechRecognition;function oe(){return"boolean"==typeof m.isSendEnabled?!m.isSendEnabled:V}function se(e,t){if(U.current){var r=U.current,n=r.selectionStart,a=r.selectionEnd;if("number"==typeof n&&"number"==typeof a){var i,o=v||"",s=o.substring(0,n),c=o.substring(a),l=void 0;t?(l=s.replace(t,e)+c,i=s.replace(t,e).length):(l=s+e+c,i=n+e.length),x(l),setTimeout(function(){var e,t;null===(e=U.current)||void 0===e||e.focus(),null===(t=U.current)||void 0===t||t.setSelectionRange(i,i)},0)}}}function ce(e){se("@".concat(e," "),/@(\w*)$/),Z([])}function le(e,t){void 0===t&&(t=!1),se(e,t?/:(\w+)$/:void 0),B(!1)}var de=E?(0,o.jsx)(M(),{size:24}):(0,o.jsx)(pe(),{title:G,children:(0,o.jsx)(ee(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,j?(e.stop(),C(!0),w(!1)):(e.start(),P(""),w(!0)),e.onstart=function(){w(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;v.length>0?x(v+" "+r):x(r),null===(t=U.current)||void 0===t||t.focus(),w(!1)},e.onerror=function(e){var t=he[e.error];P(t),w(!1)},e.onend=function(){C(!1),w(!1)}},size:"small",sx:{color:Q,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(L.A,{name:$})})});function ye(){var e,t,r=(new Date).toISOString(),n={id:(0,J.v4)(),timestamp:r,sender:m.sender,conversationId:m.conversationId,format:"chatCompletionRequest",data:{text:v},inReplyTo:null===(e=m.lastMsg)||void 0===e?void 0:e.id,messageHistory:null===(t=m.lastMsg)||void 0===t?void 0:t.messageHistory};m.send(n),x(""),P("")}return(0,o.jsxs)(f(),{className:"rustic-base-input",ref:t,children:[(0,o.jsxs)(f(),{className:"rustic-error-and-input-container",children:[(0,o.jsx)(f(),{className:"rustic-error-container",children:(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:T})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:F?"secondary.main":"action.disabled",backgroundColor:"background.paper"},children:[D.length>0&&U.current&&(0,o.jsx)(xe,{anchorEl:U.current,items:D.filter(function(e){return"unicode"in e}),isOpen:q,onClose:function(){B(!1),H(0)},onSelect:function(e){return le(e.unicode,!0)},selectedIndex:z,renderItem:ve}),X.length>0&&U.current&&(0,o.jsx)(xe,{anchorEl:U.current,items:X,isOpen:ne,onClose:function(){ae(!1),H(0)},onSelect:function(e){return ce(e.displayName)},renderItem:ge,selectedIndex:z}),(0,o.jsx)(ue(),{className:"rustic-text-field",variant:"outlined",value:v,label:m.label,placeholder:m.placeholder,maxRows:c,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),q&&D.length>0&&"unicode"in D[z]?le(D[z].unicode,!0):ne&&X.length>0?ce(X[z].displayName):e.shiftKey||oe()||ye();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(q?H(function(e){return(e+t+D.length)%D.length}):ne&&H(function(e){return(e+t+X.length)%X.length}));0!==z&&H(0)}},onChange:function(e){P("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&m.getMembers){var r=t[1].toLowerCase();m.getMembers().then(function(e){var t=e.filter(function(e){return e.displayName.toLowerCase().startsWith(r)});Z(t),t.length>0?ae(!0):ae(!1)})}else Z([])}(t);var r,n=t.match(/:(\w{2,}):/g),a=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");W.getEmojiByShortcode(i).then(function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)}).catch(function(){x(t)}),B(!1)}else a?(r=a[0].replace(":",""),W.getEmojiBySearchQuery(r).then(function(e){e.length?(I(e.slice(0,p)),B(!0)):(I([]),B(!1))}).catch(function(){I([]),B(!1)})):B(!1)},onFocus:function(){return k(!0)},onBlur:function(){return k(!1)},inputRef:U,color:"secondary",size:"small",autoFocus:m.autoFocus,slotProps:{input:{endAdornment:(0,o.jsxs)(re(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(fe,{dataSource:m.emojiDataSource,onEmojiClick:le,buttonColor:K}),ie&&de]})},inputLabel:{className:F?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(f(),{className:"rustic-input-actions",children:[m.children,(0,o.jsx)(pe(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(ee(),{"aria-label":"send message",onClick:ye,disabled:oe(),color:"secondary",children:(0,o.jsx)(L.A,{name:"send"})})})})]})]})}),be=require("@mui/material/LinearProgress");var je=a.n(be);const we=require("axios");var Se=a.n(we);const Fe=require("react-dom"),ke=require("@mui/material/Card");var Oe=a.n(ke);const Ee=require("@mui/material/Modal");var Ce=a.n(Ee);const Ne=require("@mui/system/Stack");var Te=a.n(Ne);const Pe=require("@mui/system/useTheme");var Ae=a.n(Pe);const De=require("pdfjs-dist"),Ie=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,o.jsx)(pe(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(ee(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(L.A,{name:r.symbol})})})})},Le=function(e){var t,r=(0,b.useRef)(null),n=(0,b.useState)(1),a=n[0],i=n[1],s=(0,b.useState)(1),c=s[0],l=s[1],u=(0,b.useState)(1),d=u[0],p=u[1],m=(0,b.useState)(!1),h=m[0],v=m[1],x=(0,b.useState)(),j=x[0],w=x[1],S=Ae()(),F=y()(S.breakpoints.down("sm")),k=y()(S.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,b.useState)(function(){return F?.5:k?1:1.5}),E=O[0],C=O[1];function N(t){De.getDocument({url:e.url,httpHeaders:t}).promise.then(function(e){l(e.numPages),function(e){e.getPage(a).then(function(e){var t=e.getViewport({scale:E}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};j&&j.cancel();var s=e.render(o);w(s),s.promise.then(function(){w(void 0)}).catch(function(e){console.error(e)})}}})}(e)}).catch(function(){v(!0)})}return(0,b.useEffect)(function(){De.GlobalWorkerOptions.workerSrc||(De.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(De.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then(function(e){return N(e.headers)}).catch(function(){return v(!0)}):N()},[e.url,a,E]),h?(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(f(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(Ie,{action:"zoomOut",onClick:function(){C(function(e){return Math.max(e-.2,.2)})}}),(0,o.jsx)(Ie,{action:"zoomIn",onClick:function(){C(function(e){return e+.2})}})]}),(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body",children:(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body-inner",children:(0,o.jsx)("canvas",{ref:r})})}),(0,o.jsxs)(Te(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(Ie,{action:"previousPage",onClick:function(){a>1&&(i(a-1),p(a-1))},isDisabled:1===a}),(0,o.jsx)(g(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(ue(),{type:"number",value:d,onChange:function(e){var t=parseInt(e.target.value);p(t),!isNaN(t)&&t>=1&&t<=c&&i(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(g(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Ie,{action:"nextPage",onClick:function(){a<c&&(i(a+1),p(a+1))},isDisabled:a===c})]})]})};var Re=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Me={pdf:Le};function qe(e){var t=e.supportedViewers,r=void 0===t?Me:t,n=e.showFullName,a=void 0===n||n,i=Re(e,["supportedViewers","showFullName"]),s=(0,h.useTheme)(),c=(0,b.useState)(!1),l=c[0],u=c[1];function d(){u(!1)}var p,m,f=i.file.url&&(p=i.file.url.split("."))[p.length-1].toLowerCase(),v=f&&r?r[f]:null,x=!!v,y=x?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(a?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=a?i.file.name:(m=i.file.name).length<=15?m:m.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(Oe(),{className:j,variant:"outlined",sx:{boxShadow:s.shadows[1]},onClick:function(){u(!0)},children:[(0,o.jsx)(g(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:i.children})]}),x&&(0,o.jsx)(Ce(),{open:l,onClose:d,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(pe(),{title:"Close",children:(0,o.jsx)(ee(),{onClick:d,className:"rustic-close-button",children:(0,o.jsx)(L.A,{name:"close"})})}),i.file.url&&(0,o.jsx)(v,{url:i.file.url,getAuthHeaders:i.getAuthHeaders})]})})]})}var Be=a(3110);const _e=require("@mui/material"),ze=require("@mui/material/Button");var He=a.n(ze);const Ue=require("@mui/material/Drawer");var We=a.n(Ue);const Ve=require("@mui/material/ListItemText");var Ge=a.n(Ve);const Ke=require("@mui/material/Menu");var Qe=a.n(Ke),$e=function(){return $e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},$e.apply(this,arguments)};function Je(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useRef)(null),i=(0,h.useTheme)(),s=(0,_e.useMediaQuery)(i.breakpoints.down("md")),c=s?We():Qe(),l={borderRadius:"".concat(i.shape.borderRadius,"px"),border:"1px solid ".concat(i.palette.divider)};function u(e){return(0,o.jsxs)(o.Fragment,{children:[e.startDecorator&&(0,o.jsx)(T.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,o.jsx)(Ge(),{children:(0,o.jsx)(g(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,o.jsx)(T.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(l=$e($e({},l),{borderRadius:"".concat(i.shape.borderRadius,"px ").concat(i.shape.borderRadius,"px 0 0"),borderBottom:0}));var d=e.menuItems.map(function(e){return e.href?(0,o.jsx)(ae(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)(ae(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:u(e)},e.label)});var p,m,f=s?{}:{anchorEl:a.current};return(0,o.jsxs)(o.Fragment,{children:[(p={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},m=(0,o.jsx)(L.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(He(),$e({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(pe(),{title:e.ariaLabel,children:(0,o.jsx)(ee(),$e({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,$e({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":$e($e({},l),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:d}))]})}var Ye=function(){return Ye=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ye.apply(this,arguments)},Xe=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Ze(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const et=function(e){var t,r=(0,b.useState)([]),n=r[0],a=r[1],i=(0,b.useState)([]),s=i[0],c=i[1],l=(0,b.useState)({}),u=l[0],d=l[1],p=(0,b.useRef)({}),m=(0,J.v4)();(0,b.useEffect)(function(){a([]),c([]),p.current={}},[e.messageId]);var h=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function v(e,t,r){var n;p.current=Ye(Ye({},p.current),((n={})[e]=p.current[e]--,n)),function(e,t,r){c(function(t){return Xe(Xe([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)}),a(function(e){return e.filter(function(e){return e.id!==t})})}(e,t,r)}var x=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map(function(t,r){return(0,o.jsx)(qe,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(je(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(pe(),{title:"Delete",children:(0,o.jsx)(ee(),{color:"primary",onClick:function(){return function(t,r){var n,i;c([]);var o=t.name;if(p.current=Ye(Ye({},p.current),((n={})[o]=p.current[o]--,n)),e.onFileUpdate("remove",o),100===t.loadingProgress){var s="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);h.then(function(t){Se().delete(s,Ye({},t)).then(function(){return a(function(e){return e.filter(function(e,t){return t!==r})})}).catch(function(){return e.onFileUpdate("add",o),c(function(e){return Xe(Xe([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)})})})}else t.abortController.abort(),a(function(e){return e.filter(function(e,t){return t!==r})}),p.current=Ye(Ye({},p.current),((i={})[o]=p.current[o]++,i))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)})}),y=(0,o.jsx)(f(),{children:s.map(function(e,t){return(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)})});function j(e,t){return t?(0,Fe.createPortal)(e,t):e}var w=null===(t=e.uploadOptions)||void 0===t?void 0:t.map(function(t){return{label:t.label,onClick:function(){return function(t){d(t.metadata);var r=document.getElementById(m);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,o.jsx)(Be.default,{name:t.iconName})}});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(f(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:m,children:(null==w?void 0:w.length)?(0,o.jsx)(Je,{ariaLabel:"Upload",icon:(0,o.jsx)(Be.default,{name:"upload_2"}),menuItems:w}):(0,o.jsx)(pe(),{title:"Upload",children:(0,o.jsx)(ee(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,o.jsx)("input",{type:"file",id:m,onChange:function(t){c([]);var r=t.target.files&&Array.from(t.target.files),i=n.length+(r?r.length:0);e.maxFileCount&&i>e.maxFileCount&&c(function(t){return Xe(Xe([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)});var o=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,i,e.maxFileCount);o&&o.forEach(function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,c(function(t){return Xe(Xe([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&Ze(e.maxFileSize),".")],!1)})):function(t){var r=new FormData,n=new AbortController,i=function(e){var t,r,n=e.name,a=p.current[n];if(a){var i=a+1,o=n.lastIndexOf("."),s=n.substring(0,o),c=n.substring(o);n="".concat(s,"(").concat(a,")").concat(c),p.current=Ye(Ye({},p.current),((t={})[e.name]=i,t))}else p.current=Ye(Ye({},p.current),((r={})[e.name]=1,r));return n}(t),o=new File([t],i,{type:t.type});if(e.getUploadData||u){var s=e.getUploadData?e.getUploadData(i):{},c=Ye(Ye({},s),u);Object.keys(c).forEach(function(e){var t=c[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)})}r.append("file",o);var l=(0,J.v4)(),d={name:i,loadingProgress:0,abortController:n,id:l};function m(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=d.id,a(function(e){var n=e.map(function(e){return e.id===r?Ye(Ye({},e),{loadingProgress:t}):e});return n}))}a(function(e){return Xe(Xe([],e,!0),[d],!1)}),e.onFileUpdate("add",i);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId);!function o(){return h.then(function(s){return Se().post(f,r,Ye(Ye({},s),{onUploadProgress:m,signal:n.signal})).then(function(t){var n,i,o=r.get("file");t.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,t.data.url),t.data.fileId&&(n=t.data,i=d.id,a(function(e){var t=e.findIndex(function(e){return e.id===i});if(-1!==t){var r=Xe([],e,!0);return r[t]=Ye(Ye({},r[t]),{id:n.fileId}),r}return e}))}).catch(function(n){var s,c,u=r.get("file");u instanceof File&&u.name&&e.onFileUpdate("remove",u.name);var p,m,f,h;409===(null===(s=n.response)||void 0===s?void 0:s.status)&&e.listFiles?(p=i.lastIndexOf("."),m=i.substring(0,p),f=i.substring(p),h=new RegExp("^".concat(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then(function(e){for(var t=0,r=0,n=e;r<n.length;r++){var a=n[r];if(h.test(a.name)){var i=a.name.match(h),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;t=Math.max(t,o)}}return"".concat(m,"(").concat(t+1,")").concat(f)}):Promise.resolve(i)).then(function(n){e.onFileUpdate("add",n);var i=new File([t],n,{type:t.type});r.set("file",i),a(function(e){return e.map(function(e){return e.id===l?Ye(Ye({},e),{name:n,loadingProgress:0}):e})}),o()}).catch(function(){var e;v(t.name,d.id,null===(e=n.response)||void 0===e?void 0:e.data)}):v(t.name,d.id,null===(c=n.response)||void 0===c?void 0:c.data)})})}()}(t)}(t)}),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),s.length>0&&j(y,e.errorMessagesContainer),n.length>0&&j(x,e.filePreviewsContainer)]})};var tt=function(){return tt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},tt.apply(this,arguments)},rt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},nt=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},at=2097152;function it(e){var t=e.maxFileSize,r=void 0===t?at:t,n=e.maxFileCount,a=void 0===n?1:n,i=rt(e,["maxFileSize","maxFileCount"]),s=(0,b.useState)({uploaded:[],fileList:[]}),c=s[0],l=s[1],u=(0,b.useState)((0,J.v4)()),d=u[0],p=u[1],m=(0,b.useState)(),v=m[0],g=m[1],x=(0,b.useState)(),y=x[0],j=x[1],w=(0,b.useRef)(null),S=(0,h.useTheme)(),F=c.fileList.length>0,k=c.uploaded.length===c.fileList.length&&c.uploaded.length>0;return(0,b.useEffect)(function(){w.current&&(j(w.current.querySelector(".rustic-error-container")),g(w.current.querySelector(".rustic-input-extras")))}),(0,o.jsx)(f(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(S.palette.action.disabled),borderRadius:"".concat(S.shape.borderRadius,"px"),":focus-within":{borderColor:S.palette.secondary.main},background:S.palette.background.paper},children:(0,o.jsx)(ye,tt({},i,{send:function(e){e.data=V(e.sender,e.data.text,c.uploaded.map(function(e){return{url:e.url,name:e.name}})),e.id=d,i.ws.send(e),p((0,J.v4)()),l({uploaded:[],fileList:[]})},isSendEnabled:F?k:void 0,ref:w,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(et,{acceptedFileTypes:i.acceptedFileTypes,maxFileCount:a,maxFileSize:r,uploadFileEndpoint:i.uploadFileEndpoint,deleteFileEndpoint:i.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)l(function(e){return tt(tt({},e),{fileList:nt(nt([],e.fileList,!0),[{name:t}],!1)})});else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");l(function(e){var n=e.fileList.findIndex(function(e){return e.name===t}),a=nt(nt(nt([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return tt(tt({},e),{uploaded:a})})}else l(function(e){return{uploaded:e.uploaded.filter(function(e){return e.name!==t}),fileList:e.fileList.filter(function(e){return e.name!==t})}})},messageId:d,filePreviewsContainer:v,errorMessagesContainer:y,showFullName:i.showFullName,getUploadData:i.getUploadData,uploadOptions:i.uploadOptions,listFiles:i.listFiles,getUploadHeaders:i.getUploadHeaders})})}))})}var ot=function(){return ot=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},ot.apply(this,arguments)},st=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function ct(e){var t=e.ws,r=st(e,["ws"]);return(0,o.jsx)(ye,ot({},r,{send:function(e){e.data=V(e.sender,e.data.text),t.send(e)}}))}require("ol/ol.css");var lt=a(5642),ut=a.n(lt);const dt=require("ol/layer/Tile.js");var pt=a.n(dt);const mt=require("ol/Map.js");var ft=a.n(mt);const ht=require("ol/Overlay.js");var vt=a.n(ht);const gt=require("ol/proj.js"),xt=require("ol/source/OSM.js");var yt=a.n(xt);const bt=require("ol/View.js");var jt=a.n(bt);function wt(e){var t=(0,b.useState)(""),r=t[0],n=t[1],a=(0,b.useRef)(null),i=(0,b.useRef)(null);return(0,b.useEffect)(function(){if(n(""),e.latitude<-90||e.latitude>90||e.longitude<-180||e.longitude>180)return n("Invalid coordinates");if(a.current&&i.current){var t=new(ft())({layers:[new(pt())({source:new(yt())})],view:new(jt())({center:(0,gt.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(vt())({element:i.current,position:(0,gt.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return t.addOverlay(r),t.once("postrender",function(){var e;if(!(null===(e=a.current)||void 0===e?void 0:e.querySelector("canvas")))return n("An error occurred while loading the map")}),function(){t.setTarget(""),t.removeOverlay(r)}}},[]),(0,o.jsx)(o.Fragment,{children:r.length>0?(0,o.jsx)(ut(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(f(),{ref:i,children:(0,o.jsx)(L.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:a,className:"rustic-open-layers-map-canvas"})]})})}var St=a(4409);const Ft=require("@mui/material/Slider");var kt=a.n(Ft);function Ot(e){var t,r={play:{symbol:"play_circle",label:"Play"},pause:{symbol:"pause_circle",label:"Pause"},forward:{symbol:"forward_10",label:"Forward ten seconds"},replay:{symbol:"replay_10",label:"Replay ten seconds"},volumeUp:{symbol:"volume_up",label:"Mute"},volumeOff:{symbol:"volume_off",label:"Unmute"},miniPlayer:{symbol:"picture_in_picture",label:"Mini player"},miniPlayerExit:{symbol:"picture_in_picture_off",label:"Exit mini player"},fullscreen:{symbol:"fullscreen",label:"Fullscreen"},fullscreenExit:{symbol:"fullscreen_exit",label:"Exit fullscreen"},captionsOn:{symbol:"closed_caption",label:"Show captions"},captionsOff:{symbol:"closed_caption_disabled",label:"Hide captions"}};return r[e.action].label.replaceAll(" ","-").toLowerCase(),(0,o.jsx)(pe(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(ee(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(L.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var Et=100;function Ct(e){var t="dark"===(0,_e.useTheme)().palette.mode,r=U(e.mediaElement.currentTime);return(0,o.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var r=e.mediaElement.buffered,n=0,a=r.length-1;a>=0;--a){var i=r.start(a),s=r.end(a);if(i<e.mediaElement.currentTime){n=s;break}}var c=n/e.mediaElement.duration*Et;return(0,o.jsx)(je(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(kt(),{className:"rustic-progress-slider",size:"small","aria-label":"Time","aria-valuetext":"Current time: ".concat(r),max:e.mediaElement.duration,value:e.mediaElement.currentTime,onChange:function(t,r){e.mediaElement.currentTime=r},valueLabelDisplay:"auto",valueLabelFormat:function(e){return U(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function Nt(e){var t=(0,b.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,b.useState)(e.mediaElement.volume),i=a[0],s=a[1],c=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,o.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,o.jsx)(Ot,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(s(e.mediaElement.volume),n(0)):n(i)},className:"rustic-mute-button",action:c}),(0,o.jsx)(kt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*Et,"%"),value:r,onChange:function(t,r){var a=r;e.mediaElement.muted=0===a,e.mediaElement.volume=a,n(e.mediaElement.volume)}})]})}function Tt(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(He(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(L.A,{name:t}),children:(0,o.jsx)(g(),{variant:"overline",children:r})})}function Pt(e){var t=(0,b.useState)(!e.mediaElement.paused),r=t[0],n=t[1],a=r?"pause":"play";return e.mediaElement.onended=function(){n(!1)},e.mediaElement.onpause=function(){n(!1)},e.mediaElement.onplay=function(){n(!0)},(0,o.jsx)(Ot,{onClick:function(){r?e.mediaElement.pause():e.mediaElement.play().catch(function(t){e.onError("Failed to play the media. Error: ".concat(t.message))})},action:a,className:"rustic-pause-play-icon"})}function At(e){var t,r=(0,b.useState)(e.mediaElement.playbackRate),n=r[0],a=r[1];return(0,o.jsx)(pe(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(He(),{onClick:function(){var t=1;e.mediaElement.playbackRate<2&&(t=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=t,a(t)},className:"rustic-playback-rate-button",children:(0,o.jsxs)(g(),{variant:"body1",children:[n,"X"]})})})}function Dt(e){var t="replay"===e.movement,r=t?function(){e.mediaElement.currentTime-=10}:function(){e.mediaElement.currentTime+=10},n=t?"replay":"forward";return(0,o.jsx)(Ot,{onClick:r,action:n})}var It=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function Lt(e){var t=e.style,r=void 0===t?"condensed":t,n=It(e,["style"]),a=U(n.elapsedTimeInSeconds),i=U(n.durationTimeInSeconds),s="".concat(a," / ").concat(i);return"wide"===r?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(g(),{variant:"overline",children:a}),(0,o.jsx)(g(),{variant:"overline",children:i})]}):(0,o.jsx)(g(),{variant:"overline",className:"rustic-time-display",children:s})}const Rt=require("@mui/material/Divider");var Mt=a.n(Rt);function qt(e){var t=!!document.fullscreenElement;return(0,o.jsxs)(T.Box,{className:"rustic-transcript-container",children:[!t&&(0,o.jsx)(Mt(),{orientation:"vertical",flexItem:!0}),(0,o.jsx)(g(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function Bt(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(0),p=d[0],m=d[1],f=(0,b.useState)(""),h=f[0],v=f[1],x=(0,b.useState)(""),y=x[0],j=x[1],S=(0,_e.useTheme)(),F=(0,b.useRef)(null),k=(0,_e.useMediaQuery)(S.breakpoints.down("md"));function O(){return(0,o.jsx)(g(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function E(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Ot,{action:t,onClick:function(){return s(!i)}})}}function C(){if(F.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Dt,{mediaElement:F.current,movement:"replay"}),(0,o.jsx)(Pt,{mediaElement:F.current,onError:j}),(0,o.jsx)(Dt,{mediaElement:F.current,movement:"forward"})]})}function N(){if(e.transcript&&r)return(0,o.jsx)(qt,{transcript:e.transcript})}function P(){if(e.transcript)return(0,o.jsx)(Tt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function A(){return(0,o.jsx)("video",{src:e.src,ref:F,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,b.useEffect)(function(){var e,t,r,n;function a(e){v(e)}null===(e=F.current)||void 0===e||e.addEventListener("timeupdate",function(){F.current&&m(F.current.currentTime)}),null===(t=F.current)||void 0===t||t.addEventListener("canplay",function(){v(""),u(!1)}),null===(r=F.current)||void 0===r||r.addEventListener("error",function(){return a("Failed to load the audio.")}),null===(n=F.current)||void 0===n||n.addEventListener("stalled",function(){return a("Failed to fetch audio data, but trying.")})},[]);var D=k?function(){if(F.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Lt,{elapsedTimeInSeconds:p,durationTimeInSeconds:F.current.duration,style:"wide"}),(0,o.jsx)(Ct,{mediaElement:F.current}),O(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-left",children:C()}),(0,o.jsx)(Nt,{mediaElement:F.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[P(),(0,o.jsxs)(T.Box,{children:[E(),(0,o.jsx)(At,{mediaElement:F.current})]})]})]}),N()]})}:function(){if(F.current)return(0,o.jsxs)(o.Fragment,{children:[O(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Ct,{mediaElement:F.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-left",children:[C(),E(),(0,o.jsx)(At,{mediaElement:F.current}),(0,o.jsx)(Nt,{mediaElement:F.current}),(0,o.jsx)(Lt,{elapsedTimeInSeconds:p,durationTimeInSeconds:F.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:P()})]}),N()]})]})};return h.length>0?(0,o.jsx)(ut(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[A(),(0,o.jsx)(M(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[A(),D(),y.length>0&&(0,o.jsx)(ut(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:y})]})}function _t(e){var t=(0,b.useState)(!!document.pictureInPictureElement),r=t[0],n=t[1],a=e.mediaElement,i=r?"miniPlayerExit":"miniPlayer";return a.onleavepictureinpicture=function(){n(!1)},(0,o.jsx)(Ot,{onClick:function(){r?document.exitPictureInPicture().then(function(){n(!1)}).catch(function(t){e.onError("Failed to exit mini player. Error: ".concat(t.message))}):a.requestPictureInPicture().then(function(){n(!0)}).catch(function(t){e.onError("Failed to enter mini player. Error: ".concat(t.message))})},action:i})}function zt(e){var t=(0,b.useState)(!!document.fullscreenElement),r=t[0],n=t[1],a=e.element,i=r?"fullscreenExit":"fullscreen";return a.onfullscreenchange=function(){n(!!document.fullscreenElement)},(0,o.jsx)(Ot,{onClick:function(){r?document.exitFullscreen().then(function(){n(!1)}).catch(function(t){e.onError("Failed to exit fullscreen mode. Error: ".concat(t.message))}):a.requestFullscreen().then(function(){n(!0)}).catch(function(t){e.onError("Failed to enter fullscreen mode. Error: ".concat(t.message))})},action:i})}function Ht(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(!!document.fullscreenElement),p=d[0],m=d[1],f=(0,b.useState)(!1),h=f[0],v=f[1],x=(0,b.useState)(""),y=x[0],j=x[1],S=(0,b.useState)(""),F=S[0],k=S[1],O=(0,b.useState)(0),E=O[0],C=O[1],N=(0,b.useRef)(null),P=(0,b.useRef)(null),A=(0,_e.useTheme)(),D=(0,_e.useMediaQuery)(A.breakpoints.down("md"));(0,b.useEffect)(function(){var e,t,r,n,a,i,o,s;function c(e){k(e),u(!1)}function l(){clearTimeout(s),s=setTimeout(function(){return v(!1)},3e3)}null===(e=P.current)||void 0===e||e.addEventListener("timeupdate",function(){P.current&&C(P.current.currentTime)}),null===(t=P.current)||void 0===t||t.addEventListener("canplay",function(){k(""),u(!1)}),null===(r=P.current)||void 0===r||r.addEventListener("error",function(){return c("Failed to load the video.")}),null===(n=P.current)||void 0===n||n.addEventListener("stalled",function(){return c("Failed to fetch video data, but trying.")}),document.addEventListener("fullscreenchange",function(){m(!!document.fullscreenElement)}),null===(a=N.current)||void 0===a||a.addEventListener("mousemove",function(){v(!0),l()}),null===(i=N.current)||void 0===i||i.addEventListener("mouseleave",function(){v(!1)}),null===(o=N.current)||void 0===o||o.addEventListener("keydown",function(){v(!0),l()})},[]);var I={backgroundColor:A.palette.background.paper,opacity:h?1:0};function L(){if(e.transcript&&r)return(0,o.jsx)(qt,{transcript:e.transcript})}function R(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Ot,{action:t,onClick:function(){return s(!i)}})}}function q(){if(e.transcript)return(0,o.jsx)(Tt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var B=D?function(){return p?(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:I,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(Pt,{mediaElement:P.current,onError:j}),(0,o.jsx)(Ct,{mediaElement:P.current}),(0,o.jsx)(Lt,{elapsedTimeInSeconds:E,durationTimeInSeconds:P.current.duration})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Dt,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(Dt,{mediaElement:P.current,movement:"forward"}),R(),(0,o.jsx)(At,{mediaElement:P.current})]}),q()]}),L()]})}):(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Pt,{mediaElement:P.current,onError:j}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[q(),(0,o.jsx)(zt,{element:N.current,onError:j})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:I,children:[(0,o.jsx)(Ct,{mediaElement:P.current}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-left",children:[(0,o.jsx)(Pt,{mediaElement:P.current,onError:j}),(0,o.jsx)(Dt,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(Dt,{mediaElement:P.current,movement:"forward"}),R(),(0,o.jsx)(At,{mediaElement:P.current}),(0,o.jsx)(Nt,{mediaElement:P.current}),(0,o.jsx)(Lt,{elapsedTimeInSeconds:E,durationTimeInSeconds:P.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[q(),(0,o.jsx)(_t,{mediaElement:P.current,onError:j}),(0,o.jsx)(zt,{element:N.current,onError:j})]})]}),p&&L()]})})};return F.length>0?(0,o.jsx)(ut(),{severity:"error",children:F}):(0,o.jsxs)(T.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(M(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(T.Box,{ref:N,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[y.length>0&&(0,o.jsx)(ut(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:y}),(!D||p)&&function(){if(P.current&&N.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:I,children:[(0,o.jsx)(g(),{variant:"body2",children:e.title}),p&&D&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(_t,{mediaElement:P.current,onError:j}),(0,o.jsx)(zt,{element:N.current,onError:j})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:P,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),B()]}),!p&&L(),e.description&&(0,o.jsx)(w.A,{text:e.description})]})}const Ut=require("@mui/material/Chip");var Wt=a.n(Ut);const Vt=require("@mui/system/Box");var Gt=a.n(Vt);const Kt=require("@mui/material/Stack");var Qt=a.n(Kt);const $t=function(e){return(0,o.jsx)(g(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:_(e.timestamp)})},Jt=(0,b.forwardRef)(function(e,t){var r=(0,_e.useTheme)(),n=e.inReplyTo?e.inReplyTo:e.message;return(0,o.jsxs)(Qt(),{id:n.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(Qt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(n),(0,o.jsx)($t,{timestamp:n.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(g(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,o.jsx)($t,{timestamp:e.message.timestamp})]})]})]})});var Yt=function(){return Yt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Yt.apply(this,arguments)},Xt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function Zt(e){var t=e.scrollDownLabel,r=void 0===t?"Scroll down":t,n=Xt(e,["scrollDownLabel"]),a=(0,b.useRef)(null),i=(0,b.useRef)(null),s=(0,b.useRef)(),c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(!0),p=d[0],m=d[1],f=(0,b.useState)(!1),h=f[0],v=f[1],g=(0,b.useState)({}),x=g[0],y=g[1],j=(0,b.useState)(!0),w=j[0],S=j[1],F=(0,b.useState)(""),k=F[0],O=F[1],E=Object.keys(x).length;function C(){var e=i.current,t=a.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;u(n-1<=r)}}function N(){if(function(){var e,t=null===(e=i.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every(function(e){return e.readyState>=1})}()){var e=i.current;v(!0),e&&setTimeout(function(){m(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(function(){m(!1)},2e3),e.scrollTop=e.scrollHeight,u(!0)},0)}else setTimeout(N,1)}return(0,b.useEffect)(function(){var e={};n.getHistoricMessages().then(function(t){t.forEach(function(t){var r=G(e,t);e=r}),y(e),S(!1)}).catch(function(e){var t,r,n,a=(null===(r=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===r?void 0:r.detail)||(null===(n=e.response)||void 0===n?void 0:n.data);O(a||"Failed to load messages"),S(!1)})},[n.getHistoricMessages]),(0,b.useEffect)(function(){!w&&x&&N();var e=i.current;if(e)return C(),e.addEventListener("scroll",C),window.addEventListener("resize",C),function(){e.removeEventListener("scroll",C),window.removeEventListener("resize",C)}},[w,x]),(0,b.useEffect)(function(){N()},[h]),w?(0,o.jsx)(Gt(),{className:"rustic-message-archive-loading",children:n.loadingIcon?n.loadingIcon:(0,o.jsx)(M(),{})}):(0,o.jsxs)(Gt(),{className:"rustic-message-archive",children:[n.infoMessage&&!k&&(0,o.jsx)(ut(),{severity:"warning",children:n.infoMessage}),k&&(0,o.jsx)(ut(),{severity:"error",children:k}),(0,o.jsxs)(Gt(),{ref:i,className:"rustic-message-container",children:[Object.keys(x).map(function(e,t){var r=x[e],i=r[r.length-1],s=i.format.includes("Response"),c=s&&{inReplyTo:r[0]};return(0,o.jsx)(Jt,Yt({message:i},c,{getActionsComponent:n.getActionsComponent,getProfileComponent:n.getProfileComponent,ref:t===E-1?a:null,children:(0,o.jsx)(I,{messages:s?[r[0]]:r,supportedElements:n.supportedElements})}),e)}),!l&&!p&&(0,o.jsx)(Wt(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:N,label:(0,o.jsxs)(o.Fragment,{children:[r,(0,o.jsx)(L.A,{name:"arrow_downward"})]})})]})]})}var er=a(4445);function tr(e){var t=(0,b.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(er.default,{message:e.message,icon:(0,o.jsx)(L.A,{name:"file_copy"}),onClick:function(e){e.data.text&&navigator.clipboard.writeText(e.data.text).then(function(){n("Copied"),setTimeout(function(){n("Copy text")},2e3)}).catch(function(){n("Failed to copy")})},label:r})}function rr(e){var t=(0,b.useState)("Start reading aloud"),r=t[0],n=t[1],a=[e.message.data.title,e.message.data.description,e.message.data.alt,e.message.data.text,e.message.data.transcript].filter(Boolean).join(" "),i=new SpeechSynthesisUtterance(a);return(0,o.jsx)(er.default,{message:e.message,icon:(0,o.jsx)(L.A,{name:"text_to_speech"}),onClick:function(){window.speechSynthesis.speaking?(window.speechSynthesis.cancel(),n("Start reading aloud")):(i.onend=function(){n("Start reading aloud")},window.speechSynthesis.speak(i),n("Stop reading aloud"))},label:r})}var nr=function(){return nr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},nr.apply(this,arguments)},ar=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function ir(e){var t,r,n,a=e.scrollDownLabel,i=void 0===a?"Scroll down":a,s=ar(e,["scrollDownLabel"]),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(),d=(0,b.useState)(!0),p=d[0],m=d[1],f=(0,b.useState)(!0),h=f[0],v=f[1],g=(0,b.useState)(!1),x=g[0],y=g[1],j=(0,b.useState)({}),w=j[0],S=j[1],F=Object.keys(w).length,k=(r=F,n=(0,b.useRef)(0),(0,b.useEffect)(function(){n.current=r}),n.current);function O(){v(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(function(){v(!1)},2e3)}function E(){var e=l.current,t=c.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;m(n-1<=r)}}function C(){if(function(){var e,t=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every(function(e){return e.readyState>=1})}()){var e=l.current;y(!0),e&&setTimeout(function(){O(),e.scrollTop=e.scrollHeight},0)}else setTimeout(C,1)}function N(e){S(function(t){return G(t,e)})}return(0,b.useEffect)(function(){var e=l.current;if(E(),e)return e.addEventListener("scroll",E),window.addEventListener("resize",E),function(){e.removeEventListener("scroll",E),window.removeEventListener("resize",E)}},[p]),(0,b.useEffect)(function(){C()},[x]),(0,b.useEffect)(function(){p&&0!==k&&F>k&&(O(),C())},[p,Object.keys(w).length]),(0,b.useEffect)(function(){var e,t={};null===(e=s.receivedMessages)||void 0===e||e.forEach(function(e){var r=G(t,e);t=r}),S(t)},[null===(t=s.receivedMessages)||void 0===t?void 0:t.length]),(0,b.useEffect)(function(){s.ws.onReceive&&s.ws.onReceive(N)},[]),(0,o.jsxs)(Gt(),{className:"rustic-message-space",children:[(0,o.jsxs)(Gt(),{ref:l,className:"rustic-message-container",children:[Object.keys(w).map(function(e,t){var r,n=w[e],a=n[n.length-1],i=a.format.includes("Response"),l=i&&{inReplyTo:n[0]};return"prompts"!==a.format?(0,o.jsx)(Jt,nr({message:a},l,{getActionsComponent:s.getActionsComponent,getProfileComponent:s.getProfileComponent,ref:t===F-1?c:null,children:(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})}),e):"inConversation"===(null===(r=a.data)||void 0===r?void 0:r.position)?(0,o.jsx)("div",{ref:t===F-1?c:null,children:(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})},e):void 0}),!p&&!h&&(0,o.jsx)(Wt(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:C,label:(0,o.jsxs)(o.Fragment,{children:[i,(0,o.jsx)(L.A,{name:"arrow_downward"})]})})]}),function(e){var t,r=Object.values(e).flat(),n=r[r.length-1];return"prompts"===(null==n?void 0:n.format)&&"inConversation"!==(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.position)?(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:[n],supportedElements:s.supportedElements}):null}(w)]})}var or=a(8010),sr=function(){return sr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},sr.apply(this,arguments)};function cr(e){return(0,o.jsx)(pe(),{title:"Download",className:"rustic-shift-to-right-by-8",children:e.getAuthHeaders?(0,o.jsx)(ee(),{onClick:function(){(0,e.getAuthHeaders)().then(function(t){return fetch(e.url,sr({},t))}).then(function(e){return e.blob()}).then(function(t){var r=window.URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e.fileName,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)}).catch(function(e){throw new Error("Error downloading file. "+e.message)})},children:(0,o.jsx)(L.A,{name:"download"})}):(0,o.jsx)(ee(),{component:"a",href:e.url,download:e.fileName,children:(0,o.jsx)(L.A,{name:"download"})})})}function lr(e){return new URL(e).pathname.split("/").pop()}function ur(e){return(0,o.jsxs)(f(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(or.default,{text:e.description})]}),e.messages.map(function(t,r){return"string"==typeof t.content?(0,o.jsx)(or.default,{text:t.content},r):function(t,r){var n=[],a="";return t.map(function(t){if("text"===t.type)a+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,i={url:r,name:t[t.type].name||lr(r)},s=(0,o.jsx)(qe,{file:i,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:i.url&&(0,o.jsx)(cr,{url:i.url,fileName:i.name,getAuthHeaders:e.getAuthHeaders})});n.push(s)}}),(0,o.jsxs)(j().Fragment,{children:[a.length>0&&(0,o.jsx)(or.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]},r)}(t.content,r)})]})}function dr(e){return(0,o.jsxs)(Gt(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(or.default,{text:e.description})]}),e.text&&(0,o.jsx)(or.default,{text:e.text}),(t=e.files.map(function(t,r){return(0,o.jsx)(qe,{file:t,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:t.url&&(0,o.jsx)(cr,{url:t.url,fileName:t.name,getAuthHeaders:e.getAuthHeaders})},r)}),(0,o.jsx)(Gt(),{className:"rustic-files",children:t}))]});var t}const pr=require("@mui/material/Dialog");var mr=a.n(pr);const fr=require("@mui/material/DialogTitle");var hr=a.n(fr);const vr=require("@mui/material/List");var gr=a.n(vr);const xr=require("@mui/material/ListItem");var yr=a.n(xr);const br=require("@mui/material/ListSubheader");var jr=a.n(br);const wr=require("pluralize");var Sr=a.n(wr),Fr=a(7159);function kr(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(Sr()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(g(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(gr(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(jr(),{disableSticky:!0,className:"rustic-participant-list-subheader",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-list-subheader-title",children:[e.participantTypeIcon,(0,o.jsx)(g(),{variant:"subtitle2",color:"text.secondary",children:s})]}),a>3&&(0,o.jsx)(He(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(L.A,{name:"keyboard_arrow_down"}),children:c})]}),children:i.map(function(e){return(0,o.jsxs)(yr(),{className:"rustic-participant-list-item",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-profile",children:[(0,o.jsx)(X(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"subtitle2",children:e.displayName})]}),(0,o.jsx)(g(),{variant:e.participantRole===Fr.sW.Owner?"subtitle2":"caption",children:H(e.participantRole||Fr.sW.Member)})]},e.id)})})}const Or=function(e){function t(e,t){return function(e){return function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],e,!0).sort(function(e,t){return t.participantRole===Fr.sW.Owner?1:-1})}(e.filter(function(e){return e.participantType===t}))}var r=t(e.participants,Fr.yJ.Human),n=t(e.participants,Fr.yJ.Agent),a="".concat(Sr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(mr(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(hr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:a}),(0,o.jsx)(kr,{participantType:"Human",participantTypeIcon:(0,o.jsx)(L.A,{name:"account_circle"}),participants:r}),n.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Mt(),{className:"rustic-participants-container-divider"}),(0,o.jsx)(kr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(L.A,{name:"smart_toy"}),participants:n})]})]})},Er=require("@mui/material/DialogActions");var Cr=a.n(Er);const Nr=require("@mui/material/DialogContent");var Tr=a.n(Nr);const Pr=require("@mui/material/DialogContentText");var Ar=a.n(Pr),Dr=function(){return Dr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Dr.apply(this,arguments)},Ir=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Lr(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!1),l=c[0],u=c[1],d=(0,b.useState)(!1),p=d[0],m=d[1],f=(0,b.useState)([]),h=f[0],v=f[1],x=(0,b.useState)(null),y=x[0],j=x[1],w=(0,T.useTheme)(),S=h[h.length-1],F=Dr(Dr({},e.ws),{send:function(e){j(e)}});function k(e){v(function(t){return Ir(Ir([],t,!0),[e],!1)})}function O(){if(y){var t=Dr(Dr({},y),{threadId:e.messageId});e.ws.send(t)}}if((0,b.useEffect)(function(){e.ws.onReceive&&e.ws.onReceive(k)},[e.ws]),(0,b.useEffect)(function(){h.length>0&&(S&&S.sender.id!==e.sender.id&&s(!1),"promptBuilder"===S.format&&S.data.isLastQuestion&&n(!0))},[h.length]),0!==h.length)return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(mr(),{open:l,onClose:function(){return u(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(w.palette.divider)}},children:[(0,o.jsx)(hr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(Mt(),{}),(0,o.jsx)(Tr(),{children:(0,o.jsx)(Ar(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(Cr(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(He(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(L.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(He(),{variant:"contained",color:"primary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(g(),{color:"text.secondary",children:"Prompt Builder"}),(0,o.jsx)(Mt(),{className:"rustic-prompt-builder-divider"}),(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!p&&h.length>0)return h.map(function(t){if(t.sender.id!==e.sender.id&&"promptBuilder"!==t.format)return(0,o.jsx)(I,{ws:F,sender:e.sender,messages:[t],supportedElements:e.supportedElements},t.id)})}(),i&&(0,o.jsx)(M(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,o.jsx)(o.Fragment,{children:!p&&(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons",children:[(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,o.jsx)(He(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(L.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(He(),{variant:"outlined",color:"secondary",endIcon:(0,o.jsx)(L.A,{name:"chevron_right"}),onClick:function(){O(),j(null),s(!0)},disabled:!y,"aria-disabled":!y,children:"Next question"})]}),r&&(0,o.jsx)(T.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,o.jsx)(He(),{variant:"contained",color:"primary",onClick:function(){O(),m(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}var Rr=function(){return Rr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Rr.apply(this,arguments)};function Mr(e){var t=Ae()(),r=e.prompts.map(function(r,n){return(0,o.jsx)(Wt(),{onClick:function(){return t=r,n=(new Date).toISOString(),a={id:(0,J.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:V(e.sender,t.toString())},void e.ws.send(a);var t,n,a},color:"secondary",size:"small",className:"rustic-prompt",sx:Rr(Rr({backgroundColor:t.palette.background.paper},"inConversation"===e.position&&{border:"1px solid ".concat(t.palette.divider)}),{"&:hover":{color:t.palette.text.primary,backgroundColor:t.palette.primary.hover}}),label:r},n)});return(0,o.jsx)(f(),{className:e.className,children:r})}function qr(e){var t=(0,b.useState)(e.data||""),r=t[0],n=t[1],a=(0,_e.useTheme)(),i=(0,_e.useMediaQuery)(a.breakpoints.down("md"))?"column":"row",s=e.options.map(function(t,a){return(0,o.jsx)(Wt(),{onClick:function(){return function(t){var r;n(t);var a=(new Date).toISOString(),i={id:(0,J.v4)(),timestamp:a,sender:e.sender,conversationId:e.conversationId,format:"questionResponse",data:{data:t,inReplyTo:e.messageId}};null===(r=e.ws)||void 0===r||r.send(i)}(t)},color:"secondary",size:"small",sx:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r||!e.ws,"aria-disabled":!!r||!e.ws,label:t},a)});return(0,o.jsxs)(f(),{className:"rustic-question",children:[(e.title||e.description)&&(0,o.jsxs)(f(),{className:"rustic-question-text",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description})]}),(0,o.jsx)(Qt(),{direction:i,className:"rustic-options-container",children:s})]})}const Br=require("@mui/material/Table");var _r=a.n(Br);const zr=require("@mui/material/TableBody");var Hr=a.n(zr);const Ur=require("@mui/material/TableCell");var Wr=a.n(Ur);const Vr=require("@mui/material/TableContainer");var Gr=a.n(Vr);const Kr=require("@mui/material/TableHead");var Qr=a.n(Kr);const $r=require("@mui/material/TablePagination");var Jr=a.n($r);const Yr=require("@mui/material/TableRow");var Xr=a.n(Yr);const Zr=require("@mui/material/TableSortLabel");var en,tn=a.n(Zr),rn=10;function nn(){return(0,o.jsx)(L.A,{name:"expand_all"})}function an(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>rn,i=(0,b.useState)({}),s=i[0],c=i[1],l=(0,b.useState)(a?rn:-1),u=l[0],d=l[1],p=(0,b.useState)(0),m=p[0],f=p[1],h=(0,_e.useTheme)(),v=Array.from(new Set(e.data.flatMap(function(e){return Object.keys(e)}))),x=e.headers||v.map(function(e){return{dataKey:e}}),y=(t=e.data,r=Object.keys(s)[0],n=s[r],r&&n?t.slice().sort(function(e,t){var r=Object.keys(s)[0],n=s[r];return e[r]<t[r]?n===en.Descending?1:-1:e[r]>t[r]?n===en.Descending?-1:1:0}):t),j=y.slice(m*u,m*u+u),S=u>0?j:y;function F(e){if(!s[e])return nn}return(0,o.jsxs)(Qt(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(Gr(),{className:"rustic-table-container",children:(0,o.jsxs)(_r(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[x.length>0&&(0,o.jsx)(Qr(),{children:(0,o.jsx)(Xr(),{children:x.map(function(e,t){return(0,o.jsx)(Wr(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(pe(),{title:(r=e.dataKey,n=s[r],n?Object.keys(en)[Object.values(en).indexOf(n)]:"Sort"),children:(0,o.jsx)(tn(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c(function(t){var r,n,a={};switch(t[e]){case en.Ascending:(r={})[e]=en.Descending,a=r;break;case en.Descending:a={};break;default:(n={})[e]=en.Ascending,a=n}return a})}(e.dataKey)},className:"rustic-table-header",IconComponent:F(e.dataKey),children:e.label||H(e.dataKey)})})},"header-".concat(t));var r,n})})}),(0,o.jsx)(Hr(),{children:S.map(function(e,t){return(0,o.jsx)(Xr(),{children:x.map(function(r,n){return(0,o.jsx)(Wr(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))})},"row-".concat(t))})})]})}),a&&(0,o.jsx)(Jr(),{className:"rustic-table-pagination",component:"div",count:e.data.length,rowsPerPage:u,labelRowsPerPage:"Rows:",page:m,onPageChange:function(e,t){return f(t)},onRowsPerPageChange:function(e){d(+e.target.value),f(0)},sx:{"& .MuiTablePagination-selectLabel":{color:h.palette.text.disabled}},classes:{toolbar:"rustic-table-toolbar",input:"rustic-table-input",spacer:"rustic-table-spacer",displayedRows:"rustic-table-displayed-rows",actions:"rustic-table-actions"}})]})}!function(e){e.Ascending="asc",e.Descending="desc"}(en||(en={}));var on=a(7447),sn=a.n(on);const cn=function(e){var t=(0,b.useState)(sn().sanitize(e.text)),r=t[0],n=t[1],a=(0,b.useState)(""),i=a[0],s=a[1];return(0,b.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var i=a[r];"string"!=typeof i.text&&(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=i.text}n(sn().sanitize(t))}},[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g(),{variant:"body2",children:r}),i&&(0,o.jsx)(ut(),{severity:"error",children:i})]})},ln=function(e){return(0,o.jsx)(g(),{variant:"body1",className:"rustic-text",children:sn().sanitize(e.text)})},un=require("mermaid");var dn=a.n(un),pn=function(){return pn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},pn.apply(this,arguments)};const mn=function(e){var t=(0,b.useRef)(null),r=(0,b.useState)(),n=r[0],a=r[1],i=Ae()(),s=(0,J.v4)();return(0,b.useEffect)(function(){var r="dark"===i.palette.mode?"dark":"neutral",n=i.typography.fontFamily;t.current&&(dn().initialize(pn({theme:r,themeVariables:{fontFamily:n}},e.config)),dn().render("mermaid-svg-".concat(s),e.diagram,t.current).then(function(e){t.current&&(t.current.innerHTML=e.svg),a("")}).catch(function(){var e;null===(e=t.current)||void 0===e||e.replaceChildren(),a("Failed to render the diagram.")}))}),(0,o.jsxs)(Qt(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(g(),{variant:"body2",children:n})]})};var fn;require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@finos/perspective"),require("@finos/perspective/dist/wasm/perspective-server.wasm"),require("@finos/perspective-viewer"),require("@finos/perspective-viewer/dist/wasm/perspective-viewer.wasm");var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},hn.apply(this,arguments)};function vn(e){return e?e.reduce(function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e},{}):{}}const gn=function(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available."});var t=(0,b.useRef)(null),r=(0,h.useTheme)(),n=(0,b.useState)(!1),a=n[0],i=n[1],s=(0,b.useState)(fn),c=s[0],l=s[1],u=r.palette.mode,d="dark"===u?"Pro Dark":"Pro Light",p=vn(e.headers),m="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(r.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide border for aggregate Selector */\n .aggregate-selector:hover {\n border: none !important;\n }\n \n /* Input and Select Elements */\n input, select, .noselect, #add-expression, .dropdown-width-container, \n .pivot-column-border, .pivot-column, .column-selector-column-border {\n border-radius: 8px !important;\n }\n \n /* Change background color */\n #settings_panel, #column_settings_sidebar {\n background: ").concat("dark"===u?"dark":"white"," !important;\n background-image: none !important;\n }\n \n /* Expression Edit Button */\n .expression-edit-button {\n display: none;\n }\n \n /* Add padding to expression input */\n #editor-container, .editable {\n padding: 8px !important;\n }\n \n /* Change Button Font Size */\n .button select, .button {\n font-size: 12px !important;\n }\n \n /* Button and Icon Colors */\n #status_bar .hover-target:hover .button>span {\n display:none !important;\n }\n \n #status_bar .hover-target.modal-target .button>span {\n display:none !important;\n }\n \n .button select:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide unused buttons */\n #debug_open_button.sidebar_close_button, .reset-default-style-disabled, \n .expression-edit-button, #theme, #status, #status_bar .input-sizer {\n display: none !important;\n }\n \n #status_bar .hover-target:hover, #status_bar .hover-target.modal-target {\n height: fit-content !important;\n }\n\n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: auto !important;\n }\n\n #settings_button:hover {\n color: ").concat(r.palette.primary.contrastText," !important;\n background-color: ").concat(r.palette.primary.main," !important;\n }\n ");(0,b.useEffect)(function(){l(fn)},[fn]);var f,v,x,y,j,S,F,k,O,E=e.config&&(v=(f=e.config).groupBy,x=f.splitBy,y=f.aggregates,j=f.sort,S=f.filter,F=f.columns,k=null==j?void 0:j.map(function(e){return[p[e[0]]||e[0],e[1]]}),O=y&&Object.fromEntries(Object.entries(y).map(function(e){var t=e[0],r=e[1];return[p[t]||t,r]})),{group_by:null==v?void 0:v.map(function(e){return p[e]||e}),split_by:null==x?void 0:x.map(function(e){return p[e]||e}),aggregates:O,sort:k,filter:S&&function(e){return e.map(function(e){return[p[e[0]]||e[0],e[1],e[e.length-1]]})}(S),columns:null==F?void 0:F.map(function(e){return p[e]||e})});return(0,b.useEffect)(function(){var r=null,n=null,a=!0;if(c){var o=t.current;c.table(function(e,t){var r=vn(t);return e.map(function(e){for(var t={},n=0,a=Object.entries(e);n<a.length;n++){var i=a[n],o=i[0],s=i[1];t[r[o]||o]=s}return t})}(e.data,e.headers)).then(function(e){if(r=e,a){if(o){if(o.shadowRoot){var t=new CSSStyleSheet;t.replaceSync(m),o.shadowRoot.adoptedStyleSheets.push(t)}return o.load(r)}}else r&&(r.delete({lazy:!0}),r=null)}).then(function(){var t,r,n;if(a&&o){var i={date_format:{dateStyle:(null===(t=e.config)||void 0===t?void 0:t.dateStyle)||"medium"}},s={};return null===(n=null===(r=e.config)||void 0===r?void 0:r.dateColumns)||void 0===n||n.forEach(function(e){s[e]=i}),o.restore(hn(hn({},E),{theme:d,title:e.title,settings:!1,columns_config:s}))}}).then(function(){if(a&&o)return o.getView()}).then(function(r){var i;if(a){n=r;var o=null===(i=e.config)||void 0===i?void 0:i.expansionDepth;if("number"==typeof o&&n)return n.set_depth(o).then(function(){t.current&&t.current.resize()})}else r&&r.delete()}).catch(function(){i(!0)})}return function(){a=!1,n&&n.delete(),r&&r.delete({lazy:!0})}},[c,e.data,d,e.config]),a?(0,o.jsx)(g(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(Te(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},xn=require("react-plotly.js");var yn=a.n(xn),bn=function(){return bn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},bn.apply(this,arguments)};const jn=function(e){var t=bn(bn({},e.plotParams),{className:"rustic-plotly"});return t.config=bn(bn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Gt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(yn(),bn({},t))]})},wn=require("react-dom/server"),Sn=require("vega"),Fn=require("vega-embed");var kn=a.n(Fn),On=function(){return On=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},On.apply(this,arguments)},En="source_0";const Cn=function(e){var t=e.theme,r=void 0===t?{dark:"dark"}:t,n=e.refreshIntervalInMs,a=void 0===n?0:n,i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme","refreshIntervalInMs"]),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useState)(!1),u=l[0],d=l[1],p=Ae()(),m="dark"===p.palette.mode,f=p.typography.fontFamily,h=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(i.getAuthHeaders?i.getAuthHeaders().then(function(e){return r.headers=On(On({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return Se()(e,t)}).then(function(e){return e.data})};function v(){var e=Sn.loader();return i.getAuthHeaders&&(e.http=h),e}var x={backgroundColor:p.palette.primary.main,color:p.palette.background.paper,borderRadius:p.shape.borderRadius+"px",padding:"4px 8px",fontSize:p.typography.caption.fontSize,fontFamily:f,fontWeight:p.typography.caption.fontWeight},y={formatTooltip:function(e,t){return(0,wn.renderToStaticMarkup)((0,o.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:x,children:Object.entries(e).map(function(e){var r=e[0],n=e[1];return(0,o.jsxs)("div",{children:[(0,o.jsxs)("strong",{children:[t(r),":"]})," ",t(n)]},r)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},j=[{label:"Save as SVG"},{label:"Save as PNG"}];function S(){var e,t;if(s.current&&i.spec){var n=On(On({config:{font:f}},i.options),{theme:m?r.dark:r.light,tooltip:y,actions:!1,loader:v()});(null===(t=null===(e=i.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(n.config.font=f);var o=On(On({},i.spec),{name:En});delete o.title,kn()(s.current,o,n).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var i="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,i).then(function(e){j[a].href=e,j[a].downloadFileName="".concat(r,".").concat(n)})}),c.current=e.view,d(!1),a>0&&function(){var e=this;if(c.current&&i.spec){F.current&&(clearInterval(F.current),F.current=null);var t=i.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,i=function(){var e,r,n;return function(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!((a=(a=i.trys).length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(a){switch(a.label){case 0:if(!c.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,v().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=Sn.changeset().remove(function(){return!0}).insert(r),c.current.change(En,n).run(),[3,4];case 3:return a.sent(),d(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function o(e){try{c(i.next(e))}catch(e){t(e)}}function s(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(o,s)}c((i=i.apply(r,n||[])).next())});var r,n,a,i},a);F.current=r}}}()}).catch(function(){d(!0)})}}(0,b.useEffect)(function(){function e(){S()}return S(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[i.spec,m]),(0,b.useEffect)(function(){var e=setTimeout(function(){if(i.updatedData&&i.updatedData.length>0&&c.current){var e=(r=i.updatedData,n=[],null==r||r.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var r=e.spec.data.values;Array.isArray(r)&&n.push.apply(n,r)}}),n);if(e.length>0)try{var t=Sn.changeset().insert(e);c.current.change(En,t).run()}catch(e){console.error("Failed to update streaming data:",e)}}var r,n},0);return function(){return clearTimeout(e)}},[i.updatedData]);var F=(0,b.useRef)(null);return(0,b.useEffect)(function(){return function(){F.current&&clearInterval(F.current)}},[]),u?(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(Te(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Gt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(Je,{menuItems:j,ariaLabel:"Download options"})}),i.title&&(0,o.jsx)(g(),{variant:"h6",children:i.title}),i.description&&(0,o.jsx)(w.A,{text:i.description}),(0,o.jsxs)(Gt(),{textAlign:"center",mt:1,children:["string"==typeof i.spec.title&&(0,o.jsx)(g(),{variant:"subtitle2",children:i.spec.title}),i.spec.description&&(0,o.jsx)(g(),{variant:"caption",children:i.spec.description})]}),(0,o.jsx)("div",{ref:s,className:"rustic-vega-lite"})]})};function Nn(e){var t=(0,b.useState)(e.units),r=t[0],n=t[1];function a(t){return"metric"===e.units&&"imperial"===r?Math.round(1.8*t+32):"imperial"===e.units&&"metric"===r?Math.round(t*(5/9)-32):Math.round(t)}var i=new Date(1e3*e.weather[0].timestamp),s=W(e.weather[0].timestamp).shortName,c=i.getDate(),l=i.getFullYear().toString().slice(2),u="".concat(s," ").concat(c,"/").concat(l," TODAY"),d="HIGH: ".concat(a(e.weather[0].temp.high)," / LOW: ").concat(a(e.weather[0].temp.high)),p=e.weather.map(function(e,t){if(0!==t)return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(g(),{variant:"h5",component:"span",color:"text.secondary","aria-label":W(e.timestamp).fullName,children:W(e.timestamp).shortName}),(0,o.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)});return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(Je,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return n("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return n("imperial")}}]}),(0,o.jsxs)(Qt(),{alignItems:"center",children:[(0,o.jsx)(g(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(Qt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,o.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,o.jsx)(g(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(g(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[a(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(r)]}),(0,o.jsxs)(Qt(),{direction:"row",spacing:2,children:[(0,o.jsx)(g(),{variant:"overline",children:u}),(0,o.jsx)(g(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)(Qt(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(L.A,{name:"cloud"}),(0,o.jsx)(g(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}var Tn=a(9517);return i})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rustic-ai/ui-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"rustic-ai",
|
|
6
6
|
"conversational-ui"
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@types/uuid": "9.0.7",
|
|
72
72
|
"@typescript-eslint/eslint-plugin": "8.32.1",
|
|
73
73
|
"@typescript-eslint/parser": "8.32.1",
|
|
74
|
-
"commitizen": "4.3.
|
|
74
|
+
"commitizen": "4.3.1",
|
|
75
75
|
"css-loader": "6.10.0",
|
|
76
76
|
"cypress": "14.3.3",
|
|
77
77
|
"cypress-intercept-formdata": "0.6.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"eslint-plugin-storybook": "9.0.15",
|
|
88
88
|
"eslint-plugin-unused-imports": "4.1.4",
|
|
89
89
|
"husky": "9.1.7",
|
|
90
|
-
"lint-staged": "
|
|
90
|
+
"lint-staged": "16.2.3",
|
|
91
91
|
"mermaid": "11.10.1",
|
|
92
92
|
"mini-css-extract-plugin": "2.8.1",
|
|
93
93
|
"mock-socket": "9.3.1",
|