@rustic-ai/ui-components 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dynamicForm/index.js +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.css +22 -0
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/uploader/index.css +22 -0
- package/dist/components/input/multimodal/uploader/index.js +1 -1
- package/dist/components/input/multimodal/uploader/uploader.d.ts.map +1 -1
- package/dist/components/types.d.ts +10 -0
- package/dist/components/types.d.ts.map +1 -1
- package/dist/index.css +22 -22
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -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 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:()=>m});const t=require("react/jsx-runtime"),o=require("ajv");var n=e.n(o);require("react");const i=require("uniforms-bridge-json-schema"),a=require("uniforms-mui"),s=require("@mui/material/Box");var u=e.n(s);const c=require("@mui/material/Typography");var d=e.n(c);const l=require("uuid"),m=function(e){var r,o,s=new(n())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),c=(r=e.schema,o=s.compile(r),function(e){var r;return o(e),(null===(r=o.errors)||void 0===r?void 0:r.length)?{details:o.errors}:null}),m=new i.JSONSchemaBridge({schema:e.schema,validator:c});return(0,t.jsxs)(u(),{className:"rustic-form",children:[e.title&&(0,t.jsx)(d(),{variant:"h6",children:e.title}),e.description&&(0,t.jsx)(d(),{variant:"body1",children:e.description}),(0,t.jsx)(a.AutoForm,{schema:m,onSubmit:function(r){return function(r){var t=(new Date).toISOString(),o={id:(0,l.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"
|
|
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:()=>m});const t=require("react/jsx-runtime"),o=require("ajv");var n=e.n(o);require("react");const i=require("uniforms-bridge-json-schema"),a=require("uniforms-mui"),s=require("@mui/material/Box");var u=e.n(s);const c=require("@mui/material/Typography");var d=e.n(c);const l=require("uuid"),m=function(e){var r,o,s=new(n())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),c=(r=e.schema,o=s.compile(r),function(e){var r;return o(e),(null===(r=o.errors)||void 0===r?void 0:r.length)?{details:o.errors}:null}),m=new i.JSONSchemaBridge({schema:e.schema,validator:c});return(0,t.jsxs)(u(),{className:"rustic-form",children:[e.title&&(0,t.jsx)(d(),{variant:"h6",children:e.title}),e.description&&(0,t.jsx)(d(),{variant:"body1",children:e.description}),(0,t.jsx)(a.AutoForm,{schema:m,onSubmit:function(r){return function(r){var t=(new Date).toISOString(),o={id:(0,l.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"formResponse",data:r,inReplyTo:e.messageId};e.ws.send(o)}(r)}})]})};return r})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
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={767:(e,r,t)=>{t.d(r,{A:()=>a});var o=t(732),n=(t(15),function(){return n=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},n.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,o.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:n({},r),children:e.name})}},15:e=>{e.exports=require("react")},732:e=>{e.exports=require("react/jsx-runtime")}},r={};function t(o){var n=r[o];if(void 0!==n)return n.exports;var a=r[o]={exports:{}};return e[o](a,a.exports,t),a.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:()=>n});const n=t(767).A;return o})()));
|
|
@@ -253,3 +253,25 @@ emoji-picker {
|
|
|
253
253
|
width: fit-content;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
.rustic-popover-menu ul {
|
|
257
|
+
padding: 0;
|
|
258
|
+
min-width: 100px;
|
|
259
|
+
max-width: 240px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.rustic-popover-menu li {
|
|
263
|
+
padding-block: 8px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.rustic-popover-menu-item-icon {
|
|
267
|
+
display: flex;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.rustic-popover-menu-item-start-icon {
|
|
271
|
+
margin-right: 8px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.rustic-popover-menu-item-end-icon {
|
|
275
|
+
margin-left: 80px;
|
|
276
|
+
}
|
|
277
|
+
|
|
@@ -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={342:e=>{e.exports=require("emoji-picker-element")}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.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 a=Object.create(null);i.r(a);var o={};e=e||[null,r({}),r([]),r(r)];for(var c=2&n&&t;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,i.d(a,o),a},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};i.r(a),i.d(a,{default:()=>fe});const o=require("react/jsx-runtime"),c=require("@mui/material/Box");var l=i.n(c);const s=require("@mui/material/styles"),u=require("react"),d=require("uuid"),f=require("@mui/material/CircularProgress");var p=i.n(f);const m=require("@mui/material/IconButton");var h=i.n(m);const v=require("@mui/material/InputAdornment");var g=i.n(v);const x=require("@mui/material/MenuItem");var b=i.n(x);const j=require("@mui/material/MenuList");var y=i.n(j);const w=require("@mui/material/Popover");var S=i.n(w);const C=require("@mui/material/TextField");var N=i.n(C);const k=require("@mui/material/Tooltip");var F=i.n(k);const P=require("@mui/material/Typography");var O=i.n(P),E=i(342),q=function(){return q=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},q.apply(this,arguments)};function T(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,o.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:q({},r),children:e.name})}const z=function(e){var r=(0,s.useTheme)(),t=(0,u.useRef)(null),n=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],l=a[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 f(){l(!1)}function p(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),f()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(i.t.bind(i,342,23)).then((function(e){var t=new(0,e.Picker),i="dark"===r.palette.mode?"dark":"light";t.classList.add(i),Object.keys(d).forEach((function(e){t.style.setProperty(e,d[e])})),n.current=t})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",p),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[c,e.onEmojiClick]),(0,o.jsxs)("div",{children:[(0,o.jsx)(F(),{title:"Emoji",children:(0,o.jsx)(h(),{size:"small",ref:t,onClick:function(){l((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(T,{name:"Mood"})})}),n.current&&(0,o.jsx)(S(),{open:c,anchorEl:t.current,onClose:f,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 I={"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 R(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var _=new E.Database,A=(0,u.forwardRef)((function(e,r){var t=(0,u.useState)(""),n=t[0],i=t[1],a=(0,u.useState)(!1),c=a[0],s=a[1],f=(0,u.useState)(!1),m=f[0],v=f[1],x=(0,u.useState)(!1),j=x[0],w=x[1],C=(0,u.useState)(""),k=C[0],P=C[1],E=(0,u.useState)([]),q=E[0],A=E[1],D=(0,u.useState)(!1),M=D[0],U=D[1],B=(0,u.useRef)(null),L=!n.trim().length&&!e.isSendEnabled,W="".concat(c?"Stop":"Start"," speech to text"),H=m?"primary.main":"primary.light",V=c?"error.main":H,$=c?"stop_circle":"speech_to_text";function G(e,r){if(void 0===r&&(r=!1),B.current){var t=B.current,a=t.selectionStart,o=t.selectionEnd;if("number"==typeof a&&"number"==typeof o){var c,l=n||"",s=l.substring(0,a),u=l.substring(o);c=r?s.replace(/:(\w+)$/,e)+u:s+e+u,i(c);var d=r?s.replace(/:(\w+)$/,e).length:a+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)}}U(!1)}var K=j?(0,o.jsx)(p(),{size:24}):(0,o.jsx)(F(),{title:W,children:(0,o.jsx)(h(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,c?(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?i(n+" "+t):i(t),null===(r=B.current)||void 0===r||r.focus(),s(!1)},e.onerror=function(e){var r=I[e.error];P(r),s(!1)},e.onend=function(){w(!1),s(!1)}},size:"small",sx:{color:V,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(T,{name:$})})});function Q(){var r=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:n}};e.send(t),i(""),P("")}return(0,o.jsxs)(l(),{className:"rustic-base-input",ref:r,children:[(0,o.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,o.jsx)(l(),{className:"rustic-error-container",children:(0,o.jsx)(O(),{variant:"caption",color:"error",className:"rustic-error-message",children:k})}),(0,o.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:m?"secondary.main":"action.disabled"},children:[q.length>0&&(0,o.jsx)(S(),{open:M,anchorEl:B.current,onClose:function(){return U(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,o.jsx)(y(),{children:q.map((function(e,r){return"unicode"in e&&(0,o.jsx)(b(),{onClick:function(){return G(e.unicode,!0)},children:R(e)},r)}))})}),(0,o.jsx)(N(),{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(),!L&&Q())},onChange:function(r){P("");var t=r.target.value;i(t);var n,a=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(a){var c=a[0].replace(/:/g,"");_.getEmojiByShortcode(c).then((function(e){if(e&&"unicode"in e){var r=t.replace(a[0],e.unicode);i(r)}else i(t)})).catch((function(){i(t)})),U(!1)}else o?(n=o[0].replace(":",""),_.getEmojiBySearchQuery(n).then((function(r){r.length?(A(r.slice(0,e.maximumEmojiSearchResults)),U(!0)):(A([]),U(!1))})).catch((function(){A([]),U(!1)}))):U(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:B,color:"secondary",size:"small",InputProps:{endAdornment:(0,o.jsxs)(g(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(z,{onEmojiClick:G,buttonColor:H}),e.enableSpeechToText&&K]})},InputLabelProps:{className:m?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(l(),{className:"rustic-input-actions",children:[e.children,(0,o.jsx)(F(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(h(),{"aria-label":"send message",onClick:Q,disabled:L,color:"secondary",children:(0,o.jsx)(T,{name:"send"})})})})]})]})}));A.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const D=A,M=require("@mui/material/LinearProgress");var U=i.n(M);const B=require("axios");var L=i.n(B);const W=require("react-dom"),H=require("@mui/material/Card");var V=i.n(H);const $=require("@mui/material/Modal");var G,K=i.n($);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(G||(G={}));const Q=require("@mui/material/useMediaQuery");var Y=i.n(Q);const Z=require("@mui/system/Stack");var J=i.n(Z);const X=require("@mui/system/useTheme");var ee=i.n(X);const re=require("pdfjs-dist"),te=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,o.jsx)(F(),{title:t.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(h(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(T,{name:t.symbol})})})})};var ne={pdf:function(e){var r,t=(0,u.useRef)(null),n=(0,u.useState)(1),i=n[0],a=n[1],c=(0,u.useState)(1),s=c[0],d=c[1],f=(0,u.useState)(1),p=f[0],m=f[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],j=x[1],y=ee()(),w=Y()(y.breakpoints.down("sm")),S=Y()(y.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,o.jsx)(V(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(O(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var C=(0,u.useState)((function(){return w?.5:S?1:1.5})),k=C[0],F=C[1];return(0,u.useEffect)((function(){re.GlobalWorkerOptions.workerSrc||(re.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(re.version,"/pdf.worker.mjs")),re.getDocument({url:"".concat(e.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(i).then((function(e){var r=e.getViewport({scale:k}),n=t.current;if(n){var i=n.getContext("2d");if(i){var a=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*a,n.height=r.height*a;var o={canvasContext:i,viewport:r,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(o);j(c),c.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,i,k]),v?(0,o.jsx)(V(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(O(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(V(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(te,{action:"zoomOut",onClick:function(){F((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(te,{action:"zoomIn",onClick:function(){F((function(e){return e+.2}))}})]}),(0,o.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,o.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,o.jsx)("canvas",{ref:t})})}),(0,o.jsxs)(J(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(te,{action:"previousPage",onClick:function(){i>1&&(a(i-1),m(i-1))},isDisabled:1===i}),(0,o.jsx)(O(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(N(),{type:"number",value:p,onChange:function(e){var r=parseInt(e.target.value);m(r),!isNaN(r)&&r>=1&&r<=s&&a(r)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(O(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,o.jsx)(te,{action:"nextPage",onClick:function(){i<s&&(a(i+1),m(i+1))},isDisabled:i===s})]})]})}};function ie(e){var r=(0,s.useTheme)(),t=(0,u.useState)(!1),n=t[0],i=t[1];function a(){i(!1)}var c,l,d=e.file.url&&(c=e.file.url.split("."))[c.length-1].toLowerCase(),f=d&&e.supportedViewers?e.supportedViewers[d]:null,p=!!f,m=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",v=p?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(m).concat(v),x=e.showFullName?e.file.name:(15,(l=e.file.name).length<=15?l:l.substring(0,12)+"...");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(V(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,o.jsx)(O(),{variant:"subtitle2",children:x}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,o.jsx)(K(),{open:n,onClose:a,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(F(),{title:"Close",children:(0,o.jsx)(h(),{onClick:a,className:"rustic-close-button",children:(0,o.jsx)(T,{name:"close"})})}),e.file.url&&(0,o.jsx)(f,{url:e.file.url})]})})]})}ie.defaultProps={supportedViewers:ne};var ae=function(){return ae=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},ae.apply(this,arguments)},oe=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))};function ce(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 le=function(e){var r=(0,u.useState)([]),t=r[0],n=r[1],i=(0,u.useState)([]),a=i[0],c=i[1],s=(0,u.useRef)({}),f=(0,d.v4)();(0,u.useEffect)((function(){n([]),c([]),s.current={}}),[e.messageId]);var p=(0,o.jsx)(l(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,t){return(0,o.jsx)(ie,{file:{name:r.name},showFullName:e.showFullName,children:(0,o.jsxs)(l(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,o.jsx)(U(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(F(),{title:"Delete",children:(0,o.jsx)(h(),{color:"primary",onClick:function(){return function(r,t){var i,a;c([]);var o=r.name;if(s.current=ae(ae({},s.current),((i={})[o]=s.current[o]--,i)),e.onFileUpdate("remove",o),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);L().delete(l).then((function(){return n((function(e){return e.filter((function(e,r){return r!==t}))}))})).catch((function(){return e.onFileUpdate("add",o),c((function(e){return oe(oe([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else r.abortController.abort(),n((function(e){return e.filter((function(e,r){return r!==t}))})),s.current=ae(ae({},s.current),((a={})[o]=s.current[o]++,a))}(r,t)},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"})})})]})},t)}))}),m=(0,o.jsx)(l(),{children:a.map((function(e,r){return(0,o.jsx)(O(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function v(e,r){return r?(0,W.createPortal)(e,r):e}return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(l(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:f,children:(0,o.jsx)(F(),{title:"Upload",children:(0,o.jsx)(h(),{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:f,onChange:function(r){c([]);var i=r.target.files&&Array.from(r.target.files),a=t.length+(i?i.length:0);e.maxFileCount&&a>e.maxFileCount&&c((function(r){return oe(oe([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=i&&function(e,r,t){return t?r<=t?e:e.slice(0,t-r):e}(i,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var t;e.maxFileSize&&r.size>e.maxFileSize?(t=r.name,c((function(r){return oe(oe([],r,!0),["Failed to upload ".concat(t,". You cannot upload files larger than ").concat(e.maxFileSize&&ce(e.maxFileSize),".")],!1)}))):function(r){var t=new FormData,i=new AbortController,a=function(e){var r,t,n=e.name,i=s.current[n];if(i){var a=i+1,o=n.lastIndexOf("."),c=n.substring(0,o),l=n.substring(o);n="".concat(c,"(").concat(i,")").concat(l),s.current=ae(ae({},s.current),((r={})[e.name]=a,r))}else s.current=ae(ae({},s.current),((t={})[e.name]=1,t));return n}(r),o=new File([r],a,{type:r.type});if(e.getUploadData){var l=e.getUploadData(a);Object.keys(l).map((function(e){t.append(e,l[e])}))}t.append("file",o);var u=(0,d.v4)(),f={name:a,loadingProgress:0,abortController:i,id:u};n((function(e){return oe(oe([],e,!0),[f],!1)})),e.onFileUpdate("add",a);var p="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);L().post(p,t,{onUploadProgress:function(e){var r,t;e.total&&(r=e.loaded/e.total*100,t=f.id,n((function(e){var n=e.map((function(e){return e.id===t?ae(ae({},e),{loadingProgress:r}):e}));return n})))},signal:i.signal}).then((function(e){var r,t;e.data.fileId&&(r=e.data,t=f.id,n((function(e){var n=e.findIndex((function(e){return e.id===t}));if(-1!==n){var i=oe([],e,!0);return i[n]=ae(ae({},i[n]),{id:r.fileId}),i}return e})))})).catch((function(t){var i,o;e.onFileUpdate("remove",a),s.current=ae(ae({},s.current),((i={})[a]=s.current[r.name]--,i)),function(e,r,t){c((function(r){return oe(oe([],r,!0),["Failed to upload ".concat(e,". ").concat((null==t?void 0:t.message)||"")],!1)})),n((function(e){return e.filter((function(e){return e.id!==r}))}))}(r.name,f.id,null===(o=t.response)||void 0===o?void 0:o.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),a.length>0&&v(m,e.errorMessagesContainer),t.length>0&&v(p,e.filePreviewsContainer)]})};var se=function(){return se=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},se.apply(this,arguments)},ue=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))};function de(e){var r=(0,u.useState)([]),t=r[0],n=r[1],i=(0,u.useState)((0,d.v4)()),a=i[0],c=i[1],f=(0,u.useState)(),p=f[0],m=f[1],h=(0,u.useState)(),v=h[0],g=h[1],x=(0,u.useRef)(null),b=(0,s.useTheme)(),j=t.length>0;return(0,u.useEffect)((function(){x.current&&(g(x.current.querySelector(".rustic-error-container")),m(x.current.querySelector(".rustic-input-extras")))})),(0,o.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(b.palette.action.disabled),borderRadius:"".concat(b.shape.borderRadius,"px"),":focus-within":{borderColor:b.palette.secondary.main},background:b.palette.background.paper},children:(0,o.jsx)(D,se({},e,{send:function(r){j&&(r.id=a,r.format="filesWithText",r.data.files=t),e.ws.send(r),c((0,d.v4)()),n([])},isSendEnabled:j,ref:x,children:(0,o.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(le,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,r){n("add"===e?function(e){return ue(ue([],e,!0),[{name:r}],!1)}:function(e){return e.filter((function(e){return e.name!==r}))})},messageId:a,filePreviewsContainer:p,errorMessagesContainer:v,showFullName:e.showFullName,getUploadData:e.getUploadData})})}))})}de.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};const fe=de;return a})()));
|
|
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,n={767:(e,r,n)=>{n.d(r,{A:()=>a});var t=n(732),o=(n(15),function(){return o=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},o.apply(this,arguments)});function a(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:o({},r),children:e.name})}},110:(e,r,n)=>{n.d(r,{default:()=>t});const t=n(767).A},342:e=>{e.exports=require("emoji-picker-element")},15:e=>{e.exports=require("react")},732:e=>{e.exports=require("react/jsx-runtime")}},t={};function o(e){var r=t[e];if(void 0!==r)return r.exports;var a=t[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,t){if(1&t&&(n=this(n)),8&t)return n;if("object"==typeof n&&n){if(4&t&&n.__esModule)return n;if(16&t&&"function"==typeof n.then)return n}var a=Object.create(null);o.r(a);var i={};e=e||[null,r({}),r([]),r(r)];for(var c=2&t&&n;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>i[e]=()=>n[e]));return i.default=()=>n,o.d(a,i),a},o.d=(e,r)=>{for(var n in r)o.o(r,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},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 a={};o.r(a),o.d(a,{default:()=>Ne});var i=o(732);const c=require("@mui/material/Box");var s=o.n(c);const l=require("@mui/material/styles");var u=o(15);const d=require("uuid"),m=require("@mui/material/CircularProgress");var p=o.n(m);const f=require("@mui/material/IconButton");var h=o.n(f);const v=require("@mui/material/InputAdornment");var x=o.n(v);const g=require("@mui/material/MenuItem");var b=o.n(g);const j=require("@mui/material/MenuList");var y=o.n(j);const w=require("@mui/material/Popover");var C=o.n(w);const N=require("@mui/material/TextField");var k=o.n(N);const S=require("@mui/material/Tooltip");var F=o.n(S);const P=require("@mui/material/Typography");var O=o.n(P),E=o(342),q=o(767);const T=function(e){var r=(0,l.useTheme)(),n=(0,u.useRef)(null),t=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],s=a[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 m(){s(!1)}function p(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),m()}return(0,u.useEffect)((function(){t.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,342,23)).then((function(e){var n=new(0,e.Picker),o="dark"===r.palette.mode?"dark":"light";n.classList.add(o),Object.keys(d).forEach((function(e){n.style.setProperty(e,d[e])})),t.current=n})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return t.current&&t.current.addEventListener("emoji-click",p),function(){var e;null===(e=t.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[c,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(F(),{title:"Emoji",children:(0,i.jsx)(h(),{size:"small",ref:n,onClick:function(){s((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(q.A,{name:"Mood"})})}),t.current&&(0,i.jsx)(C(),{open:c,anchorEl:n.current,onClose:m,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&t.current&&!e.contains(t.current)&&e.appendChild(t.current)}})})]})};var I={"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 R(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var A=new E.Database,D=(0,u.forwardRef)((function(e,r){var n=(0,u.useState)(""),t=n[0],o=n[1],a=(0,u.useState)(!1),c=a[0],l=a[1],m=(0,u.useState)(!1),f=m[0],v=m[1],g=(0,u.useState)(!1),j=g[0],w=g[1],N=(0,u.useState)(""),S=N[0],P=N[1],E=(0,u.useState)([]),D=E[0],z=E[1],_=(0,u.useState)(!1),M=_[0],U=_[1],B=(0,u.useRef)(null),L=!t.trim().length&&!e.isSendEnabled,W="".concat(c?"Stop":"Start"," speech to text"),H=f?"primary.main":"primary.light",V=c?"error.main":H,$=c?"stop_circle":"speech_to_text";function G(e,r){if(void 0===r&&(r=!1),B.current){var n=B.current,a=n.selectionStart,i=n.selectionEnd;if("number"==typeof a&&"number"==typeof i){var c,s=t||"",l=s.substring(0,a),u=s.substring(i);c=r?l.replace(/:(\w+)$/,e)+u:l+e+u,o(c);var d=r?l.replace(/:(\w+)$/,e).length:a+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)}}U(!1)}var K=j?(0,i.jsx)(p(),{size:24}):(0,i.jsx)(F(),{title:W,children:(0,i.jsx)(h(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,c?(e.stop(),w(!0),l(!1)):(e.start(),P(""),l(!0)),e.onstart=function(){l(!0)},e.onresult=function(e){var r,n=e.results[0][0].transcript;t.length>0?o(t+" "+n):o(n),null===(r=B.current)||void 0===r||r.focus(),l(!1)},e.onerror=function(e){var r=I[e.error];P(r),l(!1)},e.onend=function(){w(!1),l(!1)}},size:"small",sx:{color:V,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(q.A,{name:$})})});function Q(){var r=(new Date).toISOString(),n={id:(0,d.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t}};e.send(n),o(""),P("")}return(0,i.jsxs)(s(),{className:"rustic-base-input",ref:r,children:[(0,i.jsxs)(s(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(s(),{className:"rustic-error-container",children:(0,i.jsx)(O(),{variant:"caption",color:"error",className:"rustic-error-message",children:S})}),(0,i.jsxs)(s(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:f?"secondary.main":"action.disabled"},children:[D.length>0&&(0,i.jsx)(C(),{open:M,anchorEl:B.current,onClose:function(){return U(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,i.jsx)(y(),{children:D.map((function(e,r){return"unicode"in e&&(0,i.jsx)(b(),{onClick:function(){return G(e.unicode,!0)},children:R(e)},r)}))})}),(0,i.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:t,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(),!L&&Q())},onChange:function(r){P("");var n=r.target.value;o(n);var t,a=n.match(/:(\w{2,}):/g),i=n.match(/:(\w{2,})/g);if(a){var c=a[0].replace(/:/g,"");A.getEmojiByShortcode(c).then((function(e){if(e&&"unicode"in e){var r=n.replace(a[0],e.unicode);o(r)}else o(n)})).catch((function(){o(n)})),U(!1)}else i?(t=i[0].replace(":",""),A.getEmojiBySearchQuery(t).then((function(r){r.length?(z(r.slice(0,e.maximumEmojiSearchResults)),U(!0)):(z([]),U(!1))})).catch((function(){z([]),U(!1)}))):U(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:B,color:"secondary",size:"small",InputProps:{endAdornment:(0,i.jsxs)(x(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(T,{onEmojiClick:G,buttonColor:H}),e.enableSpeechToText&&K]})},InputLabelProps:{className:f?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(s(),{className:"rustic-input-actions",children:[e.children,(0,i.jsx)(F(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(h(),{"aria-label":"send message",onClick:Q,disabled:L,color:"secondary",children:(0,i.jsx)(q.A,{name:"send"})})})})]})]})}));D.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const z=D,_=require("@mui/material/LinearProgress");var M=o.n(_);const U=require("axios");var B=o.n(U);const L=require("react-dom"),W=require("@mui/material/Card");var H=o.n(W);const V=require("@mui/material/Modal");var $,G=o.n(V);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}($||($={}));const K=require("@mui/material/useMediaQuery");var Q=o.n(K);const Y=require("@mui/system/Stack");var Z=o.n(Y);const J=require("@mui/system/useTheme");var X=o.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"}},n=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,i.jsx)(F(),{title:n.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(h(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(q.A,{name:n.symbol})})})})};var ne={pdf:function(e){var r,n=(0,u.useRef)(null),t=(0,u.useState)(1),o=t[0],a=t[1],c=(0,u.useState)(1),l=c[0],d=c[1],m=(0,u.useState)(1),p=m[0],f=m[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")),C=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)(O(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var N=(0,u.useState)((function(){return w?.5:C?1:1.5})),S=N[0],F=N[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(o).then((function(e){var r=e.getViewport({scale:S}),t=n.current;if(t){var o=t.getContext("2d");if(o){var a=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*a,t.height=r.height*a;var i={canvasContext:o,viewport:r,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(i);j(c),c.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){x(!0)}))}),[e.url,o,S]),v?(0,i.jsx)(H(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(O(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(H(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(s(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(re,{action:"zoomOut",onClick:function(){F((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(re,{action:"zoomIn",onClick:function(){F((function(e){return e+.2}))}})]}),(0,i.jsx)(s(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(s(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:n})})}),(0,i.jsxs)(Z(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(re,{action:"previousPage",onClick:function(){o>1&&(a(o-1),f(o-1))},isDisabled:1===o}),(0,i.jsx)(O(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(k(),{type:"number",value:p,onChange:function(e){var r=parseInt(e.target.value);f(r),!isNaN(r)&&r>=1&&r<=l&&a(r)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(O(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,i.jsx)(re,{action:"nextPage",onClick:function(){o<l&&(a(o+1),f(o+1))},isDisabled:o===l})]})]})}};function te(e){var r=(0,l.useTheme)(),n=(0,u.useState)(!1),t=n[0],o=n[1];function a(){o(!1)}var c,s,d=e.file.url&&(c=e.file.url.split("."))[c.length-1].toLowerCase(),m=d&&e.supportedViewers?e.supportedViewers[d]:null,p=!!m,f=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",v=p?" rustic-cursor-pointer":"",x="rustic-file-preview ".concat(f).concat(v),g=e.showFullName?e.file.name:(15,(s=e.file.name).length<=15?s:s.substring(0,12)+"...");return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(H(),{className:x,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){o(!0)},children:[(0,i.jsx)(O(),{variant:"subtitle2",children:g}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,i.jsx)(G(),{open:t,onClose:a,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(F(),{title:"Close",children:(0,i.jsx)(h(),{onClick:a,className:"rustic-close-button",children:(0,i.jsx)(q.A,{name:"close"})})}),e.file.url&&(0,i.jsx)(m,{url:e.file.url})]})})]})}te.defaultProps={supportedViewers:ne};var oe=o(110);const ae=require("@mui/material"),ie=require("@mui/material/Button");var ce=o.n(ie);const se=require("@mui/material/Drawer");var le=o.n(se);const ue=require("@mui/material/ListItemText");var de=o.n(ue);const me=require("@mui/material/Menu");var pe=o.n(me);const fe=require("@mui/system");var he=function(){return he=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},he.apply(this,arguments)};function ve(e){var r=(0,u.useState)(!1),n=r[0],t=r[1],o=(0,u.useRef)(null),a=(0,l.useTheme)(),c=(0,ae.useMediaQuery)(a.breakpoints.down("md")),s=c?le():pe(),d={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.palette.divider)};function m(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)(O(),{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})]})}c&&(d=he(he({},d),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map((function(e){return e.href?(0,i.jsx)(b(),{component:"a",onClick:function(){return t(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:m(e)},e.label):(0,i.jsx)(b(),{onClick:function(r){e.onClick&&e.onClick(r),t(!1)},disabled:!e.onClick,children:m(e)},e.label)}));var f,v,x=c?{}:{anchorEl:o.current};return(0,i.jsxs)(i.Fragment,{children:[(f={onClick:function(e){e.stopPropagation(),t(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},v=(0,i.jsx)(q.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(ce(),he({},f,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(F(),{title:e.ariaLabel,children:(0,i.jsx)(h(),he({},f,{children:e.icon?e.icon:v}))})),(0,i.jsx)(s,he({open:n,onClose:function(){return t(!1)}},x,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":he(he({},d),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:p}))]})}var xe=function(){return xe=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},xe.apply(this,arguments)},ge=function(e,r,n){if(n||2===arguments.length)for(var t,o=0,a=r.length;o<a;o++)!t&&o in r||(t||(t=Array.prototype.slice.call(r,0,o)),t[o]=r[o]);return e.concat(t||Array.prototype.slice.call(r))};function be(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 je=function(e){var r,n=(0,u.useState)([]),t=n[0],o=n[1],a=(0,u.useState)([]),c=a[0],l=a[1],m=(0,u.useState)({}),p=m[0],f=m[1],v=(0,u.useRef)({}),x=(0,d.v4)();(0,u.useEffect)((function(){o([]),l([]),v.current={}}),[e.messageId]);var g=(0,i.jsx)(s(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,n){return(0,i.jsx)(te,{file:{name:r.name},showFullName:e.showFullName,children:(0,i.jsxs)(s(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,i.jsx)(M(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(F(),{title:"Delete",children:(0,i.jsx)(h(),{color:"primary",onClick:function(){return function(r,n){var t,a;l([]);var i=r.name;if(v.current=xe(xe({},v.current),((t={})[i]=v.current[i]--,t)),e.onFileUpdate("remove",i),100===r.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);B().delete(c).then((function(){return o((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",i),l((function(e){return ge(ge([],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}))})),v.current=xe(xe({},v.current),((a={})[i]=v.current[i]++,a))}(r,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)}))}),b=(0,i.jsx)(s(),{children:c.map((function(e,r){return(0,i.jsx)(O(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function j(e,r){return r?(0,L.createPortal)(e,r):e}var y=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 n=document.getElementById(x);n&&(n.accept=r.acceptedFileTypes||e.acceptedFileTypes),n.click()}(r)},startDecorator:r.iconName&&(0,i.jsx)(oe.default,{name:r.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:x,children:(null==y?void 0:y.length)?(0,i.jsx)(ve,{ariaLabel:"Upload",icon:(0,i.jsx)(oe.default,{name:"upload_2"}),menuItems:y}):(0,i.jsx)(F(),{title:"Upload",children:(0,i.jsx)(h(),{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:x,onChange:function(r){l([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&l((function(r){return ge(ge([],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,l((function(r){return ge(ge([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&be(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,o=v.current[t];if(o){var a=o+1,i=t.lastIndexOf("."),c=t.substring(0,i),s=t.substring(i);t="".concat(c,"(").concat(o,")").concat(s),v.current=xe(xe({},v.current),((r={})[e.name]=a,r))}else v.current=xe(xe({},v.current),((n={})[e.name]=1,n));return t}(r),i=new File([r],a,{type:r.type});if(e.getUploadData||p){var c=e.getUploadData?e.getUploadData(a):{},s=xe(xe({},c),p);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 u=(0,d.v4)(),m={name:a,loadingProgress:0,abortController:t,id:u};o((function(e){return ge(ge([],e,!0),[m],!1)})),e.onFileUpdate("add",a);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);B().post(f,n,{onUploadProgress:function(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=m.id,o((function(e){var t=e.map((function(e){return e.id===n?xe(xe({},e),{loadingProgress:r}):e}));return t})))},signal:t.signal}).then((function(e){var r,n;e.data.fileId&&(r=e.data,n=m.id,o((function(e){var t=e.findIndex((function(e){return e.id===n}));if(-1!==t){var o=ge([],e,!0);return o[t]=xe(xe({},o[t]),{id:r.fileId}),o}return e})))})).catch((function(n){var t,i;e.onFileUpdate("remove",a),v.current=xe(xe({},v.current),((t={})[a]=v.current[r.name]--,t)),function(e,r,n){l((function(r){return ge(ge([],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}))}))}(r.name,m.id,null===(i=n.response)||void 0===i?void 0:i.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&j(b,e.errorMessagesContainer),t.length>0&&j(g,e.filePreviewsContainer)]})};var ye=function(){return ye=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},ye.apply(this,arguments)},we=function(e,r,n){if(n||2===arguments.length)for(var t,o=0,a=r.length;o<a;o++)!t&&o in r||(t||(t=Array.prototype.slice.call(r,0,o)),t[o]=r[o]);return e.concat(t||Array.prototype.slice.call(r))};function Ce(e){var r=(0,u.useState)([]),n=r[0],t=r[1],o=(0,u.useState)((0,d.v4)()),a=o[0],c=o[1],m=(0,u.useState)(),p=m[0],f=m[1],h=(0,u.useState)(),v=h[0],x=h[1],g=(0,u.useRef)(null),b=(0,l.useTheme)(),j=n.length>0;return(0,u.useEffect)((function(){g.current&&(x(g.current.querySelector(".rustic-error-container")),f(g.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(s(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(b.palette.action.disabled),borderRadius:"".concat(b.shape.borderRadius,"px"),":focus-within":{borderColor:b.palette.secondary.main},background:b.palette.background.paper},children:(0,i.jsx)(z,ye({},e,{send:function(r){j&&(r.id=a,r.format="filesWithText",r.data.files=n),e.ws.send(r),c((0,d.v4)()),t([])},isSendEnabled:j,ref:g,children:(0,i.jsx)(s(),{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("add"===e?function(e){return we(we([],e,!0),[{name:r}],!1)}:function(e){return e.filter((function(e){return e.name!==r}))})},messageId:a,filePreviewsContainer:p,errorMessagesContainer:v,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions})})}))})}Ce.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};const Ne=Ce;return a})()));
|
|
@@ -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;AAQ9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,
|
|
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;AAQ9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAmFlE;kBAnFuB,eAAe;;;;;;;;;eAAf,eAAe"}
|
|
@@ -154,3 +154,25 @@ span.rustic-icon-large {
|
|
|
154
154
|
width: fit-content;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
.rustic-popover-menu ul {
|
|
158
|
+
padding: 0;
|
|
159
|
+
min-width: 100px;
|
|
160
|
+
max-width: 240px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.rustic-popover-menu li {
|
|
164
|
+
padding-block: 8px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.rustic-popover-menu-item-icon {
|
|
168
|
+
display: flex;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.rustic-popover-menu-item-start-icon {
|
|
172
|
+
margin-right: 8px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.rustic-popover-menu-item-end-icon {
|
|
176
|
+
margin-left: 80px;
|
|
177
|
+
}
|
|
178
|
+
|
|
@@ -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:()=>R});const t=require("react/jsx-runtime"),n=require("@mui/material/Box");var a=e.n(n);const i=require("@mui/material/IconButton");var o=e.n(i);const l=require("@mui/material/LinearProgress");var s=e.n(l);const c=require("@mui/material/Tooltip");var u=e.n(c);const d=require("@mui/material/Typography");var f=e.n(d);const m=require("axios");var p=e.n(m);const v=require("react"),h=require("react-dom"),g=require("uuid"),x=require("@mui/material/Card");var b=e.n(x);const j=require("@mui/material/Modal");var y=e.n(j);const w=require("@mui/material/styles");var N;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(N||(N={}));var F=function(){return F=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},F.apply(this,arguments)};function C(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:F({},r),children:e.name})}const P=require("@mui/material/TextField");var S=e.n(P);const O=require("@mui/material/useMediaQuery");var k=e.n(O);const q=require("@mui/system/Stack");var I=e.n(q);const A=require("@mui/system/useTheme");var T=e.n(A);const z=require("pdfjs-dist"),D=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,t.jsx)(u(),{title:n.label,children:(0,t.jsx)("span",{children:(0,t.jsx)(o(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,t.jsx)(C,{name:n.symbol})})})})};var U={pdf:function(e){var r,n=(0,v.useRef)(null),i=(0,v.useState)(1),o=i[0],l=i[1],s=(0,v.useState)(1),c=s[0],u=s[1],d=(0,v.useState)(1),m=d[0],p=d[1],h=(0,v.useState)(!1),g=h[0],x=h[1],j=(0,v.useState)(),y=j[0],w=j[1],N=T()(),F=k()(N.breakpoints.down("sm")),C=k()(N.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,t.jsx)(b(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(f(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var P=(0,v.useState)((function(){return F?.5:C?1:1.5})),O=P[0],q=P[1];return(0,v.useEffect)((function(){z.GlobalWorkerOptions.workerSrc||(z.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(z.version,"/pdf.worker.mjs")),z.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:O}),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]};y&&y.cancel();var l=e.render(o);w(l),l.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){x(!0)}))}),[e.url,o,O]),g?(0,t.jsx)(b(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(f(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,t.jsxs)(b(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,t.jsxs)(a(),{className:"rustic-pdf-viewer-header",children:[(0,t.jsx)(D,{action:"zoomOut",onClick:function(){q((function(e){return Math.max(e-.2,.2)}))}}),(0,t.jsx)(D,{action:"zoomIn",onClick:function(){q((function(e){return e+.2}))}})]}),(0,t.jsx)(a(),{className:"rustic-pdf-viewer-body",children:(0,t.jsx)(a(),{className:"rustic-pdf-viewer-body-inner",children:(0,t.jsx)("canvas",{ref:n})})}),(0,t.jsxs)(I(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,t.jsx)(D,{action:"previousPage",onClick:function(){o>1&&(l(o-1),p(o-1))},isDisabled:1===o}),(0,t.jsx)(f(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,t.jsx)(S(),{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,t.jsxs)(f(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,t.jsx)(D,{action:"nextPage",onClick:function(){o<c&&(l(o+1),p(o+1))},isDisabled:o===c})]})]})}};function _(e){var r=(0,w.useTheme)(),n=(0,v.useState)(!1),a=n[0],i=n[1];function l(){i(!1)}var s,c,d=e.file.url&&(s=e.file.url.split("."))[s.length-1].toLowerCase(),m=d&&e.supportedViewers?e.supportedViewers[d]:null,p=!!m,h=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",g=p?" rustic-cursor-pointer":"",x="rustic-file-preview ".concat(h).concat(g),j=e.showFullName?e.file.name:(15,(c=e.file.name).length<=15?c:c.substring(0,12)+"...");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(b(),{className:x,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,t.jsx)(f(),{variant:"subtitle2",children:j}),(0,t.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,t.jsx)(y(),{open:a,onClose:l,className:"rustic-file-preview-modal",children:(0,t.jsxs)("div",{className:"rustic-modal-content",children:[(0,t.jsx)(u(),{title:"Close",children:(0,t.jsx)(o(),{onClick:l,className:"rustic-close-button",children:(0,t.jsx)(C,{name:"close"})})}),e.file.url&&(0,t.jsx)(m,{url:e.file.url})]})})]})}_.defaultProps={supportedViewers:U};var M=function(){return M=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},M.apply(this,arguments)},E=function(e,r,t){if(t||2===arguments.length)for(var n,a=0,i=r.length;a<i;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 B(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 R=function(e){var r=(0,v.useState)([]),n=r[0],i=r[1],l=(0,v.useState)([]),c=l[0],d=l[1],m=(0,v.useRef)({}),x=(0,g.v4)();(0,v.useEffect)((function(){i([]),d([]),m.current={}}),[e.messageId]);var b=(0,t.jsx)(a(),{className:"rustic-files rustic-padding-16",children:n.map((function(r,n){return(0,t.jsx)(_,{file:{name:r.name},showFullName:e.showFullName,children:(0,t.jsxs)(a(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,t.jsx)(s(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,t.jsx)(u(),{title:"Delete",children:(0,t.jsx)(o(),{color:"primary",onClick:function(){return function(r,t){var n,a;d([]);var o=r.name;if(m.current=M(M({},m.current),((n={})[o]=m.current[o]--,n)),e.onFileUpdate("remove",o),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);p().delete(l).then((function(){return i((function(e){return e.filter((function(e,r){return r!==t}))}))})).catch((function(){return e.onFileUpdate("add",o),d((function(e){return E(E([],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!==t}))})),m.current=M(M({},m.current),((a={})[o]=m.current[o]++,a))}(r,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,t.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)}))}),j=(0,t.jsx)(a(),{children:c.map((function(e,r){return(0,t.jsx)(f(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function y(e,r){return r?(0,h.createPortal)(e,r):e}return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a(),{className:"rustic-uploader",children:[(0,t.jsx)("label",{htmlFor:x,children:(0,t.jsx)(u(),{title:"Upload",children:(0,t.jsx)(o(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,t.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,t.jsx)("input",{type:"file",id:x,onChange:function(r){d([]);var t=r.target.files&&Array.from(r.target.files),a=n.length+(t?t.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return E(E([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=t&&function(e,r,t){return t?r<=t?e:e.slice(0,t-r):e}(t,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var t;e.maxFileSize&&r.size>e.maxFileSize?(t=r.name,d((function(r){return E(E([],r,!0),["Failed to upload ".concat(t,". You cannot upload files larger than ").concat(e.maxFileSize&&B(e.maxFileSize),".")],!1)}))):function(r){var t=new FormData,n=new AbortController,a=function(e){var r,t,n=e.name,a=m.current[n];if(a){var i=a+1,o=n.lastIndexOf("."),l=n.substring(0,o),s=n.substring(o);n="".concat(l,"(").concat(a,")").concat(s),m.current=M(M({},m.current),((r={})[e.name]=i,r))}else m.current=M(M({},m.current),((t={})[e.name]=1,t));return n}(r),o=new File([r],a,{type:r.type});if(e.getUploadData){var l=e.getUploadData(a);Object.keys(l).map((function(e){t.append(e,l[e])}))}t.append("file",o);var s=(0,g.v4)(),c={name:a,loadingProgress:0,abortController:n,id:s};i((function(e){return E(E([],e,!0),[c],!1)})),e.onFileUpdate("add",a);var u="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);p().post(u,t,{onUploadProgress:function(e){var r,t;e.total&&(r=e.loaded/e.total*100,t=c.id,i((function(e){var n=e.map((function(e){return e.id===t?M(M({},e),{loadingProgress:r}):e}));return n})))},signal:n.signal}).then((function(e){var r,t;e.data.fileId&&(r=e.data,t=c.id,i((function(e){var n=e.findIndex((function(e){return e.id===t}));if(-1!==n){var a=E([],e,!0);return a[n]=M(M({},a[n]),{id:r.fileId}),a}return e})))})).catch((function(t){var n,o;e.onFileUpdate("remove",a),m.current=M(M({},m.current),((n={})[a]=m.current[r.name]--,n)),function(e,r,t){d((function(r){return E(E([],r,!0),["Failed to upload ".concat(e,". ").concat((null==t?void 0:t.message)||"")],!1)})),i((function(e){return e.filter((function(e){return e.id!==r}))}))}(r.name,c.id,null===(o=t.response)||void 0===o?void 0:o.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&y(j,e.errorMessagesContainer),n.length>0&&y(b,e.filePreviewsContainer)]})};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={767:(e,r,n)=>{n.d(r,{A:()=>o});var t=n(732),a=(n(15),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})}},110:(e,r,n)=>{n.d(r,{default:()=>t});const t=n(767).A},15:e=>{e.exports=require("react")},732: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(732);const o=require("@mui/material/Box");var i=n.n(o);const l=require("@mui/material/IconButton");var c=n.n(l);const s=require("@mui/material/LinearProgress");var u=n.n(s);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(15);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 N=n.n(w);const C=require("@mui/material/styles");var F;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(F||(F={}));var P=n(767);const k=require("@mui/material/TextField");var S=n.n(k);const O=require("@mui/material/useMediaQuery");var q=n.n(O);const I=require("@mui/system/Stack");var D=n.n(I);const T=require("@mui/system/useTheme");var A=n.n(T);const M=require("pdfjs-dist"),U=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)(c(),{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],c=(0,x.useState)(1),s=c[0],u=c[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],N=A()(),C=q()(N.breakpoints.down("sm")),F=q()(N.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 C?.5:F?1:1.5})),k=P[0],O=P[1];return(0,x.useEffect)((function(){M.GlobalWorkerOptions.workerSrc||(M.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(M.version,"/pdf.worker.mjs")),M.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)(U,{action:"zoomOut",onClick:function(){O((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(U,{action:"zoomIn",onClick:function(){O((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)(U,{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)(S(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=s&&l(r)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(f(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,a.jsx)(U,{action:"nextPage",onClick:function(){o<s&&(l(o+1),p(o+1))},isDisabled:o===s})]})]})}};function z(e){var r=(0,C.useTheme)(),n=(0,x.useState)(!1),t=n[0],o=n[1];function i(){o(!1)}var l,s,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:(15,(s=e.file.name).length<=15?s:s.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",children:b}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,a.jsx)(N(),{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)(c(),{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})]})})]})}z.defaultProps={supportedViewers:_};var R=n(110);const B=require("@mui/material"),E=require("@mui/material/Button");var L=n.n(E);const H=require("@mui/material/Drawer");var V=n.n(H);const G=require("@mui/material/ListItemText");var Q=n.n(G);const W=require("@mui/material/Menu");var Y=n.n(W);const Z=require("@mui/material/MenuItem");var $=n.n(Z);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,C.useTheme)(),l=(0,B.useMediaQuery)(i.breakpoints.down("md")),s=l?V():Y(),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)(Q(),{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)($(),{component:"a",onClick:function(){return t(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,a.jsx)($(),{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)(c(),K({},v,{children:e.icon?e.icon:h}))})),(0,a.jsx)(s,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)([]),s=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 N=(0,a.jsx)(i(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,n){return(0,a.jsx)(z,{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)(c(),{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);h().delete(l).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)}))}),C=(0,a.jsx)(i(),{children:s.map((function(e,r){return(0,a.jsx)(f(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function F(e,r){return r?(0,g.createPortal)(e,r):e}var P=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)(R.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==P?void 0:P.length)?(0,a.jsx)(X,{ariaLabel:"Upload",icon:(0,a.jsx)(R.default,{name:"upload_2"}),menuItems:P}):(0,a.jsx)(m(),{title:"Upload",children:(0,a.jsx)(c(),{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),c=t.substring(i);t="".concat(l,"(").concat(a,")").concat(c),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):{},c=ee(ee({},l),v);Object.keys(c).forEach((function(e){var r=c[e];n.append(e,"object"==typeof r?JSON.stringify(r):r)}))}n.append("file",i);var s=(0,b.v4)(),u={name:a,loadingProgress:0,abortController:t,id:s};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);h().post(m,n,{onUploadProgress:function(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})))},signal:t.signal}).then((function(e){var r,n;e.data.fileId&&(r=e.data,n=u.id,o((function(e){var t=e.findIndex((function(e){return e.id===n}));if(-1!==t){var a=re([],e,!0);return a[t]=ee(ee({},a[t]),{id:r.fileId}),a}return e})))})).catch((function(n){var t,i;e.onFileUpdate("remove",a),y.current=ee(ee({},y.current),((t={})[a]=y.current[r.name]--,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}))}))}(r.name,u.id,null===(i=n.response)||void 0===i?void 0:i.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),s.length>0&&F(C,e.errorMessagesContainer),t.length>0&&F(N,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;
|
|
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,2CA0VrC;AACD,eAAe,QAAQ,CAAA"}
|
|
@@ -197,6 +197,14 @@ export interface TextInputProps extends Omit<BaseInputProps, 'send' | 'isSendEna
|
|
|
197
197
|
/** WebSocket connection to send and receive messages to and from a backend.*/
|
|
198
198
|
ws: WebSocketClient;
|
|
199
199
|
}
|
|
200
|
+
export interface UploadOption {
|
|
201
|
+
label: string;
|
|
202
|
+
metadata: {
|
|
203
|
+
[key: string]: any;
|
|
204
|
+
};
|
|
205
|
+
acceptedFileTypes?: string;
|
|
206
|
+
iconName?: string;
|
|
207
|
+
}
|
|
200
208
|
export interface UploaderProps {
|
|
201
209
|
/** The types of files that are allowed to be selected for upload. For safety reasons, only allow file types that can be handled by your server. Avoid accepting executable file types like .exe, .bat, or .msi. For more information, refer to the [mdn web docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers). */
|
|
202
210
|
acceptedFileTypes: string;
|
|
@@ -222,6 +230,8 @@ export interface UploaderProps {
|
|
|
222
230
|
getUploadData?: (fileName: string) => {
|
|
223
231
|
[key: string]: any;
|
|
224
232
|
};
|
|
233
|
+
/** 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.*/
|
|
234
|
+
uploadOptions?: UploadOption[];
|
|
225
235
|
}
|
|
226
236
|
export type MultimodalInputProps = TextInputProps & Omit<UploaderProps, 'messageId' | 'onFileUpdate' | 'filePreviewsContainer' | 'errorMessagesContainer'>;
|
|
227
237
|
export interface ConversationProps {
|
|
@@ -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.css
CHANGED
|
@@ -311,6 +311,28 @@ emoji-picker {
|
|
|
311
311
|
width: fit-content;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
.rustic-popover-menu ul {
|
|
315
|
+
padding: 0;
|
|
316
|
+
min-width: 100px;
|
|
317
|
+
max-width: 240px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.rustic-popover-menu li {
|
|
321
|
+
padding-block: 8px;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.rustic-popover-menu-item-icon {
|
|
325
|
+
display: flex;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.rustic-popover-menu-item-start-icon {
|
|
329
|
+
margin-right: 8px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.rustic-popover-menu-item-end-icon {
|
|
333
|
+
margin-left: 80px;
|
|
334
|
+
}
|
|
335
|
+
|
|
314
336
|
.rustic-open-layers-map-canvas {
|
|
315
337
|
width: 100%;
|
|
316
338
|
aspect-ratio: 16/9;
|
|
@@ -598,28 +620,6 @@ span.rustic-open-layers-map-marker {
|
|
|
598
620
|
}
|
|
599
621
|
}
|
|
600
622
|
|
|
601
|
-
.rustic-popover-menu ul {
|
|
602
|
-
padding: 0;
|
|
603
|
-
min-width: 100px;
|
|
604
|
-
max-width: 240px;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
.rustic-popover-menu li {
|
|
608
|
-
padding-block: 8px;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
.rustic-popover-menu-item-icon {
|
|
612
|
-
display: flex;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
.rustic-popover-menu-item-start-icon {
|
|
616
|
-
margin-right: 8px;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
.rustic-popover-menu-item-end-icon {
|
|
620
|
-
margin-left: 80px;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
623
|
.rustic-message-actions {
|
|
624
624
|
padding: 4px 8px;
|
|
625
625
|
}
|
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={445:(e,t,r)=>{r.d(t,{default:()=>c});var n=r(732),i=r(909),a=r.n(i),o=r(603),s=r.n(o);r(15);const c=function(e){return(0,n.jsx)(s(),{title:e.label,children:(0,n.jsx)(a(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},321:(e,t,r)=>{r.d(t,{rusticDarkTheme:()=>J,rusticLightTheme:()=>q});var n=r(182);const i=require("@mui/utils");var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.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,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);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"},x="#E1D9D5",v="#0000001F",g="#2D2825",b="#2D282599",y="#1E0C04",j="#9C9795",w="#00000061",S="#2D282514",k="#2D28251F",F="#2D28254D",C="#2D282580",E={fontWeight:700},N={"&.Mui-disabled":{background:s,color:j,border:"1px solid ".concat(w)}},T=a(a(a({},E),{background:g,color:s,"&:hover":{background:b},"&:focus":{border:"4px solid ".concat(b)}}),N),O=a(a(a({},E),{background:s,color:y,border:"1px solid ".concat(b),"&:focus":{border:"4px solid ".concat(b)}}),N),P={fontWeight:400,"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"}},D=a({background:F,color:y,border:"1px solid ".concat(C),"&:hover":{border:"1px solid ".concat(C),background:S},"&:focus":{border:"3px solid ".concat(C),background:k},"&.Mui-disabled":{background:w,opacity:100,border:"none",color:s,"& .MuiChip-icon":{color:s}},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:y}},P),R=a({background:s,color:y,border:"1px solid ".concat(u),"&:focus":{border:"4px 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),q=(0,n.createTheme)((0,i.deepmerge)(p,{palette:{mode:"light",divider:x,text:{primary:y,secondary:"#4E443F",disabled:j},primary:{main:g,dark:o,light:b,contrastText:s,focus:k,focusVisible:F,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:v,focus:v,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:v},root:{borderBottom:"1px solid ".concat(x),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:y}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(x),backgroundImage:"none"}}},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"16px"},m),T)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"24px"},f),T)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"32px"},h),T)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"16px","&:hover":{border:"1px solid ".concat(o),background:s}},m),O)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"24px","&:hover":{border:"2px solid ".concat(o),background:s}},f),O)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"32px","&:hover":{border:"2px solid ".concat(o),background:s}},h),O)}]},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"24px"},m),D)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"32px"},f),D)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"48px"},h),D)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"24px","&:hover":{border:"1px solid ".concat(c),background:s}},m),R)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"32px","&:hover":{border:"2px solid ".concat(c),background:s}},f),R)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"48px","&:hover":{border:"2px solid ".concat(c),background:s}},h),R)}]}}})),z="#FFFFFF61",I="#FFFFFF1F",M="#E1D9D5",L="#202020",B="#FFFCFB",_="#FFFCFB99",A="#000000DE",H="#FFFFFF61",W="#FF692880",V="#FFFCFB1F",U="#FFFCFB4D",G="#FFFCFB14",K="#FFFFFF4D",Q={"&.Mui-disabled":{background:K,color:z,border:"1px solid ".concat(H)}},Y=a(a(a({},E),{background:B,color:o,"&:hover":{background:_},"&:focus":{border:"4px solid ".concat(_)}}),Q),X=a(a(a({},E),{background:L,color:s,border:"1px solid ".concat(_),"&:focus":{border:"4px solid ".concat(_)}}),Q),$=a(a({background:U,color:s,border:"1px solid ".concat(W),"&:hover":{border:"1px solid ".concat(W),background:G},"&:focus":{border:"4px solid ".concat(_),background:V},"&.Mui-disabled":{background:H,opacity:100,border:"none",color:A,"& .MuiChip-icon":{color:A}}},P),{"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}}),Z=a({background:L,color:s,border:"1px solid ".concat(u),"&:focus":{border:"4px solid ".concat(u)},"&.Mui-disabled":{background:L,color:u,border:"1px solid ".concat(u),opacity:100},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}},P),J=(0,n.createTheme)((0,i.deepmerge)(p,{palette:{mode:"dark",divider:M,primary:{main:B,dark:s,light:_,contrastText:A,hover:G,selected:"#FFFCFB29",focus:V,focusVisible:U,border:W},secondary:{main:c,light:u,dark:l,contrastText:A,hover:"#FF692814",selected:"#FF692829",focus:"#FF69281F",focusVisible:d,border:"#FF692880"},background:{default:"#2C2C2C",paper:L},text:{primary:s,secondary:"#FFFFFFB2",disabled:z},action:{active:K,hover:K,selected:"#FFFFFF29",focus:I,disabledBackground:I,disabled:H},success:{main:"#00B775",dark:"#01784D",light:"#00E390",contrastText:A},error:{contrastText:A},warning:{contrastText:A},info:{contrastText:A}},components:{MuiTooltip:{styleOverrides:{tooltip:{backgroundColor:B,color:o}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:s}}}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:I},root:{borderBottom:"1px solid ".concat(M),padding:"8px 16px"}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(M),backgroundImage:"none"}}},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"24px"},m),$)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"32px"},f),$)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"48px"},h),$)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"24px","&:hover":{background:L,border:"1px solid ".concat(c)}},m),Z)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"32px","&:hover":{background:L,border:"2px solid ".concat(c)}},f),Z)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"48px","&:hover":{background:L,border:"2px solid ".concat(c)}},h),Z)}]},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"8px"},m),Y)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"12px"},f),Y)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"16px"},h),Y)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"8px","&:hover":{background:L,border:"1px solid ".concat(s)}},m),X)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"12px","&:hover":{background:L,border:"2px solid ".concat(s)}},f),X)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"16px","&:hover":{background:L,border:"2px solid ".concat(s)}},h),X)}]}}}));q=(0,n.responsiveFontSizes)(q),J=(0,n.responsiveFontSizes)(J)},909:e=>{e.exports=require("@mui/material/IconButton")},603:e=>{e.exports=require("@mui/material/Tooltip")},182:e=>{e.exports=require("@mui/material/styles")},342:e=>{e.exports=require("emoji-picker-element")},15:e=>{e.exports=require("react")},732:e=>{e.exports=require("react/jsx-runtime")}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.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 a=Object.create(null);i.r(a);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,i.d(a,o),a},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};i.r(a),i.d(a,{Action:()=>Mt.default,CodeSnippet:()=>O,CopyText:()=>Lt,ElementRenderer:()=>D,FCCalendar:()=>w,Icon:()=>q,Image:()=>U,MarkedMarkdown:()=>ot,MarkedStreamingMarkdown:()=>st,MermaidViz:()=>on,MessageCanvas:()=>Wt,MessageSpace:()=>Xt,MultimodalInput:()=>Le,Multipart:()=>Zt,OpenLayersMap:()=>tt,PDFViewer:()=>Te,ParticipantsContainer:()=>fr,PerspectiveViz:()=>dn,PlotlyGraph:()=>hn,PopoverMenu:()=>It,PromptBuilder:()=>Sr,Question:()=>kr,RechartsTimeSeries:()=>tn,Sound:()=>Ft,StreamingText:()=>Ur,Table:()=>Vr,Text:()=>$t,TextInput:()=>Ae,TextToSpeech:()=>Bt,Timestamp:()=>Ht,Uploader:()=>ze,VegaLiteViz:()=>jn,Video:()=>Nt,Weather:()=>wn,YoutubeVideo:()=>Kr,rusticDarkTheme:()=>Sn.rusticDarkTheme,rusticLightTheme:()=>Sn.rusticLightTheme});var o=i(732);const s=require("@fullcalendar/daygrid");var c=i.n(s);const l=require("@fullcalendar/react");var u=i.n(l);const d=require("@fullcalendar/timegrid");var p=i.n(d);const m=require("@mui/material/Box");var f=i.n(m),h=i(182);const x=require("@mui/material/useMediaQuery");var v=i.n(x),g=i(15),b=i.n(g),y=function(){return y=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);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:[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"),k=require("@codemirror/language-data"),F=require("@codemirror/state"),C=require("@codemirror/view"),E=require("@mui/material/Typography");var N=i.n(E);const T=require("@mui/system");function O(e){var t=(0,g.useRef)(null),r=(0,g.useRef)(),n=new F.Compartment,i=[F.EditorState.readOnly.of(!0),(0,C.highlightSpecialChars)(),(0,S.syntaxHighlighting)(S.defaultHighlightStyle,{fallback:!0}),n.of([])],a=k.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=F.EditorState.create({doc:e.code,extensions:i});r.current=new C.EditorView({state:s,parent:o}),a&&r.current&&a.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)(N(),{variant:"body2","aria-label":"language type",children:e.language})})})}var P=function(){return P=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},P.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,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)(N(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var R=function(){return R=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},R.apply(this,arguments)};function q(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,o.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:R({},t),children:e.name})}const z=require("@mui/material/CircularProgress");var I,M=i.n(z),L=function(){return L=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},L.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),i=navigator.language;return r=t===I.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(i,r)}(e,t<=1?I.HOUR:I.MONTH_DATE)}function A(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),i=t>0?"".concat(t,":"):"",a="".concat(t>0?r.toString().padStart(2,"0"):r),o=n.toString().padStart(2,"0");return"".concat(i).concat(a,":").concat(o)}function H(e,t){var r={};return e&&(r={width:e}),t&&(r=L(L({},r),{height:t})),e||t||(r={className:"rustic-fit-container"}),r}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(I||(I={}));var W=function(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]}},V=function(){return V=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},V.apply(this,arguments)};function U(e){var t=(0,g.useState)(!0),r=t[0],n=t[1],i=(0,g.useState)(""),a=i[0],s=i[1];return a.length>0?(0,o.jsx)(N(),{variant:"body2",children:a}):(0,o.jsxs)("figure",{children:[r&&(0,o.jsx)(M(),{}),(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)(N(),{variant:"body2",children:e.description})})]})}U.defaultProps={alt:"An image is displayed"};const G=require("uuid");var K=i(909),Q=i.n(K);const Y=require("@mui/material/InputAdornment");var X=i.n(Y);const $=require("@mui/material/MenuItem");var Z=i.n($);const J=require("@mui/material/MenuList");var ee=i.n(J);const te=require("@mui/material/Popover");var re=i.n(te);const ne=require("@mui/material/TextField");var ie=i.n(ne),ae=i(603),oe=i.n(ae),se=i(342);const ce=function(e){var t=(0,h.useTheme)(),r=(0,g.useRef)(null),n=(0,g.useRef)(null),a=(0,g.useState)(!1),s=a[0],c=a[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(i.t.bind(i,342,23)).then((function(e){var r=new(0,e.Picker),i="dark"===t.palette.mode?"dark":"light";r.classList.add(i),Object.keys(l).forEach((function(e){r.style.setProperty(e,l[e])})),n.current=r})).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)(oe(),{title:"Emoji",children:(0,o.jsx)(Q(),{size:"small",ref:r,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(q,{name:"Mood"})})}),n.current&&(0,o.jsx)(re(),{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 le={"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 ue(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var de=new se.Database,pe=(0,g.forwardRef)((function(e,t){var r=(0,g.useState)(""),n=r[0],i=r[1],a=(0,g.useState)(!1),s=a[0],c=a[1],l=(0,g.useState)(!1),u=l[0],d=l[1],p=(0,g.useState)(!1),m=p[0],h=p[1],x=(0,g.useState)(""),v=x[0],b=x[1],y=(0,g.useState)([]),j=y[0],w=y[1],S=(0,g.useState)(!1),k=S[0],F=S[1],C=(0,g.useRef)(null),E=!n.trim().length&&!e.isSendEnabled,T="".concat(s?"Stop":"Start"," speech to text"),O=u?"primary.main":"primary.light",P=s?"error.main":O,D=s?"stop_circle":"speech_to_text";function R(e,t){if(void 0===t&&(t=!1),C.current){var r=C.current,a=r.selectionStart,o=r.selectionEnd;if("number"==typeof a&&"number"==typeof o){var s,c=n||"",l=c.substring(0,a),u=c.substring(o);s=t?l.replace(/:(\w+)$/,e)+u:l+e+u,i(s);var d=t?l.replace(/:(\w+)$/,e).length:a+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)}}F(!1)}var z=m?(0,o.jsx)(M(),{size:24}):(0,o.jsx)(oe(),{title:T,children:(0,o.jsx)(Q(),{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?i(n+" "+r):i(r),null===(t=C.current)||void 0===t||t.focus(),c(!1)},e.onerror=function(e){var t=le[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)(q,{name:D})})});function I(){var t=(new Date).toISOString(),r={id:(0,G.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:n}};e.send(r),i(""),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)(N(),{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)(re(),{open:k,anchorEl:C.current,onClose:function(){return F(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,o.jsx)(ee(),{children:j.map((function(e,t){return"unicode"in e&&(0,o.jsx)(Z(),{onClick:function(){return R(e.unicode,!0)},children:ue(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(),!E&&I())},onChange:function(t){b("");var r=t.target.value;i(r);var n,a=r.match(/:(\w{2,}):/g),o=r.match(/:(\w{2,})/g);if(a){var s=a[0].replace(/:/g,"");de.getEmojiByShortcode(s).then((function(e){if(e&&"unicode"in e){var t=r.replace(a[0],e.unicode);i(t)}else i(r)})).catch((function(){i(r)})),F(!1)}else o?(n=o[0].replace(":",""),de.getEmojiBySearchQuery(n).then((function(t){t.length?(w(t.slice(0,e.maximumEmojiSearchResults)),F(!0)):(w([]),F(!1))})).catch((function(){w([]),F(!1)}))):F(!1)},onFocus:function(){return d(!0)},onBlur:function(){return d(!1)},inputRef:C,color:"secondary",size:"small",InputProps:{endAdornment:(0,o.jsxs)(X(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(ce,{onEmojiClick:R,buttonColor:O}),e.enableSpeechToText&&z]})},InputLabelProps:{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)(oe(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(Q(),{"aria-label":"send message",onClick:I,disabled:E,color:"secondary",children:(0,o.jsx)(q,{name:"send"})})})})]})]})}));pe.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const me=pe,fe=require("@mui/material/LinearProgress");var he=i.n(fe);const xe=require("axios");var ve=i.n(xe);const ge=require("react-dom"),be=require("@mui/material/Card");var ye=i.n(be);const je=require("@mui/material/Modal");var we=i.n(je);const Se=require("@mui/system/Stack");var ke=i.n(Se);const Fe=require("@mui/system/useTheme");var Ce=i.n(Fe);const Ee=require("pdfjs-dist"),Ne=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)(oe(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(Q(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(q,{name:r.symbol})})})})},Te=function(e){var t,r=(0,g.useRef)(null),n=(0,g.useState)(1),i=n[0],a=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],x=m[1],b=(0,g.useState)(),y=b[0],j=b[1],w=Ce()(),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)(N(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var F=(0,g.useState)((function(){return S?.5:k?1:1.5})),C=F[0],E=F[1];return(0,g.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){l(e.numPages),function(e){e.getPage(i).then((function(e){var t=e.getViewport({scale:C}),n=r.current;if(n){var i=n.getContext("2d");if(i){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var o={canvasContext:i,viewport:t,transform:[a,0,0,a,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(){x(!0)}))}),[e.url,i,C]),h?(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(N(),{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)(Ne,{action:"zoomOut",onClick:function(){E((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(Ne,{action:"zoomIn",onClick:function(){E((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)(Ne,{action:"previousPage",onClick:function(){i>1&&(a(i-1),p(i-1))},isDisabled:1===i}),(0,o.jsx)(N(),{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&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(N(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Ne,{action:"nextPage",onClick:function(){i<c&&(a(i+1),p(i+1))},isDisabled:i===c})]})]})};var Oe={pdf:Te};function Pe(e){var t=(0,h.useTheme)(),r=(0,g.useState)(!1),n=r[0],i=r[1];function a(){i(!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),x=e.showFullName?e.file.name:(15,(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(){i(!0)},children:[(0,o.jsx)(N(),{variant:"subtitle2",children:x}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),d&&(0,o.jsx)(we(),{open:n,onClose:a,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(oe(),{title:"Close",children:(0,o.jsx)(Q(),{onClick:a,className:"rustic-close-button",children:(0,o.jsx)(q,{name:"close"})})}),e.file.url&&(0,o.jsx)(u,{url:e.file.url})]})})]})}Pe.defaultProps={supportedViewers:Oe};var De=function(){return De=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},De.apply(this,arguments)},Re=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function qe(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const ze=function(e){var t=(0,g.useState)([]),r=t[0],n=t[1],i=(0,g.useState)([]),a=i[0],s=i[1],c=(0,g.useRef)({}),l=(0,G.v4)();(0,g.useEffect)((function(){n([]),s([]),c.current={}}),[e.messageId]);var u=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:r.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)(oe(),{title:"Delete",children:(0,o.jsx)(Q(),{color:"primary",onClick:function(){return function(t,r){var i,a;s([]);var o=t.name;if(c.current=De(De({},c.current),((i={})[o]=c.current[o]--,i)),e.onFileUpdate("remove",o),100===t.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);ve().delete(l).then((function(){return n((function(e){return e.filter((function(e,t){return t!==r}))}))})).catch((function(){return e.onFileUpdate("add",o),s((function(e){return Re(Re([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else t.abortController.abort(),n((function(e){return e.filter((function(e,t){return t!==r}))})),c.current=De(De({},c.current),((a={})[o]=c.current[o]++,a))}(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)}))}),d=(0,o.jsx)(f(),{children:a.map((function(e,t){return(0,o.jsx)(N(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function p(e,t){return t?(0,ge.createPortal)(e,t):e}return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(f(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:l,children:(0,o.jsx)(oe(),{title:"Upload",children:(0,o.jsx)(Q(),{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:l,onChange:function(t){s([]);var i=t.target.files&&Array.from(t.target.files),a=r.length+(i?i.length:0);e.maxFileCount&&a>e.maxFileCount&&s((function(t){return Re(Re([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=i&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(i,a,e.maxFileCount);o&&o.forEach((function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,s((function(t){return Re(Re([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&qe(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,i=new AbortController,a=function(e){var t,r,n=e.name,i=c.current[n];if(i){var a=i+1,o=n.lastIndexOf("."),s=n.substring(0,o),l=n.substring(o);n="".concat(s,"(").concat(i,")").concat(l),c.current=De(De({},c.current),((t={})[e.name]=a,t))}else c.current=De(De({},c.current),((r={})[e.name]=1,r));return n}(t),o=new File([t],a,{type:t.type});if(e.getUploadData){var l=e.getUploadData(a);Object.keys(l).map((function(e){r.append(e,l[e])}))}r.append("file",o);var u=(0,G.v4)(),d={name:a,loadingProgress:0,abortController:i,id:u};n((function(e){return Re(Re([],e,!0),[d],!1)})),e.onFileUpdate("add",a);var p="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);ve().post(p,r,{onUploadProgress:function(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=d.id,n((function(e){var n=e.map((function(e){return e.id===r?De(De({},e),{loadingProgress:t}):e}));return n})))},signal:i.signal}).then((function(e){var t,r;e.data.fileId&&(t=e.data,r=d.id,n((function(e){var n=e.findIndex((function(e){return e.id===r}));if(-1!==n){var i=Re([],e,!0);return i[n]=De(De({},i[n]),{id:t.fileId}),i}return e})))})).catch((function(r){var i,o;e.onFileUpdate("remove",a),c.current=De(De({},c.current),((i={})[a]=c.current[t.name]--,i)),function(e,t,r){s((function(t){return Re(Re([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),n((function(e){return e.filter((function(e){return e.id!==t}))}))}(t.name,d.id,null===(o=r.response)||void 0===o?void 0:o.data)}))}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),a.length>0&&p(d,e.errorMessagesContainer),r.length>0&&p(u,e.filePreviewsContainer)]})};var Ie=function(){return Ie=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ie.apply(this,arguments)},Me=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function Le(e){var t=(0,g.useState)([]),r=t[0],n=t[1],i=(0,g.useState)((0,G.v4)()),a=i[0],s=i[1],c=(0,g.useState)(),l=c[0],u=c[1],d=(0,g.useState)(),p=d[0],m=d[1],x=(0,g.useRef)(null),v=(0,h.useTheme)(),b=r.length>0;return(0,g.useEffect)((function(){x.current&&(m(x.current.querySelector(".rustic-error-container")),u(x.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)(me,Ie({},e,{send:function(t){b&&(t.id=a,t.format="filesWithText",t.data.files=r),e.ws.send(t),s((0,G.v4)()),n([])},isSendEnabled:b,ref:x,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(ze,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,t){n("add"===e?function(e){return Me(Me([],e,!0),[{name:t}],!1)}:function(e){return e.filter((function(e){return e.name!==t}))})},messageId:a,filePreviewsContainer:l,errorMessagesContainer:p,showFullName:e.showFullName,getUploadData:e.getUploadData})})}))})}Le.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};var Be=function(){return Be=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Be.apply(this,arguments)},_e=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 i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};function Ae(e){var t=e.ws,r=_e(e,["ws"]);return(0,o.jsx)(me,Be({},r,{send:function(e){t.send(e)}}))}require("ol/ol.css");const He=require("@mui/material/Alert");var We=i.n(He);const Ve=require("ol/layer/Tile.js");var Ue=i.n(Ve);const Ge=require("ol/Map.js");var Ke=i.n(Ge);const Qe=require("ol/Overlay.js");var Ye=i.n(Qe);const Xe=require("ol/proj.js"),$e=require("ol/source/OSM.js");var Ze=i.n($e);const Je=require("ol/View.js");var et=i.n(Je);function tt(e){var t=(0,g.useState)(""),r=t[0],n=t[1],i=(0,g.useRef)(null),a=(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(i.current&&a.current){var t=new(Ke())({layers:[new(Ue())({source:new(Ze())})],view:new(et())({center:(0,Xe.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:i.current}),r=new(Ye())({element:a.current,position:(0,Xe.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return t.addOverlay(r),t.once("postrender",(function(){var e;if(!(null===(e=i.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)(We(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[(0,o.jsx)(f(),{ref:a,children:(0,o.jsx)(q,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:i,className:"rustic-open-layers-map-canvas"})]})})}const rt=require("dompurify");var nt=i.n(rt);const it=require("marked");function at(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=it.marked.parse(t);return nt().sanitize(r)}const ot=function(e){var t=(0,g.useState)(at(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(at(t))}}),[e.text,e.updatedData]),(0,o.jsx)(N(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}})},st=function(e){var t=(0,g.useState)(at(e.text)),r=t[0],n=t[1],i=(0,g.useState)(""),a=i[0],s=i[1];return(0,g.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,i=e.updatedData;r<i.length;r++){var a=i[r];"string"!=typeof a.text?(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=a.text}n(at(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(N(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),a&&(0,o.jsx)(We(),{severity:"error",children:a})]})},ct=require("@mui/material"),lt=require("@mui/material/Button");var ut=i.n(lt);const dt=require("@mui/material/Slider");var pt=i.n(dt);function mt(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)(oe(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Q(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(q,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var ft=100;function ht(e){var t="dark"===(0,ct.useTheme)().palette.mode,r=A(e.mediaElement.currentTime);return(0,o.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var r=e.mediaElement.buffered,n=0,i=r.length-1;i>=0;--i){var a=r.start(i),s=r.end(i);if(a<e.mediaElement.currentTime){n=s;break}}var c=n/e.mediaElement.duration*ft;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)(pt(),{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 A(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function xt(e){var t=(0,g.useState)(e.mediaElement.volume),r=t[0],n=t[1],i=(0,g.useState)(e.mediaElement.volume),a=i[0],s=i[1],c=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,o.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,o.jsx)(mt,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(s(e.mediaElement.volume),n(0)):n(a)},className:"rustic-mute-button",action:c}),(0,o.jsx)(pt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*ft,"%"),value:r,onChange:function(t,r){var i=r;e.mediaElement.muted=0===i,e.mediaElement.volume=i,n(e.mediaElement.volume)}})]})}function vt(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(ut(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(q,{name:t}),children:(0,o.jsx)(N(),{variant:"overline",children:r})})}function gt(e){var t=(0,g.useState)(!e.mediaElement.paused),r=t[0],n=t[1],i=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)(mt,{onClick:function(){r?e.mediaElement.pause():e.mediaElement.play().catch((function(t){e.onError("Failed to play the media. Error: ".concat(t.message))}))},action:i,className:"rustic-pause-play-icon"})}function bt(e){var t,r=(0,g.useState)(e.mediaElement.playbackRate),n=r[0],i=r[1];return(0,o.jsx)(oe(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(ut(),{onClick:function(){var t=1;e.mediaElement.playbackRate<2&&(t=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=t,i(t)},className:"rustic-playback-rate-button",children:(0,o.jsxs)(N(),{variant:"body1",children:[n,"X"]})})})}function yt(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)(mt,{onClick:r,action:n})}function jt(e){var t=A(e.elapsedTimeInSeconds),r=A(e.durationTimeInSeconds),n="".concat(t," / ").concat(r);return"wide"===e.style?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(N(),{variant:"overline",children:t}),(0,o.jsx)(N(),{variant:"overline",children:r})]}):(0,o.jsx)(N(),{variant:"overline",className:"rustic-time-display",children:n})}jt.defaultProps={style:"condensed"};const wt=require("@mui/material/Divider");var St=i.n(wt);function kt(e){var t=!!document.fullscreenElement;return(0,o.jsxs)(T.Box,{className:"rustic-transcript-container",children:[!t&&(0,o.jsx)(St(),{orientation:"vertical",flexItem:!0}),(0,o.jsx)(N(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function Ft(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useState)(!1),a=i[0],s=i[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],x=f[1],v=(0,g.useState)(""),b=v[0],y=v[1],j=(0,ct.useTheme)(),w=(0,g.useRef)(null),S=(0,ct.useMediaQuery)(j.breakpoints.down("md"));function k(){return(0,o.jsx)(N(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function F(){if(e.captions&&e.captions.length>0){var t=a?"captionsOff":"captionsOn";return(0,o.jsx)(mt,{action:t,onClick:function(){return s(!a)}})}}function C(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(yt,{mediaElement:w.current,movement:"replay"}),(0,o.jsx)(gt,{mediaElement:w.current,onError:y}),(0,o.jsx)(yt,{mediaElement:w.current,movement:"forward"})]})}function E(){if(e.transcript&&r)return(0,o.jsx)(kt,{transcript:e.transcript})}function O(){if(e.transcript)return(0,o.jsx)(vt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function P(){return(0,o.jsx)("video",{src:e.src,ref:w,className:a?"rustic-has-captions":"",children:a&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,g.useEffect)((function(){var e,t,r,n;function i(e){x(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(){x(""),u(!1)})),null===(r=w.current)||void 0===r||r.addEventListener("error",(function(){return i("Failed to load the audio.")})),null===(n=w.current)||void 0===n||n.addEventListener("stalled",(function(){return i("Failed to fetch audio data, but trying.")}))}),[]);var D=S?function(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(jt,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"wide"}),(0,o.jsx)(ht,{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:C()}),(0,o.jsx)(xt,{mediaElement:w.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[O(),(0,o.jsxs)(T.Box,{children:[F(),(0,o.jsx)(bt,{mediaElement:w.current})]})]})]}),E()]})}: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)(ht,{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(),F(),(0,o.jsx)(bt,{mediaElement:w.current}),(0,o.jsx)(xt,{mediaElement:w.current}),(0,o.jsx)(jt,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:O()})]}),E()]})]})};return h.length>0?(0,o.jsx)(We(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[P(),(0,o.jsx)(M(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[P(),D(),b.length>0&&(0,o.jsx)(We(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b})]})}function Ct(e){var t=(0,g.useState)(!!document.pictureInPictureElement),r=t[0],n=t[1],i=e.mediaElement,a=r?"miniPlayerExit":"miniPlayer";return i.onleavepictureinpicture=function(){n(!1)},(0,o.jsx)(mt,{onClick:function(){r?document.exitPictureInPicture().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit mini player. Error: ".concat(t.message))})):i.requestPictureInPicture().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter mini player. Error: ".concat(t.message))}))},action:a})}function Et(e){var t=(0,g.useState)(!!document.fullscreenElement),r=t[0],n=t[1],i=e.element,a=r?"fullscreenExit":"fullscreen";return i.onfullscreenchange=function(){n(!!document.fullscreenElement)},(0,o.jsx)(mt,{onClick:function(){r?document.exitFullscreen().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit fullscreen mode. Error: ".concat(t.message))})):i.requestFullscreen().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter fullscreen mode. Error: ".concat(t.message))}))},action:a})}function Nt(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useState)(!1),a=i[0],s=i[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],x=f[1],v=(0,g.useState)(""),b=v[0],y=v[1],j=(0,g.useState)(""),w=j[0],S=j[1],k=(0,g.useState)(0),F=k[0],C=k[1],E=(0,g.useRef)(null),O=(0,g.useRef)(null),P=(0,ct.useTheme)(),D=(0,ct.useMediaQuery)(P.breakpoints.down("md"));(0,g.useEffect)((function(){var e,t,r,n,i,a,o,s;function c(e){S(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return x(!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===(i=E.current)||void 0===i||i.addEventListener("mousemove",(function(){x(!0),l()})),null===(a=E.current)||void 0===a||a.addEventListener("mouseleave",(function(){x(!1)})),null===(o=E.current)||void 0===o||o.addEventListener("keydown",(function(){x(!0),l()}))}),[]);var R={backgroundColor:P.palette.background.paper,opacity:h?1:0};function q(){if(e.transcript&&r)return(0,o.jsx)(kt,{transcript:e.transcript})}function z(){if(e.captions&&e.captions.length>0){var t=a?"captionsOff":"captionsOn";return(0,o.jsx)(mt,{action:t,onClick:function(){return s(!a)}})}}function I(){if(e.transcript)return(0,o.jsx)(vt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var L=D?function(){return p?(0,o.jsx)(o.Fragment,{children:O.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:R,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(gt,{mediaElement:O.current,onError:y}),(0,o.jsx)(ht,{mediaElement:O.current}),(0,o.jsx)(jt,{elapsedTimeInSeconds:F,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)(yt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(yt,{mediaElement:O.current,movement:"forward"}),z(),(0,o.jsx)(bt,{mediaElement:O.current})]}),I()]}),q()]})}):(0,o.jsx)(o.Fragment,{children:O.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(gt,{mediaElement:O.current,onError:y}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[I(),(0,o.jsx)(Et,{element:E.current,onError:y})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:O.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:R,children:[(0,o.jsx)(ht,{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)(gt,{mediaElement:O.current,onError:y}),(0,o.jsx)(yt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(yt,{mediaElement:O.current,movement:"forward"}),z(),(0,o.jsx)(bt,{mediaElement:O.current}),(0,o.jsx)(xt,{mediaElement:O.current}),(0,o.jsx)(jt,{elapsedTimeInSeconds:F,durationTimeInSeconds:O.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[I(),(0,o.jsx)(Ct,{mediaElement:O.current,onError:y}),(0,o.jsx)(Et,{element:E.current,onError:y})]})]}),p&&q()]})})};return w.length>0?(0,o.jsx)(We(),{severity:"error",children:w}):(0,o.jsxs)(T.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(M(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(T.Box,{ref:E,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[b.length>0&&(0,o.jsx)(We(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b}),(!D||p)&&function(){if(O.current&&E.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:R,children:[(0,o.jsx)(N(),{variant:"body2",children:e.title}),p&&D&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(Ct,{mediaElement:O.current,onError:y}),(0,o.jsx)(Et,{element:E.current,onError:y})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:O,src:e.src,poster:e.poster,children:a&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),L()]}),!p&&q()]})}const Tt=require("@mui/material/Drawer");var Ot=i.n(Tt);const Pt=require("@mui/material/ListItemText");var Dt=i.n(Pt);const Rt=require("@mui/material/Menu");var qt=i.n(Rt),zt=function(){return zt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},zt.apply(this,arguments)};function It(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useRef)(null),a=(0,h.useTheme)(),s=(0,ct.useMediaQuery)(a.breakpoints.down("md")),c=s?Ot():qt(),l={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.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)(Dt(),{children:(0,o.jsx)(N(),{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=zt(zt({},l),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.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:i.current};return(0,o.jsxs)(o.Fragment,{children:[(p={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},m=(0,o.jsx)(q,{name:"more_vert"}),e.buttonText?(0,o.jsx)(ut(),zt({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(oe(),{title:e.ariaLabel,children:(0,o.jsx)(Q(),zt({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,zt({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":zt(zt({},l),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:d}))]})}var Mt=i(445);function Lt(e){var t=(0,g.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(Mt.default,{message:e.message,icon:(0,o.jsx)(q,{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 Bt(e){var t=(0,g.useState)("Start reading aloud"),r=t[0],n=t[1],i=[e.message.data.title,e.message.data.description,e.message.data.alt,e.message.data.text,e.message.data.transcript].filter(Boolean).join(" "),a=new SpeechSynthesisUtterance(i);return(0,o.jsx)(Mt.default,{message:e.message,icon:(0,o.jsx)(q,{name:"text_to_speech"}),onClick:function(){window.speechSynthesis.speaking?(window.speechSynthesis.cancel(),n("Start reading aloud")):(a.onend=function(){n("Start reading aloud")},window.speechSynthesis.speak(a),n("Stop reading aloud"))},label:r})}const _t=require("@mui/material/Stack");var At=i.n(_t);const Ht=function(e){return(0,o.jsx)(N(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),n=navigator.language,i={month:"short",day:"numeric"},a=new Date,s=r.getFullYear()!==a.getFullYear(),c=s?" at ":", ",s&&(i.year="numeric"),r.toLocaleDateString(n,i)+c+r.toLocaleTimeString(n,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,n,i,a,s,c},Wt=(0,g.forwardRef)((function(e,t){var r=(0,ct.useTheme)();return(0,o.jsxs)(At(),{id:e.message.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(At(),{direction:"row",alignItems:"center",spacing:1,children:[e.getProfileComponent&&e.getProfileComponent(e.message),(0,o.jsx)(Ht,{timestamp:e.message.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(e.message)}),(0,o.jsx)(ye(),{variant:"outlined",className:"rustic-message-container",children:e.children})]})})),Vt=require("@mui/material/Chip");var Ut=i.n(Vt);const Gt=require("@mui/system/Box");var Kt=i.n(Gt),Qt=function(){return Qt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Qt.apply(this,arguments)};function Yt(e,t){var r=t.format.includes("update")?t.threadId:t.id;if(r){var n=Qt({},e),i=(e[r]||[])[0];return t.format.includes("update")&&i&&i.sender.id!==t.sender.id&&(r=t.id),n[r]||(n[r]=[]),n[r]=n[r].concat(t),n}return e}function Xt(e){var t,r,n,i=(0,g.useRef)(null),a=(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],x=f[1],v=(0,g.useState)({}),b=v[0],y=v[1],j=Object.keys(b).length,w=(r=j,n=(0,g.useRef)(0),(0,g.useEffect)((function(){n.current=r})),n.current),S=2e3;function k(){m(!0),s.current&&clearTimeout(s.current),s.current=setTimeout((function(){m(!1)}),S)}function F(){var e=a.current,t=i.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=a.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=a.current;x(!0),e&&setTimeout((function(){k(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(C,1)}function E(e){y((function(t){return Yt(t,e)}))}return(0,g.useEffect)((function(){var e=a.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(){C()}),[h]),(0,g.useEffect)((function(){l&&0!==w&&j>w&&(k(),C())}),[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=Yt(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(E)}),[]),(0,o.jsxs)(Kt(),{ref:a,className:"rustic-message-space",children:[Object.keys(b).map((function(t,r){var n=b[t],a=n[n.length-1];return(0,o.jsx)(Wt,{message:a,getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===j-1?i:null,children:(0,o.jsx)(D,{ws:e.ws,sender:e.sender,messages:n,supportedElements:e.supportedElements})},t)})),!l&&!p&&(0,o.jsx)(Ut(),{variant:"rusticSecondary",className:"rustic-scroll-down-button",size:"medium",onClick:C,label:(0,o.jsxs)(o.Fragment,{children:[e.scrollDownLabel,(0,o.jsx)(q,{name:"arrow_downward"})]})})]})}Xt.defaultProps={scrollDownLabel:"Scroll down"};const $t=function(e){return(0,o.jsx)(N(),{variant:"body2",className:"rustic-text",children:nt().sanitize(e.text)})};function Zt(e){return(0,o.jsxs)(Kt(),{className:"rustic-multipart",children:[e.text&&(0,o.jsx)($t,{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)(oe(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(Q(),{component:"a",href:t.url,download:t.name,children:(0,o.jsx)(q,{name:"download"})})})},r)})),(0,o.jsx)(Kt(),{className:"rustic-files",children:t}))]});var t}const Jt=require("@mui/material/Dialog");var er=i.n(Jt);const tr=require("@mui/material/DialogTitle");var rr=i.n(tr);const nr=require("@mui/material/List");var ir=i.n(nr);const ar=require("@mui/material/ListItem");var or=i.n(ar);const sr=require("@mui/material/ListSubheader");var cr=i.n(sr);const lr=require("pluralize");var ur,dr,pr=i.n(lr);function mr(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=e.participants.length,a=r?e.participants:e.participants.slice(0,3),s="".concat(pr()(e.participantType,i)," (").concat(i,")"),c=r?"Show Less":"Show All ".concat(i);return 0===i?(0,o.jsx)(N(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(ir(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(cr(),{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)(N(),{variant:"subtitle2",color:"text.secondary",children:s})]}),i>3&&(0,o.jsx)(ut(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(q,{name:"keyboard_arrow_down"}),children:c})]}),children:a.map((function(e){return(0,o.jsxs)(or(),{className:"rustic-participant-list-item",children:[(0,o.jsx)(N(),{variant:"subtitle2",children:e.displayName}),(0,o.jsx)(N(),{variant:e.participantRole===ur.Owner?"subtitle2":"caption",children:B(e.participantRole)})]},e.id)}))})}!function(e){e.Owner="owner",e.Member="member"}(ur||(ur={})),function(e){e.Human="human",e.Agent="agent"}(dr||(dr={}));const fr=function(e){function t(e,t){return function(e){return function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],e,!0).sort((function(e,t){return t.participantRole===ur.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,dr.Human),n=t(e.participants,dr.Agent),i="".concat(pr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(er(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(rr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:i}),(0,o.jsx)(mr,{participantType:"Human",participantTypeIcon:(0,o.jsx)(q,{name:"account_circle"}),participants:r}),n.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(St(),{className:"rustic-participants-container-divider"}),(0,o.jsx)(mr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(q,{name:"smart_toy"}),participants:n})]})]})},hr=require("@mui/material/DialogActions");var xr=i.n(hr);const vr=require("@mui/material/DialogContent");var gr=i.n(vr);const br=require("@mui/material/DialogContentText");var yr=i.n(br),jr=function(){return jr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},jr.apply(this,arguments)},wr=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function Sr(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useState)(!1),a=i[0],s=i[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],x=f[1],v=(0,g.useState)(null),b=v[0],y=v[1],j=(0,T.useTheme)(),w=h[h.length-1],S=jr(jr({},e.ws),{send:function(e){y(e)}});function k(e){x((function(t){return wr(wr([],t,!0),[e],!1)}))}function F(){if(b){var t=jr(jr({},b),{threadId:e.messageId});e.ws.send(t)}}if((0,g.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(k)}),[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)(er(),{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)(rr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(St(),{}),(0,o.jsx)(gr(),{children:(0,o.jsx)(yr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(xr(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(ut(),{variant:"rusticSecondary",startIcon:(0,o.jsx)(q,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(ut(),{variant:"rusticPrimary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(N(),{color:"text.secondary",children:"Prompt Builder"}),(0,o.jsx)(St(),{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)}))}(),a&&(0,o.jsx)(M(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,o.jsx)(o.Fragment,{children:!p&&(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons",children:[(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,o.jsx)(ut(),{variant:"rusticSecondary",startIcon:(0,o.jsx)(q,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(ut(),{variant:"rusticSecondary",endIcon:(0,o.jsx)(q,{name:"chevron_right"}),onClick:function(){F(),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)(ut(),{variant:"rusticPrimary",onClick:function(){F(),m(!0),s(!0),e.onSubmit()},disabled:a,"aria-disabled":a,children:"Generate"})})]})})]})}function kr(e){var t=(0,g.useState)(""),r=t[0],n=t[1],i=(0,ct.useTheme)(),a=(0,ct.useMediaQuery)(i.breakpoints.down("md"))?"column":"row",s=e.options.map((function(t,i){return(0,o.jsx)(Ut(),{onClick:function(){return function(t){n(t);var r=(new Date).toISOString(),i={id:(0,G.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:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r,"aria-disabled":!!r,label:t},i)}));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)(N(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",children:e.description})]}),(0,o.jsx)(At(),{direction:a,className:"rustic-options-container",children:s})]})}const Fr=require("@mui/material/Table");var Cr=i.n(Fr);const Er=require("@mui/material/TableBody");var Nr=i.n(Er);const Tr=require("@mui/material/TableCell");var Or=i.n(Tr);const Pr=require("@mui/material/TableContainer");var Dr=i.n(Pr);const Rr=require("@mui/material/TableHead");var qr=i.n(Rr);const zr=require("@mui/material/TablePagination");var Ir=i.n(zr);const Mr=require("@mui/material/TableRow");var Lr=i.n(Mr);const Br=require("@mui/material/TableSortLabel");var _r,Ar=i.n(Br),Hr=10;function Wr(){return(0,o.jsx)(q,{name:"expand_all"})}function Vr(e){if(0===e.data.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available"});var t,r,n,i=e.data.length>Hr,a=(0,g.useState)({}),s=a[0],c=a[1],l=(0,g.useState)(i?Hr:-1),u=l[0],d=l[1],p=(0,g.useState)(0),m=p[0],f=p[1],h=(0,ct.useTheme)(),x=Array.from(new Set(e.data.flatMap((function(e){return Object.keys(e)})))),v=e.headers||x.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===_r.Descending?1:-1:e[r]>t[r]?n===_r.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 Wr}return(0,o.jsxs)(At(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(N(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)(Dr(),{className:"rustic-table-container",children:(0,o.jsxs)(Cr(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[v.length>0&&(0,o.jsx)(qr(),{children:(0,o.jsx)(Lr(),{children:v.map((function(e,t){return(0,o.jsx)(Or(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(oe(),{title:(r=e.dataKey,n=s[r],n?Object.keys(_r)[Object.values(_r).indexOf(n)]:"Sort"),children:(0,o.jsx)(Ar(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c((function(t){var r,n,i={};switch(t[e]){case _r.Ascending:(r={})[e]=_r.Descending,i=r;break;case _r.Descending:i={};break;default:(n={})[e]=_r.Ascending,i=n}return i}))}(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)(Nr(),{children:j.map((function(e,t){return(0,o.jsx)(Lr(),{children:v.map((function(r,n){return(0,o.jsx)(Or(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))})]})}),i&&(0,o.jsx)(Ir(),{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"}(_r||(_r={}));const Ur=function(e){var t=(0,g.useState)(nt().sanitize(e.text)),r=t[0],n=t[1],i=(0,g.useState)(""),a=i[0],s=i[1];return(0,g.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,i=e.updatedData;r<i.length;r++){var a=i[r];"string"!=typeof a.text&&(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=a.text}n(nt().sanitize(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(N(),{variant:"body2",children:r}),a&&(0,o.jsx)(We(),{severity:"error",children:a})]})};var Gr=function(){return Gr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Gr.apply(this,arguments)};function Kr(e){var t=nt().sanitize(e.youtubeVideoId);return(0,o.jsx)("iframe",Gr({},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"}))}Kr.defaultProps={title:"Embedded video"};const Qr=require("@mui/material/FormControl");var Yr=i.n(Qr);const Xr=require("recharts");var $r=function(){return $r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$r.apply(this,arguments)},Zr={line:Xr.LineChart,bar:Xr.BarChart,area:Xr.AreaChart};function Jr(e){var t={};return e.forEach((function(e){t[e]=!0})),t}function en(e){var t=(0,g.useState)(e.defaultChartType||"line"),r=t[0],n=t[1],i=(0,g.useState)(null),a=i[0],s=i[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)(Jr(f)),x=h[0],v=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,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);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=Zr[r];function y(e){a?s(null):e&&s(e.currentTarget)}function j(t,r){return x[t]?e.chartColors[r%e.chartColors.length]:"grey"}function w(e){return x[e]?"none":"line-through"}if(0===l.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available"});var S,k,F,C,E=e.timeSeries[e.timeSeries.length-1],T=(S=e.timeSeries[0][m],k=E[m],F=new Date(S),C=new Date(k),Math.round(Math.abs((C.getTime()-F.getTime())/864e5)));return(0,o.jsxs)(Kt(),{className:"rustic-recharts-time-series",children:[!e.disableChartTypeToggle&&(0,o.jsxs)(Yr(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,o.jsx)(Q(),{"aria-label":"chart options","aria-expanded":Boolean(a),"aria-haspopup":"true",onClick:y,color:"primary",children:(0,o.jsx)(q,{name:"more_vert"})}),(0,o.jsxs)(qt(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:a,open:Boolean(a),onClose:function(e){return y(e)},children:[(0,o.jsx)(N(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(Zr).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)(Kt(),{children:[e.title&&(0,o.jsx)(N(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",className:"rustic-recharts-time-series-description",children:e.description}),(0,o.jsx)(Xr.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)(Xr.XAxis,{dataKey:m,tickFormatter:function(e){return _(e,T)},stroke:d.palette.text.primary}),(0,o.jsx)(Xr.YAxis,{domain:["auto","auto"],width:e.yAxisLabelWidth,tickFormatter:e.yAxisTickFormatter,stroke:d.palette.text.primary}),(0,o.jsx)(Xr.Tooltip,{labelFormatter:function(e){return[_(e,T)]},formatter:e.tooltipFormatter,contentStyle:{color:d.palette.common.black}}),(0,o.jsx)(Xr.Legend,{content:function(){return(0,o.jsx)(Kt(),{className:"rustic-recharts-time-series-legend",children:f.map((function(e,t){return(0,o.jsxs)(Kt(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=x[e]&&!f.find((function(t){return t!==e&&x[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(x)){for(var n={},i=0,a=f;i<a.length;i++){var o=a[i],s=o===e;n[o]=s}v(n)}else v(r?Jr(f):$r($r({},x),((t={})[e]=!x[e],t)))}(e)},sx:{color:j(e,t)},children:[(0,o.jsx)(q,{name:"crop_16_9"}),(0,o.jsx)(N(),{variant:"body2",display:"inline",sx:{textDecorationLine:w(e)},children:e})]},t)}))})}}),f.map((function(t,n){return x[t]?function(t,n){var i=n%e.chartColors.length,a=x[t]?e.chartColors[i]:"transparent",s={onClick:e.onClick,cursor:"pointer"};switch(r){case"line":return(0,o.jsx)(Xr.Line,{type:"monotone",isAnimationActive:!1,dataKey:t,name:t,dot:!1,stroke:a,activeDot:e.onClick&&s},t);case"bar":return(0,o.jsx)(Xr.Bar,{dataKey:t,fill:a,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:a,stopOpacity:.8}),(0,o.jsx)("stop",{offset:"95%",stopColor:a,stopOpacity:0})]})}),(0,o.jsx)(Xr.Area,{isAnimationActive:!1,dataKey:t,type:"monotone",stroke:a,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)(Xr.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)}))]})})]})]})}en.defaultProps={minChartWidth:200,maxHeight:600,yAxisLabelWidth:30,aspectRatio:16/9,disableChartTypeToggle:!1};const tn=en,rn=require("mermaid");var nn=i.n(rn),an=function(){return an=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},an.apply(this,arguments)};const on=function(e){var t=(0,g.useRef)(null),r=(0,g.useState)(),n=r[0],i=r[1],a=Ce()(),s=(0,G.v4)();return(0,g.useEffect)((function(){var r="dark"===a.palette.mode?"dark":"neutral",n=a.typography.fontFamily;t.current&&(nn().initialize(an({theme:r,themeVariables:{fontFamily:n}},e.config)),nn().render("mermaid-svg-".concat(s),e.diagram,t.current).then((function(e){t.current&&(t.current.innerHTML=e.svg),i("")})).catch((function(){var e;null===(e=t.current)||void 0===e||e.replaceChildren(),i("Failed to render the diagram.")})))})),(0,o.jsxs)(At(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(N(),{variant:"subtitle2",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",children:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(N(),{variant:"body2",children:n})]})},sn=(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 cn=i.n(sn),ln=function(){return ln=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ln.apply(this,arguments)};function un(e){return e?e.reduce((function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e}),{}):{}}const dn=function(e){if(0===e.data.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available."});var t=(0,g.useRef)(null),r=(0,h.useTheme)(),n=(0,g.useState)(!1),i=n[0],a=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=un(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 span.button {\n color: ").concat(r.palette.primary.main," !important;\n }\n \n span.button:hover:before {\n background-color: ").concat(r.palette.primary.main," !important;\n }\n \n .button select:hover, .button:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(r.palette.primary.light," !important;\n }\n \n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: scroll !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 ");var d,p,m,f,x,v,b,y,j,w=e.config&&(p=(d=e.config).groupBy,m=d.splitBy,f=d.aggregates,x=d.sort,v=d.filter,b=d.columns,y=null==x?void 0:x.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: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,g.useEffect)((function(){var r=t.current;r&&cn().worker().then((function(t){t.table(function(e,t){var r=un(t);return e.map((function(e){for(var t={},n=0,i=Object.entries(e);n<i.length;n++){var a=i[n],o=a[0],s=a[1];t[r[o]||o]=s}return t}))}(e.data,e.headers)).then((function(t){r.load(t).then((function(){return r.restore(ln(ln({},w),{theme:c,title:e.title,settings:!1})).then((function(){if(r.shadowRoot){var e=new CSSStyleSheet;e.replaceSync(u),r.shadowRoot.adoptedStyleSheets.push(e)}}))}))}))})).catch((function(){a(!0)}))}),[e.data,c]),i?(0,o.jsx)(N(),{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)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},pn=require("react-plotly.js");var mn=i.n(pn),fn=function(){return fn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},fn.apply(this,arguments)};const hn=function(e){var t=fn(fn({},e.plotParams),{className:"rustic-plotly"});return t.config=fn(fn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Kt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)(mn(),fn({},t))]})},xn=require("react-dom/server"),vn=require("vega-embed");var gn=i.n(vn),bn=function(){return bn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},bn.apply(this,arguments)};function yn(e){var t=(0,g.useRef)(null),r=(0,g.useState)(!1),n=r[0],i=r[1],a=Ce()(),s="dark"===a.palette.mode,c=a.typography.fontFamily,l={backgroundColor:a.palette.primary.main,color:a.palette.background.paper,borderRadius:a.shape.borderRadius+"px",padding:"4px 8px",fontSize:a.typography.caption.fontSize,fontFamily:c,fontWeight:a.typography.caption.fontWeight},u={formatTooltip:function(e,t){return(0,xn.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,a,o;if(t.current&&e.spec){var l=bn(bn({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===(a=e.options)||void 0===a?void 0:a.config)||void 0===o?void 0:o.font)||(l.config.font=c);var p=bn({},e.spec);delete p.title,gn()(t.current,p,l).then((function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map((function(n,i){var a="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,a).then((function(e){d[i].href=e,d[i].downloadFileName="".concat(r,".").concat(n)}))})),i(!1)})).catch((function(){i(!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)(N(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(ke(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Kt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(It,{menuItems:d,ariaLabel:"Download options"})}),e.title&&(0,o.jsx)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(ot,{text:e.description}),(0,o.jsxs)(Kt(),{textAlign:"center",mt:1,children:["string"==typeof e.spec.title&&(0,o.jsx)(N(),{variant:"subtitle2",children:e.spec.title}),e.spec.description&&(0,o.jsx)(N(),{variant:"caption",children:e.spec.description})]}),(0,o.jsx)("div",{ref:t,className:"rustic-vega-lite"})]})}const jn=yn;function wn(e){var t=(0,g.useState)(e.units),r=t[0],n=t[1];function i(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 a=new Date(1e3*e.weather[0].timestamp),s=W(e.weather[0].timestamp).shortName,c=a.getDate(),l=a.getFullYear().toString().slice(2),u="".concat(s," ").concat(c,"/").concat(l," TODAY"),d="HIGH: ".concat(i(e.weather[0].temp.high)," / LOW: ").concat(i(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)(N(),{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)(N(),{variant:"body2",color:"text.secondary",children:["High: ",i(e.temp.high),"°"]}),(0,o.jsxs)(N(),{variant:"body2",color:"text.secondary",children:["Low: ",i(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(ye(),{variant:"outlined",className:"rustic-weather",children:[(0,o.jsx)(It,{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)(At(),{alignItems:"center",children:[(0,o.jsx)(N(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(At(),{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)(N(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(N(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[i(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(r)]}),(0,o.jsxs)(At(),{direction:"row",spacing:2,children:[(0,o.jsx)(N(),{variant:"overline",children:u}),(0,o.jsx)(N(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)(At(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(q,{name:"cloud"}),(0,o.jsx)(N(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}yn.defaultProps={theme:{dark:"dark"}};var Sn=i(321);return a})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e,t,r={767:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(732),i=(r(15),function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)});function a(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:i({},t),children:e.name})}},110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(767).A},445:(e,t,r)=>{r.d(t,{default:()=>c});var n=r(732),i=r(909),a=r.n(i),o=r(603),s=r.n(o);r(15);const c=function(e){return(0,n.jsx)(s(),{title:e.label,children:(0,n.jsx)(a(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},321:(e,t,r)=>{r.d(t,{rusticDarkTheme:()=>J,rusticLightTheme:()=>q});var n=r(182);const i=require("@mui/utils");var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a.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,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);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"},x="#E1D9D5",v="#0000001F",g="#2D2825",b="#2D282599",y="#1E0C04",j="#9C9795",w="#00000061",S="#2D282514",k="#2D28251F",F="#2D28254D",C="#2D282580",E={fontWeight:700},N={"&.Mui-disabled":{background:s,color:j,border:"1px solid ".concat(w)}},T=a(a(a({},E),{background:g,color:s,"&:hover":{background:b},"&:focus":{border:"4px solid ".concat(b)}}),N),O=a(a(a({},E),{background:s,color:y,border:"1px solid ".concat(b),"&:focus":{border:"4px solid ".concat(b)}}),N),P={fontWeight:400,"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"}},D=a({background:F,color:y,border:"1px solid ".concat(C),"&:hover":{border:"1px solid ".concat(C),background:S},"&:focus":{border:"3px solid ".concat(C),background:k},"&.Mui-disabled":{background:w,opacity:100,border:"none",color:s,"& .MuiChip-icon":{color:s}},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:y}},P),R=a({background:s,color:y,border:"1px solid ".concat(u),"&:focus":{border:"4px 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),q=(0,n.createTheme)((0,i.deepmerge)(p,{palette:{mode:"light",divider:x,text:{primary:y,secondary:"#4E443F",disabled:j},primary:{main:g,dark:o,light:b,contrastText:s,focus:k,focusVisible:F,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:v,focus:v,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:v},root:{borderBottom:"1px solid ".concat(x),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:y}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(x),backgroundImage:"none"}}},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"16px"},m),T)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"24px"},f),T)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"32px"},h),T)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"16px","&:hover":{border:"1px solid ".concat(o),background:s}},m),O)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"24px","&:hover":{border:"2px solid ".concat(o),background:s}},f),O)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"32px","&:hover":{border:"2px solid ".concat(o),background:s}},h),O)}]},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"24px"},m),D)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"32px"},f),D)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"48px"},h),D)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"24px","&:hover":{border:"1px solid ".concat(c),background:s}},m),R)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"32px","&:hover":{border:"2px solid ".concat(c),background:s}},f),R)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"48px","&:hover":{border:"2px solid ".concat(c),background:s}},h),R)}]}}})),A="#FFFFFF61",I="#FFFFFF1F",z="#E1D9D5",M="#202020",L="#FFFCFB",B="#FFFCFB99",_="#000000DE",H="#FFFFFF61",W="#FF692880",V="#FFFCFB1F",U="#FFFCFB4D",G="#FFFCFB14",K="#FFFFFF4D",Q={"&.Mui-disabled":{background:K,color:A,border:"1px solid ".concat(H)}},Y=a(a(a({},E),{background:L,color:o,"&:hover":{background:B},"&:focus":{border:"4px solid ".concat(B)}}),Q),X=a(a(a({},E),{background:M,color:s,border:"1px solid ".concat(B),"&:focus":{border:"4px solid ".concat(B)}}),Q),$=a(a({background:U,color:s,border:"1px solid ".concat(W),"&:hover":{border:"1px solid ".concat(W),background:G},"&:focus":{border:"4px solid ".concat(B),background:V},"&.Mui-disabled":{background:H,opacity:100,border:"none",color:_,"& .MuiChip-icon":{color:_}}},P),{"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}}),Z=a({background:M,color:s,border:"1px solid ".concat(u),"&:focus":{border:"4px solid ".concat(u)},"&.Mui-disabled":{background:M,color:u,border:"1px solid ".concat(u),opacity:100},"& .MuiChip-icon":{margin:"0px 8px 0px 0px",color:s}},P),J=(0,n.createTheme)((0,i.deepmerge)(p,{palette:{mode:"dark",divider:z,primary:{main:L,dark:s,light:B,contrastText:_,hover:G,selected:"#FFFCFB29",focus:V,focusVisible:U,border:W},secondary:{main:c,light:u,dark:l,contrastText:_,hover:"#FF692814",selected:"#FF692829",focus:"#FF69281F",focusVisible:d,border:"#FF692880"},background:{default:"#2C2C2C",paper:M},text:{primary:s,secondary:"#FFFFFFB2",disabled:A},action:{active:K,hover:K,selected:"#FFFFFF29",focus:I,disabledBackground:I,disabled:H},success:{main:"#00B775",dark:"#01784D",light:"#00E390",contrastText:_},error:{contrastText:_},warning:{contrastText:_},info:{contrastText:_}},components:{MuiTooltip:{styleOverrides:{tooltip:{backgroundColor:L,color:o}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:s}}}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:I},root:{borderBottom:"1px solid ".concat(z),padding:"8px 16px"}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(z),backgroundImage:"none"}}},MuiChip:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"24px"},m),$)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"32px"},f),$)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"48px"},h),$)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"24px","&:hover":{background:M,border:"1px solid ".concat(c)}},m),Z)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"32px","&:hover":{background:M,border:"2px solid ".concat(c)}},f),Z)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"48px","&:hover":{background:M,border:"2px solid ".concat(c)}},h),Z)}]},MuiButton:{variants:[{props:{variant:"rusticPrimary",size:"small"},style:a(a({borderRadius:"8px"},m),Y)},{props:{variant:"rusticPrimary",size:"medium"},style:a(a({borderRadius:"12px"},f),Y)},{props:{variant:"rusticPrimary",size:"large"},style:a(a({borderRadius:"16px"},h),Y)},{props:{variant:"rusticSecondary",size:"small"},style:a(a({borderRadius:"8px","&:hover":{background:M,border:"1px solid ".concat(s)}},m),X)},{props:{variant:"rusticSecondary",size:"medium"},style:a(a({borderRadius:"12px","&:hover":{background:M,border:"2px solid ".concat(s)}},f),X)},{props:{variant:"rusticSecondary",size:"large"},style:a(a({borderRadius:"16px","&:hover":{background:M,border:"2px solid ".concat(s)}},h),X)}]}}}));q=(0,n.responsiveFontSizes)(q),J=(0,n.responsiveFontSizes)(J)},909:e=>{e.exports=require("@mui/material/IconButton")},603:e=>{e.exports=require("@mui/material/Tooltip")},182:e=>{e.exports=require("@mui/material/styles")},342:e=>{e.exports=require("emoji-picker-element")},15:e=>{e.exports=require("react")},732:e=>{e.exports=require("react/jsx-runtime")}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.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 a=Object.create(null);i.r(a);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,i.d(a,o),a},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};i.r(a),i.d(a,{Action:()=>zt.default,CodeSnippet:()=>O,CopyText:()=>Mt,ElementRenderer:()=>D,FCCalendar:()=>w,Icon:()=>R.A,Image:()=>V,MarkedMarkdown:()=>vt,MarkedStreamingMarkdown:()=>gt,MermaidViz:()=>on,MessageCanvas:()=>Wt,MessageSpace:()=>Xt,MultimodalInput:()=>Ye,Multipart:()=>Zt,OpenLayersMap:()=>pt,PDFViewer:()=>Ne,ParticipantsContainer:()=>fr,PerspectiveViz:()=>dn,PlotlyGraph:()=>hn,PopoverMenu:()=>He,PromptBuilder:()=>Sr,Question:()=>kr,RechartsTimeSeries:()=>tn,Sound:()=>Rt,StreamingText:()=>Ur,Table:()=>Vr,Text:()=>$t,TextInput:()=>Ze,TextToSpeech:()=>Lt,Timestamp:()=>Ht,Uploader:()=>Ge,VegaLiteViz:()=>jn,Video:()=>It,Weather:()=>wn,YoutubeVideo:()=>Kr,rusticDarkTheme:()=>Sn.rusticDarkTheme,rusticLightTheme:()=>Sn.rusticLightTheme});var o=i(732);const s=require("@fullcalendar/daygrid");var c=i.n(s);const l=require("@fullcalendar/react");var u=i.n(l);const d=require("@fullcalendar/timegrid");var p=i.n(d);const m=require("@mui/material/Box");var f=i.n(m),h=i(182);const x=require("@mui/material/useMediaQuery");var v=i.n(x),g=i(15),b=i.n(g),y=function(){return y=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);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:[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"),k=require("@codemirror/language-data"),F=require("@codemirror/state"),C=require("@codemirror/view"),E=require("@mui/material/Typography");var N=i.n(E);const T=require("@mui/system");function O(e){var t=(0,g.useRef)(null),r=(0,g.useRef)(),n=new F.Compartment,i=[F.EditorState.readOnly.of(!0),(0,C.highlightSpecialChars)(),(0,S.syntaxHighlighting)(S.defaultHighlightStyle,{fallback:!0}),n.of([])],a=k.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=F.EditorState.create({doc:e.code,extensions:i});r.current=new C.EditorView({state:s,parent:o}),a&&r.current&&a.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)(N(),{variant:"body2","aria-label":"language type",children:e.language})})})}var P=function(){return P=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},P.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,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)(N(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var R=i(767);const q=require("@mui/material/CircularProgress");var A,I=i.n(q),z=function(){return z=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},z.apply(this,arguments)},M=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function L(e,t){return function(e,t){var r,n=new Date(e),i=navigator.language;return r=t===A.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(i,r)}(e,t<=1?A.HOUR:A.MONTH_DATE)}function B(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),i=t>0?"".concat(t,":"):"",a="".concat(t>0?r.toString().padStart(2,"0"):r),o=n.toString().padStart(2,"0");return"".concat(i).concat(a,":").concat(o)}function _(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(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(A||(A={}));var H=function(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]}},W=function(){return W=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},W.apply(this,arguments)};function V(e){var t=(0,g.useState)(!0),r=t[0],n=t[1],i=(0,g.useState)(""),a=i[0],s=i[1];return a.length>0?(0,o.jsx)(N(),{variant:"body2",children:a}):(0,o.jsxs)("figure",{children:[r&&(0,o.jsx)(I(),{}),(0,o.jsx)("img",W({},_(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)(N(),{variant:"body2",children:e.description})})]})}V.defaultProps={alt:"An image is displayed"};const U=require("uuid");var G=i(909),K=i.n(G);const Q=require("@mui/material/InputAdornment");var Y=i.n(Q);const X=require("@mui/material/MenuItem");var $=i.n(X);const Z=require("@mui/material/MenuList");var J=i.n(Z);const ee=require("@mui/material/Popover");var te=i.n(ee);const re=require("@mui/material/TextField");var ne=i.n(re),ie=i(603),ae=i.n(ie),oe=i(342);const se=function(e){var t=(0,h.useTheme)(),r=(0,g.useRef)(null),n=(0,g.useRef)(null),a=(0,g.useState)(!1),s=a[0],c=a[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(i.t.bind(i,342,23)).then((function(e){var r=new(0,e.Picker),i="dark"===t.palette.mode?"dark":"light";r.classList.add(i),Object.keys(l).forEach((function(e){r.style.setProperty(e,l[e])})),n.current=r})).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)(ae(),{title:"Emoji",children:(0,o.jsx)(K(),{size:"small",ref:r,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(R.A,{name:"Mood"})})}),n.current&&(0,o.jsx)(te(),{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 ce={"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 le(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var ue=new oe.Database,de=(0,g.forwardRef)((function(e,t){var r=(0,g.useState)(""),n=r[0],i=r[1],a=(0,g.useState)(!1),s=a[0],c=a[1],l=(0,g.useState)(!1),u=l[0],d=l[1],p=(0,g.useState)(!1),m=p[0],h=p[1],x=(0,g.useState)(""),v=x[0],b=x[1],y=(0,g.useState)([]),j=y[0],w=y[1],S=(0,g.useState)(!1),k=S[0],F=S[1],C=(0,g.useRef)(null),E=!n.trim().length&&!e.isSendEnabled,T="".concat(s?"Stop":"Start"," speech to text"),O=u?"primary.main":"primary.light",P=s?"error.main":O,D=s?"stop_circle":"speech_to_text";function q(e,t){if(void 0===t&&(t=!1),C.current){var r=C.current,a=r.selectionStart,o=r.selectionEnd;if("number"==typeof a&&"number"==typeof o){var s,c=n||"",l=c.substring(0,a),u=c.substring(o);s=t?l.replace(/:(\w+)$/,e)+u:l+e+u,i(s);var d=t?l.replace(/:(\w+)$/,e).length:a+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)}}F(!1)}var A=m?(0,o.jsx)(I(),{size:24}):(0,o.jsx)(ae(),{title:T,children:(0,o.jsx)(K(),{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?i(n+" "+r):i(r),null===(t=C.current)||void 0===t||t.focus(),c(!1)},e.onerror=function(e){var t=ce[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)(R.A,{name:D})})});function z(){var t=(new Date).toISOString(),r={id:(0,U.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:n}};e.send(r),i(""),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)(N(),{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)(te(),{open:k,anchorEl:C.current,onClose:function(){return F(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,o.jsx)(J(),{children:j.map((function(e,t){return"unicode"in e&&(0,o.jsx)($(),{onClick:function(){return q(e.unicode,!0)},children:le(e)},t)}))})}),(0,o.jsx)(ne(),{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(),!E&&z())},onChange:function(t){b("");var r=t.target.value;i(r);var n,a=r.match(/:(\w{2,}):/g),o=r.match(/:(\w{2,})/g);if(a){var s=a[0].replace(/:/g,"");ue.getEmojiByShortcode(s).then((function(e){if(e&&"unicode"in e){var t=r.replace(a[0],e.unicode);i(t)}else i(r)})).catch((function(){i(r)})),F(!1)}else o?(n=o[0].replace(":",""),ue.getEmojiBySearchQuery(n).then((function(t){t.length?(w(t.slice(0,e.maximumEmojiSearchResults)),F(!0)):(w([]),F(!1))})).catch((function(){w([]),F(!1)}))):F(!1)},onFocus:function(){return d(!0)},onBlur:function(){return d(!1)},inputRef:C,color:"secondary",size:"small",InputProps:{endAdornment:(0,o.jsxs)(Y(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(se,{onEmojiClick:q,buttonColor:O}),e.enableSpeechToText&&A]})},InputLabelProps:{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)(ae(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(K(),{"aria-label":"send message",onClick:z,disabled:E,color:"secondary",children:(0,o.jsx)(R.A,{name:"send"})})})})]})]})}));de.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const pe=de,me=require("@mui/material/LinearProgress");var fe=i.n(me);const he=require("axios");var xe=i.n(he);const ve=require("react-dom"),ge=require("@mui/material/Card");var be=i.n(ge);const ye=require("@mui/material/Modal");var je=i.n(ye);const we=require("@mui/system/Stack");var Se=i.n(we);const ke=require("@mui/system/useTheme");var Fe=i.n(ke);const Ce=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)(ae(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(K(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(R.A,{name:r.symbol})})})})},Ne=function(e){var t,r=(0,g.useRef)(null),n=(0,g.useState)(1),i=n[0],a=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],x=m[1],b=(0,g.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)(be(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(N(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var F=(0,g.useState)((function(){return S?.5:k?1:1.5})),C=F[0],E=F[1];return(0,g.useEffect)((function(){Ce.GlobalWorkerOptions.workerSrc||(Ce.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Ce.version,"/pdf.worker.mjs")),Ce.getDocument({url:"".concat(e.url)}).promise.then((function(e){l(e.numPages),function(e){e.getPage(i).then((function(e){var t=e.getViewport({scale:C}),n=r.current;if(n){var i=n.getContext("2d");if(i){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var o={canvasContext:i,viewport:t,transform:[a,0,0,a,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(){x(!0)}))}),[e.url,i,C]),h?(0,o.jsx)(be(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(N(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(be(),{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(){E((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(Ee,{action:"zoomIn",onClick:function(){E((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)(Se(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(Ee,{action:"previousPage",onClick:function(){i>1&&(a(i-1),p(i-1))},isDisabled:1===i}),(0,o.jsx)(N(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(ne(),{type:"number",value:d,onChange:function(e){var t=parseInt(e.target.value);p(t),!isNaN(t)&&t>=1&&t<=c&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(N(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Ee,{action:"nextPage",onClick:function(){i<c&&(a(i+1),p(i+1))},isDisabled:i===c})]})]})};var Te={pdf:Ne};function Oe(e){var t=(0,h.useTheme)(),r=(0,g.useState)(!1),n=r[0],i=r[1];function a(){i(!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),x=e.showFullName?e.file.name:(15,(c=e.file.name).length<=15?c:c.substring(0,12)+"...");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(be(),{className:f,variant:"outlined",sx:{boxShadow:t.shadows[1]},onClick:function(){i(!0)},children:[(0,o.jsx)(N(),{variant:"subtitle2",children:x}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),d&&(0,o.jsx)(je(),{open:n,onClose:a,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(ae(),{title:"Close",children:(0,o.jsx)(K(),{onClick:a,className:"rustic-close-button",children:(0,o.jsx)(R.A,{name:"close"})})}),e.file.url&&(0,o.jsx)(u,{url:e.file.url})]})})]})}Oe.defaultProps={supportedViewers:Te};var Pe=i(110);const De=require("@mui/material"),Re=require("@mui/material/Button");var qe=i.n(Re);const Ae=require("@mui/material/Drawer");var Ie=i.n(Ae);const ze=require("@mui/material/ListItemText");var Me=i.n(ze);const Le=require("@mui/material/Menu");var Be=i.n(Le),_e=function(){return _e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_e.apply(this,arguments)};function He(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useRef)(null),a=(0,h.useTheme)(),s=(0,De.useMediaQuery)(a.breakpoints.down("md")),c=s?Ie():Be(),l={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.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)(N(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,o.jsx)(T.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(l=_e(_e({},l),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var d=e.menuItems.map((function(e){return e.href?(0,o.jsx)($(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)($(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:u(e)},e.label)}));var p,m,f=s?{}:{anchorEl:i.current};return(0,o.jsxs)(o.Fragment,{children:[(p={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},m=(0,o.jsx)(R.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(qe(),_e({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(ae(),{title:e.ariaLabel,children:(0,o.jsx)(K(),_e({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,_e({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":_e(_e({},l),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:d}))]})}var We=function(){return We=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},We.apply(this,arguments)},Ve=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function Ue(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 Ge=function(e){var t,r=(0,g.useState)([]),n=r[0],i=r[1],a=(0,g.useState)([]),s=a[0],c=a[1],l=(0,g.useState)({}),u=l[0],d=l[1],p=(0,g.useRef)({}),m=(0,U.v4)();(0,g.useEffect)((function(){i([]),c([]),p.current={}}),[e.messageId]);var h=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,o.jsx)(Oe,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(fe(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(ae(),{title:"Delete",children:(0,o.jsx)(K(),{color:"primary",onClick:function(){return function(t,r){var n,a;c([]);var o=t.name;if(p.current=We(We({},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 i((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(),i((function(e){return e.filter((function(e,t){return t!==r}))})),p.current=We(We({},p.current),((a={})[o]=p.current[o]++,a))}(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)(N(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function v(e,t){return t?(0,ve.createPortal)(e,t):e}var b=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)(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:m,children:(null==b?void 0:b.length)?(0,o.jsx)(He,{ariaLabel:"Upload",icon:(0,o.jsx)(Pe.default,{name:"upload_2"}),menuItems:b}):(0,o.jsx)(ae(),{title:"Upload",children:(0,o.jsx)(K(),{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),a=n.length+(r?r.length:0);e.maxFileCount&&a>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,a,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&&Ue(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,a=function(e){var t,r,n=e.name,i=p.current[n];if(i){var a=i+1,o=n.lastIndexOf("."),s=n.substring(0,o),c=n.substring(o);n="".concat(s,"(").concat(i,")").concat(c),p.current=We(We({},p.current),((t={})[e.name]=a,t))}else p.current=We(We({},p.current),((r={})[e.name]=1,r));return n}(t),o=new File([t],a,{type:t.type});if(e.getUploadData||u){var s=e.getUploadData?e.getUploadData(a):{},l=We(We({},s),u);Object.keys(l).forEach((function(e){var t=l[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)}))}r.append("file",o);var d=(0,U.v4)(),m={name:a,loadingProgress:0,abortController:n,id:d};i((function(e){return Ve(Ve([],e,!0),[m],!1)})),e.onFileUpdate("add",a);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);xe().post(f,r,{onUploadProgress:function(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=m.id,i((function(e){var n=e.map((function(e){return e.id===r?We(We({},e),{loadingProgress:t}):e}));return n})))},signal:n.signal}).then((function(e){var t,r;e.data.fileId&&(t=e.data,r=m.id,i((function(e){var n=e.findIndex((function(e){return e.id===r}));if(-1!==n){var i=Ve([],e,!0);return i[n]=We(We({},i[n]),{id:t.fileId}),i}return e})))})).catch((function(r){var n,o;e.onFileUpdate("remove",a),p.current=We(We({},p.current),((n={})[a]=p.current[t.name]--,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)})),i((function(e){return e.filter((function(e){return e.id!==t}))}))}(t.name,m.id,null===(o=r.response)||void 0===o?void 0:o.data)}))}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),s.length>0&&v(x,e.errorMessagesContainer),n.length>0&&v(h,e.filePreviewsContainer)]})};var Ke=function(){return Ke=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ke.apply(this,arguments)},Qe=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function Ye(e){var t=(0,g.useState)([]),r=t[0],n=t[1],i=(0,g.useState)((0,U.v4)()),a=i[0],s=i[1],c=(0,g.useState)(),l=c[0],u=c[1],d=(0,g.useState)(),p=d[0],m=d[1],x=(0,g.useRef)(null),v=(0,h.useTheme)(),b=r.length>0;return(0,g.useEffect)((function(){x.current&&(m(x.current.querySelector(".rustic-error-container")),u(x.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,Ke({},e,{send:function(t){b&&(t.id=a,t.format="filesWithText",t.data.files=r),e.ws.send(t),s((0,U.v4)()),n([])},isSendEnabled:b,ref:x,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Ge,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,t){n("add"===e?function(e){return Qe(Qe([],e,!0),[{name:t}],!1)}:function(e){return e.filter((function(e){return e.name!==t}))})},messageId:a,filePreviewsContainer:l,errorMessagesContainer:p,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions})})}))})}Ye.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 i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Xe.apply(this,arguments)},$e=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 i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};function Ze(e){var t=e.ws,r=$e(e,["ws"]);return(0,o.jsx)(pe,Xe({},r,{send:function(e){t.send(e)}}))}require("ol/ol.css");const Je=require("@mui/material/Alert");var et=i.n(Je);const tt=require("ol/layer/Tile.js");var rt=i.n(tt);const nt=require("ol/Map.js");var it=i.n(nt);const at=require("ol/Overlay.js");var ot=i.n(at);const st=require("ol/proj.js"),ct=require("ol/source/OSM.js");var lt=i.n(ct);const ut=require("ol/View.js");var dt=i.n(ut);function pt(e){var t=(0,g.useState)(""),r=t[0],n=t[1],i=(0,g.useRef)(null),a=(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(i.current&&a.current){var t=new(it())({layers:[new(rt())({source:new(lt())})],view:new(dt())({center:(0,st.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:i.current}),r=new(ot())({element:a.current,position:(0,st.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return t.addOverlay(r),t.once("postrender",(function(){var e;if(!(null===(e=i.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)(et(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[(0,o.jsx)(f(),{ref:a,children:(0,o.jsx)(R.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:i,className:"rustic-open-layers-map-canvas"})]})})}const mt=require("dompurify");var ft=i.n(mt);const ht=require("marked");function xt(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=ht.marked.parse(t);return ft().sanitize(r)}const vt=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)(N(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}})},gt=function(e){var t=(0,g.useState)(xt(e.text)),r=t[0],n=t[1],i=(0,g.useState)(""),a=i[0],s=i[1];return(0,g.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,i=e.updatedData;r<i.length;r++){var a=i[r];"string"!=typeof a.text?(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=a.text}n(xt(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(N(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),a&&(0,o.jsx)(et(),{severity:"error",children:a})]})},bt=require("@mui/material/Slider");var yt=i.n(bt);function jt(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)(ae(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(K(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(R.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var wt=100;function St(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,i=r.length-1;i>=0;--i){var a=r.start(i),s=r.end(i);if(a<e.mediaElement.currentTime){n=s;break}}var c=n/e.mediaElement.duration*wt;return(0,o.jsx)(fe(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(yt(),{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],i=(0,g.useState)(e.mediaElement.volume),a=i[0],s=i[1],c=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,o.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,o.jsx)(jt,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(s(e.mediaElement.volume),n(0)):n(a)},className:"rustic-mute-button",action:c}),(0,o.jsx)(yt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*wt,"%"),value:r,onChange:function(t,r){var i=r;e.mediaElement.muted=0===i,e.mediaElement.volume=i,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)(qe(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(R.A,{name:t}),children:(0,o.jsx)(N(),{variant:"overline",children:r})})}function Ct(e){var t=(0,g.useState)(!e.mediaElement.paused),r=t[0],n=t[1],i=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)(jt,{onClick:function(){r?e.mediaElement.pause():e.mediaElement.play().catch((function(t){e.onError("Failed to play the media. Error: ".concat(t.message))}))},action:i,className:"rustic-pause-play-icon"})}function Et(e){var t,r=(0,g.useState)(e.mediaElement.playbackRate),n=r[0],i=r[1];return(0,o.jsx)(ae(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(qe(),{onClick:function(){var t=1;e.mediaElement.playbackRate<2&&(t=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=t,i(t)},className:"rustic-playback-rate-button",children:(0,o.jsxs)(N(),{variant:"body1",children:[n,"X"]})})})}function Nt(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)(jt,{onClick:r,action:n})}function Tt(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)(N(),{variant:"overline",children:t}),(0,o.jsx)(N(),{variant:"overline",children:r})]}):(0,o.jsx)(N(),{variant:"overline",className:"rustic-time-display",children:n})}Tt.defaultProps={style:"condensed"};const Ot=require("@mui/material/Divider");var Pt=i.n(Ot);function Dt(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)(N(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function Rt(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useState)(!1),a=i[0],s=i[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],x=f[1],v=(0,g.useState)(""),b=v[0],y=v[1],j=(0,De.useTheme)(),w=(0,g.useRef)(null),S=(0,De.useMediaQuery)(j.breakpoints.down("md"));function k(){return(0,o.jsx)(N(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function F(){if(e.captions&&e.captions.length>0){var t=a?"captionsOff":"captionsOn";return(0,o.jsx)(jt,{action:t,onClick:function(){return s(!a)}})}}function C(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Nt,{mediaElement:w.current,movement:"replay"}),(0,o.jsx)(Ct,{mediaElement:w.current,onError:y}),(0,o.jsx)(Nt,{mediaElement:w.current,movement:"forward"})]})}function E(){if(e.transcript&&r)return(0,o.jsx)(Dt,{transcript:e.transcript})}function O(){if(e.transcript)return(0,o.jsx)(Ft,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function P(){return(0,o.jsx)("video",{src:e.src,ref:w,className:a?"rustic-has-captions":"",children:a&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,g.useEffect)((function(){var e,t,r,n;function i(e){x(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(){x(""),u(!1)})),null===(r=w.current)||void 0===r||r.addEventListener("error",(function(){return i("Failed to load the audio.")})),null===(n=w.current)||void 0===n||n.addEventListener("stalled",(function(){return i("Failed to fetch audio data, but trying.")}))}),[]);var D=S?function(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Tt,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"wide"}),(0,o.jsx)(St,{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: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:[F(),(0,o.jsx)(Et,{mediaElement:w.current})]})]})]}),E()]})}: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)(St,{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(),F(),(0,o.jsx)(Et,{mediaElement:w.current}),(0,o.jsx)(kt,{mediaElement:w.current}),(0,o.jsx)(Tt,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:O()})]}),E()]})]})};return h.length>0?(0,o.jsx)(et(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[P(),(0,o.jsx)(I(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[P(),D(),b.length>0&&(0,o.jsx)(et(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b})]})}function qt(e){var t=(0,g.useState)(!!document.pictureInPictureElement),r=t[0],n=t[1],i=e.mediaElement,a=r?"miniPlayerExit":"miniPlayer";return i.onleavepictureinpicture=function(){n(!1)},(0,o.jsx)(jt,{onClick:function(){r?document.exitPictureInPicture().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit mini player. Error: ".concat(t.message))})):i.requestPictureInPicture().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter mini player. Error: ".concat(t.message))}))},action:a})}function At(e){var t=(0,g.useState)(!!document.fullscreenElement),r=t[0],n=t[1],i=e.element,a=r?"fullscreenExit":"fullscreen";return i.onfullscreenchange=function(){n(!!document.fullscreenElement)},(0,o.jsx)(jt,{onClick:function(){r?document.exitFullscreen().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit fullscreen mode. Error: ".concat(t.message))})):i.requestFullscreen().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter fullscreen mode. Error: ".concat(t.message))}))},action:a})}function It(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useState)(!1),a=i[0],s=i[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],x=f[1],v=(0,g.useState)(""),b=v[0],y=v[1],j=(0,g.useState)(""),w=j[0],S=j[1],k=(0,g.useState)(0),F=k[0],C=k[1],E=(0,g.useRef)(null),O=(0,g.useRef)(null),P=(0,De.useTheme)(),D=(0,De.useMediaQuery)(P.breakpoints.down("md"));(0,g.useEffect)((function(){var e,t,r,n,i,a,o,s;function c(e){S(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return x(!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===(i=E.current)||void 0===i||i.addEventListener("mousemove",(function(){x(!0),l()})),null===(a=E.current)||void 0===a||a.addEventListener("mouseleave",(function(){x(!1)})),null===(o=E.current)||void 0===o||o.addEventListener("keydown",(function(){x(!0),l()}))}),[]);var R={backgroundColor:P.palette.background.paper,opacity:h?1:0};function q(){if(e.transcript&&r)return(0,o.jsx)(Dt,{transcript:e.transcript})}function A(){if(e.captions&&e.captions.length>0){var t=a?"captionsOff":"captionsOn";return(0,o.jsx)(jt,{action:t,onClick:function(){return s(!a)}})}}function z(){if(e.transcript)return(0,o.jsx)(Ft,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var M=D?function(){return p?(0,o.jsx)(o.Fragment,{children:O.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:R,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(Ct,{mediaElement:O.current,onError:y}),(0,o.jsx)(St,{mediaElement:O.current}),(0,o.jsx)(Tt,{elapsedTimeInSeconds:F,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)(Nt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Nt,{mediaElement:O.current,movement:"forward"}),A(),(0,o.jsx)(Et,{mediaElement:O.current})]}),z()]}),q()]})}):(0,o.jsx)(o.Fragment,{children:O.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Ct,{mediaElement:O.current,onError:y}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[z(),(0,o.jsx)(At,{element:E.current,onError:y})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:O.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:R,children:[(0,o.jsx)(St,{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)(Ct,{mediaElement:O.current,onError:y}),(0,o.jsx)(Nt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Nt,{mediaElement:O.current,movement:"forward"}),A(),(0,o.jsx)(Et,{mediaElement:O.current}),(0,o.jsx)(kt,{mediaElement:O.current}),(0,o.jsx)(Tt,{elapsedTimeInSeconds:F,durationTimeInSeconds:O.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[z(),(0,o.jsx)(qt,{mediaElement:O.current,onError:y}),(0,o.jsx)(At,{element:E.current,onError:y})]})]}),p&&q()]})})};return w.length>0?(0,o.jsx)(et(),{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:E,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[b.length>0&&(0,o.jsx)(et(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b}),(!D||p)&&function(){if(O.current&&E.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:R,children:[(0,o.jsx)(N(),{variant:"body2",children:e.title}),p&&D&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(qt,{mediaElement:O.current,onError:y}),(0,o.jsx)(At,{element:E.current,onError:y})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:O,src:e.src,poster:e.poster,children:a&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),M()]}),!p&&q()]})}var zt=i(445);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)(R.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 Lt(e){var t=(0,g.useState)("Start reading aloud"),r=t[0],n=t[1],i=[e.message.data.title,e.message.data.description,e.message.data.alt,e.message.data.text,e.message.data.transcript].filter(Boolean).join(" "),a=new SpeechSynthesisUtterance(i);return(0,o.jsx)(zt.default,{message:e.message,icon:(0,o.jsx)(R.A,{name:"text_to_speech"}),onClick:function(){window.speechSynthesis.speaking?(window.speechSynthesis.cancel(),n("Start reading aloud")):(a.onend=function(){n("Start reading aloud")},window.speechSynthesis.speak(a),n("Stop reading aloud"))},label:r})}const Bt=require("@mui/material/Stack");var _t=i.n(Bt);const Ht=function(e){return(0,o.jsx)(N(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),n=navigator.language,i={month:"short",day:"numeric"},a=new Date,s=r.getFullYear()!==a.getFullYear(),c=s?" at ":", ",s&&(i.year="numeric"),r.toLocaleDateString(n,i)+c+r.toLocaleTimeString(n,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,n,i,a,s,c},Wt=(0,g.forwardRef)((function(e,t){var r=(0,De.useTheme)();return(0,o.jsxs)(_t(),{id:e.message.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(_t(),{direction:"row",alignItems:"center",spacing:1,children:[e.getProfileComponent&&e.getProfileComponent(e.message),(0,o.jsx)(Ht,{timestamp:e.message.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(be(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(e.message)}),(0,o.jsx)(be(),{variant:"outlined",className:"rustic-message-container",children:e.children})]})})),Vt=require("@mui/material/Chip");var Ut=i.n(Vt);const Gt=require("@mui/system/Box");var Kt=i.n(Gt),Qt=function(){return Qt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Qt.apply(this,arguments)};function Yt(e,t){var r=t.format.includes("update")?t.threadId:t.id;if(r){var n=Qt({},e),i=(e[r]||[])[0];return t.format.includes("update")&&i&&i.sender.id!==t.sender.id&&(r=t.id),n[r]||(n[r]=[]),n[r]=n[r].concat(t),n}return e}function Xt(e){var t,r,n,i=(0,g.useRef)(null),a=(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],x=f[1],v=(0,g.useState)({}),b=v[0],y=v[1],j=Object.keys(b).length,w=(r=j,n=(0,g.useRef)(0),(0,g.useEffect)((function(){n.current=r})),n.current),S=2e3;function k(){m(!0),s.current&&clearTimeout(s.current),s.current=setTimeout((function(){m(!1)}),S)}function F(){var e=a.current,t=i.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=a.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=a.current;x(!0),e&&setTimeout((function(){k(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(C,1)}function E(e){y((function(t){return Yt(t,e)}))}return(0,g.useEffect)((function(){var e=a.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(){C()}),[h]),(0,g.useEffect)((function(){l&&0!==w&&j>w&&(k(),C())}),[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=Yt(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(E)}),[]),(0,o.jsxs)(Kt(),{ref:a,className:"rustic-message-space",children:[Object.keys(b).map((function(t,r){var n=b[t],a=n[n.length-1];return(0,o.jsx)(Wt,{message:a,getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===j-1?i:null,children:(0,o.jsx)(D,{ws:e.ws,sender:e.sender,messages:n,supportedElements:e.supportedElements})},t)})),!l&&!p&&(0,o.jsx)(Ut(),{variant:"rusticSecondary",className:"rustic-scroll-down-button",size:"medium",onClick:C,label:(0,o.jsxs)(o.Fragment,{children:[e.scrollDownLabel,(0,o.jsx)(R.A,{name:"arrow_downward"})]})})]})}Xt.defaultProps={scrollDownLabel:"Scroll down"};const $t=function(e){return(0,o.jsx)(N(),{variant:"body2",className:"rustic-text",children:ft().sanitize(e.text)})};function Zt(e){return(0,o.jsxs)(Kt(),{className:"rustic-multipart",children:[e.text&&(0,o.jsx)($t,{text:e.text}),(t=e.files.map((function(t,r){return(0,o.jsx)(Oe,{file:t,showFullName:e.showFullName,children:t.url&&(0,o.jsx)(ae(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(K(),{component:"a",href:t.url,download:t.name,children:(0,o.jsx)(R.A,{name:"download"})})})},r)})),(0,o.jsx)(Kt(),{className:"rustic-files",children:t}))]});var t}const Jt=require("@mui/material/Dialog");var er=i.n(Jt);const tr=require("@mui/material/DialogTitle");var rr=i.n(tr);const nr=require("@mui/material/List");var ir=i.n(nr);const ar=require("@mui/material/ListItem");var or=i.n(ar);const sr=require("@mui/material/ListSubheader");var cr=i.n(sr);const lr=require("pluralize");var ur,dr,pr=i.n(lr);function mr(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=e.participants.length,a=r?e.participants:e.participants.slice(0,3),s="".concat(pr()(e.participantType,i)," (").concat(i,")"),c=r?"Show Less":"Show All ".concat(i);return 0===i?(0,o.jsx)(N(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(ir(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(cr(),{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)(N(),{variant:"subtitle2",color:"text.secondary",children:s})]}),i>3&&(0,o.jsx)(qe(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(R.A,{name:"keyboard_arrow_down"}),children:c})]}),children:a.map((function(e){return(0,o.jsxs)(or(),{className:"rustic-participant-list-item",children:[(0,o.jsx)(N(),{variant:"subtitle2",children:e.displayName}),(0,o.jsx)(N(),{variant:e.participantRole===ur.Owner?"subtitle2":"caption",children:M(e.participantRole)})]},e.id)}))})}!function(e){e.Owner="owner",e.Member="member"}(ur||(ur={})),function(e){e.Human="human",e.Agent="agent"}(dr||(dr={}));const fr=function(e){function t(e,t){return function(e){return function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],e,!0).sort((function(e,t){return t.participantRole===ur.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,dr.Human),n=t(e.participants,dr.Agent),i="".concat(pr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(er(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(rr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:i}),(0,o.jsx)(mr,{participantType:"Human",participantTypeIcon:(0,o.jsx)(R.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)(mr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(R.A,{name:"smart_toy"}),participants:n})]})]})},hr=require("@mui/material/DialogActions");var xr=i.n(hr);const vr=require("@mui/material/DialogContent");var gr=i.n(vr);const br=require("@mui/material/DialogContentText");var yr=i.n(br),jr=function(){return jr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},jr.apply(this,arguments)},wr=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function Sr(e){var t=(0,g.useState)(!1),r=t[0],n=t[1],i=(0,g.useState)(!1),a=i[0],s=i[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],x=f[1],v=(0,g.useState)(null),b=v[0],y=v[1],j=(0,T.useTheme)(),w=h[h.length-1],S=jr(jr({},e.ws),{send:function(e){y(e)}});function k(e){x((function(t){return wr(wr([],t,!0),[e],!1)}))}function F(){if(b){var t=jr(jr({},b),{threadId:e.messageId});e.ws.send(t)}}if((0,g.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(k)}),[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)(be(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(er(),{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)(rr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(Pt(),{}),(0,o.jsx)(gr(),{children:(0,o.jsx)(yr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(xr(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(qe(),{variant:"rusticSecondary",startIcon:(0,o.jsx)(R.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(qe(),{variant:"rusticPrimary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(N(),{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(!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)}))}(),a&&(0,o.jsx)(I(),{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)(qe(),{variant:"rusticSecondary",startIcon:(0,o.jsx)(R.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(qe(),{variant:"rusticSecondary",endIcon:(0,o.jsx)(R.A,{name:"chevron_right"}),onClick:function(){F(),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)(qe(),{variant:"rusticPrimary",onClick:function(){F(),m(!0),s(!0),e.onSubmit()},disabled:a,"aria-disabled":a,children:"Generate"})})]})})]})}function kr(e){var t=(0,g.useState)(""),r=t[0],n=t[1],i=(0,De.useTheme)(),a=(0,De.useMediaQuery)(i.breakpoints.down("md"))?"column":"row",s=e.options.map((function(t,i){return(0,o.jsx)(Ut(),{onClick:function(){return function(t){n(t);var r=(new Date).toISOString(),i={id:(0,U.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:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r,"aria-disabled":!!r,label:t},i)}));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)(N(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",children:e.description})]}),(0,o.jsx)(_t(),{direction:a,className:"rustic-options-container",children:s})]})}const Fr=require("@mui/material/Table");var Cr=i.n(Fr);const Er=require("@mui/material/TableBody");var Nr=i.n(Er);const Tr=require("@mui/material/TableCell");var Or=i.n(Tr);const Pr=require("@mui/material/TableContainer");var Dr=i.n(Pr);const Rr=require("@mui/material/TableHead");var qr=i.n(Rr);const Ar=require("@mui/material/TablePagination");var Ir=i.n(Ar);const zr=require("@mui/material/TableRow");var Mr=i.n(zr);const Lr=require("@mui/material/TableSortLabel");var Br,_r=i.n(Lr),Hr=10;function Wr(){return(0,o.jsx)(R.A,{name:"expand_all"})}function Vr(e){if(0===e.data.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available"});var t,r,n,i=e.data.length>Hr,a=(0,g.useState)({}),s=a[0],c=a[1],l=(0,g.useState)(i?Hr:-1),u=l[0],d=l[1],p=(0,g.useState)(0),m=p[0],f=p[1],h=(0,De.useTheme)(),x=Array.from(new Set(e.data.flatMap((function(e){return Object.keys(e)})))),v=e.headers||x.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===Br.Descending?1:-1:e[r]>t[r]?n===Br.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 Wr}return(0,o.jsxs)(_t(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(N(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)(Dr(),{className:"rustic-table-container",children:(0,o.jsxs)(Cr(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[v.length>0&&(0,o.jsx)(qr(),{children:(0,o.jsx)(Mr(),{children:v.map((function(e,t){return(0,o.jsx)(Or(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(ae(),{title:(r=e.dataKey,n=s[r],n?Object.keys(Br)[Object.values(Br).indexOf(n)]:"Sort"),children:(0,o.jsx)(_r(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c((function(t){var r,n,i={};switch(t[e]){case Br.Ascending:(r={})[e]=Br.Descending,i=r;break;case Br.Descending:i={};break;default:(n={})[e]=Br.Ascending,i=n}return i}))}(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)(Nr(),{children:j.map((function(e,t){return(0,o.jsx)(Mr(),{children:v.map((function(r,n){return(0,o.jsx)(Or(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))})]})}),i&&(0,o.jsx)(Ir(),{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"}(Br||(Br={}));const Ur=function(e){var t=(0,g.useState)(ft().sanitize(e.text)),r=t[0],n=t[1],i=(0,g.useState)(""),a=i[0],s=i[1];return(0,g.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,i=e.updatedData;r<i.length;r++){var a=i[r];"string"!=typeof a.text&&(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=a.text}n(ft().sanitize(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(N(),{variant:"body2",children:r}),a&&(0,o.jsx)(et(),{severity:"error",children:a})]})};var Gr=function(){return Gr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Gr.apply(this,arguments)};function Kr(e){var t=ft().sanitize(e.youtubeVideoId);return(0,o.jsx)("iframe",Gr({},_(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"}))}Kr.defaultProps={title:"Embedded video"};const Qr=require("@mui/material/FormControl");var Yr=i.n(Qr);const Xr=require("recharts");var $r=function(){return $r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$r.apply(this,arguments)},Zr={line:Xr.LineChart,bar:Xr.BarChart,area:Xr.AreaChart};function Jr(e){var t={};return e.forEach((function(e){t[e]=!0})),t}function en(e){var t=(0,g.useState)(e.defaultChartType||"line"),r=t[0],n=t[1],i=(0,g.useState)(null),a=i[0],s=i[1],c=(0,g.useState)(e.timeSeries),l=c[0],u=c[1],d=Fe()(),p=l.length>0?Object.keys(l[0]):[],m=p[0],f=p.slice(1),h=(0,g.useState)(Jr(f)),x=h[0],v=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,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);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=Zr[r];function y(e){a?s(null):e&&s(e.currentTarget)}function j(t,r){return x[t]?e.chartColors[r%e.chartColors.length]:"grey"}function w(e){return x[e]?"none":"line-through"}if(0===l.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available"});var S,k,F,C,E=e.timeSeries[e.timeSeries.length-1],T=(S=e.timeSeries[0][m],k=E[m],F=new Date(S),C=new Date(k),Math.round(Math.abs((C.getTime()-F.getTime())/864e5)));return(0,o.jsxs)(Kt(),{className:"rustic-recharts-time-series",children:[!e.disableChartTypeToggle&&(0,o.jsxs)(Yr(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,o.jsx)(K(),{"aria-label":"chart options","aria-expanded":Boolean(a),"aria-haspopup":"true",onClick:y,color:"primary",children:(0,o.jsx)(R.A,{name:"more_vert"})}),(0,o.jsxs)(Be(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:a,open:Boolean(a),onClose:function(e){return y(e)},children:[(0,o.jsx)(N(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(Zr).map((function(e){return(0,o.jsxs)($(),{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)(Kt(),{children:[e.title&&(0,o.jsx)(N(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",className:"rustic-recharts-time-series-description",children:e.description}),(0,o.jsx)(Xr.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)(Xr.XAxis,{dataKey:m,tickFormatter:function(e){return L(e,T)},stroke:d.palette.text.primary}),(0,o.jsx)(Xr.YAxis,{domain:["auto","auto"],width:e.yAxisLabelWidth,tickFormatter:e.yAxisTickFormatter,stroke:d.palette.text.primary}),(0,o.jsx)(Xr.Tooltip,{labelFormatter:function(e){return[L(e,T)]},formatter:e.tooltipFormatter,contentStyle:{color:d.palette.common.black}}),(0,o.jsx)(Xr.Legend,{content:function(){return(0,o.jsx)(Kt(),{className:"rustic-recharts-time-series-legend",children:f.map((function(e,t){return(0,o.jsxs)(Kt(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=x[e]&&!f.find((function(t){return t!==e&&x[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(x)){for(var n={},i=0,a=f;i<a.length;i++){var o=a[i],s=o===e;n[o]=s}v(n)}else v(r?Jr(f):$r($r({},x),((t={})[e]=!x[e],t)))}(e)},sx:{color:j(e,t)},children:[(0,o.jsx)(R.A,{name:"crop_16_9"}),(0,o.jsx)(N(),{variant:"body2",display:"inline",sx:{textDecorationLine:w(e)},children:e})]},t)}))})}}),f.map((function(t,n){return x[t]?function(t,n){var i=n%e.chartColors.length,a=x[t]?e.chartColors[i]:"transparent",s={onClick:e.onClick,cursor:"pointer"};switch(r){case"line":return(0,o.jsx)(Xr.Line,{type:"monotone",isAnimationActive:!1,dataKey:t,name:t,dot:!1,stroke:a,activeDot:e.onClick&&s},t);case"bar":return(0,o.jsx)(Xr.Bar,{dataKey:t,fill:a,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:a,stopOpacity:.8}),(0,o.jsx)("stop",{offset:"95%",stopColor:a,stopOpacity:0})]})}),(0,o.jsx)(Xr.Area,{isAnimationActive:!1,dataKey:t,type:"monotone",stroke:a,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)(Xr.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)}))]})})]})]})}en.defaultProps={minChartWidth:200,maxHeight:600,yAxisLabelWidth:30,aspectRatio:16/9,disableChartTypeToggle:!1};const tn=en,rn=require("mermaid");var nn=i.n(rn),an=function(){return an=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},an.apply(this,arguments)};const on=function(e){var t=(0,g.useRef)(null),r=(0,g.useState)(),n=r[0],i=r[1],a=Fe()(),s=(0,U.v4)();return(0,g.useEffect)((function(){var r="dark"===a.palette.mode?"dark":"neutral",n=a.typography.fontFamily;t.current&&(nn().initialize(an({theme:r,themeVariables:{fontFamily:n}},e.config)),nn().render("mermaid-svg-".concat(s),e.diagram,t.current).then((function(e){t.current&&(t.current.innerHTML=e.svg),i("")})).catch((function(){var e;null===(e=t.current)||void 0===e||e.replaceChildren(),i("Failed to render the diagram.")})))})),(0,o.jsxs)(_t(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(N(),{variant:"subtitle2",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",children:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(N(),{variant:"body2",children:n})]})},sn=(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 cn=i.n(sn),ln=function(){return ln=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ln.apply(this,arguments)};function un(e){return e?e.reduce((function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e}),{}):{}}const dn=function(e){if(0===e.data.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available."});var t=(0,g.useRef)(null),r=(0,h.useTheme)(),n=(0,g.useState)(!1),i=n[0],a=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=un(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 span.button {\n color: ").concat(r.palette.primary.main," !important;\n }\n \n span.button:hover:before {\n background-color: ").concat(r.palette.primary.main," !important;\n }\n \n .button select:hover, .button:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(r.palette.primary.light," !important;\n }\n \n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: scroll !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 ");var d,p,m,f,x,v,b,y,j,w=e.config&&(p=(d=e.config).groupBy,m=d.splitBy,f=d.aggregates,x=d.sort,v=d.filter,b=d.columns,y=null==x?void 0:x.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: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,g.useEffect)((function(){var r=t.current;r&&cn().worker().then((function(t){t.table(function(e,t){var r=un(t);return e.map((function(e){for(var t={},n=0,i=Object.entries(e);n<i.length;n++){var a=i[n],o=a[0],s=a[1];t[r[o]||o]=s}return t}))}(e.data,e.headers)).then((function(t){r.load(t).then((function(){return r.restore(ln(ln({},w),{theme:c,title:e.title,settings:!1})).then((function(){if(r.shadowRoot){var e=new CSSStyleSheet;e.replaceSync(u),r.shadowRoot.adoptedStyleSheets.push(e)}}))}))}))})).catch((function(){a(!0)}))}),[e.data,c]),i?(0,o.jsx)(N(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(Se(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},pn=require("react-plotly.js");var mn=i.n(pn),fn=function(){return fn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},fn.apply(this,arguments)};const hn=function(e){var t=fn(fn({},e.plotParams),{className:"rustic-plotly"});return t.config=fn(fn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Kt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)(mn(),fn({},t))]})},xn=require("react-dom/server"),vn=require("vega-embed");var gn=i.n(vn),bn=function(){return bn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},bn.apply(this,arguments)};function yn(e){var t=(0,g.useRef)(null),r=(0,g.useState)(!1),n=r[0],i=r[1],a=Fe()(),s="dark"===a.palette.mode,c=a.typography.fontFamily,l={backgroundColor:a.palette.primary.main,color:a.palette.background.paper,borderRadius:a.shape.borderRadius+"px",padding:"4px 8px",fontSize:a.typography.caption.fontSize,fontFamily:c,fontWeight:a.typography.caption.fontWeight},u={formatTooltip:function(e,t){return(0,xn.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,a,o;if(t.current&&e.spec){var l=bn(bn({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===(a=e.options)||void 0===a?void 0:a.config)||void 0===o?void 0:o.font)||(l.config.font=c);var p=bn({},e.spec);delete p.title,gn()(t.current,p,l).then((function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map((function(n,i){var a="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,a).then((function(e){d[i].href=e,d[i].downloadFileName="".concat(r,".").concat(n)}))})),i(!1)})).catch((function(){i(!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)(N(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(Se(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Kt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(He,{menuItems:d,ariaLabel:"Download options"})}),e.title&&(0,o.jsx)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(vt,{text:e.description}),(0,o.jsxs)(Kt(),{textAlign:"center",mt:1,children:["string"==typeof e.spec.title&&(0,o.jsx)(N(),{variant:"subtitle2",children:e.spec.title}),e.spec.description&&(0,o.jsx)(N(),{variant:"caption",children:e.spec.description})]}),(0,o.jsx)("div",{ref:t,className:"rustic-vega-lite"})]})}const jn=yn;function wn(e){var t=(0,g.useState)(e.units),r=t[0],n=t[1];function i(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 a=new Date(1e3*e.weather[0].timestamp),s=H(e.weather[0].timestamp).shortName,c=a.getDate(),l=a.getFullYear().toString().slice(2),u="".concat(s," ").concat(c,"/").concat(l," TODAY"),d="HIGH: ".concat(i(e.weather[0].temp.high)," / LOW: ").concat(i(e.weather[0].temp.high)),p=e.weather.map((function(e,t){if(0!==t)return(0,o.jsxs)(be(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(N(),{variant:"h5",component:"span",color:"text.secondary","aria-label":H(e.timestamp).fullName,children:H(e.timestamp).shortName}),(0,o.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,o.jsxs)(N(),{variant:"body2",color:"text.secondary",children:["High: ",i(e.temp.high),"°"]}),(0,o.jsxs)(N(),{variant:"body2",color:"text.secondary",children:["Low: ",i(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(be(),{variant:"outlined",className:"rustic-weather",children:[(0,o.jsx)(He,{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)(_t(),{alignItems:"center",children:[(0,o.jsx)(N(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(_t(),{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)(N(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(N(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[i(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(r)]}),(0,o.jsxs)(_t(),{direction:"row",spacing:2,children:[(0,o.jsx)(N(),{variant:"overline",children:u}),(0,o.jsx)(N(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)(_t(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(R.A,{name:"cloud"}),(0,o.jsx)(N(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}yn.defaultProps={theme:{dark:"dark"}};var Sn=i(321);return a})()));
|