@rustic-ai/ui-components 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e,r,t={9767:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(8732),a=(t(2015),function(){return a=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},a.apply(this,arguments)});function o(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},r),children:e.name})}},3110:(e,r,t)=>{t.d(r,{default:()=>n});const n=t(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,a),o.exports}a.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return a.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);a.r(o);var i={};e=e||[null,r({}),r([]),r(r)];for(var l=2&n&&t;"object"==typeof l&&!~e.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach((e=>i[e]=()=>t[e]));return i.default=()=>t,a.d(o,i),o},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};a.r(o),a.d(o,{default:()=>Se});var i=a(8732);const l=require("@mui/material/Box");var c=a.n(l);const s=require("@mui/material/styles");var u=a(2015);const d=require("uuid");var p;function m(e,r){var t=[];if(e&&(null==e?void 0:e.trim().length)&&t.push({type:"text",text:e}),r&&r.length>0)for(var n=0;n<(null==r?void 0:r.length);n++)t.push({type:"file_url",file_url:{url:r[n].url,name:r[n].name}});return{messages:[{content:t,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const f=require("@mui/material/CircularProgress");var h=a.n(f);const v=require("@mui/material/IconButton");var x=a.n(v);const g=require("@mui/material/InputAdornment");var b=a.n(g);const j=require("@mui/material/MenuItem");var y=a.n(j);const w=require("@mui/material/MenuList");var F=a.n(w);const S=require("@mui/material/Popover");var C=a.n(S);const N=require("@mui/material/TextField");var k=a.n(N);const P=require("@mui/material/Tooltip");var O=a.n(P);const E=require("@mui/material/Typography");var q=a.n(E),R=a(8342),T=a(9767);const I=function(e){var r=(0,s.useTheme)(),t=(0,u.useRef)(null),n=(0,u.useRef)(null),o=(0,u.useState)(!1),l=o[0],c=o[1],d={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function p(){c(!1)}function m(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),p()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then((function(t){var a=new(0,t.Picker)({dataSource:e.dataSource}),o="dark"===r.palette.mode?"dark":"light";a.classList.add(o),Object.keys(d).forEach((function(e){a.style.setProperty(e,d[e])})),n.current=a})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",m),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",m)}}),[l,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(O(),{title:"Emoji",children:(0,i.jsx)(x(),{size:"small",ref:t,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:"Mood"})})}),n.current&&(0,i.jsx)(C(),{open:l,anchorEl:t.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&&n.current&&!e.contains(n.current)&&e.appendChild(n.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 A(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var _=(0,u.forwardRef)((function(e,r){var t=(0,u.useState)(""),n=t[0],a=t[1],o=(0,u.useState)(!1),l=o[0],s=o[1],p=(0,u.useState)(!1),f=p[0],v=p[1],g=(0,u.useState)(!1),j=g[0],w=g[1],S=(0,u.useState)(""),N=S[0],P=S[1],E=(0,u.useState)([]),_=E[0],z=E[1],L=(0,u.useState)(!1),U=L[0],M=L[1],B=(0,u.useRef)(null),$=new R.Database({dataSource:e.emojiDataSource}),W=!n.trim().length&&!e.isSendEnabled,H="".concat(l?"Stop":"Start"," speech to text"),V=f?"primary.main":"primary.light",G=l?"error.main":V,K=l?"stop_circle":"speech_to_text";function Q(e,r){if(void 0===r&&(r=!1),B.current){var t=B.current,o=t.selectionStart,i=t.selectionEnd;if("number"==typeof o&&"number"==typeof i){var l,c=n||"",s=c.substring(0,o),u=c.substring(i);l=r?s.replace(/:(\w+)$/,e)+u:s+e+u,a(l);var d=r?s.replace(/:(\w+)$/,e).length:o+e.length;setTimeout((function(){var e,r;null===(e=B.current)||void 0===e||e.focus(),null===(r=B.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}M(!1)}var Y=j?(0,i.jsx)(h(),{size:24}):(0,i.jsx)(O(),{title:H,children:(0,i.jsx)(x(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,l?(e.stop(),w(!0),s(!1)):(e.start(),P(""),s(!0)),e.onstart=function(){s(!0)},e.onresult=function(e){var r,t=e.results[0][0].transcript;n.length>0?a(n+" "+t):a(t),null===(r=B.current)||void 0===r||r.focus(),s(!1)},e.onerror=function(e){var r=D[e.error];P(r),s(!1)},e.onend=function(){w(!1),s(!1)}},size:"small",sx:{color:G,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:K})})});function Z(){var r=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:m(n)};e.send(t),a(""),P("")}return(0,i.jsxs)(c(),{className:"rustic-base-input",ref:r,children:[(0,i.jsxs)(c(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(c(),{className:"rustic-error-container",children:(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:N})}),(0,i.jsxs)(c(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:f?"secondary.main":"action.disabled"},children:[_.length>0&&(0,i.jsx)(C(),{open:U,anchorEl:B.current,onClose:function(){return M(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,i.jsx)(F(),{children:_.map((function(e,r){return"unicode"in e&&(0,i.jsx)(y(),{onClick:function(){return Q(e.unicode,!0)},children:A(e)},r)}))})}),(0,i.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:n,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),W||Z())},onChange:function(r){P("");var t=r.target.value;a(t);var n,o=t.match(/:(\w{2,}):/g),i=t.match(/:(\w{2,})/g);if(o){var l=o[0].replace(/:/g,"");$.getEmojiByShortcode(l).then((function(e){if(e&&"unicode"in e){var r=t.replace(o[0],e.unicode);a(r)}else a(t)})).catch((function(){a(t)})),M(!1)}else i?(n=i[0].replace(":",""),$.getEmojiBySearchQuery(n).then((function(r){r.length?(z(r.slice(0,e.maximumEmojiSearchResults)),M(!0)):(z([]),M(!1))})).catch((function(){z([]),M(!1)}))):M(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:B,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(b(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(I,{dataSource:e.emojiDataSource,onEmojiClick:Q,buttonColor:V}),e.enableSpeechToText&&Y]})},inputLabel:{className:f?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(c(),{className:"rustic-input-actions",children:[e.children,(0,i.jsx)(O(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(x(),{"aria-label":"send message",onClick:Z,disabled:W,color:"secondary",children:(0,i.jsx)(T.A,{name:"send"})})})})]})]})}));_.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const z=_,L=require("@mui/material/LinearProgress");var U=a.n(L);const M=require("axios");var B=a.n(M);const $=require("react-dom"),W=require("@mui/material/Card");var H=a.n(W);const V=require("@mui/material/Modal");var G=a.n(V);const K=require("@mui/material/useMediaQuery");var Q=a.n(K);const Y=require("@mui/system/Stack");var Z=a.n(Y);const J=require("@mui/system/useTheme");var X=a.n(J);const ee=require("pdfjs-dist"),re=function(e){var r={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"}},t=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,i.jsx)(O(),{title:t.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(x(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(T.A,{name:t.symbol})})})})};var te={pdf:function(e){var r,t=(0,u.useRef)(null),n=(0,u.useState)(1),a=n[0],o=n[1],l=(0,u.useState)(1),s=l[0],d=l[1],p=(0,u.useState)(1),m=p[0],f=p[1],h=(0,u.useState)(!1),v=h[0],x=h[1],g=(0,u.useState)(),b=g[0],j=g[1],y=X()(),w=Q()(y.breakpoints.down("sm")),F=Q()(y.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,i.jsx)(H(),{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 S=(0,u.useState)((function(){return w?.5:F?1:1.5})),C=S[0],N=S[1];return(0,u.useEffect)((function(){ee.GlobalWorkerOptions.workerSrc||(ee.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ee.version,"/pdf.worker.mjs")),ee.getDocument({url:"".concat(e.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(a).then((function(e){var r=e.getViewport({scale:C}),n=t.current;if(n){var a=n.getContext("2d");if(a){var o=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*o,n.height=r.height*o;var i={canvasContext:a,viewport:r,transform:[o,0,0,o,0,0]};b&&b.cancel();var l=e.render(i);j(l),l.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){x(!0)}))}),[e.url,a,C]),v?(0,i.jsx)(H(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(H(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(c(),{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)(c(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(c(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:t})})}),(0,i.jsxs)(Z(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(re,{action:"previousPage",onClick:function(){a>1&&(o(a-1),f(a-1))},isDisabled:1===a}),(0,i.jsx)(q(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(k(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);f(r),!isNaN(r)&&r>=1&&r<=s&&o(r)},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(){a<s&&(o(a+1),f(a+1))},isDisabled:a===s})]})]})}};function ne(e){var r=(0,s.useTheme)(),t=(0,u.useState)(!1),n=t[0],a=t[1];function o(){a(!1)}var l,c,d=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),p=d&&e.supportedViewers?e.supportedViewers[d]:null,m=!!p,f=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=m?" rustic-cursor-pointer":"",v="rustic-file-preview ".concat(f).concat(h),g=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(H(),{className:v,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){a(!0)},children:[(0,i.jsx)(q(),{variant:"subtitle2",className:"rustic-file-preview-name",children:g}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),m&&(0,i.jsx)(G(),{open:n,onClose:o,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(O(),{title:"Close",children:(0,i.jsx)(x(),{onClick:o,className:"rustic-close-button",children:(0,i.jsx)(T.A,{name:"close"})})}),e.file.url&&(0,i.jsx)(p,{url:e.file.url})]})})]})}ne.defaultProps={supportedViewers:te,showFullName:!0};var ae=a(3110);const oe=require("@mui/material"),ie=require("@mui/material/Button");var le=a.n(ie);const ce=require("@mui/material/Drawer");var se=a.n(ce);const ue=require("@mui/material/ListItemText");var de=a.n(ue);const pe=require("@mui/material/Menu");var me=a.n(pe);const fe=require("@mui/system");var he=function(){return he=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},he.apply(this,arguments)};function ve(e){var r=(0,u.useState)(!1),t=r[0],n=r[1],a=(0,u.useRef)(null),o=(0,s.useTheme)(),l=(0,oe.useMediaQuery)(o.breakpoints.down("md")),c=l?se():me(),d={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(fe.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(de(),{children:(0,i.jsx)(q(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(fe.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}l&&(d=he(he({},d),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var m=e.menuItems.map((function(e){return e.href?(0,i.jsx)(y(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(y(),{onClick:function(r){e.onClick&&e.onClick(r),n(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var f,h,v=l?{}:{anchorEl:a.current};return(0,i.jsxs)(i.Fragment,{children:[(f={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},h=(0,i.jsx)(T.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(le(),he({},f,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(O(),{title:e.ariaLabel,children:(0,i.jsx)(x(),he({},f,{children:e.icon?e.icon:h}))})),(0,i.jsx)(c,he({open:t,onClose:function(){return n(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":he(he({},d),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:m}))]})}var xe=function(){return xe=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},xe.apply(this,arguments)},ge=function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};function be(e){for(var r=["Bytes","KB","MB","GB"],t=0;e>=1024&&t<r.length-1;)e/=1024,t++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(r[t])}const je=function(e){var r,t=(0,u.useState)([]),n=t[0],a=t[1],o=(0,u.useState)([]),l=o[0],s=o[1],p=(0,u.useState)({}),m=p[0],f=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();function g(e,r,t){var n;h.current=xe(xe({},h.current),((n={})[e]=h.current[e]--,n)),function(e,r,t){s((function(r){return ge(ge([],r,!0),["Failed to upload ".concat(e,". ").concat((null==t?void 0:t.message)||"")],!1)})),a((function(e){return e.filter((function(e){return e.id!==r}))}))}(e,r,t)}(0,u.useEffect)((function(){a([]),s([]),h.current={}}),[e.messageId]);var b=(0,i.jsx)(c(),{className:"rustic-files rustic-padding-16",children:n.map((function(r,t){return(0,i.jsx)(ne,{file:{name:r.name},showFullName:e.showFullName,children:(0,i.jsxs)(c(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,i.jsx)(U(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(O(),{title:"Delete",children:(0,i.jsx)(x(),{color:"primary",onClick:function(){return function(r,t){var n,o;s([]);var i=r.name;if(h.current=xe(xe({},h.current),((n={})[i]=h.current[i]--,n)),e.onFileUpdate("remove",i),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);B().delete(l).then((function(){return a((function(e){return e.filter((function(e,r){return r!==t}))}))})).catch((function(){return e.onFileUpdate("add",i),s((function(e){return ge(ge([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}else r.abortController.abort(),a((function(e){return e.filter((function(e,r){return r!==t}))})),h.current=xe(xe({},h.current),((o={})[i]=h.current[i]++,o))}(r,t)},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"})})})]})},t)}))}),j=(0,i.jsx)(c(),{children:l.map((function(e,r){return(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function y(e,r){return r?(0,$.createPortal)(e,r):e}var w=null===(r=e.uploadOptions)||void 0===r?void 0:r.map((function(r){return{label:r.label,onClick:function(){return function(r){f(r.metadata);var t=document.getElementById(v);t&&(t.accept=r.acceptedFileTypes||e.acceptedFileTypes),t.click()}(r)},startDecorator:r.iconName&&(0,i.jsx)(ae.default,{name:r.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==w?void 0:w.length)?(0,i.jsx)(ve,{ariaLabel:"Upload",icon:(0,i.jsx)(ae.default,{name:"upload_2"}),menuItems:w}):(0,i.jsx)(O(),{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(r){s([]);var t=r.target.files&&Array.from(r.target.files),o=n.length+(t?t.length:0);e.maxFileCount&&o>e.maxFileCount&&s((function(r){return ge(ge([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=t&&function(e,r,t){return t?r<=t?e:e.slice(0,t-r):e}(t,o,e.maxFileCount);i&&i.forEach((function(r){!function(r){var t;e.maxFileSize&&r.size>e.maxFileSize?(t=r.name,s((function(r){return ge(ge([],r,!0),["Failed to upload ".concat(t,". You cannot upload files larger than ").concat(e.maxFileSize&&be(e.maxFileSize),".")],!1)}))):function(r){var t=new FormData,n=new AbortController,o=function(e){var r,t,n=e.name,a=h.current[n];if(a){var o=a+1,i=n.lastIndexOf("."),l=n.substring(0,i),c=n.substring(i);n="".concat(l,"(").concat(a,")").concat(c),h.current=xe(xe({},h.current),((r={})[e.name]=o,r))}else h.current=xe(xe({},h.current),((t={})[e.name]=1,t));return n}(r),i=new File([r],o,{type:r.type});if(e.getUploadData||m){var l=e.getUploadData?e.getUploadData(o):{},c=xe(xe({},l),m);Object.keys(c).forEach((function(e){var r=c[e];t.append(e,"object"==typeof r?JSON.stringify(r):r)}))}t.append("file",i);var s=(0,d.v4)(),u={name:o,loadingProgress:0,abortController:n,id:s};function p(e){var r,t;e.total&&(r=e.loaded/e.total*100,t=u.id,a((function(e){var n=e.map((function(e){return e.id===t?xe(xe({},e),{loadingProgress:r}):e}));return n})))}a((function(e){return ge(ge([],e,!0),[u],!1)})),e.onFileUpdate("add",o);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId);!function i(){return B().post(f,t,{onUploadProgress:p,signal:n.signal}).then((function(r){var n,o,i=t.get("file");r.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,r.data.url),r.data.fileId&&(n=r.data,o=u.id,a((function(e){var r=e.findIndex((function(e){return e.id===o}));if(-1!==r){var t=ge([],e,!0);return t[r]=xe(xe({},t[r]),{id:n.fileId}),t}return e})))})).catch((function(n){var l,c,d=t.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,m,f,h;409===(null===(l=n.response)||void 0===l?void 0:l.status)&&e.listFiles?(p=o.lastIndexOf("."),m=o.substring(0,p),f=o.substring(p),h=new RegExp("^".concat(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var r=0,t=0,n=e;t<n.length;t++){var a=n[t];if(h.test(a.name)){var o=a.name.match(h),i=o&&o[1]?parseInt(o[1].slice(1,-1),10):0;r=Math.max(r,i)}}return"".concat(m,"(").concat(r+1,")").concat(f)})):Promise.resolve(o)).then((function(n){e.onFileUpdate("add",n);var o=new File([r],n,{type:r.type});t.set("file",o),a((function(e){return e.map((function(e){return e.id===s?xe(xe({},e),{name:n,loadingProgress:0}):e}))})),i()})).catch((function(){var e;g(r.name,u.id,null===(e=n.response)||void 0===e?void 0:e.data)})):g(r.name,u.id,null===(c=n.response)||void 0===c?void 0:c.data)}))}()}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),l.length>0&&y(j,e.errorMessagesContainer),n.length>0&&y(b,e.filePreviewsContainer)]})};var ye=function(){return ye=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ye.apply(this,arguments)},we=function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};function Fe(e){var r=(0,u.useState)({uploaded:[],fileList:[]}),t=r[0],n=r[1],a=(0,u.useState)((0,d.v4)()),o=a[0],l=a[1],p=(0,u.useState)(),f=p[0],h=p[1],v=(0,u.useState)(),x=v[0],g=v[1],b=(0,u.useRef)(null),j=(0,s.useTheme)(),y=t.uploaded.length===t.fileList.length&&t.uploaded.length>0;return(0,u.useEffect)((function(){b.current&&(g(b.current.querySelector(".rustic-error-container")),h(b.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(c(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(j.palette.action.disabled),borderRadius:"".concat(j.shape.borderRadius,"px"),":focus-within":{borderColor:j.palette.secondary.main},background:j.palette.background.paper},children:(0,i.jsx)(z,ye({},e,{send:function(r){y&&(r.id=o,r.format="chatCompletionRequest",r.data=m(r.data.text,t.uploaded.map((function(e){return{url:e.url,name:e.name}})))),e.ws.send(r),l((0,d.v4)()),n({uploaded:[],fileList:[]})},isSendEnabled:y,ref:b,children:(0,i.jsx)(c(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(je,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,r,t){if("add"===e)n((function(e){return ye(ye({},e),{fileList:we(we([],e.fileList,!0),[{name:r}],!1)})}));else if("update"===e){if(!t)return void console.error("URL is required for the 'update' action");n((function(e){var n=e.fileList.findIndex((function(e){return e.name===r})),a=we(we(we([],e.uploaded.slice(0,n),!0),[{name:r,url:t}],!1),e.uploaded.slice(n),!0);return ye(ye({},e),{uploaded:a})}))}else n((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==r})),fileList:e.fileList.filter((function(e){return e.name!==r}))}}))},messageId:o,filePreviewsContainer:f,errorMessagesContainer:x,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions,listFiles:e.listFiles})})}))})}Fe.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};const Se=Fe;return o})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e,r,t={9767:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(8732),a=(t(2015),function(){return a=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},a.apply(this,arguments)});function o(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},r),children:e.name})}},3110:(e,r,t)=>{t.d(r,{default:()=>n});const n=t(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,a),o.exports}a.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return a.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);a.r(o);var i={};e=e||[null,r({}),r([]),r(r)];for(var l=2&n&&t;"object"==typeof l&&!~e.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach((e=>i[e]=()=>t[e]));return i.default=()=>t,a.d(o,i),o},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};a.r(o),a.d(o,{default:()=>Se});var i=a(8732);const l=require("@mui/material/Box");var c=a.n(l);const s=require("@mui/material/styles");var u=a(2015);const d=require("uuid");var p;function m(e,r){var t=[];if(e&&(null==e?void 0:e.trim().length)&&t.push({type:"text",text:e}),r&&r.length>0)for(var n=0;n<(null==r?void 0:r.length);n++)t.push({type:"file_url",file_url:{url:r[n].url,name:r[n].name}});return{messages:[{content:t,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const f=require("@mui/material/CircularProgress");var h=a.n(f);const v=require("@mui/material/IconButton");var g=a.n(v);const x=require("@mui/material/InputAdornment");var b=a.n(x);const j=require("@mui/material/MenuItem");var y=a.n(j);const w=require("@mui/material/MenuList");var F=a.n(w);const S=require("@mui/material/Popover");var C=a.n(S);const N=require("@mui/material/TextField");var k=a.n(N);const P=require("@mui/material/Tooltip");var O=a.n(P);const E=require("@mui/material/Typography");var q=a.n(E),R=a(8342),T=a(9767);const I=function(e){var r=(0,s.useTheme)(),t=(0,u.useRef)(null),n=(0,u.useRef)(null),o=(0,u.useState)(!1),l=o[0],c=o[1],d={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function p(){c(!1)}function m(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),p()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then((function(t){var a=new(0,t.Picker)({dataSource:e.dataSource}),o="dark"===r.palette.mode?"dark":"light";a.classList.add(o),Object.keys(d).forEach((function(e){a.style.setProperty(e,d[e])})),n.current=a})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",m),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",m)}}),[l,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(O(),{title:"Emoji",children:(0,i.jsx)(g(),{size:"small",ref:t,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:"Mood"})})}),n.current&&(0,i.jsx)(C(),{open:l,anchorEl:t.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&&n.current&&!e.contains(n.current)&&e.appendChild(n.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 A(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var _=(0,u.forwardRef)((function(e,r){var t=(0,u.useState)(""),n=t[0],a=t[1],o=(0,u.useState)(!1),l=o[0],s=o[1],p=(0,u.useState)(!1),f=p[0],v=p[1],x=(0,u.useState)(!1),j=x[0],w=x[1],S=(0,u.useState)(""),N=S[0],P=S[1],E=(0,u.useState)([]),_=E[0],U=E[1],z=(0,u.useState)(!1),L=z[0],M=z[1],B=(0,u.useRef)(null),H=new R.Database({dataSource:e.emojiDataSource}),$=!n.trim().length&&!e.isSendEnabled,W="".concat(l?"Stop":"Start"," speech to text"),V=f?"primary.main":"primary.light",G=l?"error.main":V,K=l?"stop_circle":"speech_to_text";function Q(e,r){if(void 0===r&&(r=!1),B.current){var t=B.current,o=t.selectionStart,i=t.selectionEnd;if("number"==typeof o&&"number"==typeof i){var l,c=n||"",s=c.substring(0,o),u=c.substring(i);l=r?s.replace(/:(\w+)$/,e)+u:s+e+u,a(l);var d=r?s.replace(/:(\w+)$/,e).length:o+e.length;setTimeout((function(){var e,r;null===(e=B.current)||void 0===e||e.focus(),null===(r=B.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}M(!1)}var Y=j?(0,i.jsx)(h(),{size:24}):(0,i.jsx)(O(),{title:W,children:(0,i.jsx)(g(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,l?(e.stop(),w(!0),s(!1)):(e.start(),P(""),s(!0)),e.onstart=function(){s(!0)},e.onresult=function(e){var r,t=e.results[0][0].transcript;n.length>0?a(n+" "+t):a(t),null===(r=B.current)||void 0===r||r.focus(),s(!1)},e.onerror=function(e){var r=D[e.error];P(r),s(!1)},e.onend=function(){w(!1),s(!1)}},size:"small",sx:{color:G,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:K})})});function Z(){var r=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:m(n)};e.send(t),a(""),P("")}return(0,i.jsxs)(c(),{className:"rustic-base-input",ref:r,children:[(0,i.jsxs)(c(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(c(),{className:"rustic-error-container",children:(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:N})}),(0,i.jsxs)(c(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:f?"secondary.main":"action.disabled"},children:[_.length>0&&(0,i.jsx)(C(),{open:L,anchorEl:B.current,onClose:function(){return M(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,i.jsx)(F(),{children:_.map((function(e,r){return"unicode"in e&&(0,i.jsx)(y(),{onClick:function(){return Q(e.unicode,!0)},children:A(e)},r)}))})}),(0,i.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:n,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),$||Z())},onChange:function(r){P("");var t=r.target.value;a(t);var n,o=t.match(/:(\w{2,}):/g),i=t.match(/:(\w{2,})/g);if(o){var l=o[0].replace(/:/g,"");H.getEmojiByShortcode(l).then((function(e){if(e&&"unicode"in e){var r=t.replace(o[0],e.unicode);a(r)}else a(t)})).catch((function(){a(t)})),M(!1)}else i?(n=i[0].replace(":",""),H.getEmojiBySearchQuery(n).then((function(r){r.length?(U(r.slice(0,e.maximumEmojiSearchResults)),M(!0)):(U([]),M(!1))})).catch((function(){U([]),M(!1)}))):M(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:B,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(b(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(I,{dataSource:e.emojiDataSource,onEmojiClick:Q,buttonColor:V}),e.enableSpeechToText&&Y]})},inputLabel:{className:f?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(c(),{className:"rustic-input-actions",children:[e.children,(0,i.jsx)(O(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(g(),{"aria-label":"send message",onClick:Z,disabled:$,color:"secondary",children:(0,i.jsx)(T.A,{name:"send"})})})})]})]})}));_.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const U=_,z=require("@mui/material/LinearProgress");var L=a.n(z);const M=require("axios");var B=a.n(M);const H=require("react-dom"),$=require("@mui/material/Card");var W=a.n($);const V=require("@mui/material/Modal");var G=a.n(V);const K=require("@mui/material/useMediaQuery");var Q=a.n(K);const Y=require("@mui/system/Stack");var Z=a.n(Y);const J=require("@mui/system/useTheme");var X=a.n(J);const ee=require("pdfjs-dist"),re=function(e){var r={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"}},t=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,i.jsx)(O(),{title:t.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(g(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(T.A,{name:t.symbol})})})})};var te={pdf:function(e){var r,t=(0,u.useRef)(null),n=(0,u.useState)(1),a=n[0],o=n[1],l=(0,u.useState)(1),s=l[0],d=l[1],p=(0,u.useState)(1),m=p[0],f=p[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],j=x[1],y=X()(),w=Q()(y.breakpoints.down("sm")),F=Q()(y.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,i.jsx)(W(),{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 S=(0,u.useState)((function(){return w?.5:F?1:1.5})),C=S[0],N=S[1];return(0,u.useEffect)((function(){ee.GlobalWorkerOptions.workerSrc||(ee.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ee.version,"/pdf.worker.mjs")),ee.getDocument({url:"".concat(e.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(a).then((function(e){var r=e.getViewport({scale:C}),n=t.current;if(n){var a=n.getContext("2d");if(a){var o=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*o,n.height=r.height*o;var i={canvasContext:a,viewport:r,transform:[o,0,0,o,0,0]};b&&b.cancel();var l=e.render(i);j(l),l.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,a,C]),v?(0,i.jsx)(W(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(W(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(c(),{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)(c(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(c(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:t})})}),(0,i.jsxs)(Z(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(re,{action:"previousPage",onClick:function(){a>1&&(o(a-1),f(a-1))},isDisabled:1===a}),(0,i.jsx)(q(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(k(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);f(r),!isNaN(r)&&r>=1&&r<=s&&o(r)},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(){a<s&&(o(a+1),f(a+1))},isDisabled:a===s})]})]})}};function ne(e){var r=(0,s.useTheme)(),t=(0,u.useState)(!1),n=t[0],a=t[1];function o(){a(!1)}var l,c,d=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),p=d&&e.supportedViewers?e.supportedViewers[d]:null,m=!!p,f=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=m?" rustic-cursor-pointer":"",v="rustic-file-preview ".concat(f).concat(h),x=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(W(),{className:v,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){a(!0)},children:[(0,i.jsx)(q(),{variant:"subtitle2",className:"rustic-file-preview-name",children:x}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),m&&(0,i.jsx)(G(),{open:n,onClose:o,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(O(),{title:"Close",children:(0,i.jsx)(g(),{onClick:o,className:"rustic-close-button",children:(0,i.jsx)(T.A,{name:"close"})})}),e.file.url&&(0,i.jsx)(p,{url:e.file.url})]})})]})}ne.defaultProps={supportedViewers:te,showFullName:!0};var ae=a(3110);const oe=require("@mui/material"),ie=require("@mui/material/Button");var le=a.n(ie);const ce=require("@mui/material/Drawer");var se=a.n(ce);const ue=require("@mui/material/ListItemText");var de=a.n(ue);const pe=require("@mui/material/Menu");var me=a.n(pe);const fe=require("@mui/system");var he=function(){return he=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},he.apply(this,arguments)};function ve(e){var r=(0,u.useState)(!1),t=r[0],n=r[1],a=(0,u.useRef)(null),o=(0,s.useTheme)(),l=(0,oe.useMediaQuery)(o.breakpoints.down("md")),c=l?se():me(),d={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(fe.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(de(),{children:(0,i.jsx)(q(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(fe.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}l&&(d=he(he({},d),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var m=e.menuItems.map((function(e){return e.href?(0,i.jsx)(y(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(y(),{onClick:function(r){e.onClick&&e.onClick(r),n(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var f,h,v=l?{}:{anchorEl:a.current};return(0,i.jsxs)(i.Fragment,{children:[(f={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},h=(0,i.jsx)(T.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(le(),he({},f,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(O(),{title:e.ariaLabel,children:(0,i.jsx)(g(),he({},f,{children:e.icon?e.icon:h}))})),(0,i.jsx)(c,he({open:t,onClose:function(){return n(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":he(he({},d),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:m}))]})}var ge=function(){return ge=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ge.apply(this,arguments)},xe=function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};function be(e){for(var r=["Bytes","KB","MB","GB"],t=0;e>=1024&&t<r.length-1;)e/=1024,t++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(r[t])}const je=function(e){var r,t=(0,u.useState)([]),n=t[0],a=t[1],o=(0,u.useState)([]),l=o[0],s=o[1],p=(0,u.useState)({}),m=p[0],f=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)((function(){a([]),s([]),h.current={}}),[e.messageId]);var x=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function b(e,r,t){var n;h.current=ge(ge({},h.current),((n={})[e]=h.current[e]--,n)),function(e,r,t){s((function(r){return xe(xe([],r,!0),["Failed to upload ".concat(e,". ").concat((null==t?void 0:t.message)||"")],!1)})),a((function(e){return e.filter((function(e){return e.id!==r}))}))}(e,r,t)}var j=(0,i.jsx)(c(),{className:"rustic-files rustic-padding-16",children:n.map((function(r,t){return(0,i.jsx)(ne,{file:{name:r.name},showFullName:e.showFullName,children:(0,i.jsxs)(c(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,i.jsx)(L(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(O(),{title:"Delete",children:(0,i.jsx)(g(),{color:"primary",onClick:function(){return function(r,t){var n,o;s([]);var i=r.name;if(h.current=ge(ge({},h.current),((n={})[i]=h.current[i]--,n)),e.onFileUpdate("remove",i),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);x.then((function(r){B().delete(l,ge({},r)).then((function(){return a((function(e){return e.filter((function(e,r){return r!==t}))}))})).catch((function(){return e.onFileUpdate("add",i),s((function(e){return xe(xe([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}))}else r.abortController.abort(),a((function(e){return e.filter((function(e,r){return r!==t}))})),h.current=ge(ge({},h.current),((o={})[i]=h.current[i]++,o))}(r,t)},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"})})})]})},t)}))}),y=(0,i.jsx)(c(),{children:l.map((function(e,r){return(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function w(e,r){return r?(0,H.createPortal)(e,r):e}var F=null===(r=e.uploadOptions)||void 0===r?void 0:r.map((function(r){return{label:r.label,onClick:function(){return function(r){f(r.metadata);var t=document.getElementById(v);t&&(t.accept=r.acceptedFileTypes||e.acceptedFileTypes),t.click()}(r)},startDecorator:r.iconName&&(0,i.jsx)(ae.default,{name:r.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==F?void 0:F.length)?(0,i.jsx)(ve,{ariaLabel:"Upload",icon:(0,i.jsx)(ae.default,{name:"upload_2"}),menuItems:F}):(0,i.jsx)(O(),{title:"Upload",children:(0,i.jsx)(g(),{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(r){s([]);var t=r.target.files&&Array.from(r.target.files),o=n.length+(t?t.length:0);e.maxFileCount&&o>e.maxFileCount&&s((function(r){return xe(xe([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=t&&function(e,r,t){return t?r<=t?e:e.slice(0,t-r):e}(t,o,e.maxFileCount);i&&i.forEach((function(r){!function(r){var t;e.maxFileSize&&r.size>e.maxFileSize?(t=r.name,s((function(r){return xe(xe([],r,!0),["Failed to upload ".concat(t,". You cannot upload files larger than ").concat(e.maxFileSize&&be(e.maxFileSize),".")],!1)}))):function(r){var t=new FormData,n=new AbortController,o=function(e){var r,t,n=e.name,a=h.current[n];if(a){var o=a+1,i=n.lastIndexOf("."),l=n.substring(0,i),c=n.substring(i);n="".concat(l,"(").concat(a,")").concat(c),h.current=ge(ge({},h.current),((r={})[e.name]=o,r))}else h.current=ge(ge({},h.current),((t={})[e.name]=1,t));return n}(r),i=new File([r],o,{type:r.type});if(e.getUploadData||m){var l=e.getUploadData?e.getUploadData(o):{},c=ge(ge({},l),m);Object.keys(c).forEach((function(e){var r=c[e];t.append(e,"object"==typeof r?JSON.stringify(r):r)}))}t.append("file",i);var s=(0,d.v4)(),u={name:o,loadingProgress:0,abortController:n,id:s};function p(e){var r,t;e.total&&(r=e.loaded/e.total*100,t=u.id,a((function(e){var n=e.map((function(e){return e.id===t?ge(ge({},e),{loadingProgress:r}):e}));return n})))}a((function(e){return xe(xe([],e,!0),[u],!1)})),e.onFileUpdate("add",o);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId);!function i(){return x.then((function(l){return B().post(f,t,ge(ge({},l),{onUploadProgress:p,signal:n.signal})).then((function(r){var n,o,i=t.get("file");r.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,r.data.url),r.data.fileId&&(n=r.data,o=u.id,a((function(e){var r=e.findIndex((function(e){return e.id===o}));if(-1!==r){var t=xe([],e,!0);return t[r]=ge(ge({},t[r]),{id:n.fileId}),t}return e})))})).catch((function(n){var l,c,d=t.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,m,f,h;409===(null===(l=n.response)||void 0===l?void 0:l.status)&&e.listFiles?(p=o.lastIndexOf("."),m=o.substring(0,p),f=o.substring(p),h=new RegExp("^".concat(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var r=0,t=0,n=e;t<n.length;t++){var a=n[t];if(h.test(a.name)){var o=a.name.match(h),i=o&&o[1]?parseInt(o[1].slice(1,-1),10):0;r=Math.max(r,i)}}return"".concat(m,"(").concat(r+1,")").concat(f)})):Promise.resolve(o)).then((function(n){e.onFileUpdate("add",n);var o=new File([r],n,{type:r.type});t.set("file",o),a((function(e){return e.map((function(e){return e.id===s?ge(ge({},e),{name:n,loadingProgress:0}):e}))})),i()})).catch((function(){var e;b(r.name,u.id,null===(e=n.response)||void 0===e?void 0:e.data)})):b(r.name,u.id,null===(c=n.response)||void 0===c?void 0:c.data)}))}))}()}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),l.length>0&&w(y,e.errorMessagesContainer),n.length>0&&w(j,e.filePreviewsContainer)]})};var ye=function(){return ye=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ye.apply(this,arguments)},we=function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};function Fe(e){var r=(0,u.useState)({uploaded:[],fileList:[]}),t=r[0],n=r[1],a=(0,u.useState)((0,d.v4)()),o=a[0],l=a[1],p=(0,u.useState)(),f=p[0],h=p[1],v=(0,u.useState)(),g=v[0],x=v[1],b=(0,u.useRef)(null),j=(0,s.useTheme)(),y=t.uploaded.length===t.fileList.length&&t.uploaded.length>0;return(0,u.useEffect)((function(){b.current&&(x(b.current.querySelector(".rustic-error-container")),h(b.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(c(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(j.palette.action.disabled),borderRadius:"".concat(j.shape.borderRadius,"px"),":focus-within":{borderColor:j.palette.secondary.main},background:j.palette.background.paper},children:(0,i.jsx)(U,ye({},e,{send:function(r){y&&(r.id=o,r.format="chatCompletionRequest",r.data=m(r.data.text,t.uploaded.map((function(e){return{url:e.url,name:e.name}})))),e.ws.send(r),l((0,d.v4)()),n({uploaded:[],fileList:[]})},isSendEnabled:y,ref:b,children:(0,i.jsx)(c(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(je,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,r,t){if("add"===e)n((function(e){return ye(ye({},e),{fileList:we(we([],e.fileList,!0),[{name:r}],!1)})}));else if("update"===e){if(!t)return void console.error("URL is required for the 'update' action");n((function(e){var n=e.fileList.findIndex((function(e){return e.name===r})),a=we(we(we([],e.uploaded.slice(0,n),!0),[{name:r,url:t}],!1),e.uploaded.slice(n),!0);return ye(ye({},e),{uploaded:a})}))}else n((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==r})),fileList:e.fileList.filter((function(e){return e.name!==r}))}}))},messageId:o,filePreviewsContainer:f,errorMessagesContainer:g,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions,listFiles:e.listFiles,getUploadHeaders:e.getUploadHeaders})})}))})}Fe.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};const Se=Fe;return o})()));
@@ -1 +1 @@
1
- {"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CA+HlE;kBA/HuB,eAAe;;;;;;;;;eAAf,eAAe"}
1
+ {"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAgIlE;kBAhIuB,eAAe;;;;;;;;;eAAf,eAAe"}
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={9767:(e,r,n)=>{n.d(r,{A:()=>i});var t=n(8732),a=(n(2015),function(){return a=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},r),children:e.name})}},3110:(e,r,n)=>{n.d(r,{default:()=>t});const t=n(9767).A},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},r={};function n(t){var a=r[t];if(void 0!==a)return a.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};n.r(t),n.d(t,{default:()=>te});var a=n(8732);const i=require("@mui/material/Box");var o=n.n(i);const l=require("@mui/material/IconButton");var s=n.n(l);const c=require("@mui/material/LinearProgress");var u=n.n(c);const d=require("@mui/material/Tooltip");var m=n.n(d);const p=require("@mui/material/Typography");var f=n.n(p);const v=require("axios");var h=n.n(v),x=n(2015);const g=require("react-dom"),b=require("uuid"),j=require("@mui/material/Card");var y=n.n(j);const w=require("@mui/material/Modal");var F=n.n(w);const N=require("@mui/material/styles");var C;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(C||(C={}));var P=n(9767);const k=require("@mui/material/TextField");var O=n.n(k);const S=require("@mui/material/useMediaQuery");var q=n.n(S);const I=require("@mui/system/Stack");var D=n.n(I);const T=require("@mui/system/useTheme");var A=n.n(T);const U=require("pdfjs-dist"),M=function(e){var r={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=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,a.jsx)(m(),{title:n.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(s(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(P.A,{name:n.symbol})})})})};var _={pdf:function(e){var r,n=(0,x.useRef)(null),t=(0,x.useState)(1),i=t[0],l=t[1],s=(0,x.useState)(1),c=s[0],u=s[1],d=(0,x.useState)(1),m=d[0],p=d[1],v=(0,x.useState)(!1),h=v[0],g=v[1],b=(0,x.useState)(),j=b[0],w=b[1],F=A()(),N=q()(F.breakpoints.down("sm")),C=q()(F.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var P=(0,x.useState)((function(){return N?.5:C?1:1.5})),k=P[0],S=P[1];return(0,x.useEffect)((function(){U.GlobalWorkerOptions.workerSrc||(U.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(U.version,"/pdf.worker.mjs")),U.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(i).then((function(e){var r=e.getViewport({scale:k}),t=n.current;if(t){var a=t.getContext("2d");if(a){var i=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*i,t.height=r.height*i;var o={canvasContext:a,viewport:r,transform:[i,0,0,i,0,0]};j&&j.cancel();var l=e.render(o);w(l),l.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,i,k]),h?(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(y(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(o(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(M,{action:"zoomOut",onClick:function(){S((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(M,{action:"zoomIn",onClick:function(){S((function(e){return e+.2}))}})]}),(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:n})})}),(0,a.jsxs)(D(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(M,{action:"previousPage",onClick:function(){i>1&&(l(i-1),p(i-1))},isDisabled:1===i}),(0,a.jsx)(f(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(O(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=c&&l(r)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(f(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,a.jsx)(M,{action:"nextPage",onClick:function(){i<c&&(l(i+1),p(i+1))},isDisabled:i===c})]})]})}};function R(e){var r=(0,N.useTheme)(),n=(0,x.useState)(!1),t=n[0],i=n[1];function o(){i(!1)}var l,c,u=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),d=u&&e.supportedViewers?e.supportedViewers[u]:null,p=!!d,v=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=p?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(v).concat(h),b=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(y(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,a.jsx)(f(),{variant:"subtitle2",className:"rustic-file-preview-name",children:b}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,a.jsx)(F(),{open:t,onClose:o,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(m(),{title:"Close",children:(0,a.jsx)(s(),{onClick:o,className:"rustic-close-button",children:(0,a.jsx)(P.A,{name:"close"})})}),e.file.url&&(0,a.jsx)(d,{url:e.file.url})]})})]})}R.defaultProps={supportedViewers:_,showFullName:!0};var z=n(3110);const B=require("@mui/material"),E=require("@mui/material/Button");var L=n.n(E);const $=require("@mui/material/Drawer");var H=n.n($);const V=require("@mui/material/ListItemText");var G=n.n(V);const Q=require("@mui/material/Menu");var W=n.n(Q);const Y=require("@mui/material/MenuItem");var Z=n.n(Y);const J=require("@mui/system");var K=function(){return K=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},K.apply(this,arguments)};function X(e){var r=(0,x.useState)(!1),n=r[0],t=r[1],i=(0,x.useRef)(null),o=(0,N.useTheme)(),l=(0,B.useMediaQuery)(o.breakpoints.down("md")),c=l?H():W(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function d(e){return(0,a.jsxs)(a.Fragment,{children:[e.startDecorator&&(0,a.jsx)(J.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,a.jsx)(G(),{children:(0,a.jsx)(f(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,a.jsx)(J.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}l&&(u=K(K({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map((function(e){return e.href?(0,a.jsx)(Z(),{component:"a",onClick:function(){return t(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,a.jsx)(Z(),{onClick:function(r){e.onClick&&e.onClick(r),t(!1)},disabled:!e.onClick,children:d(e)},e.label)}));var v,h,g=l?{}:{anchorEl:i.current};return(0,a.jsxs)(a.Fragment,{children:[(v={onClick:function(e){e.stopPropagation(),t(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},h=(0,a.jsx)(P.A,{name:"more_vert"}),e.buttonText?(0,a.jsx)(L(),K({},v,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,a.jsx)(m(),{title:e.ariaLabel,children:(0,a.jsx)(s(),K({},v,{children:e.icon?e.icon:h}))})),(0,a.jsx)(c,K({open:n,onClose:function(){return t(!1)}},g,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":K(K({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:p}))]})}var ee=function(){return ee=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ee.apply(this,arguments)},re=function(e,r,n){if(n||2===arguments.length)for(var t,a=0,i=r.length;a<i;a++)!t&&a in r||(t||(t=Array.prototype.slice.call(r,0,a)),t[a]=r[a]);return e.concat(t||Array.prototype.slice.call(r))};function ne(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}const te=function(e){var r,n=(0,x.useState)([]),t=n[0],i=n[1],l=(0,x.useState)([]),c=l[0],d=l[1],p=(0,x.useState)({}),v=p[0],j=p[1],y=(0,x.useRef)({}),w=(0,b.v4)();function F(e,r,n){var t;y.current=ee(ee({},y.current),((t={})[e]=y.current[e]--,t)),function(e,r,n){d((function(r){return re(re([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),i((function(e){return e.filter((function(e){return e.id!==r}))}))}(e,r,n)}(0,x.useEffect)((function(){i([]),d([]),y.current={}}),[e.messageId]);var N=(0,a.jsx)(o(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,n){return(0,a.jsx)(R,{file:{name:r.name},showFullName:e.showFullName,children:(0,a.jsxs)(o(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,a.jsx)(u(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,a.jsx)(m(),{title:"Delete",children:(0,a.jsx)(s(),{color:"primary",onClick:function(){return function(r,n){var t,a;d([]);var o=r.name;if(y.current=ee(ee({},y.current),((t={})[o]=y.current[o]--,t)),e.onFileUpdate("remove",o),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);h().delete(l).then((function(){return i((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",o),d((function(e){return re(re([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else r.abortController.abort(),i((function(e){return e.filter((function(e,r){return r!==n}))})),y.current=ee(ee({},y.current),((a={})[o]=y.current[o]++,a))}(r,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)}))}),C=(0,a.jsx)(o(),{children:c.map((function(e,r){return(0,a.jsx)(f(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function P(e,r){return r?(0,g.createPortal)(e,r):e}var k=null===(r=e.uploadOptions)||void 0===r?void 0:r.map((function(r){return{label:r.label,onClick:function(){return function(r){j(r.metadata);var n=document.getElementById(w);n&&(n.accept=r.acceptedFileTypes||e.acceptedFileTypes),n.click()}(r)},startDecorator:r.iconName&&(0,a.jsx)(z.default,{name:r.iconName})}}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o(),{className:"rustic-uploader",children:[(0,a.jsx)("label",{htmlFor:w,children:(null==k?void 0:k.length)?(0,a.jsx)(X,{ariaLabel:"Upload",icon:(0,a.jsx)(z.default,{name:"upload_2"}),menuItems:k}):(0,a.jsx)(m(),{title:"Upload",children:(0,a.jsx)(s(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,a.jsx)("input",{type:"file",id:w,onChange:function(r){d([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return re(re([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,d((function(r){return re(re([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&ne(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,a=y.current[t];if(a){var i=a+1,o=t.lastIndexOf("."),l=t.substring(0,o),s=t.substring(o);t="".concat(l,"(").concat(a,")").concat(s),y.current=ee(ee({},y.current),((r={})[e.name]=i,r))}else y.current=ee(ee({},y.current),((n={})[e.name]=1,n));return t}(r),o=new File([r],a,{type:r.type});if(e.getUploadData||v){var l=e.getUploadData?e.getUploadData(a):{},s=ee(ee({},l),v);Object.keys(s).forEach((function(e){var r=s[e];n.append(e,"object"==typeof r?JSON.stringify(r):r)}))}n.append("file",o);var c=(0,b.v4)(),u={name:a,loadingProgress:0,abortController:t,id:c};function d(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=u.id,i((function(e){var t=e.map((function(e){return e.id===n?ee(ee({},e),{loadingProgress:r}):e}));return t})))}i((function(e){return re(re([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function o(){return h().post(m,n,{onUploadProgress:d,signal:t.signal}).then((function(r){var t,a,o=n.get("file");r.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,r.data.url),r.data.fileId&&(t=r.data,a=u.id,i((function(e){var r=e.findIndex((function(e){return e.id===a}));if(-1!==r){var n=re([],e,!0);return n[r]=ee(ee({},n[r]),{id:t.fileId}),n}return e})))})).catch((function(t){var l,s,d=n.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var m,p,f,v;409===(null===(l=t.response)||void 0===l?void 0:l.status)&&e.listFiles?(m=a.lastIndexOf("."),p=a.substring(0,m),f=a.substring(m),v=new RegExp("^".concat(p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var r=0,n=0,t=e;n<t.length;n++){var a=t[n];if(v.test(a.name)){var i=a.name.match(v),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;r=Math.max(r,o)}}return"".concat(p,"(").concat(r+1,")").concat(f)})):Promise.resolve(a)).then((function(t){e.onFileUpdate("add",t);var a=new File([r],t,{type:r.type});n.set("file",a),i((function(e){return e.map((function(e){return e.id===c?ee(ee({},e),{name:t,loadingProgress:0}):e}))})),o()})).catch((function(){var e;F(r.name,u.id,null===(e=t.response)||void 0===e?void 0:e.data)})):F(r.name,u.id,null===(s=t.response)||void 0===s?void 0:s.data)}))}()}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&P(C,e.errorMessagesContainer),t.length>0&&P(N,e.filePreviewsContainer)]})};return t})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={9767:(e,r,n)=>{n.d(r,{A:()=>o});var t=n(8732),a=(n(2015),function(){return a=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},a.apply(this,arguments)});function o(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},r),children:e.name})}},3110:(e,r,n)=>{n.d(r,{default:()=>t});const t=n(9767).A},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},r={};function n(t){var a=r[t];if(void 0!==a)return a.exports;var o=r[t]={exports:{}};return e[t](o,o.exports,n),o.exports}n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};n.r(t),n.d(t,{default:()=>te});var a=n(8732);const o=require("@mui/material/Box");var i=n.n(o);const l=require("@mui/material/IconButton");var s=n.n(l);const c=require("@mui/material/LinearProgress");var u=n.n(c);const d=require("@mui/material/Tooltip");var m=n.n(d);const p=require("@mui/material/Typography");var f=n.n(p);const v=require("axios");var h=n.n(v),x=n(2015);const g=require("react-dom"),b=require("uuid"),j=require("@mui/material/Card");var y=n.n(j);const w=require("@mui/material/Modal");var F=n.n(w);const N=require("@mui/material/styles");var C;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(C||(C={}));var P=n(9767);const k=require("@mui/material/TextField");var O=n.n(k);const S=require("@mui/material/useMediaQuery");var q=n.n(S);const I=require("@mui/system/Stack");var D=n.n(I);const T=require("@mui/system/useTheme");var A=n.n(T);const U=require("pdfjs-dist"),M=function(e){var r={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=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,a.jsx)(m(),{title:n.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(s(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(P.A,{name:n.symbol})})})})};var _={pdf:function(e){var r,n=(0,x.useRef)(null),t=(0,x.useState)(1),o=t[0],l=t[1],s=(0,x.useState)(1),c=s[0],u=s[1],d=(0,x.useState)(1),m=d[0],p=d[1],v=(0,x.useState)(!1),h=v[0],g=v[1],b=(0,x.useState)(),j=b[0],w=b[1],F=A()(),N=q()(F.breakpoints.down("sm")),C=q()(F.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var P=(0,x.useState)((function(){return N?.5:C?1:1.5})),k=P[0],S=P[1];return(0,x.useEffect)((function(){U.GlobalWorkerOptions.workerSrc||(U.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(U.version,"/pdf.worker.mjs")),U.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(o).then((function(e){var r=e.getViewport({scale:k}),t=n.current;if(t){var a=t.getContext("2d");if(a){var o=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*o,t.height=r.height*o;var i={canvasContext:a,viewport:r,transform:[o,0,0,o,0,0]};j&&j.cancel();var l=e.render(i);w(l),l.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,o,k]),h?(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(y(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(i(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(M,{action:"zoomOut",onClick:function(){S((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(M,{action:"zoomIn",onClick:function(){S((function(e){return e+.2}))}})]}),(0,a.jsx)(i(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(i(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:n})})}),(0,a.jsxs)(D(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(M,{action:"previousPage",onClick:function(){o>1&&(l(o-1),p(o-1))},isDisabled:1===o}),(0,a.jsx)(f(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(O(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=c&&l(r)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(f(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,a.jsx)(M,{action:"nextPage",onClick:function(){o<c&&(l(o+1),p(o+1))},isDisabled:o===c})]})]})}};function R(e){var r=(0,N.useTheme)(),n=(0,x.useState)(!1),t=n[0],o=n[1];function i(){o(!1)}var l,c,u=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),d=u&&e.supportedViewers?e.supportedViewers[u]:null,p=!!d,v=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=p?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(v).concat(h),b=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(y(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){o(!0)},children:[(0,a.jsx)(f(),{variant:"subtitle2",className:"rustic-file-preview-name",children:b}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,a.jsx)(F(),{open:t,onClose:i,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(m(),{title:"Close",children:(0,a.jsx)(s(),{onClick:i,className:"rustic-close-button",children:(0,a.jsx)(P.A,{name:"close"})})}),e.file.url&&(0,a.jsx)(d,{url:e.file.url})]})})]})}R.defaultProps={supportedViewers:_,showFullName:!0};var z=n(3110);const B=require("@mui/material"),E=require("@mui/material/Button");var L=n.n(E);const H=require("@mui/material/Drawer");var $=n.n(H);const V=require("@mui/material/ListItemText");var G=n.n(V);const Q=require("@mui/material/Menu");var W=n.n(Q);const Y=require("@mui/material/MenuItem");var Z=n.n(Y);const J=require("@mui/system");var K=function(){return K=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},K.apply(this,arguments)};function X(e){var r=(0,x.useState)(!1),n=r[0],t=r[1],o=(0,x.useRef)(null),i=(0,N.useTheme)(),l=(0,B.useMediaQuery)(i.breakpoints.down("md")),c=l?$():W(),u={borderRadius:"".concat(i.shape.borderRadius,"px"),border:"1px solid ".concat(i.palette.divider)};function d(e){return(0,a.jsxs)(a.Fragment,{children:[e.startDecorator&&(0,a.jsx)(J.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,a.jsx)(G(),{children:(0,a.jsx)(f(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,a.jsx)(J.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}l&&(u=K(K({},u),{borderRadius:"".concat(i.shape.borderRadius,"px ").concat(i.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map((function(e){return e.href?(0,a.jsx)(Z(),{component:"a",onClick:function(){return t(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,a.jsx)(Z(),{onClick:function(r){e.onClick&&e.onClick(r),t(!1)},disabled:!e.onClick,children:d(e)},e.label)}));var v,h,g=l?{}:{anchorEl:o.current};return(0,a.jsxs)(a.Fragment,{children:[(v={onClick:function(e){e.stopPropagation(),t(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},h=(0,a.jsx)(P.A,{name:"more_vert"}),e.buttonText?(0,a.jsx)(L(),K({},v,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,a.jsx)(m(),{title:e.ariaLabel,children:(0,a.jsx)(s(),K({},v,{children:e.icon?e.icon:h}))})),(0,a.jsx)(c,K({open:n,onClose:function(){return t(!1)}},g,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":K(K({},u),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:p}))]})}var ee=function(){return ee=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ee.apply(this,arguments)},re=function(e,r,n){if(n||2===arguments.length)for(var t,a=0,o=r.length;a<o;a++)!t&&a in r||(t||(t=Array.prototype.slice.call(r,0,a)),t[a]=r[a]);return e.concat(t||Array.prototype.slice.call(r))};function ne(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}const te=function(e){var r,n=(0,x.useState)([]),t=n[0],o=n[1],l=(0,x.useState)([]),c=l[0],d=l[1],p=(0,x.useState)({}),v=p[0],j=p[1],y=(0,x.useRef)({}),w=(0,b.v4)();(0,x.useEffect)((function(){o([]),d([]),y.current={}}),[e.messageId]);var F=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function N(e,r,n){var t;y.current=ee(ee({},y.current),((t={})[e]=y.current[e]--,t)),function(e,r,n){d((function(r){return re(re([],r,!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!==r}))}))}(e,r,n)}var C=(0,a.jsx)(i(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,n){return(0,a.jsx)(R,{file:{name:r.name},showFullName:e.showFullName,children:(0,a.jsxs)(i(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,a.jsx)(u(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,a.jsx)(m(),{title:"Delete",children:(0,a.jsx)(s(),{color:"primary",onClick:function(){return function(r,n){var t,a;d([]);var i=r.name;if(y.current=ee(ee({},y.current),((t={})[i]=y.current[i]--,t)),e.onFileUpdate("remove",i),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);F.then((function(r){h().delete(l,ee({},r)).then((function(){return o((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",i),d((function(e){return re(re([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}))}else r.abortController.abort(),o((function(e){return e.filter((function(e,r){return r!==n}))})),y.current=ee(ee({},y.current),((a={})[i]=y.current[i]++,a))}(r,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)}))}),P=(0,a.jsx)(i(),{children:c.map((function(e,r){return(0,a.jsx)(f(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function k(e,r){return r?(0,g.createPortal)(e,r):e}var O=null===(r=e.uploadOptions)||void 0===r?void 0:r.map((function(r){return{label:r.label,onClick:function(){return function(r){j(r.metadata);var n=document.getElementById(w);n&&(n.accept=r.acceptedFileTypes||e.acceptedFileTypes),n.click()}(r)},startDecorator:r.iconName&&(0,a.jsx)(z.default,{name:r.iconName})}}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(i(),{className:"rustic-uploader",children:[(0,a.jsx)("label",{htmlFor:w,children:(null==O?void 0:O.length)?(0,a.jsx)(X,{ariaLabel:"Upload",icon:(0,a.jsx)(z.default,{name:"upload_2"}),menuItems:O}):(0,a.jsx)(m(),{title:"Upload",children:(0,a.jsx)(s(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,a.jsx)("input",{type:"file",id:w,onChange:function(r){d([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return re(re([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,a,e.maxFileCount);i&&i.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,d((function(r){return re(re([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&ne(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,a=y.current[t];if(a){var o=a+1,i=t.lastIndexOf("."),l=t.substring(0,i),s=t.substring(i);t="".concat(l,"(").concat(a,")").concat(s),y.current=ee(ee({},y.current),((r={})[e.name]=o,r))}else y.current=ee(ee({},y.current),((n={})[e.name]=1,n));return t}(r),i=new File([r],a,{type:r.type});if(e.getUploadData||v){var l=e.getUploadData?e.getUploadData(a):{},s=ee(ee({},l),v);Object.keys(s).forEach((function(e){var r=s[e];n.append(e,"object"==typeof r?JSON.stringify(r):r)}))}n.append("file",i);var c=(0,b.v4)(),u={name:a,loadingProgress:0,abortController:t,id:c};function d(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=u.id,o((function(e){var t=e.map((function(e){return e.id===n?ee(ee({},e),{loadingProgress:r}):e}));return t})))}o((function(e){return re(re([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function i(){return F.then((function(l){return h().post(m,n,ee(ee({},l),{onUploadProgress:d,signal:t.signal})).then((function(r){var t,a,i=n.get("file");r.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,r.data.url),r.data.fileId&&(t=r.data,a=u.id,o((function(e){var r=e.findIndex((function(e){return e.id===a}));if(-1!==r){var n=re([],e,!0);return n[r]=ee(ee({},n[r]),{id:t.fileId}),n}return e})))})).catch((function(t){var l,s,d=n.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var m,p,f,v;409===(null===(l=t.response)||void 0===l?void 0:l.status)&&e.listFiles?(m=a.lastIndexOf("."),p=a.substring(0,m),f=a.substring(m),v=new RegExp("^".concat(p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var r=0,n=0,t=e;n<t.length;n++){var a=t[n];if(v.test(a.name)){var o=a.name.match(v),i=o&&o[1]?parseInt(o[1].slice(1,-1),10):0;r=Math.max(r,i)}}return"".concat(p,"(").concat(r+1,")").concat(f)})):Promise.resolve(a)).then((function(t){e.onFileUpdate("add",t);var a=new File([r],t,{type:r.type});n.set("file",a),o((function(e){return e.map((function(e){return e.id===c?ee(ee({},e),{name:t,loadingProgress:0}):e}))})),i()})).catch((function(){var e;N(r.name,u.id,null===(e=t.response)||void 0===e?void 0:e.data)})):N(r.name,u.id,null===(s=t.response)||void 0===s?void 0:s.data)}))}))}()}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&k(P,e.errorMessagesContainer),t.length>0&&k(C,e.filePreviewsContainer)]})};return t})()));
@@ -1 +1 @@
1
- {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/uploader/uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAgBvB,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,gBAAgB,CAAA;AAWjE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,EAAE,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,EAAE,GAAG,SAAS,CAUpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAobrC;AACD,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/uploader/uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAgBvB,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,gBAAgB,CAAA;AAWjE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,EAAE,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,EAAE,GAAG,SAAS,CAUpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAicrC;AACD,eAAe,QAAQ,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={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const n=require("react/jsx-runtime"),r=require("@mui/material/Chip");var s=e.n(r);const o=require("@mui/system/Box");var a=e.n(o);const i=require("react");var c=e.n(i);const u=require("@mui/material/Typography");var l=e.n(u),d=function(){return d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},d.apply(this,arguments)};const m=function(e){var t=e.messages[0],r=e.messages.slice(1),s=e.supportedElements[t.format];return(0,n.jsx)(n.Fragment,{children:s?c().createElement(s,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,n.jsxs)(l(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},f.apply(this,arguments)};function p(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:f({},t),children:e.name})}const v=require("@mui/material"),g=require("@mui/material/Card");var y=e.n(g);const h=require("@mui/material/Stack");var j,b=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(j||(j={}));const w=function(e){return(0,n.jsx)(l(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),s=navigator.language,o={month:"short",day:"numeric"},a=new Date,i=r.getFullYear()!==a.getFullYear(),c=i?" at ":", ",i&&(o.year="numeric"),r.toLocaleDateString(s,o)+c+r.toLocaleTimeString(s,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,s,o,a,i,c},x=(0,i.forwardRef)((function(e,t){var r=(0,v.useTheme)(),s=e.inReplyTo?e.inReplyTo:e.message;return(0,n.jsxs)(b(),{id:s.id,className:"rustic-message-canvas",ref:t,children:[(0,n.jsxs)(b(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(s),(0,n.jsx)(w,{timestamp:s.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,n.jsx)(y(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(s)}),(0,n.jsxs)(y(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,n.jsxs)(l(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,n.jsx)(w,{timestamp:e.message.timestamp})]})]})]})}));var O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},O.apply(this,arguments)},E=function(e,t,n){if(n||2===arguments.length)for(var r,s=0,o=t.length;s<o;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))};function R(e,t){var n;if(!(n=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var r=O({},e),s=(r[n]||[])[0];return t.format.includes("update")&&s&&s.sender.id!==t.sender.id&&(n=t.id),r[n]||(r[n]=[]),t.format.includes("Response")&&s?r[n]=[O(O({},s),{data:O(O({},s.data),t.data)}),t]:r[n]=E(E([],r[n],!0),[t],!1),r}function T(e){var t,r,o,c=(0,i.useRef)(null),u=(0,i.useRef)(null),l=(0,i.useRef)(),d=(0,i.useState)(!0),f=d[0],v=d[1],g=(0,i.useState)(!0),y=g[0],h=g[1],j=(0,i.useState)(!1),b=j[0],w=j[1],E=(0,i.useState)({}),T=E[0],S=E[1],C=Object.keys(T).length,N=(r=C,o=(0,i.useRef)(0),(0,i.useEffect)((function(){o.current=r})),o.current);function A(){h(!0),l.current&&clearTimeout(l.current),l.current=setTimeout((function(){h(!1)}),2e3)}function P(){var e=u.current,t=c.current;if(e&&t){var n=e.getBoundingClientRect().bottom,r=t.getBoundingClientRect().bottom;v(r-1<=n)}}function q(){if(function(){var e,t=null===(e=u.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=u.current;w(!0),e&&setTimeout((function(){A(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(q,1)}function D(e){S((function(t){return R(t,e)}))}return(0,i.useEffect)((function(){var e=u.current;if(P(),e)return e.addEventListener("scroll",P),window.addEventListener("resize",P),function(){e.removeEventListener("scroll",P),window.removeEventListener("resize",P)}}),[f]),(0,i.useEffect)((function(){q()}),[b]),(0,i.useEffect)((function(){f&&0!==N&&C>N&&(A(),q())}),[f,Object.keys(T).length]),(0,i.useEffect)((function(){var t,n={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=R(n,e);n=t})),S(n)}),[null===(t=e.receivedMessages)||void 0===t?void 0:t.length]),(0,i.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(D)}),[]),(0,n.jsxs)(a(),{className:"rustic-message-space",children:[(0,n.jsxs)(a(),{ref:u,className:"rustic-message-container",children:[Object.keys(T).map((function(t,r){var s,o=T[t],a=o[o.length-1],i=a.format.includes("Response"),u=i&&{inReplyTo:o[0]};return"prompts"!==a.format?(0,n.jsx)(x,O({message:a},u,{getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[o[0]]:o,supportedElements:e.supportedElements})}),t):"inConversation"===(null===(s=a.data)||void 0===s?void 0:s.position)?(0,n.jsx)("div",{ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[o[0]]:o,supportedElements:e.supportedElements})},t):void 0})),!f&&!y&&(0,n.jsx)(s(),{variant:"rusticSecondary",className:"rustic-scroll-down-button",size:"medium",onClick:q,label:(0,n.jsxs)(n.Fragment,{children:[e.scrollDownLabel,(0,n.jsx)(p,{name:"arrow_downward"})]})})]}),function(t){var r,s=Object.values(t).flat(),o=s[s.length-1];return"prompts"===(null==o?void 0:o.format)&&"inConversation"!==(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.position)?(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:[o],supportedElements:e.supportedElements}):null}(T)]})}T.defaultProps={scrollDownLabel:"Scroll down"};const S=T;return t})()));
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={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const n=require("react/jsx-runtime"),r=require("@mui/material/Chip");var o=e.n(r);const s=require("@mui/system/Box");var a=e.n(s);const i=require("react");var c=e.n(i);const l=require("@mui/material/Typography");var u=e.n(l),d=function(){return d=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},d.apply(this,arguments)};const m=function(e){var t=e.messages[0],r=e.messages.slice(1),o=e.supportedElements[t.format];return(0,n.jsx)(n.Fragment,{children:o?c().createElement(o,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,n.jsxs)(u(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var f=function(){return f=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},f.apply(this,arguments)};function p(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:f({},t),children:e.name})}const v=require("@mui/material"),g=require("@mui/material/Card");var y=e.n(g);const h=require("@mui/material/Stack");var j,b=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(j||(j={}));const w=function(e){return(0,n.jsx)(u(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),o=navigator.language,s={month:"short",day:"numeric"},a=new Date,i=r.getFullYear()!==a.getFullYear(),c=i?" at ":", ",i&&(s.year="numeric"),r.toLocaleDateString(o,s)+c+r.toLocaleTimeString(o,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,o,s,a,i,c},x=(0,i.forwardRef)((function(e,t){var r=(0,v.useTheme)(),o=e.inReplyTo?e.inReplyTo:e.message;return(0,n.jsxs)(b(),{id:o.id,className:"rustic-message-canvas",ref:t,children:[(0,n.jsxs)(b(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(o),(0,n.jsx)(w,{timestamp:o.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,n.jsx)(y(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(o)}),(0,n.jsxs)(y(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,n.jsxs)(u(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,n.jsx)(w,{timestamp:e.message.timestamp})]})]})]})}));var O=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)},E=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,s=t.length;o<s;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 R(e,t){var n;if(!(n=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var r=O({},e),o=(r[n]||[])[0];return t.format.includes("update")&&o&&o.sender.id!==t.sender.id&&(n=t.id),r[n]||(r[n]=[]),t.format.includes("Response")&&o?r[n]=[O(O({},o),{data:O(O({},o.data),t.data)}),t]:r[n]=E(E([],r[n],!0),[t],!1),r}function T(e){var t,r,s,c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useRef)(),d=(0,i.useState)(!0),f=d[0],v=d[1],g=(0,i.useState)(!0),y=g[0],h=g[1],j=(0,i.useState)(!1),b=j[0],w=j[1],E=(0,i.useState)({}),T=E[0],S=E[1],C=Object.keys(T).length,N=(r=C,s=(0,i.useRef)(0),(0,i.useEffect)((function(){s.current=r})),s.current);function A(){h(!0),u.current&&clearTimeout(u.current),u.current=setTimeout((function(){h(!1)}),2e3)}function P(){var e=l.current,t=c.current;if(e&&t){var n=e.getBoundingClientRect().bottom,r=t.getBoundingClientRect().bottom;v(r-1<=n)}}function q(){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;w(!0),e&&setTimeout((function(){A(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(q,1)}function D(e){S((function(t){return R(t,e)}))}return(0,i.useEffect)((function(){var e=l.current;if(P(),e)return e.addEventListener("scroll",P),window.addEventListener("resize",P),function(){e.removeEventListener("scroll",P),window.removeEventListener("resize",P)}}),[f]),(0,i.useEffect)((function(){q()}),[b]),(0,i.useEffect)((function(){f&&0!==N&&C>N&&(A(),q())}),[f,Object.keys(T).length]),(0,i.useEffect)((function(){var t,n={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=R(n,e);n=t})),S(n)}),[null===(t=e.receivedMessages)||void 0===t?void 0:t.length]),(0,i.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(D)}),[]),(0,n.jsxs)(a(),{className:"rustic-message-space",children:[(0,n.jsxs)(a(),{ref:l,className:"rustic-message-container",children:[Object.keys(T).map((function(t,r){var o,s=T[t],a=s[s.length-1],i=a.format.includes("Response"),l=i&&{inReplyTo:s[0]};return"prompts"!==a.format?(0,n.jsx)(x,O({message:a},l,{getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[s[0]]:s,supportedElements:e.supportedElements})}),t):"inConversation"===(null===(o=a.data)||void 0===o?void 0:o.position)?(0,n.jsx)("div",{ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[s[0]]:s,supportedElements:e.supportedElements})},t):void 0})),!f&&!y&&(0,n.jsx)(o(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:q,label:(0,n.jsxs)(n.Fragment,{children:[e.scrollDownLabel,(0,n.jsx)(p,{name:"arrow_downward"})]})})]}),function(t){var r,o=Object.values(t).flat(),s=o[o.length-1];return"prompts"===(null==s?void 0:s.format)&&"inConversation"!==(null===(r=null==s?void 0:s.data)||void 0===r?void 0:r.position)?(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:[s],supportedElements:e.supportedElements}):null}(T)]})}T.defaultProps={scrollDownLabel:"Scroll down"};const S=T;return t})()));
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{default:()=>A});const t=require("react/jsx-runtime"),n=require("@mui/material/Button");var i=e.n(n);const a=require("@mui/material/Card");var s=e.n(a);const o=require("@mui/material/CircularProgress");var l=e.n(o);const c=require("@mui/material/Dialog");var u=e.n(c);const d=require("@mui/material/DialogActions");var m=e.n(d);const p=require("@mui/material/DialogContent");var f=e.n(p);const g=require("@mui/material/DialogContentText");var h=e.n(g);const v=require("@mui/material/DialogTitle");var b=e.n(v);const x=require("@mui/material/Divider");var y=e.n(x);const j=require("@mui/material/Typography");var q=e.n(j);const S=require("@mui/system"),w=require("react");var C=e.n(w),N=function(){return N=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},N.apply(this,arguments)};const O=function(e){var r=e.messages[0],n=e.messages.slice(1),i=e.supportedElements[r.format];return(0,t.jsx)(t.Fragment,{children:i?C().createElement(i,N(N({sender:e.sender,ws:e.ws,messageId:r.id,conversationId:r.conversationId},r.data),n.length>0&&{updatedData:n.map((function(e){return e.data}))})):(0,t.jsxs)(q(),{variant:"body2",children:["Unsupported element format: ",r.format]})})};var P=function(){return P=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},P.apply(this,arguments)};function B(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:P({},r),children:e.name})}var I=function(){return I=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},I.apply(this,arguments)},D=function(e,r,t){if(t||2===arguments.length)for(var n,i=0,a=r.length;i<a;i++)!n&&i in r||(n||(n=Array.prototype.slice.call(r,0,i)),n[i]=r[i]);return e.concat(n||Array.prototype.slice.call(r))};const A=function(e){var r=(0,w.useState)(!1),n=r[0],a=r[1],o=(0,w.useState)(!1),c=o[0],d=o[1],p=(0,w.useState)(!1),g=p[0],v=p[1],x=(0,w.useState)(!1),j=x[0],C=x[1],N=(0,w.useState)([]),P=N[0],A=N[1],E=(0,w.useState)(null),T=E[0],_=E[1],k=(0,S.useTheme)(),M=P[P.length-1],Q=I(I({},e.ws),{send:function(e){_(e)}});function F(e){A((function(r){return D(D([],r,!0),[e],!1)}))}function R(){if(T){var r=I(I({},T),{threadId:e.messageId});e.ws.send(r)}}if((0,w.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(F)}),[e.ws]),(0,w.useEffect)((function(){P.length>0&&(M&&M.sender.id!==e.sender.id&&d(!1),"promptBuilder"===M.format&&M.data.isLastQuestion&&a(!0))}),[P.length]),0!==P.length)return(0,t.jsxs)(s(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,t.jsxs)(u(),{open:g,onClose:function(){return v(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(k.palette.divider)}},children:[(0,t.jsx)(b(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,t.jsx)(y(),{}),(0,t.jsx)(f(),{children:(0,t.jsx)(h(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,t.jsxs)(m(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,t.jsx)(i(),{variant:"rusticSecondary",startIcon:(0,t.jsx)(B,{name:"close"}),onClick:function(){v(!1),e.onCancel()},children:"Quit"}),(0,t.jsx)(i(),{variant:"rusticPrimary",onClick:function(){return v(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(P[0]):(0,t.jsx)(q(),{color:"text.secondary",children:"Prompt Builder"}),(0,t.jsx)(y(),{className:"rustic-prompt-builder-divider"}),(0,t.jsxs)(S.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!j&&P.length>0)return P.map((function(r){if(r.sender.id!==e.sender.id&&"promptBuilder"!==r.format)return(0,t.jsx)(O,{ws:Q,sender:e.sender,messages:[r],supportedElements:e.supportedElements},r.id)}))}(),c&&(0,t.jsx)(l(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,t.jsx)(t.Fragment,{children:!j&&(0,t.jsxs)(S.Box,{className:"rustic-prompt-builder-buttons",children:[(0,t.jsxs)(S.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,t.jsx)(i(),{variant:"rusticSecondary",startIcon:(0,t.jsx)(B,{name:"close"}),onClick:function(){return v(!0)},children:"Quit"}),(0,t.jsx)(i(),{variant:"rusticSecondary",endIcon:(0,t.jsx)(B,{name:"chevron_right"}),onClick:function(){R(),_(null),d(!0)},disabled:!T,"aria-disabled":!T,children:"Next question"})]}),n&&(0,t.jsx)(S.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,t.jsx)(i(),{variant:"rusticPrimary",onClick:function(){R(),C(!0),d(!0),e.onSubmit()},disabled:c,"aria-disabled":c,children:"Generate"})})]})})]})};return r})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{default:()=>A});const t=require("react/jsx-runtime"),n=require("@mui/material/Button");var i=e.n(n);const o=require("@mui/material/Card");var a=e.n(o);const s=require("@mui/material/CircularProgress");var l=e.n(s);const c=require("@mui/material/Dialog");var u=e.n(c);const d=require("@mui/material/DialogActions");var m=e.n(d);const p=require("@mui/material/DialogContent");var f=e.n(p);const g=require("@mui/material/DialogContentText");var h=e.n(g);const v=require("@mui/material/DialogTitle");var b=e.n(v);const x=require("@mui/material/Divider");var y=e.n(x);const j=require("@mui/material/Typography");var q=e.n(j);const w=require("@mui/system"),C=require("react");var N=e.n(C),O=function(){return O=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},O.apply(this,arguments)};const S=function(e){var r=e.messages[0],n=e.messages.slice(1),i=e.supportedElements[r.format];return(0,t.jsx)(t.Fragment,{children:i?N().createElement(i,O(O({sender:e.sender,ws:e.ws,messageId:r.id,conversationId:r.conversationId},r.data),n.length>0&&{updatedData:n.map((function(e){return e.data}))})):(0,t.jsxs)(q(),{variant:"body2",children:["Unsupported element format: ",r.format]})})};var P=function(){return P=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},P.apply(this,arguments)};function B(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:P({},r),children:e.name})}var I=function(){return I=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},I.apply(this,arguments)},D=function(e,r,t){if(t||2===arguments.length)for(var n,i=0,o=r.length;i<o;i++)!n&&i in r||(n||(n=Array.prototype.slice.call(r,0,i)),n[i]=r[i]);return e.concat(n||Array.prototype.slice.call(r))};const A=function(e){var r=(0,C.useState)(!1),n=r[0],o=r[1],s=(0,C.useState)(!1),c=s[0],d=s[1],p=(0,C.useState)(!1),g=p[0],v=p[1],x=(0,C.useState)(!1),j=x[0],N=x[1],O=(0,C.useState)([]),P=O[0],A=O[1],E=(0,C.useState)(null),T=E[0],_=E[1],k=(0,w.useTheme)(),M=P[P.length-1],Q=I(I({},e.ws),{send:function(e){_(e)}});function F(e){A((function(r){return D(D([],r,!0),[e],!1)}))}function R(){if(T){var r=I(I({},T),{threadId:e.messageId});e.ws.send(r)}}if((0,C.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(F)}),[e.ws]),(0,C.useEffect)((function(){P.length>0&&(M&&M.sender.id!==e.sender.id&&d(!1),"promptBuilder"===M.format&&M.data.isLastQuestion&&o(!0))}),[P.length]),0!==P.length)return(0,t.jsxs)(a(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,t.jsxs)(u(),{open:g,onClose:function(){return v(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(k.palette.divider)}},children:[(0,t.jsx)(b(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,t.jsx)(y(),{}),(0,t.jsx)(f(),{children:(0,t.jsx)(h(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,t.jsxs)(m(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,t.jsx)(i(),{variant:"outlined",color:"secondary",startIcon:(0,t.jsx)(B,{name:"close"}),onClick:function(){v(!1),e.onCancel()},children:"Quit"}),(0,t.jsx)(i(),{variant:"contained",color:"primary",onClick:function(){return v(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(P[0]):(0,t.jsx)(q(),{color:"text.secondary",children:"Prompt Builder"}),(0,t.jsx)(y(),{className:"rustic-prompt-builder-divider"}),(0,t.jsxs)(w.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!j&&P.length>0)return P.map((function(r){if(r.sender.id!==e.sender.id&&"promptBuilder"!==r.format)return(0,t.jsx)(S,{ws:Q,sender:e.sender,messages:[r],supportedElements:e.supportedElements},r.id)}))}(),c&&(0,t.jsx)(l(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,t.jsx)(t.Fragment,{children:!j&&(0,t.jsxs)(w.Box,{className:"rustic-prompt-builder-buttons",children:[(0,t.jsxs)(w.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,t.jsx)(i(),{variant:"outlined",color:"secondary",startIcon:(0,t.jsx)(B,{name:"close"}),onClick:function(){return v(!0)},children:"Quit"}),(0,t.jsx)(i(),{variant:"outlined",color:"secondary",endIcon:(0,t.jsx)(B,{name:"chevron_right"}),onClick:function(){R(),_(null),d(!0)},disabled:!T,"aria-disabled":!T,children:"Next question"})]}),n&&(0,t.jsx)(w.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,t.jsx)(i(),{variant:"contained",color:"primary",onClick:function(){R(),N(!0),d(!0),e.onSubmit()},disabled:c,"aria-disabled":c,children:"Generate"})})]})})]})};return r})()));
@@ -1 +1 @@
1
- {"version":3,"file":"promptBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/promptBuilder/promptBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,iBAAiB,CAAA;AAiBxB,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,uDAqP9D"}
1
+ {"version":3,"file":"promptBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/promptBuilder/promptBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,iBAAiB,CAAA;AAiBxB,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,uDA0P9D"}
@@ -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={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>s});const r=require("react/jsx-runtime"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var i=e.n(a);require("react");const u=require("uuid"),s=function(e){var t=e.prompts.map((function(t,o){return(0,r.jsx)(i(),{onClick:function(){return r=t,o=(new Date).toISOString(),n={id:(0,u.v4)(),timestamp:o,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:r}},void e.ws.send(n);var r,o,n},variant:"rusticSecondary",size:"small",className:"rustic-prompt",label:t},o)}));return(0,r.jsx)(n(),{className:e.className,children:t})};return t})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var o in t)e.o(t,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:t[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{default:()=>p});const t=require("react/jsx-runtime"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var i=e.n(a);const s=require("@mui/system/useTheme");var u=e.n(s);require("react");const c=require("uuid");var l=function(){return l=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},l.apply(this,arguments)};const p=function(e){var r=u()(),o=e.prompts.map((function(o,n){return(0,t.jsx)(i(),{onClick:function(){return r=o,t=(new Date).toISOString(),n={id:(0,c.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:r}},void e.ws.send(n);var r,t,n},color:"secondary",size:"small",className:"rustic-prompt",sx:l(l({backgroundColor:r.palette.background.paper},"inConversation"===e.position&&{border:"1px solid ".concat(r.palette.divider)}),{"&:hover":{color:r.palette.text.primary,backgroundColor:r.palette.primary.hover}}),label:o},n)}));return(0,t.jsx)(n(),{className:e.className,children:o})};return r})()));
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/components/prompts/prompts.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAOtB,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,UAAU,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,2CAkClD"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/components/prompts/prompts.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAQtB,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,UAAU,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,2CA8ClD"}
@@ -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={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>f});const r=require("react/jsx-runtime"),i=require("@mui/material"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var s=e.n(a);const u=require("@mui/material/Stack");var c=e.n(u);const l=require("@mui/material/Typography");var d=e.n(l);const m=require("react"),p=require("uuid"),f=function(e){var t=(0,m.useState)(""),o=t[0],a=t[1],u=(0,i.useTheme)(),l=(0,i.useMediaQuery)(u.breakpoints.down("md"))?"column":"row",f=e.options.map((function(t,i){return(0,r.jsx)(s(),{onClick:function(){return function(t){a(t);var r=(new Date).toISOString(),i={id:(0,p.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t},inReplyTo:e.messageId};e.ws.send(i)}(t)},variant:"rusticSecondary",size:"small",sx:o===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!o,"aria-disabled":!!o,label:t},i)}));return(0,r.jsxs)(n(),{className:"rustic-question",children:[(e.title||e.description)&&(0,r.jsxs)(n(),{className:"rustic-question-text",children:[e.title&&(0,r.jsx)(d(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,r.jsx)(d(),{variant:"caption",children:e.description})]}),(0,r.jsx)(c(),{direction:l,className:"rustic-options-container",children:f})]})};return t})()));
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={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>f});const r=require("react/jsx-runtime"),i=require("@mui/material"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var s=e.n(a);const u=require("@mui/material/Stack");var c=e.n(u);const l=require("@mui/material/Typography");var d=e.n(l);const m=require("react"),p=require("uuid"),f=function(e){var t=(0,m.useState)(""),o=t[0],a=t[1],u=(0,i.useTheme)(),l=(0,i.useMediaQuery)(u.breakpoints.down("md"))?"column":"row",f=e.options.map((function(t,i){return(0,r.jsx)(s(),{onClick:function(){return function(t){a(t);var r=(new Date).toISOString(),i={id:(0,p.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t},inReplyTo:e.messageId};e.ws.send(i)}(t)},color:"secondary",size:"small",sx:o===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!o,"aria-disabled":!!o,label:t},i)}));return(0,r.jsxs)(n(),{className:"rustic-question",children:[(e.title||e.description)&&(0,r.jsxs)(n(),{className:"rustic-question-text",children:[e.title&&(0,r.jsx)(d(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,r.jsx)(d(),{variant:"caption",children:e.description})]}),(0,r.jsx)(c(),{direction:l,className:"rustic-options-container",children:f})]})};return t})()));
@@ -232,6 +232,12 @@ export interface UploaderProps {
232
232
  getUploadData?: (fileName: string) => {
233
233
  [key: string]: any;
234
234
  };
235
+ /** A function that can be used to get the headers for the file upload requests. */
236
+ getUploadHeaders?: () => Promise<{
237
+ headers: {
238
+ Authorization: string;
239
+ };
240
+ }>;
235
241
  /** Defines the available options for file upload, displayed within a popover menu. If no options are provided, an upload icon button will be displayed by default.*/
236
242
  uploadOptions?: UploadOption[];
237
243
  /** A function to fetch and format existing file data when a file upload fails due to a conflict error (HTTP status code 409). The returned value will be used to determine a unique file name by appending an incremented number to the base name. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"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"}
package/dist/index.js CHANGED
@@ -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,r={9528:(e,t,r)=>{r.d(t,{UniformsForm:()=>f});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);function f(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,f=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),h=(o=e.schema,c=f.compile(o),function(e){var t;return c(e),(null===(t=c.errors)||void 0===t?void 0:t.length)?{details:c.errors}:null}),v=new d.JSONSchemaBridge({schema:e.schema,validator:h});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)(s(),{variant:"body1",children:e.description}),(0,n.jsx)(p.AutoForm,{schema:v,onSubmit:function(t){return function(t){var r=(new Date).toISOString(),n={id:(0,m.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"formResponse",data:t,inReplyTo:e.messageId};a(t),e.ws.send(n)}(t)},model:r,disabled:!!r})]})}},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},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);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})})}},2500:(e,t,r)=>{r.d(t,{default:()=>n}),r(1737);const n=r(7131).A},1737:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(7447),l=r.n(c),u=r(2015);const d=function(e){var t=(0,u.useState)(l().sanitize(e.text)),r=t[0],a=t[1],o=(0,u.useState)(""),c=o[0],d=o[1];return(0,u.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(l().sanitize(t))}}),[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",children:r}),c&&(0,n.jsx)(i(),{severity:"error",children:c})]})}},7131:(e,t,r)=>{r.d(t,{A:()=>c});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o);r(2015);const c=function(e){return(0,n.jsx)(i(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},2321:(e,t,r)=>{r.d(t,{rusticDarkTheme:()=>Z,rusticLightTheme:()=>A});var n=r(6182);const a=require("@mui/utils");var i=function(){return i=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},i.apply(this,arguments)},o="#000000",s="#FFFFFF",c="#FF6928",l="#E54500",u="#FF692899",d="#FF69284D",p=(0,n.createTheme)({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:400}},palette:{common:{black:o,white:s},error:{main:"#F82A43",dark:"#C82639",light:"#FF9BA7"},warning:{main:"#FFB800",dark:"#DC8400",light:"#FFDB7D"},info:{main:"#0094FF",dark:"#005A9B",light:"#8CCFFF"}},shadows: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))}([],(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)}),m={fontSize:"12px",lineHeight:1.5,letterSpacing:"0.5px",padding:"0 12px",minHeight:"26px"},f={fontSize:"14px",lineHeight:1.43,letterSpacing:"0.25px",padding:"0 16px",minHeight:"40px"},h={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"},v="#E1D9D5",x="#0000001F",g="#2D2825",b="#2D282599",y="#1E0C04",j="#9C9795",w="#00000061",S="#2D282514",F="#2D28251F",k="#2D28254D",C="#2D282580",N={fontWeight:700},E={"&.Mui-disabled":{background:s,color:j,border:"1px solid ".concat(w)}},T=i(i(i({},N),{background:g,color:s,"&:hover":{background:b},"&:active":{outline:"2px solid ".concat(b)}}),E),O=i(i(i({},N),{background:s,color:y,border:"1px solid ".concat(b),"&:active":{outline:"2px solid ".concat(b)}}),E),P={fontWeight:400,"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"}},R=i({background:k,color:y,border:"1px solid ".concat(C),"&:hover":{border:"1px solid ".concat(C),background:S},"&:active":{outline:"2px solid ".concat(C),background:F},"&.Mui-disabled":{background:w,opacity:100,border:"none",color:s,"& .MuiChip-icon":{color:s}},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:y}},P),D=i({background:s,color:y,boxSizing:"border-box",border:"1px solid ".concat(u),"&:active":{outline:"2px solid ".concat(u)},"&.Mui-disabled":{border:"1px solid ".concat(u),background:s,color:u,opacity:100},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:y}},P),A=(0,n.createTheme)((0,a.deepmerge)(p,{palette:{mode:"light",divider:v,text:{primary:y,secondary:"#4E443F",disabled:j},primary:{main:g,dark:o,light:b,contrastText:s,focus:F,focusVisible:k,hover:S,selected:"#2D282529",border:C},secondary:{main:c,light:u,dark:l,contrastText:s,focus:"#FF69281F",focusVisible:d,hover:"#FF692814",selected:"#FF692829",border:"#FF692880"},background:{default:"#F7F6F5",paper:s},action:{active:"#0000008F",hover:"#00000014",selected:"#00000029",disabledBackground:x,focus:x,disabled:w},success:{main:"#007F51",dark:"#014F33",light:"#00D788",contrastText:s},error:{contrastText:s},warning:{contrastText:s},info:{contrastText:s}},components:{MuiTooltip:{styleOverrides:{tooltip:{backgroundColor:g,color:s}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:x},root:{borderBottom:"1px solid ".concat(v),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:y}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(v),backgroundImage:"none"}}},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:i(i({borderRadius:"16px"},m),T)},{props:{variant:"rusticPrimary",size:"medium"},style:i(i({borderRadius:"24px"},f),T)},{props:{variant:"rusticPrimary",size:"large"},style:i(i({borderRadius:"32px"},h),T)},{props:{variant:"rusticSecondary",size:"small"},style:i(i({borderRadius:"16px","&:hover":{border:"1px solid ".concat(o),background:s}},m),O)},{props:{variant:"rusticSecondary",size:"medium"},style:i(i({borderRadius:"24px","&:hover":{border:"2px solid ".concat(o),background:s}},f),O)},{props:{variant:"rusticSecondary",size:"large"},style:i(i({borderRadius:"32px","&:hover":{border:"2px solid ".concat(o),background:s}},h),O)}]},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:i(i({borderRadius:"24px"},m),R)},{props:{variant:"rusticPrimary",size:"medium"},style:i(i({borderRadius:"32px"},f),R)},{props:{variant:"rusticPrimary",size:"large"},style:i(i({borderRadius:"48px"},h),R)},{props:{variant:"rusticSecondary",size:"small"},style:i(i({borderRadius:"24px","&:hover":{border:"1px solid ".concat(c),background:s}},m),D)},{props:{variant:"rusticSecondary",size:"medium"},style:i(i({borderRadius:"32px","&:hover":{border:"2px solid ".concat(c),background:s}},f),D)},{props:{variant:"rusticSecondary",size:"large"},style:i(i({borderRadius:"48px","&:hover":{border:"2px solid ".concat(c),background:s}},h),D)}]}}})),I="#FFFFFF61",q="#FFFFFF1F",L="#E1D9D5",z="#202020",M="#FFFCFB",_="#FFFCFB99",B="#000000DE",H="#FFFFFF61",W="#FF692880",U="#FFFCFB1F",V="#FFFCFB4D",G="#FFFCFB14",K="#FFFFFF4D",Q={"&.Mui-disabled":{background:K,color:I,border:"1px solid ".concat(H)}},Y=i(i(i({},N),{background:M,color:o,"&:hover":{background:_},"&:active":{outline:"2px solid ".concat(_)}}),Q),$=i(i(i({},N),{background:z,color:s,border:"1px solid ".concat(_),"&:active":{outline:"2px solid ".concat(_)}}),Q),X=i(i({background:V,color:s,border:"1px solid ".concat(W),"&:hover":{border:"1px solid ".concat(W),background:G},"&:active":{outline:"2px solid ".concat(_),background:U},"&.Mui-disabled":{background:H,opacity:100,border:"none",color:B,"& .MuiChip-icon":{color:B}}},P),{"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}}),J=i({background:z,color:s,border:"1px solid ".concat(u),"&:active":{outline:"2px solid ".concat(u)},"&.Mui-disabled":{background:z,color:u,border:"1px solid ".concat(u),opacity:100},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}},P),Z=(0,n.createTheme)((0,a.deepmerge)(p,{palette:{mode:"dark",divider:L,primary:{main:M,dark:s,light:_,contrastText:B,hover:G,selected:"#FFFCFB29",focus:U,focusVisible:V,border:W},secondary:{main:c,light:u,dark:l,contrastText:B,hover:"#FF692814",selected:"#FF692829",focus:"#FF69281F",focusVisible:d,border:"#FF692880"},background:{default:"#2C2C2C",paper:z},text:{primary:s,secondary:"#FFFFFFB2",disabled:I},action:{active:K,hover:K,selected:"#FFFFFF29",focus:q,disabledBackground:q,disabled:H},success:{main:"#00B775",dark:"#01784D",light:"#00E390",contrastText:B},error:{contrastText:B},warning:{contrastText:B},info:{contrastText:B}},components:{MuiTooltip:{styleOverrides:{tooltip:{backgroundColor:M,color:o}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:s}}}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:q},root:{borderBottom:"1px solid ".concat(L),padding:"8px 16px"}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(L),backgroundImage:"none"}}},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:i(i({borderRadius:"24px"},m),X)},{props:{variant:"rusticPrimary",size:"medium"},style:i(i({borderRadius:"32px"},f),X)},{props:{variant:"rusticPrimary",size:"large"},style:i(i({borderRadius:"48px"},h),X)},{props:{variant:"rusticSecondary",size:"small"},style:i(i({borderRadius:"24px","&:hover":{background:z,border:"1px solid ".concat(c)}},m),J)},{props:{variant:"rusticSecondary",size:"medium"},style:i(i({borderRadius:"32px","&:hover":{background:z,border:"2px solid ".concat(c)}},f),J)},{props:{variant:"rusticSecondary",size:"large"},style:i(i({borderRadius:"48px","&:hover":{background:z,border:"2px solid ".concat(c)}},h),J)}]},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:i(i({borderRadius:"8px"},m),Y)},{props:{variant:"rusticPrimary",size:"medium"},style:i(i({borderRadius:"12px"},f),Y)},{props:{variant:"rusticPrimary",size:"large"},style:i(i({borderRadius:"16px"},h),Y)},{props:{variant:"rusticSecondary",size:"small"},style:i(i({borderRadius:"8px","&:hover":{background:z,border:"1px solid ".concat(s)}},m),$)},{props:{variant:"rusticSecondary",size:"medium"},style:i(i({borderRadius:"12px","&:hover":{background:z,border:"2px solid ".concat(s)}},f),$)},{props:{variant:"rusticSecondary",size:"large"},style:i(i({borderRadius:"16px","&:hover":{background:z,border:"2px solid ".concat(s)}},h),$)}]}}}));A=(0,n.responsiveFontSizes)(A),Z=(0,n.responsiveFontSizes)(Z)},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")},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:()=>tr,CodeSnippet:()=>O,CopyText:()=>Mt,ElementRenderer:()=>D,FCCalendar:()=>w,Icon:()=>A.A,Image:()=>G,MarkedMarkdown:()=>gt,MarkedStreamingMarkdown:()=>bt,MermaidViz:()=>pn,MessageCanvas:()=>Ut,MessageSpace:()=>Jt,MultimodalInput:()=>$e,Multipart:()=>nr,OpenLayersMap:()=>mt,PDFViewer:()=>Te,ParticipantsContainer:()=>br,PerspectiveViz:()=>xn,PlotlyGraph:()=>jn,PopoverMenu:()=>We,PromptBuilder:()=>Er,Prompts:()=>Tr,Question:()=>Or,RechartsTimeSeries:()=>cn,Sound:()=>At,StreamingText:()=>Xr.A,Table:()=>$r,Text:()=>rr.A,TextInput:()=>Ze,TextToSpeech:()=>_t,Timestamp:()=>Wt,UniformsForm:()=>P.UniformsForm,Uploader:()=>Ke,VegaLiteViz:()=>Nn,Video:()=>Lt,Weather:()=>En,YoutubeVideo:()=>Zr,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);const v=require("@mui/material/useMediaQuery");var x=a.n(v),g=a(2015),b=a.n(g),y=function(){return y=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},y.apply(this,arguments)};function j(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function w(e){var t=(0,h.useTheme)(),r=x()(t.breakpoints.up("md"));return(0,o.jsx)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":y({},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":y({},t.typography.caption)},children:(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(j)})})}const S=require("@codemirror/language"),F=require("@codemirror/language-data"),k=require("@codemirror/state"),C=require("@codemirror/view");var N=a(785),E=a.n(N);const T=require("@mui/system");function O(e){var t=(0,g.useRef)(null),r=(0,g.useRef)(),n=new k.Compartment,a=[k.EditorState.readOnly.of(!0),(0,C.highlightSpecialChars)(),(0,S.syntaxHighlighting)(S.defaultHighlightStyle,{fallback:!0}),n.of([])],i=F.languages.find((function(t){return t.name.toLowerCase()===e.language.toLowerCase()}));return(0,g.useEffect)((function(){if(t.current&&!r.current){var o=t.current,s=k.EditorState.create({doc:e.code,extensions:a});r.current=new C.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.jsx)(T.Box,{sx:{backgroundColor:"background.default"},className:"rustic-code-snippet",children:(0,o.jsx)("div",{"aria-label":"code snippet",ref:t,children:(0,o.jsx)(E(),{variant:"body2","aria-label":"language type",children:e.language})})})}var P=a(9528),R=function(){return R=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},R.apply(this,arguments)};const D=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?b().createElement(n,R(R({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)(E(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var A=a(9767);const I=require("@mui/material/CircularProgress");var q,L=a.n(I),z=function(){return z=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},z.apply(this,arguments)},M=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function _(e,t){return function(e,t){var r,n=new Date(e),a=navigator.language;return r=t===q.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(a,r)}(e,t<=1?q.HOUR:q.MONTH_DATE)}function B(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 H(e,t){var r={};return e&&(r={width:e}),t&&(r=z(z({},r),{height:t})),e||t||(r={className:"rustic-fit-container"}),r}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 U(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(q||(q={}));var V=function(){return V=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},V.apply(this,arguments)};function G(e){var t=(0,g.useState)(!0),r=t[0],n=t[1],a=(0,g.useState)(""),i=a[0],s=a[1];return i.length>0?(0,o.jsx)(E(),{variant:"body2",children:i}):(0,o.jsxs)("figure",{children:[r&&(0,o.jsx)(L(),{}),(0,o.jsx)("img",V({},H(e.width,e.height),{src:e.src,alt:e.alt,onError:function(){s("Image failed to load"),n(!1)},onLoad:function(){n(!1)}})),e.description&&(0,o.jsx)("figcaption",{children:(0,o.jsx)(E(),{variant:"body2",children:e.description})})]})}G.defaultProps={alt:"An image is displayed"};var K=a(3903),Q=a(909),Y=a.n(Q);const $=require("@mui/material/InputAdornment");var X=a.n($);const J=require("@mui/material/MenuItem");var Z=a.n(J);const ee=require("@mui/material/MenuList");var te=a.n(ee);const re=require("@mui/material/Popover");var ne=a.n(re);const ae=require("@mui/material/TextField");var ie=a.n(ae),oe=a(4603),se=a.n(oe),ce=a(8342);const le=function(e){var t=(0,h.useTheme)(),r=(0,g.useRef)(null),n=(0,g.useRef)(null),i=(0,g.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,g.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,g.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)(se(),{title:"Emoji",children:(0,o.jsx)(Y(),{size:"small",ref:r,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(A.A,{name:"Mood"})})}),n.current&&(0,o.jsx)(ne(),{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 ue={"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 de(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var pe=(0,g.forwardRef)((function(e,t){var r=(0,g.useState)(""),n=r[0],a=r[1],i=(0,g.useState)(!1),s=i[0],c=i[1],l=(0,g.useState)(!1),u=l[0],d=l[1],p=(0,g.useState)(!1),m=p[0],h=p[1],v=(0,g.useState)(""),x=v[0],b=v[1],y=(0,g.useState)([]),j=y[0],w=y[1],S=(0,g.useState)(!1),F=S[0],k=S[1],C=(0,g.useRef)(null),N=new ce.Database({dataSource:e.emojiDataSource}),T=!n.trim().length&&!e.isSendEnabled,O="".concat(s?"Stop":"Start"," speech to text"),P=u?"primary.main":"primary.light",R=s?"error.main":P,D=s?"stop_circle":"speech_to_text";function I(e,t){if(void 0===t&&(t=!1),C.current){var r=C.current,i=r.selectionStart,o=r.selectionEnd;if("number"==typeof i&&"number"==typeof o){var s,c=n||"",l=c.substring(0,i),u=c.substring(o);s=t?l.replace(/:(\w+)$/,e)+u:l+e+u,a(s);var d=t?l.replace(/:(\w+)$/,e).length:i+e.length;setTimeout((function(){var e,t;null===(e=C.current)||void 0===e||e.focus(),null===(t=C.current)||void 0===t||t.setSelectionRange(d,d)}),0)}}k(!1)}var q=m?(0,o.jsx)(L(),{size:24}):(0,o.jsx)(se(),{title:O,children:(0,o.jsx)(Y(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,s?(e.stop(),h(!0),c(!1)):(e.start(),b(""),c(!0)),e.onstart=function(){c(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;n.length>0?a(n+" "+r):a(r),null===(t=C.current)||void 0===t||t.focus(),c(!1)},e.onerror=function(e){var t=ue[e.error];b(t),c(!1)},e.onend=function(){h(!1),c(!1)}},size:"small",sx:{color:R,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(A.A,{name:D})})});function z(){var t=(new Date).toISOString(),r={id:(0,K.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:U(n)};e.send(r),a(""),b("")}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)(E(),{variant:"caption",color:"error",className:"rustic-error-message",children:x})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:u?"secondary.main":"action.disabled"},children:[j.length>0&&(0,o.jsx)(ne(),{open:F,anchorEl:C.current,onClose:function(){return k(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,o.jsx)(te(),{children:j.map((function(e,t){return"unicode"in e&&(0,o.jsx)(Z(),{onClick:function(){return I(e.unicode,!0)},children:de(e)},t)}))})}),(0,o.jsx)(ie(),{className:"rustic-text-field",variant:"outlined",value:n,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),T||z())},onChange:function(t){b("");var r=t.target.value;a(r);var n,i=r.match(/:(\w{2,}):/g),o=r.match(/:(\w{2,})/g);if(i){var s=i[0].replace(/:/g,"");N.getEmojiByShortcode(s).then((function(e){if(e&&"unicode"in e){var t=r.replace(i[0],e.unicode);a(t)}else a(r)})).catch((function(){a(r)})),k(!1)}else o?(n=o[0].replace(":",""),N.getEmojiBySearchQuery(n).then((function(t){t.length?(w(t.slice(0,e.maximumEmojiSearchResults)),k(!0)):(w([]),k(!1))})).catch((function(){w([]),k(!1)}))):k(!1)},onFocus:function(){return d(!0)},onBlur:function(){return d(!1)},inputRef:C,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(X(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(le,{dataSource:e.emojiDataSource,onEmojiClick:I,buttonColor:P}),e.enableSpeechToText&&q]})},inputLabel:{className:u?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(f(),{className:"rustic-input-actions",children:[e.children,(0,o.jsx)(se(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(Y(),{"aria-label":"send message",onClick:z,disabled:T,color:"secondary",children:(0,o.jsx)(A.A,{name:"send"})})})})]})]})}));pe.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const me=pe,fe=require("@mui/material/LinearProgress");var he=a.n(fe);const ve=require("axios");var xe=a.n(ve);const ge=require("react-dom"),be=require("@mui/material/Card");var ye=a.n(be);const je=require("@mui/material/Modal");var we=a.n(je);const Se=require("@mui/system/Stack");var Fe=a.n(Se);const ke=require("@mui/system/useTheme");var Ce=a.n(ke);const Ne=require("pdfjs-dist"),Ee=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)(se(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(Y(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(A.A,{name:r.symbol})})})})},Te=function(e){var t,r=(0,g.useRef)(null),n=(0,g.useState)(1),a=n[0],i=n[1],s=(0,g.useState)(1),c=s[0],l=s[1],u=(0,g.useState)(1),d=u[0],p=u[1],m=(0,g.useState)(!1),h=m[0],v=m[1],b=(0,g.useState)(),y=b[0],j=b[1],w=Ce()(),S=x()(w.breakpoints.down("sm")),F=x()(w.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(E(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var k=(0,g.useState)((function(){return S?.5:F?1:1.5})),C=k[0],N=k[1];return(0,g.useEffect)((function(){Ne.GlobalWorkerOptions.workerSrc||(Ne.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Ne.version,"/pdf.worker.mjs")),Ne.getDocument({url:"".concat(e.url)}).promise.then((function(e){l(e.numPages),function(e){e.getPage(a).then((function(e){var t=e.getViewport({scale:C}),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]};y&&y.cancel();var s=e.render(o);j(s),s.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){v(!0)}))}),[e.url,a,C]),h?(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(E(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(f(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(Ee,{action:"zoomOut",onClick:function(){N((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(Ee,{action:"zoomIn",onClick:function(){N((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)(Fe(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(Ee,{action:"previousPage",onClick:function(){a>1&&(i(a-1),p(a-1))},isDisabled:1===a}),(0,o.jsx)(E(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(ie(),{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)(E(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Ee,{action:"nextPage",onClick:function(){a<c&&(i(a+1),p(a+1))},isDisabled:a===c})]})]})};var Oe={pdf:Te};function Pe(e){var t=(0,h.useTheme)(),r=(0,g.useState)(!1),n=r[0],a=r[1];function i(){a(!1)}var s,c,l=e.file.url&&(s=e.file.url.split("."))[s.length-1].toLowerCase(),u=l&&e.supportedViewers?e.supportedViewers[l]:null,d=!!u,p=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",m=d?" rustic-cursor-pointer":"",f="rustic-file-preview ".concat(p).concat(m),v=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(ye(),{className:f,variant:"outlined",sx:{boxShadow:t.shadows[1]},onClick:function(){a(!0)},children:[(0,o.jsx)(E(),{variant:"subtitle2",className:"rustic-file-preview-name",children:v}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),d&&(0,o.jsx)(we(),{open:n,onClose:i,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(se(),{title:"Close",children:(0,o.jsx)(Y(),{onClick:i,className:"rustic-close-button",children:(0,o.jsx)(A.A,{name:"close"})})}),e.file.url&&(0,o.jsx)(u,{url:e.file.url})]})})]})}Pe.defaultProps={supportedViewers:Oe,showFullName:!0};var Re=a(3110);const De=require("@mui/material"),Ae=require("@mui/material/Button");var Ie=a.n(Ae);const qe=require("@mui/material/Drawer");var Le=a.n(qe);const ze=require("@mui/material/ListItemText");var Me=a.n(ze);const _e=require("@mui/material/Menu");var Be=a.n(_e),He=function(){return He=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},He.apply(this,arguments)};function We(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],a=(0,g.useRef)(null),i=(0,h.useTheme)(),s=(0,De.useMediaQuery)(i.breakpoints.down("md")),c=s?Le():Be(),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)(Me(),{children:(0,o.jsx)(E(),{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=He(He({},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)(Z(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)(Z(),{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)(A.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(Ie(),He({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(se(),{title:e.ariaLabel,children:(0,o.jsx)(Y(),He({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,He({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":He(He({},l),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:d}))]})}var Ue=function(){return Ue=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},Ue.apply(this,arguments)},Ve=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 Ge(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 Ke=function(e){var t,r=(0,g.useState)([]),n=r[0],a=r[1],i=(0,g.useState)([]),s=i[0],c=i[1],l=(0,g.useState)({}),u=l[0],d=l[1],p=(0,g.useRef)({}),m=(0,K.v4)();function h(e,t,r){var n;p.current=Ue(Ue({},p.current),((n={})[e]=p.current[e]--,n)),function(e,t,r){c((function(t){return Ve(Ve([],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)}(0,g.useEffect)((function(){a([]),c([]),p.current={}}),[e.messageId]);var v=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,o.jsx)(Pe,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(he(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(se(),{title:"Delete",children:(0,o.jsx)(Y(),{color:"primary",onClick:function(){return function(t,r){var n,i;c([]);var o=t.name;if(p.current=Ue(Ue({},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);xe().delete(s).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 Ve(Ve([],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=Ue(Ue({},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)}))}),x=(0,o.jsx)(f(),{children:s.map((function(e,t){return(0,o.jsx)(E(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function b(e,t){return t?(0,ge.createPortal)(e,t):e}var y=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)(Re.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==y?void 0:y.length)?(0,o.jsx)(We,{ariaLabel:"Upload",icon:(0,o.jsx)(Re.default,{name:"upload_2"}),menuItems:y}):(0,o.jsx)(se(),{title:"Upload",children:(0,o.jsx)(Y(),{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 Ve(Ve([],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 Ve(Ve([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&Ge(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=Ue(Ue({},p.current),((t={})[e.name]=i,t))}else p.current=Ue(Ue({},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=Ue(Ue({},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,K.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?Ue(Ue({},e),{loadingProgress:t}):e}));return n})))}a((function(e){return Ve(Ve([],e,!0),[d],!1)})),e.onFileUpdate("add",i);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId);!function o(){return xe().post(f,r,{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=Ve([],e,!0);return r[t]=Ue(Ue({},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,v;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),v=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(v.test(a.name)){var i=a.name.match(v),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?Ue(Ue({},e),{name:n,loadingProgress:0}):e}))})),o()})).catch((function(){var e;h(t.name,d.id,null===(e=n.response)||void 0===e?void 0:e.data)})):h(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&&b(x,e.errorMessagesContainer),n.length>0&&b(v,e.filePreviewsContainer)]})};var 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)},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 $e(e){var t=(0,g.useState)({uploaded:[],fileList:[]}),r=t[0],n=t[1],a=(0,g.useState)((0,K.v4)()),i=a[0],s=a[1],c=(0,g.useState)(),l=c[0],u=c[1],d=(0,g.useState)(),p=d[0],m=d[1],v=(0,g.useRef)(null),x=(0,h.useTheme)(),b=r.uploaded.length===r.fileList.length&&r.uploaded.length>0;return(0,g.useEffect)((function(){v.current&&(m(v.current.querySelector(".rustic-error-container")),u(v.current.querySelector(".rustic-input-extras")))})),(0,o.jsx)(f(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(x.palette.action.disabled),borderRadius:"".concat(x.shape.borderRadius,"px"),":focus-within":{borderColor:x.palette.secondary.main},background:x.palette.background.paper},children:(0,o.jsx)(me,Qe({},e,{send:function(t){b&&(t.id=i,t.format="chatCompletionRequest",t.data=U(t.data.text,r.uploaded.map((function(e){return{url:e.url,name:e.name}})))),e.ws.send(t),s((0,K.v4)()),n({uploaded:[],fileList:[]})},isSendEnabled:b,ref:v,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Ke,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)n((function(e){return Qe(Qe({},e),{fileList:Ye(Ye([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");n((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),a=Ye(Ye(Ye([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Qe(Qe({},e),{uploaded:a})}))}else n((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:i,filePreviewsContainer:l,errorMessagesContainer:p,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions,listFiles:e.listFiles})})}))})}$e.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};var Xe=function(){return Xe=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},Xe.apply(this,arguments)},Je=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 Ze(e){var t=e.ws,r=Je(e,["ws"]);return(0,o.jsx)(me,Xe({},r,{send:function(e){t.send(e)}}))}require("ol/ol.css");var et=a(5642),tt=a.n(et);const rt=require("ol/layer/Tile.js");var nt=a.n(rt);const at=require("ol/Map.js");var it=a.n(at);const ot=require("ol/Overlay.js");var st=a.n(ot);const ct=require("ol/proj.js"),lt=require("ol/source/OSM.js");var ut=a.n(lt);const dt=require("ol/View.js");var pt=a.n(dt);function mt(e){var t=(0,g.useState)(""),r=t[0],n=t[1],a=(0,g.useRef)(null),i=(0,g.useRef)(null);return(0,g.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(it())({layers:[new(nt())({source:new(ut())})],view:new(pt())({center:(0,ct.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(st())({element:i.current,position:(0,ct.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)(tt(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[(0,o.jsx)(f(),{ref:i,children:(0,o.jsx)(A.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:a,className:"rustic-open-layers-map-canvas"})]})})}var ft=a(7447),ht=a.n(ft);const vt=require("marked");function xt(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=vt.marked.parse(t);return ht().sanitize(r)}const gt=function(e){var t=(0,g.useState)(xt(e.text)),r=t[0],n=t[1];return(0,g.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;n(xt(t))}}),[e.text,e.updatedData]),(0,o.jsx)(E(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}})},bt=function(e){var t=(0,g.useState)(xt(e.text)),r=t[0],n=t[1],a=(0,g.useState)(""),i=a[0],s=a[1];return(0,g.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(xt(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(E(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),i&&(0,o.jsx)(tt(),{severity:"error",children:i})]})},yt=require("@mui/material/Slider");var jt=a.n(yt);function wt(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)(se(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Y(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(A.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var St=100;function Ft(e){var t="dark"===(0,De.useTheme)().palette.mode,r=B(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*St;return(0,o.jsx)(he(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(jt(),{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 B(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function kt(e){var t=(0,g.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,g.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)(wt,{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)(jt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*St,"%"),value:r,onChange:function(t,r){var a=r;e.mediaElement.muted=0===a,e.mediaElement.volume=a,n(e.mediaElement.volume)}})]})}function Ct(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(Ie(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(A.A,{name:t}),children:(0,o.jsx)(E(),{variant:"overline",children:r})})}function Nt(e){var t=(0,g.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)(wt,{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 Et(e){var t,r=(0,g.useState)(e.mediaElement.playbackRate),n=r[0],a=r[1];return(0,o.jsx)(se(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Ie(),{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)(E(),{variant:"body1",children:[n,"X"]})})})}function Tt(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)(wt,{onClick:r,action:n})}function Ot(e){var t=B(e.elapsedTimeInSeconds),r=B(e.durationTimeInSeconds),n="".concat(t," / ").concat(r);return"wide"===e.style?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(E(),{variant:"overline",children:t}),(0,o.jsx)(E(),{variant:"overline",children:r})]}):(0,o.jsx)(E(),{variant:"overline",className:"rustic-time-display",children:n})}Ot.defaultProps={style:"condensed"};const Pt=require("@mui/material/Divider");var Rt=a.n(Pt);function Dt(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)(E(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function At(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],a=(0,g.useState)(!1),i=a[0],s=a[1],c=(0,g.useState)(!0),l=c[0],u=c[1],d=(0,g.useState)(0),p=d[0],m=d[1],f=(0,g.useState)(""),h=f[0],v=f[1],x=(0,g.useState)(""),b=x[0],y=x[1],j=(0,De.useTheme)(),w=(0,g.useRef)(null),S=(0,De.useMediaQuery)(j.breakpoints.down("md"));function F(){return(0,o.jsx)(E(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function k(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(wt,{action:t,onClick:function(){return s(!i)}})}}function C(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Tt,{mediaElement:w.current,movement:"replay"}),(0,o.jsx)(Nt,{mediaElement:w.current,onError:y}),(0,o.jsx)(Tt,{mediaElement:w.current,movement:"forward"})]})}function N(){if(e.transcript&&r)return(0,o.jsx)(Dt,{transcript:e.transcript})}function O(){if(e.transcript)return(0,o.jsx)(Ct,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function P(){return(0,o.jsx)("video",{src:e.src,ref:w,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,g.useEffect)((function(){var e,t,r,n;function a(e){v(e)}null===(e=w.current)||void 0===e||e.addEventListener("timeupdate",(function(){w.current&&m(w.current.currentTime)})),null===(t=w.current)||void 0===t||t.addEventListener("canplay",(function(){v(""),u(!1)})),null===(r=w.current)||void 0===r||r.addEventListener("error",(function(){return a("Failed to load the audio.")})),null===(n=w.current)||void 0===n||n.addEventListener("stalled",(function(){return a("Failed to fetch audio data, but trying.")}))}),[]);var R=S?function(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Ot,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"wide"}),(0,o.jsx)(Ft,{mediaElement:w.current}),F(),(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)(kt,{mediaElement:w.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[O(),(0,o.jsxs)(T.Box,{children:[k(),(0,o.jsx)(Et,{mediaElement:w.current})]})]})]}),N()]})}:function(){if(w.current)return(0,o.jsxs)(o.Fragment,{children:[F(),(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Ft,{mediaElement:w.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(),k(),(0,o.jsx)(Et,{mediaElement:w.current}),(0,o.jsx)(kt,{mediaElement:w.current}),(0,o.jsx)(Ot,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:O()})]}),N()]})]})};return h.length>0?(0,o.jsx)(tt(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[P(),(0,o.jsx)(L(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[P(),R(),b.length>0&&(0,o.jsx)(tt(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b})]})}function It(e){var t=(0,g.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)(wt,{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 qt(e){var t=(0,g.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)(wt,{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 Lt(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],a=(0,g.useState)(!1),i=a[0],s=a[1],c=(0,g.useState)(!0),l=c[0],u=c[1],d=(0,g.useState)(!!document.fullscreenElement),p=d[0],m=d[1],f=(0,g.useState)(!1),h=f[0],v=f[1],x=(0,g.useState)(""),b=x[0],y=x[1],j=(0,g.useState)(""),w=j[0],S=j[1],F=(0,g.useState)(0),k=F[0],C=F[1],N=(0,g.useRef)(null),O=(0,g.useRef)(null),P=(0,De.useTheme)(),R=(0,De.useMediaQuery)(P.breakpoints.down("md"));(0,g.useEffect)((function(){var e,t,r,n,a,i,o,s;function c(e){S(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return v(!1)}),3e3)}null===(e=O.current)||void 0===e||e.addEventListener("timeupdate",(function(){O.current&&C(O.current.currentTime)})),null===(t=O.current)||void 0===t||t.addEventListener("canplay",(function(){S(""),u(!1)})),null===(r=O.current)||void 0===r||r.addEventListener("error",(function(){return c("Failed to load the video.")})),null===(n=O.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 D={backgroundColor:P.palette.background.paper,opacity:h?1:0};function A(){if(e.transcript&&r)return(0,o.jsx)(Dt,{transcript:e.transcript})}function I(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(wt,{action:t,onClick:function(){return s(!i)}})}}function q(){if(e.transcript)return(0,o.jsx)(Ct,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var z=R?function(){return p?(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:D,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(Nt,{mediaElement:O.current,onError:y}),(0,o.jsx)(Ft,{mediaElement:O.current}),(0,o.jsx)(Ot,{elapsedTimeInSeconds:k,durationTimeInSeconds:O.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)(Tt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:O.current,movement:"forward"}),I(),(0,o.jsx)(Et,{mediaElement:O.current})]}),q()]}),A()]})}):(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Nt,{mediaElement:O.current,onError:y}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[q(),(0,o.jsx)(qt,{element:N.current,onError:y})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:D,children:[(0,o.jsx)(Ft,{mediaElement:O.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)(Nt,{mediaElement:O.current,onError:y}),(0,o.jsx)(Tt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:O.current,movement:"forward"}),I(),(0,o.jsx)(Et,{mediaElement:O.current}),(0,o.jsx)(kt,{mediaElement:O.current}),(0,o.jsx)(Ot,{elapsedTimeInSeconds:k,durationTimeInSeconds:O.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[q(),(0,o.jsx)(It,{mediaElement:O.current,onError:y}),(0,o.jsx)(qt,{element:N.current,onError:y})]})]}),p&&A()]})})};return w.length>0?(0,o.jsx)(tt(),{severity:"error",children:w}):(0,o.jsxs)(T.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(L(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(T.Box,{ref:N,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[b.length>0&&(0,o.jsx)(tt(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b}),(!R||p)&&function(){if(O.current&&N.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:D,children:[(0,o.jsx)(E(),{variant:"body2",children:e.title}),p&&R&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(It,{mediaElement:O.current,onError:y}),(0,o.jsx)(qt,{element:N.current,onError:y})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:O,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),z()]}),!p&&A()]})}var zt=a(4445);function Mt(e){var t=(0,g.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(zt.default,{message:e.message,icon:(0,o.jsx)(A.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 _t(e){var t=(0,g.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)(A.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})}const Bt=require("@mui/material/Stack");var Ht=a.n(Bt);const Wt=function(e){return(0,o.jsx)(E(),{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},Ut=(0,g.forwardRef)((function(e,t){var r=(0,De.useTheme)(),n=e.inReplyTo?e.inReplyTo:e.message;return(0,o.jsxs)(Ht(),{id:n.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(Ht(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(n),(0,o.jsx)(Wt,{timestamp:n.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(E(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,o.jsx)(Wt,{timestamp:e.message.timestamp})]})]})]})})),Vt=require("@mui/material/Chip");var Gt=a.n(Vt);const Kt=require("@mui/system/Box");var Qt=a.n(Kt),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)},$t=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 Xt(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var n=Yt({},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]=[Yt(Yt({},a),{data:Yt(Yt({},a.data),t.data)}),t]:n[r]=$t($t([],n[r],!0),[t],!1),n}function Jt(e){var t,r,n,a=(0,g.useRef)(null),i=(0,g.useRef)(null),s=(0,g.useRef)(),c=(0,g.useState)(!0),l=c[0],u=c[1],d=(0,g.useState)(!0),p=d[0],m=d[1],f=(0,g.useState)(!1),h=f[0],v=f[1],x=(0,g.useState)({}),b=x[0],y=x[1],j=Object.keys(b).length,w=(r=j,n=(0,g.useRef)(0),(0,g.useEffect)((function(){n.current=r})),n.current);function S(){m(!0),s.current&&clearTimeout(s.current),s.current=setTimeout((function(){m(!1)}),2e3)}function F(){var e=i.current,t=a.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;u(n-1<=r)}}function k(){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(){S(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(k,1)}function C(e){y((function(t){return Xt(t,e)}))}return(0,g.useEffect)((function(){var e=i.current;if(F(),e)return e.addEventListener("scroll",F),window.addEventListener("resize",F),function(){e.removeEventListener("scroll",F),window.removeEventListener("resize",F)}}),[l]),(0,g.useEffect)((function(){k()}),[h]),(0,g.useEffect)((function(){l&&0!==w&&j>w&&(S(),k())}),[l,Object.keys(b).length]),(0,g.useEffect)((function(){var t,r={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=Xt(r,e);r=t})),y(r)}),[null===(t=e.receivedMessages)||void 0===t?void 0:t.length]),(0,g.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(C)}),[]),(0,o.jsxs)(Qt(),{className:"rustic-message-space",children:[(0,o.jsxs)(Qt(),{ref:i,className:"rustic-message-container",children:[Object.keys(b).map((function(t,r){var n,i=b[t],s=i[i.length-1],c=s.format.includes("Response"),l=c&&{inReplyTo:i[0]};return"prompts"!==s.format?(0,o.jsx)(Ut,Yt({message:s},l,{getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===j-1?a:null,children:(0,o.jsx)(D,{ws:e.ws,sender:e.sender,messages:c?[i[0]]:i,supportedElements:e.supportedElements})}),t):"inConversation"===(null===(n=s.data)||void 0===n?void 0:n.position)?(0,o.jsx)("div",{ref:r===j-1?a:null,children:(0,o.jsx)(D,{ws:e.ws,sender:e.sender,messages:c?[i[0]]:i,supportedElements:e.supportedElements})},t):void 0})),!l&&!p&&(0,o.jsx)(Gt(),{variant:"rusticSecondary",className:"rustic-scroll-down-button",size:"medium",onClick:k,label:(0,o.jsxs)(o.Fragment,{children:[e.scrollDownLabel,(0,o.jsx)(A.A,{name:"arrow_downward"})]})})]}),function(t){var r,n=Object.values(t).flat(),a=n[n.length-1];return"prompts"===(null==a?void 0:a.format)&&"inConversation"!==(null===(r=null==a?void 0:a.data)||void 0===r?void 0:r.position)?(0,o.jsx)(D,{ws:e.ws,sender:e.sender,messages:[a],supportedElements:e.supportedElements}):null}(b)]})}Jt.defaultProps={scrollDownLabel:"Scroll down"};var Zt=a(2500);function er(e){return new URL(e).pathname.split("/").pop()}function tr(e){return(0,o.jsx)(f(),{className:"rustic-multipart",children:e.messages.map((function(t){return"string"==typeof t.content?(0,o.jsx)(Zt.default,{text:t.content}):(r=t.content,n=[],a="",r.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||er(r)},s=(0,o.jsx)(Pe,{file:i,showFullName:e.showFullName,children:i.url&&(0,o.jsx)(se(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(Y(),{component:"a",href:i.url,download:i.name,children:(0,o.jsx)(Re.default,{name:"download"})})})});n.push(s)}})),(0,o.jsxs)(o.Fragment,{children:[a.length>0&&(0,o.jsx)(Zt.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]}));var r,n,a}))})}var rr=a(7131);function nr(e){return(0,o.jsxs)(Qt(),{className:"rustic-multipart",children:[e.text&&(0,o.jsx)(rr.A,{text:e.text}),(t=e.files.map((function(t,r){return(0,o.jsx)(Pe,{file:t,showFullName:e.showFullName,children:t.url&&(0,o.jsx)(se(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(Y(),{component:"a",href:t.url,download:t.name,children:(0,o.jsx)(A.A,{name:"download"})})})},r)})),(0,o.jsx)(Qt(),{className:"rustic-files",children:t}))]});var t}const ar=require("@mui/material/Dialog");var ir=a.n(ar);const or=require("@mui/material/DialogTitle");var sr=a.n(or);const cr=require("@mui/material/List");var lr=a.n(cr);const ur=require("@mui/material/ListItem");var dr=a.n(ur);const pr=require("@mui/material/ListSubheader");var mr=a.n(pr);const fr=require("pluralize");var hr,vr,xr=a.n(fr);function gr(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(xr()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(E(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(lr(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(mr(),{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)(E(),{variant:"subtitle2",color:"text.secondary",children:s})]}),a>3&&(0,o.jsx)(Ie(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(A.A,{name:"keyboard_arrow_down"}),children:c})]}),children:i.map((function(e){return(0,o.jsxs)(dr(),{className:"rustic-participant-list-item",children:[(0,o.jsx)(E(),{variant:"subtitle2",children:e.displayName}),(0,o.jsx)(E(),{variant:e.participantRole===hr.Owner?"subtitle2":"caption",children:M(e.participantRole)})]},e.id)}))})}!function(e){e.Owner="owner",e.Member="member"}(hr||(hr={})),function(e){e.Human="human",e.Agent="agent"}(vr||(vr={}));const br=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===hr.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,vr.Human),n=t(e.participants,vr.Agent),a="".concat(xr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(ir(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(sr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:a}),(0,o.jsx)(gr,{participantType:"Human",participantTypeIcon:(0,o.jsx)(A.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)(gr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(A.A,{name:"smart_toy"}),participants:n})]})]})},yr=require("@mui/material/DialogActions");var jr=a.n(yr);const wr=require("@mui/material/DialogContent");var Sr=a.n(wr);const Fr=require("@mui/material/DialogContentText");var kr=a.n(Fr),Cr=function(){return Cr=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},Cr.apply(this,arguments)},Nr=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 Er(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],a=(0,g.useState)(!1),i=a[0],s=a[1],c=(0,g.useState)(!1),l=c[0],u=c[1],d=(0,g.useState)(!1),p=d[0],m=d[1],f=(0,g.useState)([]),h=f[0],v=f[1],x=(0,g.useState)(null),b=x[0],y=x[1],j=(0,T.useTheme)(),w=h[h.length-1],S=Cr(Cr({},e.ws),{send:function(e){y(e)}});function F(e){v((function(t){return Nr(Nr([],t,!0),[e],!1)}))}function k(){if(b){var t=Cr(Cr({},b),{threadId:e.messageId});e.ws.send(t)}}if((0,g.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(F)}),[e.ws]),(0,g.useEffect)((function(){h.length>0&&(w&&w.sender.id!==e.sender.id&&s(!1),"promptBuilder"===w.format&&w.data.isLastQuestion&&n(!0))}),[h.length]),0!==h.length)return(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(ir(),{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(j.palette.divider)}},children:[(0,o.jsx)(sr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(Rt(),{}),(0,o.jsx)(Sr(),{children:(0,o.jsx)(kr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(jr(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(Ie(),{variant:"rusticSecondary",startIcon:(0,o.jsx)(A.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(Ie(),{variant:"rusticPrimary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(E(),{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)(D,{ws:S,sender:e.sender,messages:[t],supportedElements:e.supportedElements},t.id)}))}(),i&&(0,o.jsx)(L(),{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)(Ie(),{variant:"rusticSecondary",startIcon:(0,o.jsx)(A.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(Ie(),{variant:"rusticSecondary",endIcon:(0,o.jsx)(A.A,{name:"chevron_right"}),onClick:function(){k(),y(null),s(!0)},disabled:!b,"aria-disabled":!b,children:"Next question"})]}),r&&(0,o.jsx)(T.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,o.jsx)(Ie(),{variant:"rusticPrimary",onClick:function(){k(),m(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}function Tr(e){var t=e.prompts.map((function(t,r){return(0,o.jsx)(Gt(),{onClick:function(){return r=t,n=(new Date).toISOString(),a={id:(0,K.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:r}},void e.ws.send(a);var r,n,a},variant:"rusticSecondary",size:"small",className:"rustic-prompt",label:t},r)}));return(0,o.jsx)(f(),{className:e.className,children:t})}function Or(e){var t=(0,g.useState)(""),r=t[0],n=t[1],a=(0,De.useTheme)(),i=(0,De.useMediaQuery)(a.breakpoints.down("md"))?"column":"row",s=e.options.map((function(t,a){return(0,o.jsx)(Gt(),{onClick:function(){return function(t){n(t);var r=(new Date).toISOString(),a={id:(0,K.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t},inReplyTo:e.messageId};e.ws.send(a)}(t)},variant:"rusticSecondary",size:"small",sx:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r,"aria-disabled":!!r,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)(E(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",children:e.description})]}),(0,o.jsx)(Ht(),{direction:i,className:"rustic-options-container",children:s})]})}const Pr=require("@mui/material/Table");var Rr=a.n(Pr);const Dr=require("@mui/material/TableBody");var Ar=a.n(Dr);const Ir=require("@mui/material/TableCell");var qr=a.n(Ir);const Lr=require("@mui/material/TableContainer");var zr=a.n(Lr);const Mr=require("@mui/material/TableHead");var _r=a.n(Mr);const Br=require("@mui/material/TablePagination");var Hr=a.n(Br);const Wr=require("@mui/material/TableRow");var Ur=a.n(Wr);const Vr=require("@mui/material/TableSortLabel");var Gr,Kr=a.n(Vr),Qr=10;function Yr(){return(0,o.jsx)(A.A,{name:"expand_all"})}function $r(e){if(0===e.data.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>Qr,i=(0,g.useState)({}),s=i[0],c=i[1],l=(0,g.useState)(a?Qr:-1),u=l[0],d=l[1],p=(0,g.useState)(0),m=p[0],f=p[1],h=(0,De.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}})),b=(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===Gr.Descending?1:-1:e[r]>t[r]?n===Gr.Descending?-1:1:0})):t),y=b.slice(m*u,m*u+u),j=u>0?y:b;function w(e){if(!s[e])return Yr}return(0,o.jsxs)(Ht(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(E(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)(zr(),{className:"rustic-table-container",children:(0,o.jsxs)(Rr(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[x.length>0&&(0,o.jsx)(_r(),{children:(0,o.jsx)(Ur(),{children:x.map((function(e,t){return(0,o.jsx)(qr(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(se(),{title:(r=e.dataKey,n=s[r],n?Object.keys(Gr)[Object.values(Gr).indexOf(n)]:"Sort"),children:(0,o.jsx)(Kr(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c((function(t){var r,n,a={};switch(t[e]){case Gr.Ascending:(r={})[e]=Gr.Descending,a=r;break;case Gr.Descending:a={};break;default:(n={})[e]=Gr.Ascending,a=n}return a}))}(e.dataKey)},className:"rustic-table-header",IconComponent:w(e.dataKey),children:e.label||M(e.dataKey)})})},"header-".concat(t));var r,n}))})}),(0,o.jsx)(Ar(),{children:j.map((function(e,t){return(0,o.jsx)(Ur(),{children:x.map((function(r,n){return(0,o.jsx)(qr(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))})]})}),a&&(0,o.jsx)(Hr(),{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"}(Gr||(Gr={}));var Xr=a(1737),Jr=function(){return Jr=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},Jr.apply(this,arguments)};function Zr(e){var t=ht().sanitize(e.youtubeVideoId);return(0,o.jsx)("iframe",Jr({},H(e.width,e.height),{src:"https://www.youtube.com/embed/".concat(t),title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",loading:"lazy"}))}Zr.defaultProps={title:"Embedded video"};const en=require("@mui/material/FormControl");var tn=a.n(en);const rn=require("recharts");var nn=function(){return nn=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},nn.apply(this,arguments)},an={line:rn.LineChart,bar:rn.BarChart,area:rn.AreaChart};function on(e){var t={};return e.forEach((function(e){t[e]=!0})),t}function sn(e){var t=(0,g.useState)(e.defaultChartType||"line"),r=t[0],n=t[1],a=(0,g.useState)(null),i=a[0],s=a[1],c=(0,g.useState)(e.timeSeries),l=c[0],u=c[1],d=Ce()(),p=l.length>0?Object.keys(l[0]):[],m=p[0],f=p.slice(1),h=(0,g.useState)(on(f)),v=h[0],x=h[1];(0,g.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=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.timeSeries,!0);e.updatedData.forEach((function(e){t=t.concat(e.timeSeries),u(t)}))}}),[e.timeSeries,e.updatedData]);var b=an[r];function y(e){i?s(null):e&&s(e.currentTarget)}function j(t,r){return v[t]?e.chartColors[r%e.chartColors.length]:"grey"}function w(e){return v[e]?"none":"line-through"}if(0===l.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available"});var S,F,k,C,N=e.timeSeries[e.timeSeries.length-1],T=(S=e.timeSeries[0][m],F=N[m],k=new Date(S),C=new Date(F),Math.round(Math.abs((C.getTime()-k.getTime())/864e5)));return(0,o.jsxs)(Qt(),{className:"rustic-recharts-time-series",children:[!e.disableChartTypeToggle&&(0,o.jsxs)(tn(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,o.jsx)(Y(),{"aria-label":"chart options","aria-expanded":Boolean(i),"aria-haspopup":"true",onClick:y,color:"primary",children:(0,o.jsx)(A.A,{name:"more_vert"})}),(0,o.jsxs)(Be(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:i,open:Boolean(i),onClose:function(e){return y(e)},children:[(0,o.jsx)(E(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(an).map((function(e){return(0,o.jsxs)(Z(),{value:e,selected:e===r,onClick:function(){return function(e){n(e),y()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,o.jsxs)(Qt(),{children:[e.title&&(0,o.jsx)(E(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",className:"rustic-recharts-time-series-description",children:e.description}),(0,o.jsx)(rn.ResponsiveContainer,{aspect:e.aspectRatio,width:e.width,maxHeight:e.maxHeight,minWidth:e.minChartWidth,children:(0,o.jsxs)(b,{data:l,margin:e.chartContainerMargin,children:[(0,o.jsx)(rn.XAxis,{dataKey:m,tickFormatter:function(e){return _(e,T)},stroke:d.palette.text.primary}),(0,o.jsx)(rn.YAxis,{domain:["auto","auto"],width:e.yAxisLabelWidth,tickFormatter:e.yAxisTickFormatter,stroke:d.palette.text.primary}),(0,o.jsx)(rn.Tooltip,{labelFormatter:function(e){return[_(e,T)]},formatter:e.tooltipFormatter,contentStyle:{color:d.palette.common.black}}),(0,o.jsx)(rn.Legend,{content:function(){return(0,o.jsx)(Qt(),{className:"rustic-recharts-time-series-legend",children:f.map((function(e,t){return(0,o.jsxs)(Qt(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=v[e]&&!f.find((function(t){return t!==e&&v[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(v)){for(var n={},a=0,i=f;a<i.length;a++){var o=i[a],s=o===e;n[o]=s}x(n)}else x(r?on(f):nn(nn({},v),((t={})[e]=!v[e],t)))}(e)},sx:{color:j(e,t)},children:[(0,o.jsx)(A.A,{name:"crop_16_9"}),(0,o.jsx)(E(),{variant:"body2",display:"inline",sx:{textDecorationLine:w(e)},children:e})]},t)}))})}}),f.map((function(t,n){return v[t]?function(t,n){var a=n%e.chartColors.length,i=v[t]?e.chartColors[a]:"transparent",s={onClick:e.onClick,cursor:"pointer"};switch(r){case"line":return(0,o.jsx)(rn.Line,{type:"monotone",isAnimationActive:!1,dataKey:t,name:t,dot:!1,stroke:i,activeDot:e.onClick&&s},t);case"bar":return(0,o.jsx)(rn.Bar,{dataKey:t,fill:i,onClick:e.onClick&&s.onClick,cursor:e.onClick&&s.cursor},t);case"area":return(0,o.jsxs)(g.Fragment,{children:[(0,o.jsx)("defs",{children:(0,o.jsxs)("linearGradient",{id:"color".concat(t),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,o.jsx)("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),(0,o.jsx)("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),(0,o.jsx)(rn.Area,{isAnimationActive:!1,dataKey:t,type:"monotone",stroke:i,fillOpacity:1,fill:"url(#color".concat(t,")"),activeDot:e.onClick&&s},t)]},t)}}(t,n):null})),e.referenceLineYAxis&&e.referenceLineYAxis.map((function(t,r){return(0,o.jsx)(rn.ReferenceLine,{y:t,label:e.referenceLineLabel&&e.referenceLineLabel[r],stroke:e.referenceLineColor&&e.referenceLineColor[r],strokeDasharray:"3 3",ifOverflow:"extendDomain",strokeWidth:e.referenceLineStrokeWidth&&e.referenceLineStrokeWidth[r],isFront:!0},r)}))]})})]})]})}sn.defaultProps={minChartWidth:200,maxHeight:600,yAxisLabelWidth:30,aspectRatio:16/9,disableChartTypeToggle:!1};const cn=sn,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,g.useRef)(null),r=(0,g.useState)(),n=r[0],a=r[1],i=Ce()(),s=(0,K.v4)();return(0,g.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)(Ht(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(E(),{variant:"subtitle2",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",children:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(E(),{variant:"body2",children:n})]})},mn=(require("@finos/perspective-viewer/dist/esm/perspective-viewer.inline.js"),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/dist/esm/perspective.inline.js"));var fn=a.n(mn),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 xn=function(e){if(0===e.data.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available."});var t=(0,g.useRef)(null),r=(0,h.useTheme)(),n=(0,g.useState)(!1),a=n[0],i=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=vn(e.headers),u="\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"===s?"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 ");var d,p,m,f,v,x,b,y,j,w=e.config&&(p=(d=e.config).groupBy,m=d.splitBy,f=d.aggregates,v=d.sort,x=d.filter,b=d.columns,y=null==v?void 0:v.map((function(e){return[l[e[0]]||e[0],e[1]]})),j=f&&Object.fromEntries(Object.entries(f).map((function(e){var t=e[0],r=e[1];return[l[t]||t,r]}))),{group_by:null==p?void 0:p.map((function(e){return l[e]||e})),split_by:null==m?void 0:m.map((function(e){return l[e]||e})),aggregates:j,sort:y,filter:x&&function(e){return e.map((function(e){return[l[e[0]]||e[0],e[1],e[e.length-1]]}))}(x),columns:null==b?void 0:b.map((function(e){return l[e]||e}))});return(0,g.useEffect)((function(){fn().worker().then((function(t){return t.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(r){t.current&&t.current.load(r).then((function(){t.current.restore(hn(hn({},w),{theme:c,title:e.title,settings:!1})).then((function(){if(t.current.shadowRoot){var e=new CSSStyleSheet;e.replaceSync(u),t.current.shadowRoot.adoptedStyleSheets.push(e)}}))})).catch((function(){i(!0)}))}))}),[e.data,c]),a?(0,o.jsx)(E(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(Fe(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},gn=require("react-plotly.js");var bn=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 jn=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)(Qt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)(bn(),yn({},t))]})},wn=require("react-dom/server"),Sn=require("vega-embed");var Fn=a.n(Sn),kn=function(){return kn=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},kn.apply(this,arguments)};function Cn(e){var t=(0,g.useRef)(null),r=(0,g.useState)(!1),n=r[0],a=r[1],i=Ce()(),s="dark"===i.palette.mode,c=i.typography.fontFamily,l={backgroundColor:i.palette.primary.main,color:i.palette.background.paper,borderRadius:i.shape.borderRadius+"px",padding:"4px 8px",fontSize:i.typography.caption.fontSize,fontFamily:c,fontWeight:i.typography.caption.fontWeight},u={formatTooltip:function(e,t){return(0,wn.renderToStaticMarkup)((0,o.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:l,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"},d=[{label:"Save as SVG"},{label:"Save as PNG"}];function p(){var r,n,i,o;if(t.current&&e.spec){var l=kn(kn({config:{font:c}},e.options),{theme:s?null===(r=e.theme)||void 0===r?void 0:r.dark:null===(n=e.theme)||void 0===n?void 0:n.light,tooltip:u,actions:!1});(null===(o=null===(i=e.options)||void 0===i?void 0:i.config)||void 0===o?void 0:o.font)||(l.config.font=c);var p=kn({},e.spec);delete p.title,Fn()(t.current,p,l).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){d[a].href=e,d[a].downloadFileName="".concat(r,".").concat(n)}))})),a(!1)})).catch((function(){a(!0)}))}}return(0,g.useEffect)((function(){function e(){p()}return p(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[e.spec,s]),n?(0,o.jsx)(E(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(Fe(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Qt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(We,{menuItems:d,ariaLabel:"Download options"})}),e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(gt,{text:e.description}),(0,o.jsxs)(Qt(),{textAlign:"center",mt:1,children:["string"==typeof e.spec.title&&(0,o.jsx)(E(),{variant:"subtitle2",children:e.spec.title}),e.spec.description&&(0,o.jsx)(E(),{variant:"caption",children:e.spec.description})]}),(0,o.jsx)("div",{ref:t,className:"rustic-vega-lite"})]})}const Nn=Cn;function En(e){var t=(0,g.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)(ye(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(E(),{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)(E(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(E(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-weather",children:[(0,o.jsx)(We,{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)(Ht(),{alignItems:"center",children:[(0,o.jsx)(E(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(Ht(),{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)(E(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(E(),{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)(Ht(),{direction:"row",spacing:2,children:[(0,o.jsx)(E(),{variant:"overline",children:u}),(0,o.jsx)(E(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)(Ht(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(A.A,{name:"cloud"}),(0,o.jsx)(E(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}Cn.defaultProps={theme:{dark:"dark"}};var Tn=a(2321);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:()=>f});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"),m=require("uniforms-mui");var p=r(3903);function f(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,f=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),h=(o=e.schema,c=f.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:h});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)(s(),{variant:"body1",children:e.description}),(0,n.jsx)(m.AutoForm,{schema:g,onSubmit:function(t){return function(t){var r=(new Date).toISOString(),n={id:(0,p.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"formResponse",data:t,inReplyTo:e.messageId};a(t),e.ws.send(n)}(t)},model:r,disabled:!!r})]})}},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},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);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})})}},2500:(e,t,r)=>{r.d(t,{default:()=>n}),r(1737);const n=r(7131).A},1737:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(7447),l=r.n(c),u=r(2015);const d=function(e){var t=(0,u.useState)(l().sanitize(e.text)),r=t[0],a=t[1],o=(0,u.useState)(""),c=o[0],d=o[1];return(0,u.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(l().sanitize(t))}}),[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",children:r}),c&&(0,n.jsx)(i(),{severity:"error",children:c})]})}},7131:(e,t,r)=>{r.d(t,{A:()=>c});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o);r(2015);const c=function(e){return(0,n.jsx)(i(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},9517:(e,t,r)=>{r.d(t,{generateTheme:()=>p,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"},m={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"};function p(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"},m),"&.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"},m),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)(p("light",l)),h=(0,n.createTheme)(p("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")},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:()=>qt.default,ChatCompletion:()=>tr,CodeSnippet:()=>O,CopyText:()=>Bt,ElementRenderer:()=>L,FCCalendar:()=>w,Icon:()=>A.A,Image:()=>G,MarkedMarkdown:()=>xt,MarkedStreamingMarkdown:()=>bt,MermaidViz:()=>pn,MessageCanvas:()=>Ut,MessageSpace:()=>Zt,MultimodalInput:()=>$e,Multipart:()=>nr,OpenLayersMap:()=>pt,PDFViewer:()=>Te,ParticipantsContainer:()=>br,PerspectiveViz:()=>xn,PlotlyGraph:()=>wn,PopoverMenu:()=>We,PromptBuilder:()=>Er,Prompts:()=>Or,Question:()=>Dr,RechartsTimeSeries:()=>ln,Sound:()=>At,StreamingText:()=>Zr.A,Table:()=>Xr,Text:()=>rr.A,TextInput:()=>Je,TextToSpeech:()=>_t,Timestamp:()=>Wt,UniformsForm:()=>D.UniformsForm,Uploader:()=>Ke,VegaLiteViz:()=>En,Video:()=>It,Weather:()=>Tn,YoutubeVideo:()=>en,generateTheme:()=>On.generateTheme,rusticDarkTheme:()=>On.rusticDarkTheme,rusticLightTheme:()=>On.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 m=a.n(d),p=a(6989),f=a.n(p),h=a(6182);const g=require("@mui/material/useMediaQuery");var v=a.n(g),x=a(2015),b=a.n(x),y=function(){return y=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},y.apply(this,arguments)};function j(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function w(e){var t=(0,h.useTheme)(),r=v()(t.breakpoints.up("md"));return(0,o.jsx)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":y({},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":y({},t.typography.caption)},children:(0,o.jsx)(u(),{plugins:[m(),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(j)})})}const S=require("@codemirror/language"),k=require("@codemirror/language-data"),C=require("@codemirror/state"),F=require("@codemirror/view");var N=a(785),E=a.n(N);const T=require("@mui/system");function O(e){var t=(0,x.useRef)(null),r=(0,x.useRef)(),n=new C.Compartment,a=[C.EditorState.readOnly.of(!0),(0,F.highlightSpecialChars)(),(0,S.syntaxHighlighting)(S.defaultHighlightStyle,{fallback:!0}),n.of([])],i=k.languages.find((function(t){return t.name.toLowerCase()===e.language.toLowerCase()}));return(0,x.useEffect)((function(){if(t.current&&!r.current){var o=t.current,s=C.EditorState.create({doc:e.code,extensions:a});r.current=new F.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.jsx)(T.Box,{sx:{backgroundColor:"background.default"},className:"rustic-code-snippet",children:(0,o.jsx)("div",{"aria-label":"code snippet",ref:t,children:(0,o.jsx)(E(),{variant:"body2","aria-label":"language type",children:e.language})})})}var D=a(9528),P=function(){return P=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},P.apply(this,arguments)};const L=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?b().createElement(n,P(P({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)(E(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var A=a(9767);const M=require("@mui/material/CircularProgress");var R,I=a.n(M),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){return e.charAt(0).toUpperCase()+e.slice(1)};function _(e,t){return function(e,t){var r,n=new Date(e),a=navigator.language;return r=t===R.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(a,r)}(e,t<=1?R.HOUR:R.MONTH_DATE)}function z(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 H(e,t){var r={};return e&&(r={width:e}),t&&(r=q(q({},r),{height:t})),e||t||(r={className:"rustic-fit-container"}),r}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 U(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(R||(R={}));var V=function(){return V=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},V.apply(this,arguments)};function G(e){var t=(0,x.useState)(!0),r=t[0],n=t[1],a=(0,x.useState)(""),i=a[0],s=a[1];return i.length>0?(0,o.jsx)(E(),{variant:"body2",children:i}):(0,o.jsxs)("figure",{children:[r&&(0,o.jsx)(I(),{}),(0,o.jsx)("img",V({},H(e.width,e.height),{src:e.src,alt:e.alt,onError:function(){s("Image failed to load"),n(!1)},onLoad:function(){n(!1)}})),e.description&&(0,o.jsx)("figcaption",{children:(0,o.jsx)(E(),{variant:"body2",children:e.description})})]})}G.defaultProps={alt:"An image is displayed"};var K=a(3903),Q=a(909),Y=a.n(Q);const $=require("@mui/material/InputAdornment");var X=a.n($);const Z=require("@mui/material/MenuItem");var J=a.n(Z);const ee=require("@mui/material/MenuList");var te=a.n(ee);const re=require("@mui/material/Popover");var ne=a.n(re);const ae=require("@mui/material/TextField");var ie=a.n(ae),oe=a(4603),se=a.n(oe),ce=a(8342);const le=function(e){var t=(0,h.useTheme)(),r=(0,x.useRef)(null),n=(0,x.useRef)(null),i=(0,x.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,x.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,x.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)(se(),{title:"Emoji",children:(0,o.jsx)(Y(),{size:"small",ref:r,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(A.A,{name:"Mood"})})}),n.current&&(0,o.jsx)(ne(),{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 ue={"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 de(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var me=(0,x.forwardRef)((function(e,t){var r=(0,x.useState)(""),n=r[0],a=r[1],i=(0,x.useState)(!1),s=i[0],c=i[1],l=(0,x.useState)(!1),u=l[0],d=l[1],m=(0,x.useState)(!1),p=m[0],h=m[1],g=(0,x.useState)(""),v=g[0],b=g[1],y=(0,x.useState)([]),j=y[0],w=y[1],S=(0,x.useState)(!1),k=S[0],C=S[1],F=(0,x.useRef)(null),N=new ce.Database({dataSource:e.emojiDataSource}),T=!n.trim().length&&!e.isSendEnabled,O="".concat(s?"Stop":"Start"," speech to text"),D=u?"primary.main":"primary.light",P=s?"error.main":D,L=s?"stop_circle":"speech_to_text";function M(e,t){if(void 0===t&&(t=!1),F.current){var r=F.current,i=r.selectionStart,o=r.selectionEnd;if("number"==typeof i&&"number"==typeof o){var s,c=n||"",l=c.substring(0,i),u=c.substring(o);s=t?l.replace(/:(\w+)$/,e)+u:l+e+u,a(s);var d=t?l.replace(/:(\w+)$/,e).length:i+e.length;setTimeout((function(){var e,t;null===(e=F.current)||void 0===e||e.focus(),null===(t=F.current)||void 0===t||t.setSelectionRange(d,d)}),0)}}C(!1)}var R=p?(0,o.jsx)(I(),{size:24}):(0,o.jsx)(se(),{title:O,children:(0,o.jsx)(Y(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,s?(e.stop(),h(!0),c(!1)):(e.start(),b(""),c(!0)),e.onstart=function(){c(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;n.length>0?a(n+" "+r):a(r),null===(t=F.current)||void 0===t||t.focus(),c(!1)},e.onerror=function(e){var t=ue[e.error];b(t),c(!1)},e.onend=function(){h(!1),c(!1)}},size:"small",sx:{color:P,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(A.A,{name:L})})});function q(){var t=(new Date).toISOString(),r={id:(0,K.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:U(n)};e.send(r),a(""),b("")}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)(E(),{variant:"caption",color:"error",className:"rustic-error-message",children:v})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:u?"secondary.main":"action.disabled"},children:[j.length>0&&(0,o.jsx)(ne(),{open:k,anchorEl:F.current,onClose:function(){return C(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,o.jsx)(te(),{children:j.map((function(e,t){return"unicode"in e&&(0,o.jsx)(J(),{onClick:function(){return M(e.unicode,!0)},children:de(e)},t)}))})}),(0,o.jsx)(ie(),{className:"rustic-text-field",variant:"outlined",value:n,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),T||q())},onChange:function(t){b("");var r=t.target.value;a(r);var n,i=r.match(/:(\w{2,}):/g),o=r.match(/:(\w{2,})/g);if(i){var s=i[0].replace(/:/g,"");N.getEmojiByShortcode(s).then((function(e){if(e&&"unicode"in e){var t=r.replace(i[0],e.unicode);a(t)}else a(r)})).catch((function(){a(r)})),C(!1)}else o?(n=o[0].replace(":",""),N.getEmojiBySearchQuery(n).then((function(t){t.length?(w(t.slice(0,e.maximumEmojiSearchResults)),C(!0)):(w([]),C(!1))})).catch((function(){w([]),C(!1)}))):C(!1)},onFocus:function(){return d(!0)},onBlur:function(){return d(!1)},inputRef:F,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(X(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(le,{dataSource:e.emojiDataSource,onEmojiClick:M,buttonColor:D}),e.enableSpeechToText&&R]})},inputLabel:{className:u?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(f(),{className:"rustic-input-actions",children:[e.children,(0,o.jsx)(se(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(Y(),{"aria-label":"send message",onClick:q,disabled:T,color:"secondary",children:(0,o.jsx)(A.A,{name:"send"})})})})]})]})}));me.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const pe=me,fe=require("@mui/material/LinearProgress");var he=a.n(fe);const ge=require("axios");var ve=a.n(ge);const xe=require("react-dom"),be=require("@mui/material/Card");var ye=a.n(be);const je=require("@mui/material/Modal");var we=a.n(je);const Se=require("@mui/system/Stack");var ke=a.n(Se);const Ce=require("@mui/system/useTheme");var Fe=a.n(Ce);const Ne=require("pdfjs-dist"),Ee=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)(se(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(Y(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(A.A,{name:r.symbol})})})})},Te=function(e){var t,r=(0,x.useRef)(null),n=(0,x.useState)(1),a=n[0],i=n[1],s=(0,x.useState)(1),c=s[0],l=s[1],u=(0,x.useState)(1),d=u[0],m=u[1],p=(0,x.useState)(!1),h=p[0],g=p[1],b=(0,x.useState)(),y=b[0],j=b[1],w=Fe()(),S=v()(w.breakpoints.down("sm")),k=v()(w.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(E(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var C=(0,x.useState)((function(){return S?.5:k?1:1.5})),F=C[0],N=C[1];return(0,x.useEffect)((function(){Ne.GlobalWorkerOptions.workerSrc||(Ne.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Ne.version,"/pdf.worker.mjs")),Ne.getDocument({url:"".concat(e.url)}).promise.then((function(e){l(e.numPages),function(e){e.getPage(a).then((function(e){var t=e.getViewport({scale:F}),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]};y&&y.cancel();var s=e.render(o);j(s),s.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,a,F]),h?(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(E(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(f(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(Ee,{action:"zoomOut",onClick:function(){N((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(Ee,{action:"zoomIn",onClick:function(){N((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)(ke(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(Ee,{action:"previousPage",onClick:function(){a>1&&(i(a-1),m(a-1))},isDisabled:1===a}),(0,o.jsx)(E(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(ie(),{type:"number",value:d,onChange:function(e){var t=parseInt(e.target.value);m(t),!isNaN(t)&&t>=1&&t<=c&&i(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(E(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Ee,{action:"nextPage",onClick:function(){a<c&&(i(a+1),m(a+1))},isDisabled:a===c})]})]})};var Oe={pdf:Te};function De(e){var t=(0,h.useTheme)(),r=(0,x.useState)(!1),n=r[0],a=r[1];function i(){a(!1)}var s,c,l=e.file.url&&(s=e.file.url.split("."))[s.length-1].toLowerCase(),u=l&&e.supportedViewers?e.supportedViewers[l]:null,d=!!u,m=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",p=d?" rustic-cursor-pointer":"",f="rustic-file-preview ".concat(m).concat(p),g=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(ye(),{className:f,variant:"outlined",sx:{boxShadow:t.shadows[1]},onClick:function(){a(!0)},children:[(0,o.jsx)(E(),{variant:"subtitle2",className:"rustic-file-preview-name",children:g}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),d&&(0,o.jsx)(we(),{open:n,onClose:i,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(se(),{title:"Close",children:(0,o.jsx)(Y(),{onClick:i,className:"rustic-close-button",children:(0,o.jsx)(A.A,{name:"close"})})}),e.file.url&&(0,o.jsx)(u,{url:e.file.url})]})})]})}De.defaultProps={supportedViewers:Oe,showFullName:!0};var Pe=a(3110);const Le=require("@mui/material"),Ae=require("@mui/material/Button");var Me=a.n(Ae);const Re=require("@mui/material/Drawer");var Ie=a.n(Re);const qe=require("@mui/material/ListItemText");var Be=a.n(qe);const _e=require("@mui/material/Menu");var ze=a.n(_e),He=function(){return He=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},He.apply(this,arguments)};function We(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useRef)(null),i=(0,h.useTheme)(),s=(0,Le.useMediaQuery)(i.breakpoints.down("md")),c=s?Ie():ze(),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)(Be(),{children:(0,o.jsx)(E(),{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=He(He({},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)(J(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)(J(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:u(e)},e.label)}));var m,p,f=s?{}:{anchorEl:a.current};return(0,o.jsxs)(o.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},p=(0,o.jsx)(A.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(Me(),He({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(se(),{title:e.ariaLabel,children:(0,o.jsx)(Y(),He({},m,{children:e.icon?e.icon:p}))})),(0,o.jsx)(c,He({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":He(He({},l),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:d}))]})}var Ue=function(){return Ue=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},Ue.apply(this,arguments)},Ve=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 Ge(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 Ke=function(e){var t,r=(0,x.useState)([]),n=r[0],a=r[1],i=(0,x.useState)([]),s=i[0],c=i[1],l=(0,x.useState)({}),u=l[0],d=l[1],m=(0,x.useRef)({}),p=(0,K.v4)();(0,x.useEffect)((function(){a([]),c([]),m.current={}}),[e.messageId]);var h=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function g(e,t,r){var n;m.current=Ue(Ue({},m.current),((n={})[e]=m.current[e]--,n)),function(e,t,r){c((function(t){return Ve(Ve([],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 v=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,o.jsx)(De,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(he(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(se(),{title:"Delete",children:(0,o.jsx)(Y(),{color:"primary",onClick:function(){return function(t,r){var n,i;c([]);var o=t.name;if(m.current=Ue(Ue({},m.current),((n={})[o]=m.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){ve().delete(s,Ue({},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 Ve(Ve([],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}))})),m.current=Ue(Ue({},m.current),((i={})[o]=m.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)}))}),b=(0,o.jsx)(f(),{children:s.map((function(e,t){return(0,o.jsx)(E(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function y(e,t){return t?(0,xe.createPortal)(e,t):e}var j=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(p);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,o.jsx)(Pe.default,{name:t.iconName})}}));return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(f(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:p,children:(null==j?void 0:j.length)?(0,o.jsx)(We,{ariaLabel:"Upload",icon:(0,o.jsx)(Pe.default,{name:"upload_2"}),menuItems:j}):(0,o.jsx)(se(),{title:"Upload",children:(0,o.jsx)(Y(),{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:p,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 Ve(Ve([],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 Ve(Ve([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&Ge(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,i=function(e){var t,r,n=e.name,a=m.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),m.current=Ue(Ue({},m.current),((t={})[e.name]=i,t))}else m.current=Ue(Ue({},m.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=Ue(Ue({},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,K.v4)(),d={name:i,loadingProgress:0,abortController:n,id:l};function p(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?Ue(Ue({},e),{loadingProgress:t}):e}));return n})))}a((function(e){return Ve(Ve([],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 ve().post(f,r,Ue(Ue({},s),{onUploadProgress:p,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=Ve([],e,!0);return r[t]=Ue(Ue({},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 m,p,f,h;409===(null===(s=n.response)||void 0===s?void 0:s.status)&&e.listFiles?(m=i.lastIndexOf("."),p=i.substring(0,m),f=i.substring(m),h=new RegExp("^".concat(p.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(p,"(").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?Ue(Ue({},e),{name:n,loadingProgress:0}):e}))})),o()})).catch((function(){var e;g(t.name,d.id,null===(e=n.response)||void 0===e?void 0:e.data)})):g(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&&y(b,e.errorMessagesContainer),n.length>0&&y(v,e.filePreviewsContainer)]})};var 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)},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 $e(e){var t=(0,x.useState)({uploaded:[],fileList:[]}),r=t[0],n=t[1],a=(0,x.useState)((0,K.v4)()),i=a[0],s=a[1],c=(0,x.useState)(),l=c[0],u=c[1],d=(0,x.useState)(),m=d[0],p=d[1],g=(0,x.useRef)(null),v=(0,h.useTheme)(),b=r.uploaded.length===r.fileList.length&&r.uploaded.length>0;return(0,x.useEffect)((function(){g.current&&(p(g.current.querySelector(".rustic-error-container")),u(g.current.querySelector(".rustic-input-extras")))})),(0,o.jsx)(f(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(v.palette.action.disabled),borderRadius:"".concat(v.shape.borderRadius,"px"),":focus-within":{borderColor:v.palette.secondary.main},background:v.palette.background.paper},children:(0,o.jsx)(pe,Qe({},e,{send:function(t){b&&(t.id=i,t.format="chatCompletionRequest",t.data=U(t.data.text,r.uploaded.map((function(e){return{url:e.url,name:e.name}})))),e.ws.send(t),s((0,K.v4)()),n({uploaded:[],fileList:[]})},isSendEnabled:b,ref:g,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Ke,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)n((function(e){return Qe(Qe({},e),{fileList:Ye(Ye([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");n((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),a=Ye(Ye(Ye([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Qe(Qe({},e),{uploaded:a})}))}else n((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:i,filePreviewsContainer:l,errorMessagesContainer:m,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions,listFiles:e.listFiles,getUploadHeaders:e.getUploadHeaders})})}))})}$e.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};var Xe=function(){return Xe=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},Xe.apply(this,arguments)},Ze=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 Je(e){var t=e.ws,r=Ze(e,["ws"]);return(0,o.jsx)(pe,Xe({},r,{send:function(e){t.send(e)}}))}require("ol/ol.css");var et=a(5642),tt=a.n(et);const rt=require("ol/layer/Tile.js");var nt=a.n(rt);const at=require("ol/Map.js");var it=a.n(at);const ot=require("ol/Overlay.js");var st=a.n(ot);const ct=require("ol/proj.js"),lt=require("ol/source/OSM.js");var ut=a.n(lt);const dt=require("ol/View.js");var mt=a.n(dt);function pt(e){var t=(0,x.useState)(""),r=t[0],n=t[1],a=(0,x.useRef)(null),i=(0,x.useRef)(null);return(0,x.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(it())({layers:[new(nt())({source:new(ut())})],view:new(mt())({center:(0,ct.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(st())({element:i.current,position:(0,ct.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)(tt(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[(0,o.jsx)(f(),{ref:i,children:(0,o.jsx)(A.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:a,className:"rustic-open-layers-map-canvas"})]})})}var ft=a(7447),ht=a.n(ft);const gt=require("marked");function vt(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=gt.marked.parse(t);return ht().sanitize(r)}const xt=function(e){var t=(0,x.useState)(vt(e.text)),r=t[0],n=t[1];return(0,x.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;n(vt(t))}}),[e.text,e.updatedData]),(0,o.jsx)(E(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}})},bt=function(e){var t=(0,x.useState)(vt(e.text)),r=t[0],n=t[1],a=(0,x.useState)(""),i=a[0],s=a[1];return(0,x.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(vt(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(E(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),i&&(0,o.jsx)(tt(),{severity:"error",children:i})]})},yt=require("@mui/material/Slider");var jt=a.n(yt);function wt(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)(se(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Y(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(A.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var St=100;function kt(e){var t="dark"===(0,Le.useTheme)().palette.mode,r=z(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*St;return(0,o.jsx)(he(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(jt(),{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 z(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function Ct(e){var t=(0,x.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,x.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)(wt,{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)(jt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*St,"%"),value:r,onChange:function(t,r){var a=r;e.mediaElement.muted=0===a,e.mediaElement.volume=a,n(e.mediaElement.volume)}})]})}function Ft(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(Me(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(A.A,{name:t}),children:(0,o.jsx)(E(),{variant:"overline",children:r})})}function Nt(e){var t=(0,x.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)(wt,{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 Et(e){var t,r=(0,x.useState)(e.mediaElement.playbackRate),n=r[0],a=r[1];return(0,o.jsx)(se(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Me(),{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)(E(),{variant:"body1",children:[n,"X"]})})})}function Tt(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)(wt,{onClick:r,action:n})}function Ot(e){var t=z(e.elapsedTimeInSeconds),r=z(e.durationTimeInSeconds),n="".concat(t," / ").concat(r);return"wide"===e.style?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(E(),{variant:"overline",children:t}),(0,o.jsx)(E(),{variant:"overline",children:r})]}):(0,o.jsx)(E(),{variant:"overline",className:"rustic-time-display",children:n})}Ot.defaultProps={style:"condensed"};const Dt=require("@mui/material/Divider");var Pt=a.n(Dt);function Lt(e){var t=!!document.fullscreenElement;return(0,o.jsxs)(T.Box,{className:"rustic-transcript-container",children:[!t&&(0,o.jsx)(Pt(),{orientation:"vertical",flexItem:!0}),(0,o.jsx)(E(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function At(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(0),m=d[0],p=d[1],f=(0,x.useState)(""),h=f[0],g=f[1],v=(0,x.useState)(""),b=v[0],y=v[1],j=(0,Le.useTheme)(),w=(0,x.useRef)(null),S=(0,Le.useMediaQuery)(j.breakpoints.down("md"));function k(){return(0,o.jsx)(E(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function C(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(wt,{action:t,onClick:function(){return s(!i)}})}}function F(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Tt,{mediaElement:w.current,movement:"replay"}),(0,o.jsx)(Nt,{mediaElement:w.current,onError:y}),(0,o.jsx)(Tt,{mediaElement:w.current,movement:"forward"})]})}function N(){if(e.transcript&&r)return(0,o.jsx)(Lt,{transcript:e.transcript})}function O(){if(e.transcript)return(0,o.jsx)(Ft,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function D(){return(0,o.jsx)("video",{src:e.src,ref:w,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,x.useEffect)((function(){var e,t,r,n;function a(e){g(e)}null===(e=w.current)||void 0===e||e.addEventListener("timeupdate",(function(){w.current&&p(w.current.currentTime)})),null===(t=w.current)||void 0===t||t.addEventListener("canplay",(function(){g(""),u(!1)})),null===(r=w.current)||void 0===r||r.addEventListener("error",(function(){return a("Failed to load the audio.")})),null===(n=w.current)||void 0===n||n.addEventListener("stalled",(function(){return a("Failed to fetch audio data, but trying.")}))}),[]);var P=S?function(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Ot,{elapsedTimeInSeconds:m,durationTimeInSeconds:w.current.duration,style:"wide"}),(0,o.jsx)(kt,{mediaElement:w.current}),k(),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-left",children:F()}),(0,o.jsx)(Ct,{mediaElement:w.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[O(),(0,o.jsxs)(T.Box,{children:[C(),(0,o.jsx)(Et,{mediaElement:w.current})]})]})]}),N()]})}:function(){if(w.current)return(0,o.jsxs)(o.Fragment,{children:[k(),(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(kt,{mediaElement:w.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-left",children:[F(),C(),(0,o.jsx)(Et,{mediaElement:w.current}),(0,o.jsx)(Ct,{mediaElement:w.current}),(0,o.jsx)(Ot,{elapsedTimeInSeconds:m,durationTimeInSeconds:w.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:O()})]}),N()]})]})};return h.length>0?(0,o.jsx)(tt(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[D(),(0,o.jsx)(I(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[D(),P(),b.length>0&&(0,o.jsx)(tt(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b})]})}function Mt(e){var t=(0,x.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)(wt,{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 Rt(e){var t=(0,x.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)(wt,{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 It(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(!!document.fullscreenElement),m=d[0],p=d[1],f=(0,x.useState)(!1),h=f[0],g=f[1],v=(0,x.useState)(""),b=v[0],y=v[1],j=(0,x.useState)(""),w=j[0],S=j[1],k=(0,x.useState)(0),C=k[0],F=k[1],N=(0,x.useRef)(null),O=(0,x.useRef)(null),D=(0,Le.useTheme)(),P=(0,Le.useMediaQuery)(D.breakpoints.down("md"));(0,x.useEffect)((function(){var e,t,r,n,a,i,o,s;function c(e){S(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return g(!1)}),3e3)}null===(e=O.current)||void 0===e||e.addEventListener("timeupdate",(function(){O.current&&F(O.current.currentTime)})),null===(t=O.current)||void 0===t||t.addEventListener("canplay",(function(){S(""),u(!1)})),null===(r=O.current)||void 0===r||r.addEventListener("error",(function(){return c("Failed to load the video.")})),null===(n=O.current)||void 0===n||n.addEventListener("stalled",(function(){return c("Failed to fetch video data, but trying.")})),document.addEventListener("fullscreenchange",(function(){p(!!document.fullscreenElement)})),null===(a=N.current)||void 0===a||a.addEventListener("mousemove",(function(){g(!0),l()})),null===(i=N.current)||void 0===i||i.addEventListener("mouseleave",(function(){g(!1)})),null===(o=N.current)||void 0===o||o.addEventListener("keydown",(function(){g(!0),l()}))}),[]);var L={backgroundColor:D.palette.background.paper,opacity:h?1:0};function A(){if(e.transcript&&r)return(0,o.jsx)(Lt,{transcript:e.transcript})}function M(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(wt,{action:t,onClick:function(){return s(!i)}})}}function R(){if(e.transcript)return(0,o.jsx)(Ft,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var q=P?function(){return m?(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:L,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(Nt,{mediaElement:O.current,onError:y}),(0,o.jsx)(kt,{mediaElement:O.current}),(0,o.jsx)(Ot,{elapsedTimeInSeconds:C,durationTimeInSeconds:O.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)(Tt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:O.current,movement:"forward"}),M(),(0,o.jsx)(Et,{mediaElement:O.current})]}),R()]}),A()]})}):(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Nt,{mediaElement:O.current,onError:y}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[R(),(0,o.jsx)(Rt,{element:N.current,onError:y})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:L,children:[(0,o.jsx)(kt,{mediaElement:O.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)(Nt,{mediaElement:O.current,onError:y}),(0,o.jsx)(Tt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:O.current,movement:"forward"}),M(),(0,o.jsx)(Et,{mediaElement:O.current}),(0,o.jsx)(Ct,{mediaElement:O.current}),(0,o.jsx)(Ot,{elapsedTimeInSeconds:C,durationTimeInSeconds:O.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[R(),(0,o.jsx)(Mt,{mediaElement:O.current,onError:y}),(0,o.jsx)(Rt,{element:N.current,onError:y})]})]}),m&&A()]})})};return w.length>0?(0,o.jsx)(tt(),{severity:"error",children:w}):(0,o.jsxs)(T.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(I(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(T.Box,{ref:N,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[b.length>0&&(0,o.jsx)(tt(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b}),(!P||m)&&function(){if(O.current&&N.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:L,children:[(0,o.jsx)(E(),{variant:"body2",children:e.title}),m&&P&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(Mt,{mediaElement:O.current,onError:y}),(0,o.jsx)(Rt,{element:N.current,onError:y})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:O,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),q()]}),!m&&A()]})}var qt=a(4445);function Bt(e){var t=(0,x.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(qt.default,{message:e.message,icon:(0,o.jsx)(A.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 _t(e){var t=(0,x.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)(qt.default,{message:e.message,icon:(0,o.jsx)(A.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})}const zt=require("@mui/material/Stack");var Ht=a.n(zt);const Wt=function(e){return(0,o.jsx)(E(),{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},Ut=(0,x.forwardRef)((function(e,t){var r=(0,Le.useTheme)(),n=e.inReplyTo?e.inReplyTo:e.message;return(0,o.jsxs)(Ht(),{id:n.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(Ht(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(n),(0,o.jsx)(Wt,{timestamp:n.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(E(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,o.jsx)(Wt,{timestamp:e.message.timestamp})]})]})]})})),Vt=require("@mui/material/Chip");var Gt=a.n(Vt);const Kt=require("@mui/system/Box");var Qt=a.n(Kt),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)},$t=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 Xt(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var n=Yt({},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]=[Yt(Yt({},a),{data:Yt(Yt({},a.data),t.data)}),t]:n[r]=$t($t([],n[r],!0),[t],!1),n}function Zt(e){var t,r,n,a=(0,x.useRef)(null),i=(0,x.useRef)(null),s=(0,x.useRef)(),c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(!0),m=d[0],p=d[1],f=(0,x.useState)(!1),h=f[0],g=f[1],v=(0,x.useState)({}),b=v[0],y=v[1],j=Object.keys(b).length,w=(r=j,n=(0,x.useRef)(0),(0,x.useEffect)((function(){n.current=r})),n.current);function S(){p(!0),s.current&&clearTimeout(s.current),s.current=setTimeout((function(){p(!1)}),2e3)}function k(){var e=i.current,t=a.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;u(n-1<=r)}}function C(){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;g(!0),e&&setTimeout((function(){S(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(C,1)}function F(e){y((function(t){return Xt(t,e)}))}return(0,x.useEffect)((function(){var e=i.current;if(k(),e)return e.addEventListener("scroll",k),window.addEventListener("resize",k),function(){e.removeEventListener("scroll",k),window.removeEventListener("resize",k)}}),[l]),(0,x.useEffect)((function(){C()}),[h]),(0,x.useEffect)((function(){l&&0!==w&&j>w&&(S(),C())}),[l,Object.keys(b).length]),(0,x.useEffect)((function(){var t,r={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=Xt(r,e);r=t})),y(r)}),[null===(t=e.receivedMessages)||void 0===t?void 0:t.length]),(0,x.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(F)}),[]),(0,o.jsxs)(Qt(),{className:"rustic-message-space",children:[(0,o.jsxs)(Qt(),{ref:i,className:"rustic-message-container",children:[Object.keys(b).map((function(t,r){var n,i=b[t],s=i[i.length-1],c=s.format.includes("Response"),l=c&&{inReplyTo:i[0]};return"prompts"!==s.format?(0,o.jsx)(Ut,Yt({message:s},l,{getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===j-1?a:null,children:(0,o.jsx)(L,{ws:e.ws,sender:e.sender,messages:c?[i[0]]:i,supportedElements:e.supportedElements})}),t):"inConversation"===(null===(n=s.data)||void 0===n?void 0:n.position)?(0,o.jsx)("div",{ref:r===j-1?a:null,children:(0,o.jsx)(L,{ws:e.ws,sender:e.sender,messages:c?[i[0]]:i,supportedElements:e.supportedElements})},t):void 0})),!l&&!m&&(0,o.jsx)(Gt(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:C,label:(0,o.jsxs)(o.Fragment,{children:[e.scrollDownLabel,(0,o.jsx)(A.A,{name:"arrow_downward"})]})})]}),function(t){var r,n=Object.values(t).flat(),a=n[n.length-1];return"prompts"===(null==a?void 0:a.format)&&"inConversation"!==(null===(r=null==a?void 0:a.data)||void 0===r?void 0:r.position)?(0,o.jsx)(L,{ws:e.ws,sender:e.sender,messages:[a],supportedElements:e.supportedElements}):null}(b)]})}Zt.defaultProps={scrollDownLabel:"Scroll down"};var Jt=a(2500);function er(e){return new URL(e).pathname.split("/").pop()}function tr(e){return(0,o.jsx)(f(),{className:"rustic-multipart",children:e.messages.map((function(t){return"string"==typeof t.content?(0,o.jsx)(Jt.default,{text:t.content}):(r=t.content,n=[],a="",r.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||er(r)},s=(0,o.jsx)(De,{file:i,showFullName:e.showFullName,children:i.url&&(0,o.jsx)(se(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(Y(),{component:"a",href:i.url,download:i.name,children:(0,o.jsx)(Pe.default,{name:"download"})})})});n.push(s)}})),(0,o.jsxs)(o.Fragment,{children:[a.length>0&&(0,o.jsx)(Jt.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]}));var r,n,a}))})}var rr=a(7131);function nr(e){return(0,o.jsxs)(Qt(),{className:"rustic-multipart",children:[e.text&&(0,o.jsx)(rr.A,{text:e.text}),(t=e.files.map((function(t,r){return(0,o.jsx)(De,{file:t,showFullName:e.showFullName,children:t.url&&(0,o.jsx)(se(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(Y(),{component:"a",href:t.url,download:t.name,children:(0,o.jsx)(A.A,{name:"download"})})})},r)})),(0,o.jsx)(Qt(),{className:"rustic-files",children:t}))]});var t}const ar=require("@mui/material/Dialog");var ir=a.n(ar);const or=require("@mui/material/DialogTitle");var sr=a.n(or);const cr=require("@mui/material/List");var lr=a.n(cr);const ur=require("@mui/material/ListItem");var dr=a.n(ur);const mr=require("@mui/material/ListSubheader");var pr=a.n(mr);const fr=require("pluralize");var hr,gr,vr=a.n(fr);function xr(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(vr()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(E(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(lr(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(pr(),{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)(E(),{variant:"subtitle2",color:"text.secondary",children:s})]}),a>3&&(0,o.jsx)(Me(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(A.A,{name:"keyboard_arrow_down"}),children:c})]}),children:i.map((function(e){return(0,o.jsxs)(dr(),{className:"rustic-participant-list-item",children:[(0,o.jsx)(E(),{variant:"subtitle2",children:e.displayName}),(0,o.jsx)(E(),{variant:e.participantRole===hr.Owner?"subtitle2":"caption",children:B(e.participantRole)})]},e.id)}))})}!function(e){e.Owner="owner",e.Member="member"}(hr||(hr={})),function(e){e.Human="human",e.Agent="agent"}(gr||(gr={}));const br=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===hr.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,gr.Human),n=t(e.participants,gr.Agent),a="".concat(vr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(ir(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(sr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:a}),(0,o.jsx)(xr,{participantType:"Human",participantTypeIcon:(0,o.jsx)(A.A,{name:"account_circle"}),participants:r}),n.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Pt(),{className:"rustic-participants-container-divider"}),(0,o.jsx)(xr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(A.A,{name:"smart_toy"}),participants:n})]})]})},yr=require("@mui/material/DialogActions");var jr=a.n(yr);const wr=require("@mui/material/DialogContent");var Sr=a.n(wr);const kr=require("@mui/material/DialogContentText");var Cr=a.n(kr),Fr=function(){return Fr=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},Fr.apply(this,arguments)},Nr=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 Er(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!1),l=c[0],u=c[1],d=(0,x.useState)(!1),m=d[0],p=d[1],f=(0,x.useState)([]),h=f[0],g=f[1],v=(0,x.useState)(null),b=v[0],y=v[1],j=(0,T.useTheme)(),w=h[h.length-1],S=Fr(Fr({},e.ws),{send:function(e){y(e)}});function k(e){g((function(t){return Nr(Nr([],t,!0),[e],!1)}))}function C(){if(b){var t=Fr(Fr({},b),{threadId:e.messageId});e.ws.send(t)}}if((0,x.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(k)}),[e.ws]),(0,x.useEffect)((function(){h.length>0&&(w&&w.sender.id!==e.sender.id&&s(!1),"promptBuilder"===w.format&&w.data.isLastQuestion&&n(!0))}),[h.length]),0!==h.length)return(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(ir(),{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(j.palette.divider)}},children:[(0,o.jsx)(sr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(Pt(),{}),(0,o.jsx)(Sr(),{children:(0,o.jsx)(Cr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(jr(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(Me(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(A.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(Me(),{variant:"contained",color:"primary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(E(),{color:"text.secondary",children:"Prompt Builder"}),(0,o.jsx)(Pt(),{className:"rustic-prompt-builder-divider"}),(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!m&&h.length>0)return h.map((function(t){if(t.sender.id!==e.sender.id&&"promptBuilder"!==t.format)return(0,o.jsx)(L,{ws:S,sender:e.sender,messages:[t],supportedElements:e.supportedElements},t.id)}))}(),i&&(0,o.jsx)(I(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,o.jsx)(o.Fragment,{children:!m&&(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)(Me(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(A.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(Me(),{variant:"outlined",color:"secondary",endIcon:(0,o.jsx)(A.A,{name:"chevron_right"}),onClick:function(){C(),y(null),s(!0)},disabled:!b,"aria-disabled":!b,children:"Next question"})]}),r&&(0,o.jsx)(T.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,o.jsx)(Me(),{variant:"contained",color:"primary",onClick:function(){C(),p(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}var Tr=function(){return Tr=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},Tr.apply(this,arguments)};function Or(e){var t=Fe()(),r=e.prompts.map((function(r,n){return(0,o.jsx)(Gt(),{onClick:function(){return t=r,n=(new Date).toISOString(),a={id:(0,K.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t}},void e.ws.send(a);var t,n,a},color:"secondary",size:"small",className:"rustic-prompt",sx:Tr(Tr({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 Dr(e){var t=(0,x.useState)(""),r=t[0],n=t[1],a=(0,Le.useTheme)(),i=(0,Le.useMediaQuery)(a.breakpoints.down("md"))?"column":"row",s=e.options.map((function(t,a){return(0,o.jsx)(Gt(),{onClick:function(){return function(t){n(t);var r=(new Date).toISOString(),a={id:(0,K.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t},inReplyTo:e.messageId};e.ws.send(a)}(t)},color:"secondary",size:"small",sx:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r,"aria-disabled":!!r,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)(E(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",children:e.description})]}),(0,o.jsx)(Ht(),{direction:i,className:"rustic-options-container",children:s})]})}const Pr=require("@mui/material/Table");var Lr=a.n(Pr);const Ar=require("@mui/material/TableBody");var Mr=a.n(Ar);const Rr=require("@mui/material/TableCell");var Ir=a.n(Rr);const qr=require("@mui/material/TableContainer");var Br=a.n(qr);const _r=require("@mui/material/TableHead");var zr=a.n(_r);const Hr=require("@mui/material/TablePagination");var Wr=a.n(Hr);const Ur=require("@mui/material/TableRow");var Vr=a.n(Ur);const Gr=require("@mui/material/TableSortLabel");var Kr,Qr=a.n(Gr),Yr=10;function $r(){return(0,o.jsx)(A.A,{name:"expand_all"})}function Xr(e){if(0===e.data.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>Yr,i=(0,x.useState)({}),s=i[0],c=i[1],l=(0,x.useState)(a?Yr:-1),u=l[0],d=l[1],m=(0,x.useState)(0),p=m[0],f=m[1],h=(0,Le.useTheme)(),g=Array.from(new Set(e.data.flatMap((function(e){return Object.keys(e)})))),v=e.headers||g.map((function(e){return{dataKey:e}})),b=(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===Kr.Descending?1:-1:e[r]>t[r]?n===Kr.Descending?-1:1:0})):t),y=b.slice(p*u,p*u+u),j=u>0?y:b;function w(e){if(!s[e])return $r}return(0,o.jsxs)(Ht(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(E(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)(Br(),{className:"rustic-table-container",children:(0,o.jsxs)(Lr(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[v.length>0&&(0,o.jsx)(zr(),{children:(0,o.jsx)(Vr(),{children:v.map((function(e,t){return(0,o.jsx)(Ir(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(se(),{title:(r=e.dataKey,n=s[r],n?Object.keys(Kr)[Object.values(Kr).indexOf(n)]:"Sort"),children:(0,o.jsx)(Qr(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c((function(t){var r,n,a={};switch(t[e]){case Kr.Ascending:(r={})[e]=Kr.Descending,a=r;break;case Kr.Descending:a={};break;default:(n={})[e]=Kr.Ascending,a=n}return a}))}(e.dataKey)},className:"rustic-table-header",IconComponent:w(e.dataKey),children:e.label||B(e.dataKey)})})},"header-".concat(t));var r,n}))})}),(0,o.jsx)(Mr(),{children:j.map((function(e,t){return(0,o.jsx)(Vr(),{children:v.map((function(r,n){return(0,o.jsx)(Ir(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))})]})}),a&&(0,o.jsx)(Wr(),{className:"rustic-table-pagination",component:"div",count:e.data.length,rowsPerPage:u,labelRowsPerPage:"Rows:",page:p,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"}(Kr||(Kr={}));var Zr=a(1737),Jr=function(){return Jr=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},Jr.apply(this,arguments)};function en(e){var t=ht().sanitize(e.youtubeVideoId);return(0,o.jsx)("iframe",Jr({},H(e.width,e.height),{src:"https://www.youtube.com/embed/".concat(t),title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",loading:"lazy"}))}en.defaultProps={title:"Embedded video"};const tn=require("@mui/material/FormControl");var rn=a.n(tn);const nn=require("recharts");var an=function(){return an=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},an.apply(this,arguments)},on={line:nn.LineChart,bar:nn.BarChart,area:nn.AreaChart};function sn(e){var t={};return e.forEach((function(e){t[e]=!0})),t}function cn(e){var t=(0,x.useState)(e.defaultChartType||"line"),r=t[0],n=t[1],a=(0,x.useState)(null),i=a[0],s=a[1],c=(0,x.useState)(e.timeSeries),l=c[0],u=c[1],d=Fe()(),m=l.length>0?Object.keys(l[0]):[],p=m[0],f=m.slice(1),h=(0,x.useState)(sn(f)),g=h[0],v=h[1];(0,x.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=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.timeSeries,!0);e.updatedData.forEach((function(e){t=t.concat(e.timeSeries),u(t)}))}}),[e.timeSeries,e.updatedData]);var b=on[r];function y(e){i?s(null):e&&s(e.currentTarget)}function j(t,r){return g[t]?e.chartColors[r%e.chartColors.length]:"grey"}function w(e){return g[e]?"none":"line-through"}if(0===l.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available"});var S,k,C,F,N=e.timeSeries[e.timeSeries.length-1],T=(S=e.timeSeries[0][p],k=N[p],C=new Date(S),F=new Date(k),Math.round(Math.abs((F.getTime()-C.getTime())/864e5)));return(0,o.jsxs)(Qt(),{className:"rustic-recharts-time-series",children:[!e.disableChartTypeToggle&&(0,o.jsxs)(rn(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,o.jsx)(Y(),{"aria-label":"chart options","aria-expanded":Boolean(i),"aria-haspopup":"true",onClick:y,color:"primary",children:(0,o.jsx)(A.A,{name:"more_vert"})}),(0,o.jsxs)(ze(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:i,open:Boolean(i),onClose:function(e){return y(e)},children:[(0,o.jsx)(E(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(on).map((function(e){return(0,o.jsxs)(J(),{value:e,selected:e===r,onClick:function(){return function(e){n(e),y()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,o.jsxs)(Qt(),{children:[e.title&&(0,o.jsx)(E(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",className:"rustic-recharts-time-series-description",children:e.description}),(0,o.jsx)(nn.ResponsiveContainer,{aspect:e.aspectRatio,width:e.width,maxHeight:e.maxHeight,minWidth:e.minChartWidth,children:(0,o.jsxs)(b,{data:l,margin:e.chartContainerMargin,children:[(0,o.jsx)(nn.XAxis,{dataKey:p,tickFormatter:function(e){return _(e,T)},stroke:d.palette.text.primary}),(0,o.jsx)(nn.YAxis,{domain:["auto","auto"],width:e.yAxisLabelWidth,tickFormatter:e.yAxisTickFormatter,stroke:d.palette.text.primary}),(0,o.jsx)(nn.Tooltip,{labelFormatter:function(e){return[_(e,T)]},formatter:e.tooltipFormatter,contentStyle:{color:d.palette.common.black}}),(0,o.jsx)(nn.Legend,{content:function(){return(0,o.jsx)(Qt(),{className:"rustic-recharts-time-series-legend",children:f.map((function(e,t){return(0,o.jsxs)(Qt(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=g[e]&&!f.find((function(t){return t!==e&&g[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(g)){for(var n={},a=0,i=f;a<i.length;a++){var o=i[a],s=o===e;n[o]=s}v(n)}else v(r?sn(f):an(an({},g),((t={})[e]=!g[e],t)))}(e)},sx:{color:j(e,t)},children:[(0,o.jsx)(A.A,{name:"crop_16_9"}),(0,o.jsx)(E(),{variant:"body2",display:"inline",sx:{textDecorationLine:w(e)},children:e})]},t)}))})}}),f.map((function(t,n){return g[t]?function(t,n){var a=n%e.chartColors.length,i=g[t]?e.chartColors[a]:"transparent",s={onClick:e.onClick,cursor:"pointer"};switch(r){case"line":return(0,o.jsx)(nn.Line,{type:"monotone",isAnimationActive:!1,dataKey:t,name:t,dot:!1,stroke:i,activeDot:e.onClick&&s},t);case"bar":return(0,o.jsx)(nn.Bar,{dataKey:t,fill:i,onClick:e.onClick&&s.onClick,cursor:e.onClick&&s.cursor},t);case"area":return(0,o.jsxs)(x.Fragment,{children:[(0,o.jsx)("defs",{children:(0,o.jsxs)("linearGradient",{id:"color".concat(t),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,o.jsx)("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),(0,o.jsx)("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),(0,o.jsx)(nn.Area,{isAnimationActive:!1,dataKey:t,type:"monotone",stroke:i,fillOpacity:1,fill:"url(#color".concat(t,")"),activeDot:e.onClick&&s},t)]},t)}}(t,n):null})),e.referenceLineYAxis&&e.referenceLineYAxis.map((function(t,r){return(0,o.jsx)(nn.ReferenceLine,{y:t,label:e.referenceLineLabel&&e.referenceLineLabel[r],stroke:e.referenceLineColor&&e.referenceLineColor[r],strokeDasharray:"3 3",ifOverflow:"extendDomain",strokeWidth:e.referenceLineStrokeWidth&&e.referenceLineStrokeWidth[r],isFront:!0},r)}))]})})]})]})}cn.defaultProps={minChartWidth:200,maxHeight:600,yAxisLabelWidth:30,aspectRatio:16/9,disableChartTypeToggle:!1};const ln=cn,un=require("mermaid");var dn=a.n(un),mn=function(){return mn=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},mn.apply(this,arguments)};const pn=function(e){var t=(0,x.useRef)(null),r=(0,x.useState)(),n=r[0],a=r[1],i=Fe()(),s=(0,K.v4)();return(0,x.useEffect)((function(){var r="dark"===i.palette.mode?"dark":"neutral",n=i.typography.fontFamily;t.current&&(dn().initialize(mn({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)(Ht(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(E(),{variant:"subtitle2",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",children:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(E(),{variant:"body2",children:n})]})},fn=(require("@finos/perspective-viewer/dist/esm/perspective-viewer.inline.js"),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/dist/esm/perspective.inline.js"));var hn=a.n(fn),gn=function(){return gn=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},gn.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 xn=function(e){if(0===e.data.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available."});var t=(0,x.useRef)(null),r=(0,h.useTheme)(),n=(0,x.useState)(!1),a=n[0],i=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=vn(e.headers),u="\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"===s?"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 ");var d,m,p,f,g,v,b,y,j,w=e.config&&(m=(d=e.config).groupBy,p=d.splitBy,f=d.aggregates,g=d.sort,v=d.filter,b=d.columns,y=null==g?void 0:g.map((function(e){return[l[e[0]]||e[0],e[1]]})),j=f&&Object.fromEntries(Object.entries(f).map((function(e){var t=e[0],r=e[1];return[l[t]||t,r]}))),{group_by:null==m?void 0:m.map((function(e){return l[e]||e})),split_by:null==p?void 0:p.map((function(e){return l[e]||e})),aggregates:j,sort:y,filter:v&&function(e){return e.map((function(e){return[l[e[0]]||e[0],e[1],e[e.length-1]]}))}(v),columns:null==b?void 0:b.map((function(e){return l[e]||e}))});return(0,x.useEffect)((function(){hn().worker().then((function(t){return t.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(r){t.current&&t.current.load(r).then((function(){t.current.restore(gn(gn({},w),{theme:c,title:e.title,settings:!1})).then((function(){if(t.current.shadowRoot){var e=new CSSStyleSheet;e.replaceSync(u),t.current.shadowRoot.adoptedStyleSheets.push(e)}}))})).catch((function(){i(!0)}))}))}),[e.data,c]),a?(0,o.jsx)(E(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(ke(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},bn=require("react-plotly.js");var yn=a.n(bn),jn=function(){return jn=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},jn.apply(this,arguments)};const wn=function(e){var t=jn(jn({},e.plotParams),{className:"rustic-plotly"});return t.config=jn(jn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Qt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)(yn(),jn({},t))]})},Sn=require("react-dom/server"),kn=require("vega-embed");var Cn=a.n(kn),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 Nn(e){var t=(0,x.useRef)(null),r=(0,x.useState)(!1),n=r[0],a=r[1],i=Fe()(),s="dark"===i.palette.mode,c=i.typography.fontFamily,l={backgroundColor:i.palette.primary.main,color:i.palette.background.paper,borderRadius:i.shape.borderRadius+"px",padding:"4px 8px",fontSize:i.typography.caption.fontSize,fontFamily:c,fontWeight:i.typography.caption.fontWeight},u={formatTooltip:function(e,t){return(0,Sn.renderToStaticMarkup)((0,o.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:l,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"},d=[{label:"Save as SVG"},{label:"Save as PNG"}];function m(){var r,n,i,o;if(t.current&&e.spec){var l=Fn(Fn({config:{font:c}},e.options),{theme:s?null===(r=e.theme)||void 0===r?void 0:r.dark:null===(n=e.theme)||void 0===n?void 0:n.light,tooltip:u,actions:!1});(null===(o=null===(i=e.options)||void 0===i?void 0:i.config)||void 0===o?void 0:o.font)||(l.config.font=c);var m=Fn({},e.spec);delete m.title,Cn()(t.current,m,l).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){d[a].href=e,d[a].downloadFileName="".concat(r,".").concat(n)}))})),a(!1)})).catch((function(){a(!0)}))}}return(0,x.useEffect)((function(){function e(){m()}return m(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[e.spec,s]),n?(0,o.jsx)(E(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(ke(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Qt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(We,{menuItems:d,ariaLabel:"Download options"})}),e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(xt,{text:e.description}),(0,o.jsxs)(Qt(),{textAlign:"center",mt:1,children:["string"==typeof e.spec.title&&(0,o.jsx)(E(),{variant:"subtitle2",children:e.spec.title}),e.spec.description&&(0,o.jsx)(E(),{variant:"caption",children:e.spec.description})]}),(0,o.jsx)("div",{ref:t,className:"rustic-vega-lite"})]})}const En=Nn;function Tn(e){var t=(0,x.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)),m=e.weather.map((function(e,t){if(0!==t)return(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(E(),{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)(E(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(E(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-weather",children:[(0,o.jsx)(We,{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)(Ht(),{alignItems:"center",children:[(0,o.jsx)(E(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(Ht(),{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)(E(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(E(),{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)(Ht(),{direction:"row",spacing:2,children:[(0,o.jsx)(E(),{variant:"overline",children:u}),(0,o.jsx)(E(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:m}),e.weatherProvider&&(0,o.jsxs)(Ht(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(A.A,{name:"cloud"}),(0,o.jsx)(E(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}Nn.defaultProps={theme:{dark:"dark"}};var On=a(9517);return i})()));
@@ -1,4 +1,4 @@
1
- import type { Palette, PaletteColor } from '@mui/material/styles';
1
+ import type { Palette, PaletteColor, ThemeOptions } from '@mui/material/styles';
2
2
  interface CustomPaletteColor {
3
3
  focus?: string;
4
4
  hover?: string;
@@ -12,17 +12,7 @@ declare module '@mui/material/styles' {
12
12
  secondary: PaletteColor & CustomPaletteColor;
13
13
  }
14
14
  }
15
- declare module '@mui/material/Button' {
16
- interface ButtonPropsVariantOverrides {
17
- rusticPrimary: true;
18
- rusticSecondary: true;
19
- }
20
- }
21
15
  declare module '@mui/material/Chip' {
22
- interface ChipPropsVariantOverrides {
23
- rusticPrimary: true;
24
- rusticSecondary: true;
25
- }
26
16
  interface ChipPropsSizeOverrides {
27
17
  large: true;
28
18
  }
@@ -40,6 +30,8 @@ declare module '@mui/material/Typography' {
40
30
  body1Bold: true;
41
31
  }
42
32
  }
33
+ type Colors = Record<'lightMode' | 'darkMode', Record<string, string>>;
34
+ export declare function generateTheme(mode: 'light' | 'dark', colors: Colors): ThemeOptions;
43
35
  declare let rusticLightTheme: import("@mui/material/styles").Theme;
44
36
  declare let rusticDarkTheme: import("@mui/material/styles").Theme;
45
37
  export default rusticLightTheme;
@@ -1 +1 @@
1
- {"version":3,"file":"rusticTheme.d.ts","sourceRoot":"","sources":["../src/rusticTheme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAW,MAAM,sBAAsB,CAAA;AAW1E,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAiB,aAAc,SAAQ,OAAO;QAC5C,OAAO,EAAE,YAAY,GAAG,kBAAkB,CAAA;QAC1C,SAAS,EAAE,YAAY,GAAG,kBAAkB,CAAA;KAC7C;CACF;AAED,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,2BAA2B;QACnC,aAAa,EAAE,IAAI,CAAA;QACnB,eAAe,EAAE,IAAI,CAAA;KACtB;CACF;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAU,yBAAyB;QACjC,aAAa,EAAE,IAAI,CAAA;QACnB,eAAe,EAAE,IAAI,CAAA;KACtB;IACD,UAAU,sBAAsB;QAC9B,KAAK,EAAE,IAAI,CAAA;KACZ;CACF;AAED,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,kBAAkB;QAC1B,SAAS,EAAE,KAAK,CAAC,aAAa,CAAA;KAC/B;IAGD,UAAU,yBAAyB;QACjC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;KAChC;CACF;AAGD,OAAO,QAAQ,0BAA0B,CAAC;IACxC,UAAU,+BAA+B;QACvC,SAAS,EAAE,IAAI,CAAA;KAChB;CACF;AAqRD,QAAA,IAAI,gBAAgB,sCAqOnB,CAAA;AAgGD,QAAA,IAAI,eAAe,sCAqOlB,CAAA;AAID,eAAe,gBAAgB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAA"}
1
+ {"version":3,"file":"rusticTheme.d.ts","sourceRoot":"","sources":["../src/rusticTheme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EAEZ,YAAY,EACb,MAAM,sBAAsB,CAAA;AAI7B,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAiB,aAAc,SAAQ,OAAO;QAC5C,OAAO,EAAE,YAAY,GAAG,kBAAkB,CAAA;QAC1C,SAAS,EAAE,YAAY,GAAG,kBAAkB,CAAA;KAC7C;CACF;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAU,sBAAsB;QAC9B,KAAK,EAAE,IAAI,CAAA;KACZ;CACF;AAED,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,kBAAkB;QAC1B,SAAS,EAAE,KAAK,CAAC,aAAa,CAAA;KAC/B;IAGD,UAAU,yBAAyB;QACjC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;KAChC;CACF;AAGD,OAAO,QAAQ,0BAA0B,CAAC;IACxC,UAAU,+BAA+B;QACvC,SAAS,EAAE,IAAI,CAAA;KAChB;CACF;AAED,KAAK,MAAM,GAAG,MAAM,CAAC,WAAW,GAAG,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAsJtE,wBAAgB,aAAa,CAC3B,IAAI,EAAE,OAAO,GAAG,MAAM,EACtB,MAAM,EAAE,MAAM,GACb,YAAY,CAgSd;AAED,QAAA,IAAI,gBAAgB,sCAA8C,CAAA;AAClE,QAAA,IAAI,eAAe,sCAA6C,CAAA;AAIhE,eAAe,gBAAgB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={6182:e=>{e.exports=require("@mui/material/styles")}},r={};function o(t){var i=r[t];if(void 0!==i)return i.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,o),a.exports}o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};o.r(t),o.d(t,{default:()=>re,rusticDarkTheme:()=>ee,rusticLightTheme:()=>j});var i=o(6182);const a=require("@mui/utils");var n=function(){return n=Object.assign||function(e){for(var r,o=1,t=arguments.length;o<t;o++)for(var i in r=arguments[o])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},n.apply(this,arguments)},c="#000000",s="#FFFFFF",d="#FF6928",l="#E54500",p="#FF692899",u="#FF69284D",b=(0,i.createTheme)({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:400}},palette:{common:{black:c,white:s},error:{main:"#F82A43",dark:"#C82639",light:"#FF9BA7"},warning:{main:"#FFB800",dark:"#DC8400",light:"#FFDB7D"},info:{main:"#0094FF",dark:"#005A9B",light:"#8CCFFF"}},shadows:function(e,r,o){if(o||2===arguments.length)for(var t,i=0,a=r.length;i<a;i++)!t&&i in r||(t||(t=Array.prototype.slice.call(r,0,i)),t[i]=r[i]);return e.concat(t||Array.prototype.slice.call(r))}([],(0,i.createTheme)({}).shadows.map((function(e,r){return 1===r?"0 4px 5px rgba(0, 0, 0, 0.05)":2===r?"0 4px 10px rgba(0, 0, 0, 0.1)":3===r?"0 4px 15px rgba(0, 0, 0, 0.15)":"none"})),!0)}),x={fontSize:"12px",lineHeight:1.5,letterSpacing:"0.5px",padding:"0 12px",minHeight:"26px"},g={fontSize:"14px",lineHeight:1.43,letterSpacing:"0.25px",padding:"0 16px",minHeight:"40px"},F={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"},y="#E1D9D5",m="#0000001F",h="#2D2825",f="#2D282599",v="#1E0C04",S="#9C9795",k="#00000061",z="#2D282514",M="#2D28251F",C="#2D28254D",T="#2D282580",R={fontWeight:700},D={"&.Mui-disabled":{background:s,color:S,border:"1px solid ".concat(k)}},B=n(n(n({},R),{background:h,color:s,"&:hover":{background:f},"&:active":{outline:"2px solid ".concat(f)}}),D),H=n(n(n({},R),{background:s,color:v,border:"1px solid ".concat(f),"&:active":{outline:"2px solid ".concat(f)}}),D),P={fontWeight:400,"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"}},O=n({background:C,color:v,border:"1px solid ".concat(T),"&:hover":{border:"1px solid ".concat(T),background:z},"&:active":{outline:"2px solid ".concat(T),background:M},"&.Mui-disabled":{background:k,opacity:100,border:"none",color:s,"& .MuiChip-icon":{color:s}},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:v}},P),W=n({background:s,color:v,boxSizing:"border-box",border:"1px solid ".concat(p),"&:active":{outline:"2px solid ".concat(p)},"&.Mui-disabled":{border:"1px solid ".concat(p),background:s,color:p,opacity:100},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:v}},P),j=(0,i.createTheme)((0,a.deepmerge)(b,{palette:{mode:"light",divider:y,text:{primary:v,secondary:"#4E443F",disabled:S},primary:{main:h,dark:c,light:f,contrastText:s,focus:M,focusVisible:C,hover:z,selected:"#2D282529",border:T},secondary:{main:d,light:p,dark:l,contrastText:s,focus:"#FF69281F",focusVisible:u,hover:"#FF692814",selected:"#FF692829",border:"#FF692880"},background:{default:"#F7F6F5",paper:s},action:{active:"#0000008F",hover:"#00000014",selected:"#00000029",disabledBackground:m,focus:m,disabled:k},success:{main:"#007F51",dark:"#014F33",light:"#00D788",contrastText:s},error:{contrastText:s},warning:{contrastText:s},info:{contrastText:s}},components:{MuiTooltip:{styleOverrides:{tooltip:{backgroundColor:h,color:s}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:m},root:{borderBottom:"1px solid ".concat(y),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:v}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(y),backgroundImage:"none"}}},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:n(n({borderRadius:"16px"},x),B)},{props:{variant:"rusticPrimary",size:"medium"},style:n(n({borderRadius:"24px"},g),B)},{props:{variant:"rusticPrimary",size:"large"},style:n(n({borderRadius:"32px"},F),B)},{props:{variant:"rusticSecondary",size:"small"},style:n(n({borderRadius:"16px","&:hover":{border:"1px solid ".concat(c),background:s}},x),H)},{props:{variant:"rusticSecondary",size:"medium"},style:n(n({borderRadius:"24px","&:hover":{border:"2px solid ".concat(c),background:s}},g),H)},{props:{variant:"rusticSecondary",size:"large"},style:n(n({borderRadius:"32px","&:hover":{border:"2px solid ".concat(c),background:s}},F),H)}]},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:n(n({borderRadius:"24px"},x),O)},{props:{variant:"rusticPrimary",size:"medium"},style:n(n({borderRadius:"32px"},g),O)},{props:{variant:"rusticPrimary",size:"large"},style:n(n({borderRadius:"48px"},F),O)},{props:{variant:"rusticSecondary",size:"small"},style:n(n({borderRadius:"24px","&:hover":{border:"1px solid ".concat(d),background:s}},x),W)},{props:{variant:"rusticSecondary",size:"medium"},style:n(n({borderRadius:"32px","&:hover":{border:"2px solid ".concat(d),background:s}},g),W)},{props:{variant:"rusticSecondary",size:"large"},style:n(n({borderRadius:"48px","&:hover":{border:"2px solid ".concat(d),background:s}},F),W)}]}}})),w="#FFFFFF61",E="#FFFFFF1F",A="#E1D9D5",L="#202020",I="#FFFCFB",V="#FFFCFB99",q="#000000DE",_="#FFFFFF61",G="#FF692880",J="#FFFCFB1F",K="#FFFCFB4D",N="#FFFCFB14",Q="#FFFFFF4D",U={"&.Mui-disabled":{background:Q,color:w,border:"1px solid ".concat(_)}},X=n(n(n({},R),{background:I,color:c,"&:hover":{background:V},"&:active":{outline:"2px solid ".concat(V)}}),U),Y=n(n(n({},R),{background:L,color:s,border:"1px solid ".concat(V),"&:active":{outline:"2px solid ".concat(V)}}),U),Z=n(n({background:K,color:s,border:"1px solid ".concat(G),"&:hover":{border:"1px solid ".concat(G),background:N},"&:active":{outline:"2px solid ".concat(V),background:J},"&.Mui-disabled":{background:_,opacity:100,border:"none",color:q,"& .MuiChip-icon":{color:q}}},P),{"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}}),$=n({background:L,color:s,border:"1px solid ".concat(p),"&:active":{outline:"2px solid ".concat(p)},"&.Mui-disabled":{background:L,color:p,border:"1px solid ".concat(p),opacity:100},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}},P),ee=(0,i.createTheme)((0,a.deepmerge)(b,{palette:{mode:"dark",divider:A,primary:{main:I,dark:s,light:V,contrastText:q,hover:N,selected:"#FFFCFB29",focus:J,focusVisible:K,border:G},secondary:{main:d,light:p,dark:l,contrastText:q,hover:"#FF692814",selected:"#FF692829",focus:"#FF69281F",focusVisible:u,border:"#FF692880"},background:{default:"#2C2C2C",paper:L},text:{primary:s,secondary:"#FFFFFFB2",disabled:w},action:{active:Q,hover:Q,selected:"#FFFFFF29",focus:E,disabledBackground:E,disabled:_},success:{main:"#00B775",dark:"#01784D",light:"#00E390",contrastText:q},error:{contrastText:q},warning:{contrastText:q},info:{contrastText:q}},components:{MuiTooltip:{styleOverrides:{tooltip:{backgroundColor:I,color:c}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:s}}}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:E},root:{borderBottom:"1px solid ".concat(A),padding:"8px 16px"}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(A),backgroundImage:"none"}}},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:n(n({borderRadius:"24px"},x),Z)},{props:{variant:"rusticPrimary",size:"medium"},style:n(n({borderRadius:"32px"},g),Z)},{props:{variant:"rusticPrimary",size:"large"},style:n(n({borderRadius:"48px"},F),Z)},{props:{variant:"rusticSecondary",size:"small"},style:n(n({borderRadius:"24px","&:hover":{background:L,border:"1px solid ".concat(d)}},x),$)},{props:{variant:"rusticSecondary",size:"medium"},style:n(n({borderRadius:"32px","&:hover":{background:L,border:"2px solid ".concat(d)}},g),$)},{props:{variant:"rusticSecondary",size:"large"},style:n(n({borderRadius:"48px","&:hover":{background:L,border:"2px solid ".concat(d)}},F),$)}]},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:n(n({borderRadius:"8px"},x),X)},{props:{variant:"rusticPrimary",size:"medium"},style:n(n({borderRadius:"12px"},g),X)},{props:{variant:"rusticPrimary",size:"large"},style:n(n({borderRadius:"16px"},F),X)},{props:{variant:"rusticSecondary",size:"small"},style:n(n({borderRadius:"8px","&:hover":{background:L,border:"1px solid ".concat(s)}},x),Y)},{props:{variant:"rusticSecondary",size:"medium"},style:n(n({borderRadius:"12px","&:hover":{background:L,border:"2px solid ".concat(s)}},g),Y)},{props:{variant:"rusticSecondary",size:"large"},style:n(n({borderRadius:"16px","&:hover":{background:L,border:"2px solid ".concat(s)}},F),Y)}]}}}));j=(0,i.responsiveFontSizes)(j),ee=(0,i.responsiveFontSizes)(ee);const re=j;return t})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={6182:e=>{e.exports=require("@mui/material/styles")}},r={};function t(o){var a=r[o];if(void 0!==a)return a.exports;var i=r[o]={exports:{}};return e[o](i,i.exports,t),i.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.r(o),t.d(o,{default:()=>h,generateTheme:()=>b,rusticDarkTheme:()=>x,rusticLightTheme:()=>y});var a=t(6182);const i=require("lodash");var n=t.n(i),c=function(){return c=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},c.apply(this,arguments)},l=function(e,r,t){if(t||2===arguments.length)for(var o,a=0,i=r.length;a<i;a++)!o&&a in r||(o||(o=Array.prototype.slice.call(r,0,a)),o[a]=r[a]);return e.concat(o||Array.prototype.slice.call(r))};function s(e){var r={};return Object.keys(e).forEach((function(t){var o=t.match(/^([a-z]+)([A-Z].*)$/);if(o){o[0];var a=o[1],i=o[2],c="".concat(a.toLowerCase(),".").concat(n().camelCase(i));n().set(r,c,e[t])}else n().set(r,t.toLowerCase(),e[t])})),r}var d={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)"}},g={fontSize:"12px",lineHeight:1.5,letterSpacing:"0.5px",padding:"0 12px",minHeight:"26px"},p={fontSize:"14px",lineHeight:1.43,letterSpacing:"0.25px",padding:"0 16px",minHeight:"40px"},u={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"};function b(e,r){var t="light"===e?r.lightMode:r.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:l([],(0,a.createTheme)({}).shadows.map((function(e,r){return 1===r?"0 4px 5px rgba(0, 0, 0, 0.05)":2===r?"0 4px 10px rgba(0, 0, 0, 0.1)":3===r?"0 4px 15px rgba(0, 0, 0, 0.15)":"none"})),!0),palette:c({mode:e},s(t)),components:{MuiTooltip:{styleOverrides:{tooltip:"light"===e?{backgroundColor:t.commonBlack,color:t.commonWhite}:{backgroundColor:t.commonWhite,color:t.commonBlack}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:t.actionFocus},root:{borderBottom:"1px solid ".concat(t.divider),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:t.textPrimary}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(t.divider),backgroundImage:"none"}}},MuiButton:{styleOverrides:{root:{"&.MuiButton-sizeSmall":c({},g),"&.MuiButton-sizeMedium":c({borderRadius:"24px"},p),"&.MuiButton-sizeLarge":c({borderRadius:"32px"},u),"&.Mui-disabled":{background:t.backgroundPaper,color:t.textDisabled,border:"1px solid ".concat(t.actionDisabled)}},containedPrimary:{background:t.primaryMain,color:t.primaryContrastText,"&:hover":{background:t.primaryLight},"&:active":{background:t.primaryMain,outline:"2px solid ".concat(t.primaryLight)}},containedSecondary:{"&:hover":{background:t.secondaryLight},"&:active":{background:t.secondaryMain,outline:"2px solid ".concat(t.secondaryLight)}},outlinedSecondary:{color:t.textPrimary,"&:hover":{border:"1px solid ".concat(t.secondaryDark),background:t.secondaryFocus},"&:active":{outline:"2px solid ".concat(t.secondaryLight)}},textSecondary:{color:t.textPrimary,"&:hover":{background:t.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":c({},g),"&.MuiChip-sizeMedium":c({borderRadius:"24px"},p),"&.MuiChip-sizeLarge":c({borderRadius:"32px"},u),color:t.textPrimary,background:t.backgroundPaper,"&.Mui-disabled":{opacity:1,background:t.backgroundPaper,color:t.textDisabled,border:"1px solid ".concat(t.actionDisabled)}},colorPrimary:{border:"1px solid ".concat(t.textPrimary),"&:hover":{color:t.primaryContrastText},"&:active":{outline:"2px solid ".concat(t.primaryLight)}},colorSecondary:{border:"1px solid ".concat(t.secondaryMain),"&:hover":{color:t.primaryContrastText,background:t.secondaryMain},"&:active":{outline:"2px solid ".concat(t.secondaryLight)}}}}}}}var y=(0,a.createTheme)(b("light",d)),x=(0,a.createTheme)(b("dark",d));y=(0,a.responsiveFontSizes)(y),x=(0,a.responsiveFontSizes)(x);const h=y;return o})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rustic-ai/ui-components",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "keywords": [
5
5
  "rustic-ai",
6
6
  "conversational-ui"