@1interface/chat-shell 0.5.1 → 0.6.0-moet.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-shell.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/native/providers/ChatClientProvider.js +1 -1
- package/package.json +5 -5
package/dist/chat-shell.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 222.34 49% 11%;--foreground: 0 0% 100%;--card: 215.2915 27.9312% 26.8494%;--card-foreground: 0 0% 100%;--popover: 215.2915 27.9312% 26.8494%;--popover-foreground: 0 0% 100%;--primary: 216.8916 105.653% 59.6083%;--primary-foreground: 0 0% 100%;--secondary: 149.9516 168.4095% 24.2653%;--secondary-foreground: 0 0% 100%;--muted: 250 11.7647% 20%;--muted-foreground: 250 10.1124% 65.098%;--accent: 217.2414 32.5843% 17.451%;--accent-foreground: 210 40% 98.0392%;--destructive: 0 62.3529% 50%;--destructive-foreground: 252 20% 95.098%;--border: 217.2414 32.5843% 17.451%;--input: 217.2414 32.5843% 17.451%;--ring: 212.7273 26.8293% 83.9216%;--chart-1: 312.9412 100% 50%;--chart-2: 273.8824 100% 50%;--chart-3: 186.1176 100% 50%;--chart-4: 168 100% 50%;--chart-5: 54.1176 100% 50%;--radius: .5rem}.dark{--background: 222.34 49% 11%;--foreground: 0 0% 100%;--card: 215.2915 27.9312% 26.8494%;--card-foreground: 0 0% 100%;--popover: 215.2915 27.9312% 26.8494%;--popover-foreground: 0 0% 100%;--primary: 216.8916 105.653% 59.6083%;--primary-foreground: 0 0% 100%;--secondary: 149.9516 168.4095% 24.2653%;--secondary-foreground: 0 0% 100%;--muted: 250 11.7647% 20%;--muted-foreground: 250 10.1124% 65.098%;--accent: 217.2414 32.5843% 17.451%;--accent-foreground: 210 40% 98.0392%;--destructive: 0 62.8205% 30.5882%;--destructive-foreground: 210 40% 98.0392%;--border: 217.2414 32.5843% 17.451%;--input: 217.2414 32.5843% 17.451%;--ring: 212.7273 26.8293% 83.9216%;--chart-1: 312.9412 100% 50%;--chart-2: 273.8824 100% 50%;--chart-3: 186.1176 100% 50%;--chart-4: 168 100% 50%;--chart-5: 54.1176 100% 50%;--radius: .5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media(min-width:1400px){.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{left:0;right:0}.right-3{right:.75rem}.top-1\/2{top:50%}.z-10{z-index:10}.z-\[105\]{z-index:105}.mb-1{margin-bottom:.25rem}.mb-3\.5{margin-bottom:.875rem}.mt-1{margin-top:.25rem}.mt-2\.5{margin-top:.625rem}.block{display:block}.inline{display:inline}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-8{height:2rem}.h-full{height:100%}.min-h-0{min-height:0px}.min-h-full{min-height:100%}.w-8{width:2rem}.w-full{width:100%}.max-w-lg{max-width:32rem}.flex-1{flex:1 1 0%}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-3{gap:.75rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-y-auto{overflow-y:auto}.border{border-width:1px}.border-0{border-width:0px}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.text-center{text-align:center}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.\[scrollbar-width\:none\]{scrollbar-width:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-70:disabled{opacity:.7}.\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar{display:none}
|
|
1
|
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 222.34 49% 11%;--foreground: 0 0% 100%;--card: 215.2915 27.9312% 26.8494%;--card-foreground: 0 0% 100%;--popover: 215.2915 27.9312% 26.8494%;--popover-foreground: 0 0% 100%;--primary: 216.8916 105.653% 59.6083%;--primary-foreground: 0 0% 100%;--secondary: 149.9516 168.4095% 24.2653%;--secondary-foreground: 0 0% 100%;--muted: 250 11.7647% 20%;--muted-foreground: 250 10.1124% 65.098%;--accent: 217.2414 32.5843% 17.451%;--accent-foreground: 210 40% 98.0392%;--destructive: 0 62.3529% 50%;--destructive-foreground: 252 20% 95.098%;--border: 217.2414 32.5843% 17.451%;--input: 217.2414 32.5843% 17.451%;--ring: 212.7273 26.8293% 83.9216%;--chart-1: 312.9412 100% 50%;--chart-2: 273.8824 100% 50%;--chart-3: 186.1176 100% 50%;--chart-4: 168 100% 50%;--chart-5: 54.1176 100% 50%;--radius: .5rem}.dark{--background: 222.34 49% 11%;--foreground: 0 0% 100%;--card: 215.2915 27.9312% 26.8494%;--card-foreground: 0 0% 100%;--popover: 215.2915 27.9312% 26.8494%;--popover-foreground: 0 0% 100%;--primary: 216.8916 105.653% 59.6083%;--primary-foreground: 0 0% 100%;--secondary: 149.9516 168.4095% 24.2653%;--secondary-foreground: 0 0% 100%;--muted: 250 11.7647% 20%;--muted-foreground: 250 10.1124% 65.098%;--accent: 217.2414 32.5843% 17.451%;--accent-foreground: 210 40% 98.0392%;--destructive: 0 62.8205% 30.5882%;--destructive-foreground: 210 40% 98.0392%;--border: 217.2414 32.5843% 17.451%;--input: 217.2414 32.5843% 17.451%;--ring: 212.7273 26.8293% 83.9216%;--chart-1: 312.9412 100% 50%;--chart-2: 273.8824 100% 50%;--chart-3: 186.1176 100% 50%;--chart-4: 168 100% 50%;--chart-5: 54.1176 100% 50%;--radius: .5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media(min-width:1400px){.container{max-width:1400px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{left:0;right:0}.right-3{right:.75rem}.top-1\/2{top:50%}.z-10{z-index:10}.z-\[105\]{z-index:105}.mb-1{margin-bottom:.25rem}.mb-3\.5{margin-bottom:.875rem}.mt-1{margin-top:.25rem}.mt-2\.5{margin-top:.625rem}.block{display:block}.inline{display:inline}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-8{height:2rem}.h-full{height:100%}.min-h-0{min-height:0px}.min-h-full{min-height:100%}.w-8{width:2rem}.w-full{width:100%}.max-w-lg{max-width:32rem}.flex-1{flex:1 1 0%}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-3{gap:.75rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-y-auto{overflow-y:auto}.border{border-width:1px}.border-0{border-width:0px}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.text-center{text-align:center}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.\[scrollbar-width\:none\]{scrollbar-width:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-70:disabled{opacity:.7}.\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar{display:none}
|
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export declare interface ChatClientProviderProps extends Pick<ChatProps, "baseUr
|
|
|
55
55
|
orgId?: string;
|
|
56
56
|
initialThemeStyles?: ChatThemeStyles | null;
|
|
57
57
|
initialAppearanceMode?: AppearanceMode;
|
|
58
|
+
reuseHostBranding?: boolean;
|
|
58
59
|
audioPlatform?: AudioPlatform;
|
|
59
60
|
networkMonitor?: NetworkMonitor;
|
|
60
61
|
children: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@reduxjs/toolkit"),t=require("@1interface/chat-core"),n=require("@1interface/shared-core"),r=require("@1interface/voice-core"),o=require("react/jsx-runtime"),s=require("react"),i=require("react-redux"),a=require("@1interface/voice-shell");var c=Symbol.for("immer-nothing"),u=Symbol.for("immer-draftable"),l=Symbol.for("immer-state"),d="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function p(e,...t){if("production"!==process.env.NODE_ENV){const n=d[e],r=N(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var f=Object,h=f.getPrototypeOf,_="constructor",m="prototype",y="configurable",g="enumerable",S="writable",E="value",v=e=>!!e&&!!e[l];function A(e){return!!e&&(w(e)||R(e)||!!e[u]||!!e[_]?.[u]||I(e)||k(e))}var b=f[m][_].toString(),P=new WeakMap;function w(e){if(!e||!D(e))return!1;const t=h(e);if(null===t||t===f[m])return!0;const n=f.hasOwnProperty.call(t,_)&&t[_];if(n===Object)return!0;if(!N(n))return!1;let r=P.get(n);return void 0===r&&(r=Function.toString.call(n),P.set(n,r)),r===b}function C(e,t,n=!0){0===M(e)?(n?Reflect.ownKeys(e):f.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function M(e){const t=e[l];return t?t.type_:R(e)?1:I(e)?2:k(e)?3:0}var O=(e,t,n=M(e))=>2===n?e.has(t):f[m].hasOwnProperty.call(e,t),T=(e,t,n=M(e))=>2===n?e.get(t):e[t],x=(e,t,n,r=M(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},R=Array.isArray,I=e=>e instanceof Map,k=e=>e instanceof Set,D=e=>"object"==typeof e,N=e=>"function"==typeof e,j=e=>"boolean"==typeof e,z=e=>e.copy_||e.base_,L=e=>e.modified_?e.copy_:e.base_;function F(e,t){if(I(e))return new Map(e);if(k(e))return new Set(e);if(R(e))return Array[m].slice.call(e);const n=w(e);if(!0===t||"class_only"===t&&!n){const t=f.getOwnPropertyDescriptors(e);delete t[l];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],s=t[o];!1===s[S]&&(s[S]=!0,s[y]=!0),(s.get||s.set)&&(t[o]={[y]:!0,[S]:!0,[g]:s[g],[E]:e[o]})}return f.create(h(e),t)}{const t=h(e);if(null!==t&&n)return{...e};const r=f.create(t);return f.assign(r,e)}}function K(e,t=!1){return Y(e)||v(e)||!A(e)||(M(e)>1&&f.defineProperties(e,{set:G,add:G,clear:G,delete:G}),f.freeze(e),t&&C(e,(e,t)=>{K(t,!0)},!1)),e}var G={[E]:function(){p(2)}};function Y(e){return null===e||!D(e)||f.isFrozen(e)}var $="MapSet",q="Patches",U="ArrayMethods",H={};function V(e){const t=H[e];return t||p(0,e),t}var B,W=e=>!!H[e],Q=()=>B;function X(e,t){t&&(e.patchPlugin_=V(q),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function J(e){Z(e),e.drafts_.forEach(te),e.drafts_=null}function Z(e){e===B&&(B=e.parent_)}var ee=e=>B={drafts_:[],parent_:B,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:W($)?V($):void 0,arrayMethodsPlugin_:W(U)?V(U):void 0};function te(e){const t=e[l];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ne(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[l].modified_&&(J(t),p(4)),A(e)&&(e=re(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[l].base_,e,t)}else e=re(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&K(t,n)}(t,e,!0),J(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==c?e:void 0}function re(e,t){if(Y(t))return t;const n=t[l];if(!n)return ue(t,e.handledSet_,e);if(!se(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);ce(n,e)}return n.copy_}function oe(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var se=(e,t)=>e.scope_===t,ie=[];function ae(e,t,n,r){const o=z(e),s=e.type_;if(void 0!==r&&T(o,r,s)===t)return void x(o,r,n,s);if(!e.draftLocations_){const t=e.draftLocations_=new Map;C(o,(e,n)=>{if(v(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const i=e.draftLocations_.get(t)??ie;for(const e of i)x(o,e,n,s)}function ce(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}oe(e)}}function ue(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||v(e)||t.has(e)||!A(e)||Y(e)||(t.add(e),C(e,(r,o)=>{if(v(o)){const t=o[l];if(se(t,n)){const n=L(t);x(e,r,n,e.type_),oe(t)}}else A(o)&&ue(o,t,n)})),e}var le={get(e,t){if(t===l)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const o=z(e);if(!O(o,t,e.type_))return function(e,t,n){const r=fe(t,n);return r?E in r?r[E]:r.get?.call(e.draft_):void 0}(e,o,t);const s=o[t];if(e.finalized_||!A(s))return s;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return s;if(s===pe(e.base_,t)){_e(e);const n=1===e.type_?+t:t,r=me(0,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in z(e),ownKeys:e=>Reflect.ownKeys(z(e)),set(e,t,n){const r=fe(z(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=pe(z(e),t),i=r?.[l];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((o=n)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)&&(void 0!==n||O(e.base_,t,e.type_)))return!0;_e(e),he(e)}var o,s;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(v(n)){const o=n[l];se(o,r)&&o.callbacks_.push(function(){_e(e);const r=L(o);ae(e,n,r,t)})}else A(n)&&e.callbacks_.push(function(){const o=z(e);3===e.type_?o.has(n)&&ue(n,r.handledSet_,r):T(o,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&ue(T(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(_e(e),void 0!==pe(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),he(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=z(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[S]:!0,[y]:1!==e.type_||"length"!==t,[g]:r[g],[E]:n[t]}:r},defineProperty(){p(11)},getPrototypeOf:e=>h(e.base_),setPrototypeOf(){p(12)}},de={};for(let e in le){let t=le[e];de[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function pe(e,t){const n=e[l];return(n?z(n):e)[t]}function fe(e,t){if(!(t in e))return;let n=h(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=h(n)}}function he(e){e.modified_||(e.modified_=!0,e.parent_&&he(e.parent_))}function _e(e){e.copy_||(e.assigned_=new Map,e.copy_=F(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function me(e,t,n,r){const[o,s]=I(t)?V($).proxyMap_(t,n):k(t)?V($).proxySet_(t,n):function(e,t){const n=R(e),r={type_:n?1:0,scope_:t?t.scope_:Q(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=r,s=le;n&&(o=[r],s=de);const{revoke:i,proxy:a}=Proxy.revocable(o,s);return r.draft_=a,r.revoke_=i,[a,r]}(t,n);return(n?.scope_??Q()).drafts_.push(o),s.callbacks_=n?.callbacks_??[],s.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const o=t;if(!o||!se(o,r))return;r.mapSetPlugin_?.fixSetContents(o);const s=L(o);ae(e,o.draft_??o,s,n),ce(o,r)})}(n,s,r):s.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:t}=e;s.modified_&&t&&t.generatePatches_(s,[],e)}),o}function ye(e){return v(e)||p(10,e),ge(e)}function ge(e){if(!A(e)||Y(e))return e;const t=e[l];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=F(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=F(e,!0);return C(n,(e,t)=>{x(n,e,ge(t))},r),t&&(t.finalized_=!1),n}de.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&p(13),de.set.call(this,e,t,void 0)},de.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&p(14),le.set.call(this,e[0],t,n,e[0])},new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(N(e)&&!N(t)){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,e=>t.call(this,e,...o))}}let r;if(N(t)||p(6),void 0===n||N(n)||p(7),A(e)){const o=ee(this),s=me(0,e,void 0);let i=!0;try{r=t(s),i=!1}finally{i?J(o):Z(o)}return X(o,n),ne(r,o)}if(!e||!D(e)){if(r=t(e),void 0===r&&(r=e),r===c&&(r=void 0),this.autoFreeze_&&K(r,!0),n){const t=[],o=[];V(q).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:o}),n(t,o)}return r}p(1,e)},this.produceWithPatches=(e,t)=>{if(N(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},j(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),j(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),j(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){A(e)||p(8),v(e)&&(e=ye(e));const t=ee(this),n=me(0,e,void 0);return n[l].isManual_=!0,Z(t),n}finishDraft(e,t){const n=e&&e[l];n&&n.isManual_||p(9);const{scope_:r}=n;return X(r,t),ne(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=V(q).applyPatches_;return v(e)?r(e,t):this.produce(e,e=>r(e,t))}},Error;var Se=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},Ee=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:s,inputSelectorResultsCopy:i}=e,a=r(()=>({}),...o);if(a.apply(null,s)!==a.apply(null,i)){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:s,secondInputs:i,stack:e})}},ve={inputStabilityCheck:"once",identityFunctionCheck:"once"},Ae=e=>Array.isArray(e)?e:[e];function be(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var Pe="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function we(){return{s:0,v:void 0,o:null,p:null}}function Ce(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let o,s=0;function i(){let t=n;const{length:i}=arguments;for(let e=0,n=i;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=we(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=we(),e.set(n,t)):t=r}}const a=t;let c;if(1===t.s)c=t.v;else if(c=e.apply(null,arguments),s++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==s&&s--),o="object"==typeof c&&null!==c||"function"==typeof c?new Pe(c):c}return a.s=1,a.v=c,c}return i.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Me(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,s={},i=e.pop();"object"==typeof i&&(s=i,i=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(i,`createSelector expects an output function after the inputs, but received: [${typeof i}]`);const a={...n,...s},{memoize:c,memoizeOptions:u=[],argsMemoize:l=Ce,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,f=Ae(u),h=Ae(d),_=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),m=c(function(){return r++,i.apply(null,arguments)},...f);let y=!0;const g=l(function(){o++;const e=be(_,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...ve,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Se},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:Ee}}})(y,p);if(n.shouldRun&&n.run(i,e,t),r.shouldRun){const t=be(_,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:c,memoizeOptions:f},arguments)}y&&(y=!1)}return t},...h);return Object.assign(g,{resultFunc:i,memoizedResultFunc:m,dependencies:_,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var Oe=Me(Ce),Te=Object.assign((e,t=Oe)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Te}),xe="__rtkq/",Re="online",Ie="offline",ke="focus",De="focused",Ne="visibilitychange",je=e.createAction(`${xe}${De}`),ze=e.createAction(`${xe}un${De}`),Le=e.createAction(`${xe}${Re}`),Fe=e.createAction(`${xe}${Ie}`),Ke=!1;WeakMap,new Error("Promise never resolved before cacheEntryRemoved.");const Ge=e.combineReducers({...t.apiReducers,auth:n.sessionReducer,chat:t.chatReducer,conversations:t.conversationsReducer,voice:r.voiceReducer,indicator:n.indicatorReducer}),Ye=e.createListenerMiddleware();Ye.startListening({matcher:e.isAnyOf(n.clearSession,n.sessionExpired),effect:(e,{dispatch:n})=>{n(t.resetAllApiState())}});const $e=e.configureStore({reducer:Ge,middleware:e=>e({serializableCheck:t.serializableCheck}).prepend(Ye.middleware,n.sessionListenerMiddleware.middleware,r.voiceListenerMiddleware.middleware).concat(t.apiMiddleware)});var qe;qe=$e.dispatch,function(){const[e,t,n,r]=[je,ze,Le,Fe].map(e=>()=>qe(e())),o=()=>{"visible"===window.document.visibilityState?e():t()};if(!Ke&&"undefined"!=typeof window&&window.addEventListener){let t=function(e){Object.entries(s).forEach(([t,n])=>{e?window.addEventListener(t,n,!1):window.removeEventListener(t,n)})};const s={[ke]:e,[Ne]:o,[Re]:n,[Ie]:r};t(!0),Ke=!0}}(),n.setAccessTokenReader(()=>$e.getState().auth.accessToken),n.setTokenExpiresAtReader(()=>$e.getState().auth.tokenExpiresAt),t.bindChatLogger(()=>$e.getState());const Ue=!1,He=!0,Ve=!0,Be=n.STT_IMPLEMENTATIONS.ONLINE,We=!0,Qe=(e,t)=>null===e?t:"true"===e,Xe=t.useChatSettings,Je=s.createContext(void 0),Ze=s.createContext({});function et(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?n.APPEARANCE_MODES.DARK:n.APPEARANCE_MODES.LIGHT:n.APPEARANCE_MODES.DARK}const tt=({children:e,orgId:r,fallbackThemeStyles:i,initialAppearanceMode:a=n.APPEARANCE_MODES.SYSTEM})=>{const{user:c}=t.useAuth(),u=c?.id,l=n.useStorage(),[d,p]=s.useState(a),[f,h]=s.useState(()=>a===n.APPEARANCE_MODES.SYSTEM?et():a);s.useEffect(()=>{let e=!1;const t=n.getAppearanceModeStorageKey(u),r=n.STORAGE_KEYS.APPEARANCE_MODE_KEY;return(async()=>{const o=await l.getItem(t);if(u&&await l.removeItem(r),e)return;const s=((e,t)=>e===n.APPEARANCE_MODES.LIGHT||e===n.APPEARANCE_MODES.DARK||e===n.APPEARANCE_MODES.SYSTEM?e:t)(o,a);p(s),h(s===n.APPEARANCE_MODES.SYSTEM?et():s)})(),()=>{e=!0}},[u,l,a]),s.useEffect(()=>{if(d!==n.APPEARANCE_MODES.SYSTEM)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{h(e.matches?n.APPEARANCE_MODES.DARK:n.APPEARANCE_MODES.LIGHT)};return h(e.matches?n.APPEARANCE_MODES.DARK:n.APPEARANCE_MODES.LIGHT),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[d]);const _=r||void 0,{data:m,isLoading:y,error:g}=t.useGetBrandingQuery(_),S=m?.success?m.data??null:null,E=S?.themes?(f===n.APPEARANCE_MODES.LIGHT?S.themes.light:S.themes.dark)??null:null,v=s.useMemo(()=>!S&&i?i:n.brandingToThemeStyles(S,E,f),[S,E,f,i]),A=S?.orbPosition??n.ORB_POSITIONS.FOREGROUND,b=s.useCallback(e=>{p(e);const t=n.getAppearanceModeStorageKey(u);l.setItem(t,e),u&&l.removeItem(n.STORAGE_KEYS.APPEARANCE_MODE_KEY),h(e===n.APPEARANCE_MODES.SYSTEM?et():e)},[l,u]),P={theme:f,setTheme:b,appearanceMode:d,isLoading:y,error:g?new Error("Failed to fetch branding"):null,currentThemeColors:E,themeStyles:v,orbPosition:A};return o.jsx(n.BrandingContext.Provider,{value:P,children:e})},nt=({children:e,protocolType:r})=>{const i=r||t.DEFAULT_PROTOCOL,a=s.useMemo(()=>t.createAdapter(i,t.createDefaultAdapterConfig({onAuthExpired:()=>$e.dispatch(n.clearSession())})),[i]),c=s.useMemo(()=>({adapter:a,protocolType:i}),[a,i]);return o.jsx(t.ProtocolContext.Provider,{value:c,children:e})},rt=({value:e,children:t,fallback:r,extraHydrations:a})=>{n.setModuleStorage(e);const c=i.useDispatch(),u=void 0!==r,[l,d]=s.useState(!u);return s.useEffect(()=>{let t=!1;const r=[c(n.hydrateSession(e))];if(a)for(const t of a)r.push(Promise.resolve(t(e,c)).catch(e=>{n.logger.error({message:"StorageProvider hydration step failed",component:"StorageProvider",error_message:e instanceof Error?e.message:String(e)})}));return Promise.all(r).finally(()=>{t||u&&d(!0)}),()=>{t=!0}},[]),o.jsx(n.StorageContext.Provider,{value:e,children:u&&!l?o.jsx(o.Fragment,{children:r}):t})},ot=({token:e,user:t,children:r})=>{const i=s.useRef(null);return e&&e!==i.current&&(i.current=e,$e.dispatch(n.setSession({accessToken:e,expiresIn:Math.floor(Date.now()/1e3)+3600,...t&&{user:{id:"",email:t.email||"",name:t.name}}}))),o.jsx(o.Fragment,{children:r})},st=({children:e})=>o.jsx(t.ConfigurationContext.Provider,{value:t.useConfigurationValue(),children:e}),it=({children:e,callbacks:n})=>o.jsx(t.ChatCallbacksContext.Provider,{value:n,children:e}),at=s.lazy(()=>Promise.resolve().then(()=>require("./PaymentProviderHost-B2WWp8Ey.cjs")));exports.BrandingProvider=tt,exports.ChatClientProvider=({baseUrl:e,customHeaders:r,token:s,user:c,protocol:u=t.DEFAULT_PROTOCOL,paymentProvider:l,onConversationChange:d,onConversationTitleChange:p,onMessagesChange:f,onLogoutRequested:h,onSessionExpired:_,storage:m,storageFallback:y,extraHydrations:g,orgId:S,initialThemeStyles:E,initialAppearanceMode:v,audioPlatform:A,networkMonitor:b,children:P})=>{n.initializeChatConfig({baseUrl:e,customHeaders:r,paymentProvider:l}),n.setTokenRefreshHandler(_??null);let w=o.jsx(ot,{token:s,user:c,children:o.jsx(nt,{protocolType:u,children:o.jsx(st,{children:o.jsx(it,{callbacks:{onConversationChange:d,onConversationTitleChange:p,onMessagesChange:f,onLogoutRequested:h},children:o.jsx(tt,{orgId:S,fallbackThemeStyles:E,initialAppearanceMode:v,children:o.jsx(a.AudioPlatformProvider,{value:A,children:P})})})})})});return b&&(w=o.jsx(n.NetworkContext.Provider,{value:b,children:w})),o.jsx(i.Provider,{store:$e,children:m?o.jsx(rt,{value:m,fallback:y,extraHydrations:g,children:w}):w})},exports.MessageContextProvider=({children:e,messageId:t,isDisabled:n=!1})=>{const[r,i]=s.useState({});return o.jsx(Je.Provider,{value:{messageContext:r,setMessageContext:i,updateMessageContext:(e,t)=>{i(n=>({...n,[e]:t}))},messageId:t},children:o.jsx(Ze.Provider,{value:{messageId:t,isDisabled:n},children:e})})},exports.PaymentProviderHost=e=>o.jsx(s.Suspense,{fallback:null,children:o.jsx(at,{...e})}),exports.SettingsProvider=({children:e,defaultSttImplementation:r=Be})=>{const{user:i}=t.useAuth(),a=i?.id,c=n.useStorage(),[u,l]=s.useState(!1),[d,p]=s.useState(Ue),[f,h]=s.useState(He),[_,m]=s.useState(Ve),[y,g]=s.useState(r),[S,E]=s.useState(We);return s.useEffect(()=>{let e=!1;return Promise.all([c.getItem(n.STORAGE_KEYS.DEBUG_MODE),c.getItem(n.STORAGE_KEYS.LOCATION_ENABLED),c.getItem(n.STORAGE_KEYS.STT_AUTO_SEND),c.getItem(n.STORAGE_KEYS.STT_IMPLEMENTATION),c.getItem(n.STORAGE_KEYS.SEND_DIAGNOSTICS)]).then(([t,o,s,i,a])=>{if(e)return;var c;p(Qe(t,Ue)),h(Qe(o,He)),m(Qe(s,Ve)),g((c=i)===n.STT_IMPLEMENTATIONS.ONLINE||c===n.STT_IMPLEMENTATIONS.DEVICE?c:r);const u=Qe(a,We);E(u),n.setNetworkLoggingEnabled(u)}),()=>{e=!0}},[r,a,c]),o.jsx(t.ChatSettingsContext.Provider,{value:{enableTts:u,setEnableTts:l,debugMode:d,setDebugMode:e=>{p(e),c.setItem(n.STORAGE_KEYS.DEBUG_MODE,String(e))},locationEnabled:f,setLocationEnabled:e=>{h(e),c.setItem(n.STORAGE_KEYS.LOCATION_ENABLED,String(e))},autoSendVoice:_,setAutoSendVoice:e=>{m(e),c.setItem(n.STORAGE_KEYS.STT_AUTO_SEND,String(e))},sttImplementation:y,setSttImplementation:e=>{g(e),c.setItem(n.STORAGE_KEYS.STT_IMPLEMENTATION,e)},sendDiagnostics:S,setSendDiagnostics:e=>{E(e),n.setNetworkLoggingEnabled(e),c.setItem(n.STORAGE_KEYS.SEND_DIAGNOSTICS,String(e))}},children:e})},exports.StorageProvider=rt,exports.preloadPaymentModal=()=>Promise.resolve().then(()=>require("./PaymentProviderHost-B2WWp8Ey.cjs")).catch(()=>{}),exports.rootReducer=Ge,exports.store=$e,exports.useMessageContext=()=>{const e=s.useContext(Je);if(!e)throw new Error("useMessageContext must be used within MessageContextProvider");return e},exports.useMessageDisabled=()=>{const e=s.useContext(Ze);return e?.isDisabled??!1},exports.useMessageId=()=>{const e=s.useContext(Ze);return e?.messageId},exports.useSettings=Xe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@reduxjs/toolkit"),t=require("@1interface/chat-core"),n=require("@1interface/shared-core"),r=require("@1interface/voice-core"),o=require("react/jsx-runtime"),s=require("react"),i=require("react-redux"),a=require("@1interface/voice-shell");var c=Symbol.for("immer-nothing"),u=Symbol.for("immer-draftable"),l=Symbol.for("immer-state"),d="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function p(e,...t){if("production"!==process.env.NODE_ENV){const n=d[e],r=N(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var f=Object,h=f.getPrototypeOf,_="constructor",m="prototype",y="configurable",g="enumerable",S="writable",E="value",v=e=>!!e&&!!e[l];function A(e){return!!e&&(w(e)||R(e)||!!e[u]||!!e[_]?.[u]||I(e)||k(e))}var b=f[m][_].toString(),P=new WeakMap;function w(e){if(!e||!D(e))return!1;const t=h(e);if(null===t||t===f[m])return!0;const n=f.hasOwnProperty.call(t,_)&&t[_];if(n===Object)return!0;if(!N(n))return!1;let r=P.get(n);return void 0===r&&(r=Function.toString.call(n),P.set(n,r)),r===b}function C(e,t,n=!0){0===M(e)?(n?Reflect.ownKeys(e):f.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function M(e){const t=e[l];return t?t.type_:R(e)?1:I(e)?2:k(e)?3:0}var O=(e,t,n=M(e))=>2===n?e.has(t):f[m].hasOwnProperty.call(e,t),T=(e,t,n=M(e))=>2===n?e.get(t):e[t],x=(e,t,n,r=M(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},R=Array.isArray,I=e=>e instanceof Map,k=e=>e instanceof Set,D=e=>"object"==typeof e,N=e=>"function"==typeof e,j=e=>"boolean"==typeof e,z=e=>e.copy_||e.base_,L=e=>e.modified_?e.copy_:e.base_;function F(e,t){if(I(e))return new Map(e);if(k(e))return new Set(e);if(R(e))return Array[m].slice.call(e);const n=w(e);if(!0===t||"class_only"===t&&!n){const t=f.getOwnPropertyDescriptors(e);delete t[l];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],s=t[o];!1===s[S]&&(s[S]=!0,s[y]=!0),(s.get||s.set)&&(t[o]={[y]:!0,[S]:!0,[g]:s[g],[E]:e[o]})}return f.create(h(e),t)}{const t=h(e);if(null!==t&&n)return{...e};const r=f.create(t);return f.assign(r,e)}}function K(e,t=!1){return Y(e)||v(e)||!A(e)||(M(e)>1&&f.defineProperties(e,{set:G,add:G,clear:G,delete:G}),f.freeze(e),t&&C(e,(e,t)=>{K(t,!0)},!1)),e}var G={[E]:function(){p(2)}};function Y(e){return null===e||!D(e)||f.isFrozen(e)}var $="MapSet",q="Patches",H="ArrayMethods",U={};function B(e){const t=U[e];return t||p(0,e),t}var V,W=e=>!!U[e],Q=()=>V;function X(e,t){t&&(e.patchPlugin_=B(q),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function J(e){Z(e),e.drafts_.forEach(te),e.drafts_=null}function Z(e){e===V&&(V=e.parent_)}var ee=e=>V={drafts_:[],parent_:V,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:W($)?B($):void 0,arrayMethodsPlugin_:W(H)?B(H):void 0};function te(e){const t=e[l];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ne(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[l].modified_&&(J(t),p(4)),A(e)&&(e=re(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[l].base_,e,t)}else e=re(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&K(t,n)}(t,e,!0),J(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==c?e:void 0}function re(e,t){if(Y(t))return t;const n=t[l];if(!n)return ue(t,e.handledSet_,e);if(!se(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);ce(n,e)}return n.copy_}function oe(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var se=(e,t)=>e.scope_===t,ie=[];function ae(e,t,n,r){const o=z(e),s=e.type_;if(void 0!==r&&T(o,r,s)===t)return void x(o,r,n,s);if(!e.draftLocations_){const t=e.draftLocations_=new Map;C(o,(e,n)=>{if(v(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const i=e.draftLocations_.get(t)??ie;for(const e of i)x(o,e,n,s)}function ce(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}oe(e)}}function ue(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||v(e)||t.has(e)||!A(e)||Y(e)||(t.add(e),C(e,(r,o)=>{if(v(o)){const t=o[l];if(se(t,n)){const n=L(t);x(e,r,n,e.type_),oe(t)}}else A(o)&&ue(o,t,n)})),e}var le={get(e,t){if(t===l)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const o=z(e);if(!O(o,t,e.type_))return function(e,t,n){const r=fe(t,n);return r?E in r?r[E]:r.get?.call(e.draft_):void 0}(e,o,t);const s=o[t];if(e.finalized_||!A(s))return s;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return s;if(s===pe(e.base_,t)){_e(e);const n=1===e.type_?+t:t,r=me(0,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in z(e),ownKeys:e=>Reflect.ownKeys(z(e)),set(e,t,n){const r=fe(z(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=pe(z(e),t),i=r?.[l];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((o=n)===(s=r)?0!==o||1/o==1/s:o!=o&&s!=s)&&(void 0!==n||O(e.base_,t,e.type_)))return!0;_e(e),he(e)}var o,s;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(v(n)){const o=n[l];se(o,r)&&o.callbacks_.push(function(){_e(e);const r=L(o);ae(e,n,r,t)})}else A(n)&&e.callbacks_.push(function(){const o=z(e);3===e.type_?o.has(n)&&ue(n,r.handledSet_,r):T(o,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&ue(T(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(_e(e),void 0!==pe(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),he(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=z(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[S]:!0,[y]:1!==e.type_||"length"!==t,[g]:r[g],[E]:n[t]}:r},defineProperty(){p(11)},getPrototypeOf:e=>h(e.base_),setPrototypeOf(){p(12)}},de={};for(let e in le){let t=le[e];de[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function pe(e,t){const n=e[l];return(n?z(n):e)[t]}function fe(e,t){if(!(t in e))return;let n=h(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=h(n)}}function he(e){e.modified_||(e.modified_=!0,e.parent_&&he(e.parent_))}function _e(e){e.copy_||(e.assigned_=new Map,e.copy_=F(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function me(e,t,n,r){const[o,s]=I(t)?B($).proxyMap_(t,n):k(t)?B($).proxySet_(t,n):function(e,t){const n=R(e),r={type_:n?1:0,scope_:t?t.scope_:Q(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=r,s=le;n&&(o=[r],s=de);const{revoke:i,proxy:a}=Proxy.revocable(o,s);return r.draft_=a,r.revoke_=i,[a,r]}(t,n);return(n?.scope_??Q()).drafts_.push(o),s.callbacks_=n?.callbacks_??[],s.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const o=t;if(!o||!se(o,r))return;r.mapSetPlugin_?.fixSetContents(o);const s=L(o);ae(e,o.draft_??o,s,n),ce(o,r)})}(n,s,r):s.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:t}=e;s.modified_&&t&&t.generatePatches_(s,[],e)}),o}function ye(e){return v(e)||p(10,e),ge(e)}function ge(e){if(!A(e)||Y(e))return e;const t=e[l];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=F(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=F(e,!0);return C(n,(e,t)=>{x(n,e,ge(t))},r),t&&(t.finalized_=!1),n}de.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&p(13),de.set.call(this,e,t,void 0)},de.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&p(14),le.set.call(this,e[0],t,n,e[0])},new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(N(e)&&!N(t)){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,e=>t.call(this,e,...o))}}let r;if(N(t)||p(6),void 0===n||N(n)||p(7),A(e)){const o=ee(this),s=me(0,e,void 0);let i=!0;try{r=t(s),i=!1}finally{i?J(o):Z(o)}return X(o,n),ne(r,o)}if(!e||!D(e)){if(r=t(e),void 0===r&&(r=e),r===c&&(r=void 0),this.autoFreeze_&&K(r,!0),n){const t=[],o=[];B(q).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:o}),n(t,o)}return r}p(1,e)},this.produceWithPatches=(e,t)=>{if(N(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},j(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),j(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),j(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){A(e)||p(8),v(e)&&(e=ye(e));const t=ee(this),n=me(0,e,void 0);return n[l].isManual_=!0,Z(t),n}finishDraft(e,t){const n=e&&e[l];n&&n.isManual_||p(9);const{scope_:r}=n;return X(r,t),ne(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=B(q).applyPatches_;return v(e)?r(e,t):this.produce(e,e=>r(e,t))}},Error;var Se=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},Ee=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:s,inputSelectorResultsCopy:i}=e,a=r(()=>({}),...o);if(a.apply(null,s)!==a.apply(null,i)){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:s,secondInputs:i,stack:e})}},ve={inputStabilityCheck:"once",identityFunctionCheck:"once"},Ae=e=>Array.isArray(e)?e:[e];function be(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var Pe="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function we(){return{s:0,v:void 0,o:null,p:null}}function Ce(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let o,s=0;function i(){let t=n;const{length:i}=arguments;for(let e=0,n=i;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=we(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=we(),e.set(n,t)):t=r}}const a=t;let c;if(1===t.s)c=t.v;else if(c=e.apply(null,arguments),s++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==s&&s--),o="object"==typeof c&&null!==c||"function"==typeof c?new Pe(c):c}return a.s=1,a.v=c,c}return i.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Me(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,s={},i=e.pop();"object"==typeof i&&(s=i,i=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(i,`createSelector expects an output function after the inputs, but received: [${typeof i}]`);const a={...n,...s},{memoize:c,memoizeOptions:u=[],argsMemoize:l=Ce,argsMemoizeOptions:d=[],devModeChecks:p={}}=a,f=Ae(u),h=Ae(d),_=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),m=c(function(){return r++,i.apply(null,arguments)},...f);let y=!0;const g=l(function(){o++;const e=be(_,arguments);if(t=m.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...ve,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:Se},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:Ee}}})(y,p);if(n.shouldRun&&n.run(i,e,t),r.shouldRun){const t=be(_,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:c,memoizeOptions:f},arguments)}y&&(y=!1)}return t},...h);return Object.assign(g,{resultFunc:i,memoizedResultFunc:m,dependencies:_,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var Oe=Me(Ce),Te=Object.assign((e,t=Oe)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Te}),xe="__rtkq/",Re="online",Ie="offline",ke="focus",De="focused",Ne="visibilitychange",je=e.createAction(`${xe}${De}`),ze=e.createAction(`${xe}un${De}`),Le=e.createAction(`${xe}${Re}`),Fe=e.createAction(`${xe}${Ie}`),Ke=!1;WeakMap,new Error("Promise never resolved before cacheEntryRemoved.");const Ge=e.combineReducers({...t.apiReducers,auth:n.sessionReducer,chat:t.chatReducer,conversations:t.conversationsReducer,voice:r.voiceReducer,indicator:n.indicatorReducer}),Ye=e.createListenerMiddleware();Ye.startListening({matcher:e.isAnyOf(n.clearSession,n.sessionExpired),effect:(e,{dispatch:n})=>{n(t.resetAllApiState())}});const $e=e.configureStore({reducer:Ge,middleware:e=>e({serializableCheck:t.serializableCheck}).prepend(Ye.middleware,n.sessionListenerMiddleware.middleware,r.voiceListenerMiddleware.middleware).concat(t.apiMiddleware)});var qe;qe=$e.dispatch,function(){const[e,t,n,r]=[je,ze,Le,Fe].map(e=>()=>qe(e())),o=()=>{"visible"===window.document.visibilityState?e():t()};if(!Ke&&"undefined"!=typeof window&&window.addEventListener){let t=function(e){Object.entries(s).forEach(([t,n])=>{e?window.addEventListener(t,n,!1):window.removeEventListener(t,n)})};const s={[ke]:e,[Ne]:o,[Re]:n,[Ie]:r};t(!0),Ke=!0}}(),n.setAccessTokenReader(()=>$e.getState().auth.accessToken),n.setTokenExpiresAtReader(()=>$e.getState().auth.tokenExpiresAt),t.bindChatLogger(()=>$e.getState());const He=!1,Ue=!0,Be=!0,Ve=n.STT_IMPLEMENTATIONS.ONLINE,We=!0,Qe=(e,t)=>null===e?t:"true"===e,Xe=t.useChatSettings,Je=s.createContext(void 0),Ze=s.createContext({});function et(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?n.APPEARANCE_MODES.DARK:n.APPEARANCE_MODES.LIGHT:n.APPEARANCE_MODES.DARK}const tt=({children:e,orgId:r,fallbackThemeStyles:i,initialAppearanceMode:a=n.APPEARANCE_MODES.SYSTEM})=>{const{user:c}=t.useAuth(),u=c?.id,l=n.useStorage(),[d,p]=s.useState(a),[f,h]=s.useState(()=>a===n.APPEARANCE_MODES.SYSTEM?et():a);s.useEffect(()=>{let e=!1;const t=n.getAppearanceModeStorageKey(u),r=n.STORAGE_KEYS.APPEARANCE_MODE_KEY;return(async()=>{const o=await l.getItem(t);if(u&&await l.removeItem(r),e)return;const s=((e,t)=>e===n.APPEARANCE_MODES.LIGHT||e===n.APPEARANCE_MODES.DARK||e===n.APPEARANCE_MODES.SYSTEM?e:t)(o,a);p(s),h(s===n.APPEARANCE_MODES.SYSTEM?et():s)})(),()=>{e=!0}},[u,l,a]),s.useEffect(()=>{if(d!==n.APPEARANCE_MODES.SYSTEM)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{h(e.matches?n.APPEARANCE_MODES.DARK:n.APPEARANCE_MODES.LIGHT)};return h(e.matches?n.APPEARANCE_MODES.DARK:n.APPEARANCE_MODES.LIGHT),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[d]);const _=r||void 0,{data:m,isLoading:y,error:g}=t.useGetBrandingQuery(_),S=m?.success?m.data??null:null,E=S?.themes?(f===n.APPEARANCE_MODES.LIGHT?S.themes.light:S.themes.dark)??null:null,v=s.useMemo(()=>!S&&i?i:n.brandingToThemeStyles(S,E,f),[S,E,f,i]),A=S?.orbPosition??n.ORB_POSITIONS.FOREGROUND,b=s.useCallback(e=>{p(e);const t=n.getAppearanceModeStorageKey(u);l.setItem(t,e),u&&l.removeItem(n.STORAGE_KEYS.APPEARANCE_MODE_KEY),h(e===n.APPEARANCE_MODES.SYSTEM?et():e)},[l,u]),P={theme:f,setTheme:b,appearanceMode:d,isLoading:y,error:g?new Error("Failed to fetch branding"):null,currentThemeColors:E,themeStyles:v,orbPosition:A};return o.jsx(n.BrandingContext.Provider,{value:P,children:e})},nt=({children:e,protocolType:r})=>{const i=r||t.DEFAULT_PROTOCOL,a=s.useMemo(()=>t.createAdapter(i,t.createDefaultAdapterConfig({onAuthExpired:()=>$e.dispatch(n.clearSession())})),[i]),c=s.useMemo(()=>({adapter:a,protocolType:i}),[a,i]);return o.jsx(t.ProtocolContext.Provider,{value:c,children:e})},rt=({value:e,children:t,fallback:r,extraHydrations:a})=>{n.setModuleStorage(e);const c=i.useDispatch(),u=void 0!==r,[l,d]=s.useState(!u);return s.useEffect(()=>{let t=!1;const r=[c(n.hydrateSession(e))];if(a)for(const t of a)r.push(Promise.resolve(t(e,c)).catch(e=>{n.logger.error({message:"StorageProvider hydration step failed",component:"StorageProvider",error_message:e instanceof Error?e.message:String(e)})}));return Promise.all(r).finally(()=>{t||u&&d(!0)}),()=>{t=!0}},[]),o.jsx(n.StorageContext.Provider,{value:e,children:u&&!l?o.jsx(o.Fragment,{children:r}):t})},ot=({token:e,user:t,children:r})=>{const i=s.useRef(null);return e&&e!==i.current&&(i.current=e,$e.dispatch(n.setSession({accessToken:e,expiresIn:Math.floor(Date.now()/1e3)+3600,...t&&{user:{id:"",email:t.email||"",name:t.name}}}))),o.jsx(o.Fragment,{children:r})},st=({children:e})=>o.jsx(t.ConfigurationContext.Provider,{value:t.useConfigurationValue(),children:e}),it=({children:e,callbacks:n})=>o.jsx(t.ChatCallbacksContext.Provider,{value:n,children:e}),at=s.lazy(()=>Promise.resolve().then(()=>require("./PaymentProviderHost-B2WWp8Ey.cjs")));exports.BrandingProvider=tt,exports.ChatClientProvider=({baseUrl:e,customHeaders:r,token:s,user:c,protocol:u=t.DEFAULT_PROTOCOL,paymentProvider:l,onConversationChange:d,onConversationTitleChange:p,onMessagesChange:f,onLogoutRequested:h,onSessionExpired:_,storage:m,storageFallback:y,extraHydrations:g,orgId:S,initialThemeStyles:E,initialAppearanceMode:v,reuseHostBranding:A=!1,audioPlatform:b,networkMonitor:P,children:w})=>{n.initializeChatConfig({baseUrl:e,customHeaders:r,paymentProvider:l}),n.setTokenRefreshHandler(_??null);const C=o.jsx(a.AudioPlatformProvider,{value:b,children:w});let M=o.jsx(ot,{token:s,user:c,children:o.jsx(nt,{protocolType:u,children:o.jsx(st,{children:o.jsx(it,{callbacks:{onConversationChange:d,onConversationTitleChange:p,onMessagesChange:f,onLogoutRequested:h},children:A?C:o.jsx(tt,{orgId:S,fallbackThemeStyles:E,initialAppearanceMode:v,children:C})})})})});return P&&(M=o.jsx(n.NetworkContext.Provider,{value:P,children:M})),o.jsx(i.Provider,{store:$e,children:m?o.jsx(rt,{value:m,fallback:y,extraHydrations:g,children:M}):M})},exports.MessageContextProvider=({children:e,messageId:t,isDisabled:n=!1})=>{const[r,i]=s.useState({});return o.jsx(Je.Provider,{value:{messageContext:r,setMessageContext:i,updateMessageContext:(e,t)=>{i(n=>({...n,[e]:t}))},messageId:t},children:o.jsx(Ze.Provider,{value:{messageId:t,isDisabled:n},children:e})})},exports.PaymentProviderHost=e=>o.jsx(s.Suspense,{fallback:null,children:o.jsx(at,{...e})}),exports.SettingsProvider=({children:e,defaultSttImplementation:r=Ve})=>{const{user:i}=t.useAuth(),a=i?.id,c=n.useStorage(),[u,l]=s.useState(!1),[d,p]=s.useState(He),[f,h]=s.useState(Ue),[_,m]=s.useState(Be),[y,g]=s.useState(r),[S,E]=s.useState(We);return s.useEffect(()=>{let e=!1;return Promise.all([c.getItem(n.STORAGE_KEYS.DEBUG_MODE),c.getItem(n.STORAGE_KEYS.LOCATION_ENABLED),c.getItem(n.STORAGE_KEYS.STT_AUTO_SEND),c.getItem(n.STORAGE_KEYS.STT_IMPLEMENTATION),c.getItem(n.STORAGE_KEYS.SEND_DIAGNOSTICS)]).then(([t,o,s,i,a])=>{if(e)return;var c;p(Qe(t,He)),h(Qe(o,Ue)),m(Qe(s,Be)),g((c=i)===n.STT_IMPLEMENTATIONS.ONLINE||c===n.STT_IMPLEMENTATIONS.DEVICE?c:r);const u=Qe(a,We);E(u),n.setNetworkLoggingEnabled(u)}),()=>{e=!0}},[r,a,c]),o.jsx(t.ChatSettingsContext.Provider,{value:{enableTts:u,setEnableTts:l,debugMode:d,setDebugMode:e=>{p(e),c.setItem(n.STORAGE_KEYS.DEBUG_MODE,String(e))},locationEnabled:f,setLocationEnabled:e=>{h(e),c.setItem(n.STORAGE_KEYS.LOCATION_ENABLED,String(e))},autoSendVoice:_,setAutoSendVoice:e=>{m(e),c.setItem(n.STORAGE_KEYS.STT_AUTO_SEND,String(e))},sttImplementation:y,setSttImplementation:e=>{g(e),c.setItem(n.STORAGE_KEYS.STT_IMPLEMENTATION,e)},sendDiagnostics:S,setSendDiagnostics:e=>{E(e),n.setNetworkLoggingEnabled(e),c.setItem(n.STORAGE_KEYS.SEND_DIAGNOSTICS,String(e))}},children:e})},exports.StorageProvider=rt,exports.preloadPaymentModal=()=>Promise.resolve().then(()=>require("./PaymentProviderHost-B2WWp8Ey.cjs")).catch(()=>{}),exports.rootReducer=Ge,exports.store=$e,exports.useMessageContext=()=>{const e=s.useContext(Je);if(!e)throw new Error("useMessageContext must be used within MessageContextProvider");return e},exports.useMessageDisabled=()=>{const e=s.useContext(Ze);return e?.isDisabled??!1},exports.useMessageId=()=>{const e=s.useContext(Ze);return e?.messageId},exports.useSettings=Xe;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createAction as e,nanoid as t,formatProdErrorMessage as n,createSelector as r,createAsyncThunk as o,createSlice as i,prepareAutoBatched as s,isAnyOf as a,isFulfilled as c,isRejectedWithValue as l,combineReducers as u,isPlainObject as d,SHOULD_AUTOBATCH as f,isAllOf as p,isRejected as h,isPending as m,isAction as _,createNextState as y,isAsyncThunkAction as g,configureStore as v,createListenerMiddleware as b}from"@reduxjs/toolkit";import{conversationsReducer as S,chatReducer as w,apiReducers as E,serializableCheck as P,apiMiddleware as I,resetAllApiState as k,bindChatLogger as M,useChatSettings as T,useAuth as C,ChatSettingsContext as O,useGetBrandingQuery as D,createAdapter as A,DEFAULT_PROTOCOL as z,createDefaultAdapterConfig as N,ProtocolContext as R,ConfigurationContext as x,useConfigurationValue as L,ChatCallbacksContext as j}from"@1interface/chat-core";import{indicatorReducer as F,sessionReducer as $,sessionListenerMiddleware as U,clearSession as H,sessionExpired as K,setAccessTokenReader as G,setTokenExpiresAtReader as V,useStorage as W,STT_IMPLEMENTATIONS as Y,STORAGE_KEYS as q,setNetworkLoggingEnabled as B,APPEARANCE_MODES as X,getAppearanceModeStorageKey as J,brandingToThemeStyles as Q,ORB_POSITIONS as Z,BrandingContext as ee,setModuleStorage as te,hydrateSession as ne,logger as re,StorageContext as oe,setSession as ie,initializeChatConfig as se,setTokenRefreshHandler as ae,NetworkContext as ce}from"@1interface/shared-core";import{voiceReducer as le,voiceListenerMiddleware as ue}from"@1interface/voice-core";import{jsx as de,Fragment as fe}from"react/jsx-runtime";import{useState as pe,useEffect as he,useContext as me,createContext as _e,useMemo as ye,useCallback as ge,useRef as ve,Suspense as be,lazy as Se}from"react";import{useDispatch as we,Provider as Ee}from"react-redux";import{AudioPlatformProvider as Pe}from"@1interface/voice-shell";var Ie=Symbol.for("immer-nothing"),ke=Symbol.for("immer-draftable"),Me=Symbol.for("immer-state"),Te="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ce(e,...t){if("production"!==process.env.NODE_ENV){const n=Te[e],r=Qe(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Oe=Object,De=Oe.getPrototypeOf,Ae="constructor",ze="prototype",Ne="configurable",Re="enumerable",xe="writable",Le="value",je=e=>!!e&&!!e[Me];function Fe(e){return!!e&&(He(e)||qe(e)||!!e[ke]||!!e[Ae]?.[ke]||Be(e)||Xe(e))}var $e=Oe[ze][Ae].toString(),Ue=new WeakMap;function He(e){if(!e||!Je(e))return!1;const t=De(e);if(null===t||t===Oe[ze])return!0;const n=Oe.hasOwnProperty.call(t,Ae)&&t[Ae];if(n===Object)return!0;if(!Qe(n))return!1;let r=Ue.get(n);return void 0===r&&(r=Function.toString.call(n),Ue.set(n,r)),r===$e}function Ke(e,t,n=!0){0===Ge(e)?(n?Reflect.ownKeys(e):Oe.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ge(e){const t=e[Me];return t?t.type_:qe(e)?1:Be(e)?2:Xe(e)?3:0}var Ve=(e,t,n=Ge(e))=>2===n?e.has(t):Oe[ze].hasOwnProperty.call(e,t),We=(e,t,n=Ge(e))=>2===n?e.get(t):e[t],Ye=(e,t,n,r=Ge(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},qe=Array.isArray,Be=e=>e instanceof Map,Xe=e=>e instanceof Set,Je=e=>"object"==typeof e,Qe=e=>"function"==typeof e,Ze=e=>"boolean"==typeof e,et=e=>e.copy_||e.base_,tt=e=>e.modified_?e.copy_:e.base_;function nt(e,t){if(Be(e))return new Map(e);if(Xe(e))return new Set(e);if(qe(e))return Array[ze].slice.call(e);const n=He(e);if(!0===t||"class_only"===t&&!n){const t=Oe.getOwnPropertyDescriptors(e);delete t[Me];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],i=t[o];!1===i[xe]&&(i[xe]=!0,i[Ne]=!0),(i.get||i.set)&&(t[o]={[Ne]:!0,[xe]:!0,[Re]:i[Re],[Le]:e[o]})}return Oe.create(De(e),t)}{const t=De(e);if(null!==t&&n)return{...e};const r=Oe.create(t);return Oe.assign(r,e)}}function rt(e,t=!1){return it(e)||je(e)||!Fe(e)||(Ge(e)>1&&Oe.defineProperties(e,{set:ot,add:ot,clear:ot,delete:ot}),Oe.freeze(e),t&&Ke(e,(e,t)=>{rt(t,!0)},!1)),e}var ot={[Le]:function(){Ce(2)}};function it(e){return null===e||!Je(e)||Oe.isFrozen(e)}var st="MapSet",at="Patches",ct="ArrayMethods",lt={};function ut(e){const t=lt[e];return t||Ce(0,e),t}var dt,ft=e=>!!lt[e],pt=()=>dt;function ht(e,t){t&&(e.patchPlugin_=ut(at),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function mt(e){_t(e),e.drafts_.forEach(gt),e.drafts_=null}function _t(e){e===dt&&(dt=e.parent_)}var yt=e=>dt={drafts_:[],parent_:dt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ft(st)?ut(st):void 0,arrayMethodsPlugin_:ft(ct)?ut(ct):void 0};function gt(e){const t=e[Me];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function vt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[Me].modified_&&(mt(t),Ce(4)),Fe(e)&&(e=bt(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Me].base_,e,t)}else e=bt(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&rt(t,n)}(t,e,!0),mt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ie?e:void 0}function bt(e,t){if(it(t))return t;const n=t[Me];if(!n)return kt(t,e.handledSet_,e);if(!wt(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);It(n,e)}return n.copy_}function St(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var wt=(e,t)=>e.scope_===t,Et=[];function Pt(e,t,n,r){const o=et(e),i=e.type_;if(void 0!==r&&We(o,r,i)===t)return void Ye(o,r,n,i);if(!e.draftLocations_){const t=e.draftLocations_=new Map;Ke(o,(e,n)=>{if(je(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const s=e.draftLocations_.get(t)??Et;for(const e of s)Ye(o,e,n,i)}function It(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}St(e)}}function kt(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||je(e)||t.has(e)||!Fe(e)||it(e)||(t.add(e),Ke(e,(r,o)=>{if(je(o)){const t=o[Me];if(wt(t,n)){const n=tt(t);Ye(e,r,n,e.type_),St(t)}}else Fe(o)&&kt(o,t,n)})),e}var Mt={get(e,t){if(t===Me)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const o=et(e);if(!Ve(o,t,e.type_))return function(e,t,n){const r=Ot(t,n);return r?Le in r?r[Le]:r.get?.call(e.draft_):void 0}(e,o,t);const i=o[t];if(e.finalized_||!Fe(i))return i;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return i;if(i===Ct(e.base_,t)){At(e);const n=1===e.type_?+t:t,r=zt(0,i,e,n);return e.copy_[n]=r}return i},has:(e,t)=>t in et(e),ownKeys:e=>Reflect.ownKeys(et(e)),set(e,t,n){const r=Ot(et(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Ct(et(e),t),s=r?.[Me];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||Ve(e.base_,t,e.type_)))return!0;At(e),Dt(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(je(n)){const o=n[Me];wt(o,r)&&o.callbacks_.push(function(){At(e);const r=tt(o);Pt(e,n,r,t)})}else Fe(n)&&e.callbacks_.push(function(){const o=et(e);3===e.type_?o.has(n)&&kt(n,r.handledSet_,r):We(o,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&kt(We(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(At(e),void 0!==Ct(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),Dt(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=et(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[xe]:!0,[Ne]:1!==e.type_||"length"!==t,[Re]:r[Re],[Le]:n[t]}:r},defineProperty(){Ce(11)},getPrototypeOf:e=>De(e.base_),setPrototypeOf(){Ce(12)}},Tt={};for(let e in Mt){let t=Mt[e];Tt[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function Ct(e,t){const n=e[Me];return(n?et(n):e)[t]}function Ot(e,t){if(!(t in e))return;let n=De(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=De(n)}}function Dt(e){e.modified_||(e.modified_=!0,e.parent_&&Dt(e.parent_))}function At(e){e.copy_||(e.assigned_=new Map,e.copy_=nt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function zt(e,t,n,r){const[o,i]=Be(t)?ut(st).proxyMap_(t,n):Xe(t)?ut(st).proxySet_(t,n):function(e,t){const n=qe(e),r={type_:n?1:0,scope_:t?t.scope_:pt(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=r,i=Mt;n&&(o=[r],i=Tt);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,[a,r]}(t,n);return(n?.scope_??pt()).drafts_.push(o),i.callbacks_=n?.callbacks_??[],i.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const o=t;if(!o||!wt(o,r))return;r.mapSetPlugin_?.fixSetContents(o);const i=tt(o);Pt(e,o.draft_??o,i,n),It(o,r)})}(n,i,r):i.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:t}=e;i.modified_&&t&&t.generatePatches_(i,[],e)}),o}function Nt(e){return je(e)||Ce(10,e),Rt(e)}function Rt(e){if(!Fe(e)||it(e))return e;const t=e[Me];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=nt(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=nt(e,!0);return Ke(n,(e,t)=>{Ye(n,e,Rt(t))},r),t&&(t.finalized_=!1),n}Tt.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Ce(13),Tt.set.call(this,e,t,void 0)},Tt.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Ce(14),Mt.set.call(this,e[0],t,n,e[0])},new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Qe(e)&&!Qe(t)){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,e=>t.call(this,e,...o))}}let r;if(Qe(t)||Ce(6),void 0===n||Qe(n)||Ce(7),Fe(e)){const o=yt(this),i=zt(0,e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?mt(o):_t(o)}return ht(o,n),vt(r,o)}if(!e||!Je(e)){if(r=t(e),void 0===r&&(r=e),r===Ie&&(r=void 0),this.autoFreeze_&&rt(r,!0),n){const t=[],o=[];ut(at).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:o}),n(t,o)}return r}Ce(1,e)},this.produceWithPatches=(e,t)=>{if(Qe(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Ze(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ze(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ze(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Fe(e)||Ce(8),je(e)&&(e=Nt(e));const t=yt(this),n=zt(0,e,void 0);return n[Me].isManual_=!0,_t(t),n}finishDraft(e,t){const n=e&&e[Me];n&&n.isManual_||Ce(9);const{scope_:r}=n;return ht(r,t),vt(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ut(at).applyPatches_;return je(e)?r(e,t):this.produce(e,e=>r(e,t))}},Error;var xt=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},Lt=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=r(()=>({}),...o);if(a.apply(null,i)!==a.apply(null,s)){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:i,secondInputs:s,stack:e})}},jt={inputStabilityCheck:"once",identityFunctionCheck:"once"},Ft=e=>Array.isArray(e)?e:[e];function $t(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var Ut="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function Ht(){return{s:0,v:void 0,o:null,p:null}}function Kt(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let o,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=Ht(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=Ht(),e.set(n,t)):t=r}}const a=t;let c;if(1===t.s)c=t.v;else if(c=e.apply(null,arguments),i++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==i&&i--),o="object"==typeof c&&null!==c||"function"==typeof c?new Ut(c):c}return a.s=1,a.v=c,c}return s.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Gt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:c,memoizeOptions:l=[],argsMemoize:u=Kt,argsMemoizeOptions:d=[],devModeChecks:f={}}=a,p=Ft(l),h=Ft(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),_=c(function(){return r++,s.apply(null,arguments)},...p);let y=!0;const g=u(function(){o++;const e=$t(m,arguments);if(t=_.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...jt,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:xt},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:Lt}}})(y,f);if(n.shouldRun&&n.run(s,e,t),r.shouldRun){const t=$t(m,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:c,memoizeOptions:p},arguments)}y&&(y=!1)}return t},...h);return Object.assign(g,{resultFunc:s,memoizedResultFunc:_,dependencies:m,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var Vt=Gt(Kt),Wt=Object.assign((e,t=Vt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Wt}),Yt="__rtkq/",qt="online",Bt="offline",Xt="focus",Jt="focused",Qt="visibilitychange",Zt=e(`${Yt}${Jt}`),en=e(`${Yt}un${Jt}`),tn=e(`${Yt}${qt}`),nn=e(`${Yt}${Bt}`),rn=!1;WeakMap,new Error("Promise never resolved before cacheEntryRemoved.");const on=u({...E,auth:$,chat:w,conversations:S,voice:le,indicator:F}),sn=b();sn.startListening({matcher:a(H,K),effect:(e,{dispatch:t})=>{t(k())}});const an=v({reducer:on,middleware:e=>e({serializableCheck:P}).prepend(sn.middleware,U.middleware,ue.middleware).concat(I)});var cn;cn=an.dispatch,function(){const[e,t,n,r]=[Zt,en,tn,nn].map(e=>()=>cn(e())),o=()=>{"visible"===window.document.visibilityState?e():t()};if(!rn&&"undefined"!=typeof window&&window.addEventListener){let t=function(e){Object.entries(i).forEach(([t,n])=>{e?window.addEventListener(t,n,!1):window.removeEventListener(t,n)})};const i={[Xt]:e,[Qt]:o,[qt]:n,[Bt]:r};t(!0),rn=!0}}(),G(()=>an.getState().auth.accessToken),V(()=>an.getState().auth.tokenExpiresAt),M(()=>an.getState());const ln=!1,un=!0,dn=!0,fn=Y.ONLINE,pn=!0,hn=(e,t)=>null===e?t:"true"===e,mn=({children:e,defaultSttImplementation:t=fn})=>{const{user:n}=C(),r=n?.id,o=W(),[i,s]=pe(!1),[a,c]=pe(ln),[l,u]=pe(un),[d,f]=pe(dn),[p,h]=pe(t),[m,_]=pe(pn);return he(()=>{let e=!1;return Promise.all([o.getItem(q.DEBUG_MODE),o.getItem(q.LOCATION_ENABLED),o.getItem(q.STT_AUTO_SEND),o.getItem(q.STT_IMPLEMENTATION),o.getItem(q.SEND_DIAGNOSTICS)]).then(([n,r,o,i,s])=>{if(e)return;var a;c(hn(n,ln)),u(hn(r,un)),f(hn(o,dn)),h((a=i)===Y.ONLINE||a===Y.DEVICE?a:t);const l=hn(s,pn);_(l),B(l)}),()=>{e=!0}},[t,r,o]),de(O.Provider,{value:{enableTts:i,setEnableTts:s,debugMode:a,setDebugMode:e=>{c(e),o.setItem(q.DEBUG_MODE,String(e))},locationEnabled:l,setLocationEnabled:e=>{u(e),o.setItem(q.LOCATION_ENABLED,String(e))},autoSendVoice:d,setAutoSendVoice:e=>{f(e),o.setItem(q.STT_AUTO_SEND,String(e))},sttImplementation:p,setSttImplementation:e=>{h(e),o.setItem(q.STT_IMPLEMENTATION,e)},sendDiagnostics:m,setSendDiagnostics:e=>{_(e),B(e),o.setItem(q.SEND_DIAGNOSTICS,String(e))}},children:e})},_n=T,yn=_e(void 0),gn=_e({}),vn=({children:e,messageId:t,isDisabled:n=!1})=>{const[r,o]=pe({});return de(yn.Provider,{value:{messageContext:r,setMessageContext:o,updateMessageContext:(e,t)=>{o(n=>({...n,[e]:t}))},messageId:t},children:de(gn.Provider,{value:{messageId:t,isDisabled:n},children:e})})},bn=()=>{const e=me(yn);if(!e)throw new Error("useMessageContext must be used within MessageContextProvider");return e},Sn=()=>{const e=me(gn);return e?.messageId},wn=()=>{const e=me(gn);return e?.isDisabled??!1};function En(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?X.DARK:X.LIGHT:X.DARK}const Pn=({children:e,orgId:t,fallbackThemeStyles:n,initialAppearanceMode:r=X.SYSTEM})=>{const{user:o}=C(),i=o?.id,s=W(),[a,c]=pe(r),[l,u]=pe(()=>r===X.SYSTEM?En():r);he(()=>{let e=!1;const t=J(i),n=q.APPEARANCE_MODE_KEY;return(async()=>{const o=await s.getItem(t);if(i&&await s.removeItem(n),e)return;const a=((e,t)=>e===X.LIGHT||e===X.DARK||e===X.SYSTEM?e:t)(o,r);c(a),u(a===X.SYSTEM?En():a)})(),()=>{e=!0}},[i,s,r]),he(()=>{if(a!==X.SYSTEM)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{u(e.matches?X.DARK:X.LIGHT)};return u(e.matches?X.DARK:X.LIGHT),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[a]);const d=t||void 0,{data:f,isLoading:p,error:h}=D(d),m=f?.success?f.data??null:null,_=m?.themes?(l===X.LIGHT?m.themes.light:m.themes.dark)??null:null,y=ye(()=>!m&&n?n:Q(m,_,l),[m,_,l,n]),g=m?.orbPosition??Z.FOREGROUND,v=ge(e=>{c(e);const t=J(i);s.setItem(t,e),i&&s.removeItem(q.APPEARANCE_MODE_KEY),u(e===X.SYSTEM?En():e)},[s,i]),b={theme:l,setTheme:v,appearanceMode:a,isLoading:p,error:h?new Error("Failed to fetch branding"):null,currentThemeColors:_,themeStyles:y,orbPosition:g};return de(ee.Provider,{value:b,children:e})},In=({children:e,protocolType:t})=>{const n=t||z,r=ye(()=>A(n,N({onAuthExpired:()=>an.dispatch(H())})),[n]),o=ye(()=>({adapter:r,protocolType:n}),[r,n]);return de(R.Provider,{value:o,children:e})},kn=({value:e,children:t,fallback:n,extraHydrations:r})=>{te(e);const o=we(),i=void 0!==n,[s,a]=pe(!i);return he(()=>{let t=!1;const n=[o(ne(e))];if(r)for(const t of r)n.push(Promise.resolve(t(e,o)).catch(e=>{re.error({message:"StorageProvider hydration step failed",component:"StorageProvider",error_message:e instanceof Error?e.message:String(e)})}));return Promise.all(n).finally(()=>{t||i&&a(!0)}),()=>{t=!0}},[]),de(oe.Provider,{value:e,children:i&&!s?de(fe,{children:n}):t})},Mn=({token:e,user:t,children:n})=>{const r=ve(null);return e&&e!==r.current&&(r.current=e,an.dispatch(ie({accessToken:e,expiresIn:Math.floor(Date.now()/1e3)+3600,...t&&{user:{id:"",email:t.email||"",name:t.name}}}))),de(fe,{children:n})},Tn=({children:e})=>de(x.Provider,{value:L(),children:e}),Cn=({children:e,callbacks:t})=>de(j.Provider,{value:t,children:e}),On=({baseUrl:e,customHeaders:t,token:n,user:r,protocol:o=z,paymentProvider:i,onConversationChange:s,onConversationTitleChange:a,onMessagesChange:c,onLogoutRequested:l,onSessionExpired:u,storage:d,storageFallback:f,extraHydrations:p,orgId:h,initialThemeStyles:m,initialAppearanceMode:_,audioPlatform:y,networkMonitor:g,children:v})=>{se({baseUrl:e,customHeaders:t,paymentProvider:i}),ae(u??null);let b=de(Mn,{token:n,user:r,children:de(In,{protocolType:o,children:de(Tn,{children:de(Cn,{callbacks:{onConversationChange:s,onConversationTitleChange:a,onMessagesChange:c,onLogoutRequested:l},children:de(Pn,{orgId:h,fallbackThemeStyles:m,initialAppearanceMode:_,children:de(Pe,{value:y,children:v})})})})})});return g&&(b=de(ce.Provider,{value:g,children:b})),de(Ee,{store:an,children:d?de(kn,{value:d,fallback:f,extraHydrations:p,children:b}):b})},Dn=Se(()=>import("./PaymentProviderHost-CQ1DxU82.js")),An=e=>de(be,{fallback:null,children:de(Dn,{...e})}),zn=()=>import("./PaymentProviderHost-CQ1DxU82.js").catch(()=>{});export{Pn as BrandingProvider,On as ChatClientProvider,vn as MessageContextProvider,An as PaymentProviderHost,mn as SettingsProvider,kn as StorageProvider,zn as preloadPaymentModal,on as rootReducer,an as store,bn as useMessageContext,wn as useMessageDisabled,Sn as useMessageId,_n as useSettings};
|
|
1
|
+
import{createAction as e,nanoid as t,formatProdErrorMessage as n,createSelector as r,createAsyncThunk as o,createSlice as i,prepareAutoBatched as s,isAnyOf as a,isFulfilled as c,isRejectedWithValue as l,combineReducers as u,isPlainObject as d,SHOULD_AUTOBATCH as f,isAllOf as p,isRejected as h,isPending as m,isAction as _,createNextState as y,isAsyncThunkAction as g,configureStore as v,createListenerMiddleware as b}from"@reduxjs/toolkit";import{conversationsReducer as S,chatReducer as w,apiReducers as E,serializableCheck as P,apiMiddleware as I,resetAllApiState as k,bindChatLogger as M,useChatSettings as T,useAuth as C,ChatSettingsContext as O,useGetBrandingQuery as D,createAdapter as A,DEFAULT_PROTOCOL as z,createDefaultAdapterConfig as N,ProtocolContext as R,ConfigurationContext as x,useConfigurationValue as L,ChatCallbacksContext as j}from"@1interface/chat-core";import{indicatorReducer as F,sessionReducer as $,sessionListenerMiddleware as H,clearSession as U,sessionExpired as K,setAccessTokenReader as G,setTokenExpiresAtReader as V,useStorage as W,STT_IMPLEMENTATIONS as Y,STORAGE_KEYS as q,setNetworkLoggingEnabled as B,APPEARANCE_MODES as X,getAppearanceModeStorageKey as J,brandingToThemeStyles as Q,ORB_POSITIONS as Z,BrandingContext as ee,setModuleStorage as te,hydrateSession as ne,logger as re,StorageContext as oe,setSession as ie,initializeChatConfig as se,setTokenRefreshHandler as ae,NetworkContext as ce}from"@1interface/shared-core";import{voiceReducer as le,voiceListenerMiddleware as ue}from"@1interface/voice-core";import{jsx as de,Fragment as fe}from"react/jsx-runtime";import{useState as pe,useEffect as he,useContext as me,createContext as _e,useMemo as ye,useCallback as ge,useRef as ve,Suspense as be,lazy as Se}from"react";import{useDispatch as we,Provider as Ee}from"react-redux";import{AudioPlatformProvider as Pe}from"@1interface/voice-shell";var Ie=Symbol.for("immer-nothing"),ke=Symbol.for("immer-draftable"),Me=Symbol.for("immer-state"),Te="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ce(e,...t){if("production"!==process.env.NODE_ENV){const n=Te[e],r=Qe(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Oe=Object,De=Oe.getPrototypeOf,Ae="constructor",ze="prototype",Ne="configurable",Re="enumerable",xe="writable",Le="value",je=e=>!!e&&!!e[Me];function Fe(e){return!!e&&(Ue(e)||qe(e)||!!e[ke]||!!e[Ae]?.[ke]||Be(e)||Xe(e))}var $e=Oe[ze][Ae].toString(),He=new WeakMap;function Ue(e){if(!e||!Je(e))return!1;const t=De(e);if(null===t||t===Oe[ze])return!0;const n=Oe.hasOwnProperty.call(t,Ae)&&t[Ae];if(n===Object)return!0;if(!Qe(n))return!1;let r=He.get(n);return void 0===r&&(r=Function.toString.call(n),He.set(n,r)),r===$e}function Ke(e,t,n=!0){0===Ge(e)?(n?Reflect.ownKeys(e):Oe.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ge(e){const t=e[Me];return t?t.type_:qe(e)?1:Be(e)?2:Xe(e)?3:0}var Ve=(e,t,n=Ge(e))=>2===n?e.has(t):Oe[ze].hasOwnProperty.call(e,t),We=(e,t,n=Ge(e))=>2===n?e.get(t):e[t],Ye=(e,t,n,r=Ge(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},qe=Array.isArray,Be=e=>e instanceof Map,Xe=e=>e instanceof Set,Je=e=>"object"==typeof e,Qe=e=>"function"==typeof e,Ze=e=>"boolean"==typeof e,et=e=>e.copy_||e.base_,tt=e=>e.modified_?e.copy_:e.base_;function nt(e,t){if(Be(e))return new Map(e);if(Xe(e))return new Set(e);if(qe(e))return Array[ze].slice.call(e);const n=Ue(e);if(!0===t||"class_only"===t&&!n){const t=Oe.getOwnPropertyDescriptors(e);delete t[Me];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],i=t[o];!1===i[xe]&&(i[xe]=!0,i[Ne]=!0),(i.get||i.set)&&(t[o]={[Ne]:!0,[xe]:!0,[Re]:i[Re],[Le]:e[o]})}return Oe.create(De(e),t)}{const t=De(e);if(null!==t&&n)return{...e};const r=Oe.create(t);return Oe.assign(r,e)}}function rt(e,t=!1){return it(e)||je(e)||!Fe(e)||(Ge(e)>1&&Oe.defineProperties(e,{set:ot,add:ot,clear:ot,delete:ot}),Oe.freeze(e),t&&Ke(e,(e,t)=>{rt(t,!0)},!1)),e}var ot={[Le]:function(){Ce(2)}};function it(e){return null===e||!Je(e)||Oe.isFrozen(e)}var st="MapSet",at="Patches",ct="ArrayMethods",lt={};function ut(e){const t=lt[e];return t||Ce(0,e),t}var dt,ft=e=>!!lt[e],pt=()=>dt;function ht(e,t){t&&(e.patchPlugin_=ut(at),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function mt(e){_t(e),e.drafts_.forEach(gt),e.drafts_=null}function _t(e){e===dt&&(dt=e.parent_)}var yt=e=>dt={drafts_:[],parent_:dt,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ft(st)?ut(st):void 0,arrayMethodsPlugin_:ft(ct)?ut(ct):void 0};function gt(e){const t=e[Me];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function vt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[Me].modified_&&(mt(t),Ce(4)),Fe(e)&&(e=bt(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[Me].base_,e,t)}else e=bt(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&rt(t,n)}(t,e,!0),mt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ie?e:void 0}function bt(e,t){if(it(t))return t;const n=t[Me];if(!n)return kt(t,e.handledSet_,e);if(!wt(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);It(n,e)}return n.copy_}function St(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var wt=(e,t)=>e.scope_===t,Et=[];function Pt(e,t,n,r){const o=et(e),i=e.type_;if(void 0!==r&&We(o,r,i)===t)return void Ye(o,r,n,i);if(!e.draftLocations_){const t=e.draftLocations_=new Map;Ke(o,(e,n)=>{if(je(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const s=e.draftLocations_.get(t)??Et;for(const e of s)Ye(o,e,n,i)}function It(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}St(e)}}function kt(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||je(e)||t.has(e)||!Fe(e)||it(e)||(t.add(e),Ke(e,(r,o)=>{if(je(o)){const t=o[Me];if(wt(t,n)){const n=tt(t);Ye(e,r,n,e.type_),St(t)}}else Fe(o)&&kt(o,t,n)})),e}var Mt={get(e,t){if(t===Me)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const o=et(e);if(!Ve(o,t,e.type_))return function(e,t,n){const r=Ot(t,n);return r?Le in r?r[Le]:r.get?.call(e.draft_):void 0}(e,o,t);const i=o[t];if(e.finalized_||!Fe(i))return i;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return i;if(i===Ct(e.base_,t)){At(e);const n=1===e.type_?+t:t,r=zt(0,i,e,n);return e.copy_[n]=r}return i},has:(e,t)=>t in et(e),ownKeys:e=>Reflect.ownKeys(et(e)),set(e,t,n){const r=Ot(et(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Ct(et(e),t),s=r?.[Me];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||Ve(e.base_,t,e.type_)))return!0;At(e),Dt(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(je(n)){const o=n[Me];wt(o,r)&&o.callbacks_.push(function(){At(e);const r=tt(o);Pt(e,n,r,t)})}else Fe(n)&&e.callbacks_.push(function(){const o=et(e);3===e.type_?o.has(n)&&kt(n,r.handledSet_,r):We(o,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&kt(We(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(At(e),void 0!==Ct(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),Dt(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=et(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[xe]:!0,[Ne]:1!==e.type_||"length"!==t,[Re]:r[Re],[Le]:n[t]}:r},defineProperty(){Ce(11)},getPrototypeOf:e=>De(e.base_),setPrototypeOf(){Ce(12)}},Tt={};for(let e in Mt){let t=Mt[e];Tt[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function Ct(e,t){const n=e[Me];return(n?et(n):e)[t]}function Ot(e,t){if(!(t in e))return;let n=De(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=De(n)}}function Dt(e){e.modified_||(e.modified_=!0,e.parent_&&Dt(e.parent_))}function At(e){e.copy_||(e.assigned_=new Map,e.copy_=nt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function zt(e,t,n,r){const[o,i]=Be(t)?ut(st).proxyMap_(t,n):Xe(t)?ut(st).proxySet_(t,n):function(e,t){const n=qe(e),r={type_:n?1:0,scope_:t?t.scope_:pt(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=r,i=Mt;n&&(o=[r],i=Tt);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,[a,r]}(t,n);return(n?.scope_??pt()).drafts_.push(o),i.callbacks_=n?.callbacks_??[],i.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const o=t;if(!o||!wt(o,r))return;r.mapSetPlugin_?.fixSetContents(o);const i=tt(o);Pt(e,o.draft_??o,i,n),It(o,r)})}(n,i,r):i.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:t}=e;i.modified_&&t&&t.generatePatches_(i,[],e)}),o}function Nt(e){return je(e)||Ce(10,e),Rt(e)}function Rt(e){if(!Fe(e)||it(e))return e;const t=e[Me];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=nt(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=nt(e,!0);return Ke(n,(e,t)=>{Ye(n,e,Rt(t))},r),t&&(t.finalized_=!1),n}Tt.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Ce(13),Tt.set.call(this,e,t,void 0)},Tt.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Ce(14),Mt.set.call(this,e[0],t,n,e[0])},new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Qe(e)&&!Qe(t)){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,e=>t.call(this,e,...o))}}let r;if(Qe(t)||Ce(6),void 0===n||Qe(n)||Ce(7),Fe(e)){const o=yt(this),i=zt(0,e,void 0);let s=!0;try{r=t(i),s=!1}finally{s?mt(o):_t(o)}return ht(o,n),vt(r,o)}if(!e||!Je(e)){if(r=t(e),void 0===r&&(r=e),r===Ie&&(r=void 0),this.autoFreeze_&&rt(r,!0),n){const t=[],o=[];ut(at).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:o}),n(t,o)}return r}Ce(1,e)},this.produceWithPatches=(e,t)=>{if(Qe(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Ze(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ze(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ze(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Fe(e)||Ce(8),je(e)&&(e=Nt(e));const t=yt(this),n=zt(0,e,void 0);return n[Me].isManual_=!0,_t(t),n}finishDraft(e,t){const n=e&&e[Me];n&&n.isManual_||Ce(9);const{scope_:r}=n;return ht(r,t),vt(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ut(at).applyPatches_;return je(e)?r(e,t):this.produce(e,e=>r(e,t))}},Error;var xt=(e,t,n)=>{if(1===t.length&&t[0]===n){let t=!1;try{const n={};e(n)===n&&(t=!0)}catch{}if(t){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",{stack:e})}}},Lt=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=r(()=>({}),...o);if(a.apply(null,i)!==a.apply(null,s)){let e;try{throw new Error}catch(t){({stack:e}=t)}console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",{arguments:n,firstInputs:i,secondInputs:s,stack:e})}},jt={inputStabilityCheck:"once",identityFunctionCheck:"once"},Ft=e=>Array.isArray(e)?e:[e];function $t(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var Ht="undefined"!=typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function Ut(){return{s:0,v:void 0,o:null,p:null}}function Kt(e,t={}){let n={s:0,v:void 0,o:null,p:null};const{resultEqualityCheck:r}=t;let o,i=0;function s(){let t=n;const{length:s}=arguments;for(let e=0,n=s;e<n;e++){const n=arguments[e];if("function"==typeof n||"object"==typeof n&&null!==n){let e=t.o;null===e&&(t.o=e=new WeakMap);const r=e.get(n);void 0===r?(t=Ut(),e.set(n,t)):t=r}else{let e=t.p;null===e&&(t.p=e=new Map);const r=e.get(n);void 0===r?(t=Ut(),e.set(n,t)):t=r}}const a=t;let c;if(1===t.s)c=t.v;else if(c=e.apply(null,arguments),i++,r){const e=o?.deref?.()??o;null!=e&&r(e,c)&&(c=e,0!==i&&i--),o="object"==typeof c&&null!==c||"function"==typeof c?new Ht(c):c}return a.s=1,a.v=c,c}return s.clearCache=()=>{n={s:0,v:void 0,o:null,p:null},s.resetResultsCount()},s.resultsCount=()=>i,s.resetResultsCount=()=>{i=0},s}function Gt(e,...t){const n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r=0,o=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t="expected a function, instead received "+typeof e){if("function"!=typeof e)throw new TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);const a={...n,...i},{memoize:c,memoizeOptions:l=[],argsMemoize:u=Kt,argsMemoizeOptions:d=[],devModeChecks:f={}}=a,p=Ft(l),h=Ft(d),m=function(e){const t=Array.isArray(e[0])?e[0]:e;return function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){const n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw new TypeError(`${t}[${n}]`)}}(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}(e),_=c(function(){return r++,s.apply(null,arguments)},...p);let y=!0;const g=u(function(){o++;const e=$t(m,arguments);if(t=_.apply(null,e),"production"!==process.env.NODE_ENV){const{identityFunctionCheck:n,inputStabilityCheck:r}=((e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...jt,...t};return{identityFunctionCheck:{shouldRun:"always"===n||"once"===n&&e,run:xt},inputStabilityCheck:{shouldRun:"always"===r||"once"===r&&e,run:Lt}}})(y,f);if(n.shouldRun&&n.run(s,e,t),r.shouldRun){const t=$t(m,arguments);r.run({inputSelectorResults:e,inputSelectorResultsCopy:t},{memoize:c,memoizeOptions:p},arguments)}y&&(y=!1)}return t},...h);return Object.assign(g,{resultFunc:s,memoizedResultFunc:_,dependencies:m,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>t,recomputations:()=>r,resetRecomputations:()=>{r=0},memoize:c,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}var Vt=Gt(Kt),Wt=Object.assign((e,t=Vt)=>{!function(e,t="expected an object, instead received "+typeof e){if("object"!=typeof e)throw new TypeError(t)}(e,"createStructuredSelector expects first argument to be an object where each property is a selector, instead received a "+typeof e);const n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>Wt}),Yt="__rtkq/",qt="online",Bt="offline",Xt="focus",Jt="focused",Qt="visibilitychange",Zt=e(`${Yt}${Jt}`),en=e(`${Yt}un${Jt}`),tn=e(`${Yt}${qt}`),nn=e(`${Yt}${Bt}`),rn=!1;WeakMap,new Error("Promise never resolved before cacheEntryRemoved.");const on=u({...E,auth:$,chat:w,conversations:S,voice:le,indicator:F}),sn=b();sn.startListening({matcher:a(U,K),effect:(e,{dispatch:t})=>{t(k())}});const an=v({reducer:on,middleware:e=>e({serializableCheck:P}).prepend(sn.middleware,H.middleware,ue.middleware).concat(I)});var cn;cn=an.dispatch,function(){const[e,t,n,r]=[Zt,en,tn,nn].map(e=>()=>cn(e())),o=()=>{"visible"===window.document.visibilityState?e():t()};if(!rn&&"undefined"!=typeof window&&window.addEventListener){let t=function(e){Object.entries(i).forEach(([t,n])=>{e?window.addEventListener(t,n,!1):window.removeEventListener(t,n)})};const i={[Xt]:e,[Qt]:o,[qt]:n,[Bt]:r};t(!0),rn=!0}}(),G(()=>an.getState().auth.accessToken),V(()=>an.getState().auth.tokenExpiresAt),M(()=>an.getState());const ln=!1,un=!0,dn=!0,fn=Y.ONLINE,pn=!0,hn=(e,t)=>null===e?t:"true"===e,mn=({children:e,defaultSttImplementation:t=fn})=>{const{user:n}=C(),r=n?.id,o=W(),[i,s]=pe(!1),[a,c]=pe(ln),[l,u]=pe(un),[d,f]=pe(dn),[p,h]=pe(t),[m,_]=pe(pn);return he(()=>{let e=!1;return Promise.all([o.getItem(q.DEBUG_MODE),o.getItem(q.LOCATION_ENABLED),o.getItem(q.STT_AUTO_SEND),o.getItem(q.STT_IMPLEMENTATION),o.getItem(q.SEND_DIAGNOSTICS)]).then(([n,r,o,i,s])=>{if(e)return;var a;c(hn(n,ln)),u(hn(r,un)),f(hn(o,dn)),h((a=i)===Y.ONLINE||a===Y.DEVICE?a:t);const l=hn(s,pn);_(l),B(l)}),()=>{e=!0}},[t,r,o]),de(O.Provider,{value:{enableTts:i,setEnableTts:s,debugMode:a,setDebugMode:e=>{c(e),o.setItem(q.DEBUG_MODE,String(e))},locationEnabled:l,setLocationEnabled:e=>{u(e),o.setItem(q.LOCATION_ENABLED,String(e))},autoSendVoice:d,setAutoSendVoice:e=>{f(e),o.setItem(q.STT_AUTO_SEND,String(e))},sttImplementation:p,setSttImplementation:e=>{h(e),o.setItem(q.STT_IMPLEMENTATION,e)},sendDiagnostics:m,setSendDiagnostics:e=>{_(e),B(e),o.setItem(q.SEND_DIAGNOSTICS,String(e))}},children:e})},_n=T,yn=_e(void 0),gn=_e({}),vn=({children:e,messageId:t,isDisabled:n=!1})=>{const[r,o]=pe({});return de(yn.Provider,{value:{messageContext:r,setMessageContext:o,updateMessageContext:(e,t)=>{o(n=>({...n,[e]:t}))},messageId:t},children:de(gn.Provider,{value:{messageId:t,isDisabled:n},children:e})})},bn=()=>{const e=me(yn);if(!e)throw new Error("useMessageContext must be used within MessageContextProvider");return e},Sn=()=>{const e=me(gn);return e?.messageId},wn=()=>{const e=me(gn);return e?.isDisabled??!1};function En(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches?X.DARK:X.LIGHT:X.DARK}const Pn=({children:e,orgId:t,fallbackThemeStyles:n,initialAppearanceMode:r=X.SYSTEM})=>{const{user:o}=C(),i=o?.id,s=W(),[a,c]=pe(r),[l,u]=pe(()=>r===X.SYSTEM?En():r);he(()=>{let e=!1;const t=J(i),n=q.APPEARANCE_MODE_KEY;return(async()=>{const o=await s.getItem(t);if(i&&await s.removeItem(n),e)return;const a=((e,t)=>e===X.LIGHT||e===X.DARK||e===X.SYSTEM?e:t)(o,r);c(a),u(a===X.SYSTEM?En():a)})(),()=>{e=!0}},[i,s,r]),he(()=>{if(a!==X.SYSTEM)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{u(e.matches?X.DARK:X.LIGHT)};return u(e.matches?X.DARK:X.LIGHT),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[a]);const d=t||void 0,{data:f,isLoading:p,error:h}=D(d),m=f?.success?f.data??null:null,_=m?.themes?(l===X.LIGHT?m.themes.light:m.themes.dark)??null:null,y=ye(()=>!m&&n?n:Q(m,_,l),[m,_,l,n]),g=m?.orbPosition??Z.FOREGROUND,v=ge(e=>{c(e);const t=J(i);s.setItem(t,e),i&&s.removeItem(q.APPEARANCE_MODE_KEY),u(e===X.SYSTEM?En():e)},[s,i]),b={theme:l,setTheme:v,appearanceMode:a,isLoading:p,error:h?new Error("Failed to fetch branding"):null,currentThemeColors:_,themeStyles:y,orbPosition:g};return de(ee.Provider,{value:b,children:e})},In=({children:e,protocolType:t})=>{const n=t||z,r=ye(()=>A(n,N({onAuthExpired:()=>an.dispatch(U())})),[n]),o=ye(()=>({adapter:r,protocolType:n}),[r,n]);return de(R.Provider,{value:o,children:e})},kn=({value:e,children:t,fallback:n,extraHydrations:r})=>{te(e);const o=we(),i=void 0!==n,[s,a]=pe(!i);return he(()=>{let t=!1;const n=[o(ne(e))];if(r)for(const t of r)n.push(Promise.resolve(t(e,o)).catch(e=>{re.error({message:"StorageProvider hydration step failed",component:"StorageProvider",error_message:e instanceof Error?e.message:String(e)})}));return Promise.all(n).finally(()=>{t||i&&a(!0)}),()=>{t=!0}},[]),de(oe.Provider,{value:e,children:i&&!s?de(fe,{children:n}):t})},Mn=({token:e,user:t,children:n})=>{const r=ve(null);return e&&e!==r.current&&(r.current=e,an.dispatch(ie({accessToken:e,expiresIn:Math.floor(Date.now()/1e3)+3600,...t&&{user:{id:"",email:t.email||"",name:t.name}}}))),de(fe,{children:n})},Tn=({children:e})=>de(x.Provider,{value:L(),children:e}),Cn=({children:e,callbacks:t})=>de(j.Provider,{value:t,children:e}),On=({baseUrl:e,customHeaders:t,token:n,user:r,protocol:o=z,paymentProvider:i,onConversationChange:s,onConversationTitleChange:a,onMessagesChange:c,onLogoutRequested:l,onSessionExpired:u,storage:d,storageFallback:f,extraHydrations:p,orgId:h,initialThemeStyles:m,initialAppearanceMode:_,reuseHostBranding:y=!1,audioPlatform:g,networkMonitor:v,children:b})=>{se({baseUrl:e,customHeaders:t,paymentProvider:i}),ae(u??null);const S=de(Pe,{value:g,children:b});let w=de(Mn,{token:n,user:r,children:de(In,{protocolType:o,children:de(Tn,{children:de(Cn,{callbacks:{onConversationChange:s,onConversationTitleChange:a,onMessagesChange:c,onLogoutRequested:l},children:y?S:de(Pn,{orgId:h,fallbackThemeStyles:m,initialAppearanceMode:_,children:S})})})})});return v&&(w=de(ce.Provider,{value:v,children:w})),de(Ee,{store:an,children:d?de(kn,{value:d,fallback:f,extraHydrations:p,children:w}):w})},Dn=Se(()=>import("./PaymentProviderHost-CQ1DxU82.js")),An=e=>de(be,{fallback:null,children:de(Dn,{...e})}),zn=()=>import("./PaymentProviderHost-CQ1DxU82.js").catch(()=>{});export{Pn as BrandingProvider,On as ChatClientProvider,vn as MessageContextProvider,An as PaymentProviderHost,mn as SettingsProvider,kn as StorageProvider,zn as preloadPaymentModal,on as rootReducer,an as store,bn as useMessageContext,wn as useMessageDisabled,Sn as useMessageId,_n as useSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{Provider as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Provider as b}from"react-redux";import{DEFAULT_PROTOCOL as R}from"@1interface/chat-core";import{initializeChatConfig as A,setTokenRefreshHandler as T}from"@1interface/shared-core";import{NetworkContext as H}from"@1interface/shared-core";import{AudioPlatformProvider as M}from"@1interface/voice-shell";import{store as N}from"../store";import{ProtocolProvider as w}from"../protocol/ProtocolProvider";import{StorageProvider as E}from"./StorageProvider";import{SessionInitializer as I}from"./SessionInitializer";import{ConfigurationProvider as z}from"./ConfigurationProvider";import{ChatCallbacksProvider as B}from"./ChatCallbacksProvider";import{BrandingProvider as F}from"./BrandingProvider";const $=({baseUrl:a,customHeaders:n,token:d,user:l,protocol:p=R,paymentProvider:s,onConversationChange:m,onConversationTitleChange:P,onMessagesChange:c,onLogoutRequested:f,onSessionExpired:v,storage:e,storageFallback:C,extraHydrations:u,orgId:g,initialThemeStyles:h,initialAppearanceMode:y,reuseHostBranding:k=!1,audioPlatform:x,networkMonitor:t,children:S})=>{A({baseUrl:a,customHeaders:n,paymentProvider:s}),T(v??null);const i=o(M,{value:x,children:S});let r=o(I,{token:d,user:l,children:o(w,{protocolType:p,children:o(z,{children:o(B,{callbacks:{onConversationChange:m,onConversationTitleChange:P,onMessagesChange:c,onLogoutRequested:f},children:k?i:o(F,{orgId:g,fallbackThemeStyles:h,initialAppearanceMode:y,children:i})})})})});return t&&(r=o(H.Provider,{value:t,children:r})),o(b,{store:N,children:e?o(E,{value:e,fallback:C,extraHydrations:u,children:r}):r})};export{$ as ChatClientProvider};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1interface/chat-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-moet.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"lucide-react": "^0.562.0",
|
|
52
52
|
"streamdown": "^1.6.11",
|
|
53
53
|
"tailwind-merge": "^3.6.0",
|
|
54
|
+
"@1interface/chat-core": "^0.9.0",
|
|
55
|
+
"@1interface/voice-shell": "^0.4.0",
|
|
54
56
|
"@1interface/voice-core": "^0.4.0",
|
|
55
57
|
"@1interface/shared-core": "^0.6.0",
|
|
56
|
-
"@1interface/widgets": "^0.2.0"
|
|
57
|
-
"@1interface/chat-core": "^0.9.0",
|
|
58
|
-
"@1interface/voice-shell": "^0.4.0"
|
|
58
|
+
"@1interface/widgets": "^0.2.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@reduxjs/toolkit": "^2.0.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"@types/react-dom": "^19.2.3",
|
|
74
74
|
"@vitejs/plugin-react": "5.1.1",
|
|
75
75
|
"@vitest/ui": "4.1.0",
|
|
76
|
-
"esbuild": "0.27.2",
|
|
77
76
|
"autoprefixer": "^10.5.0",
|
|
77
|
+
"esbuild": "0.27.2",
|
|
78
78
|
"glob": "^13.0.6",
|
|
79
79
|
"jsdom": "^27.4.0",
|
|
80
80
|
"postcss": "^8.5.15",
|