diff --git a/2357.9ff4482c.iframe.bundle.js b/2357.f369fe41.iframe.bundle.js similarity index 76% rename from 2357.9ff4482c.iframe.bundle.js rename to 2357.f369fe41.iframe.bundle.js index bef3f9fd..df5fbbc8 100644 --- a/2357.9ff4482c.iframe.bundle.js +++ b/2357.f369fe41.iframe.bundle.js @@ -1 +1 @@ -(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2357],{"./src/components/AgeVerificationModal/AgeVerificationModal.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_i18next__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_hot_toast__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),luxon__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/luxon/src/luxon.js"),_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/DateSelector/DateSelector.tsx"),react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/index.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AgeVerificationModal=({visible=!1,onClose,minAge})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_7__.$)(),[birthDate,setBirthDate]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[error,setError]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[submitting,setSubmitting]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(!1),onSubmit=(0,react__WEBPACK_IMPORTED_MODULE_5__.useCallback)((()=>{if(setSubmitting(!0),!birthDate)return react_hot_toast__WEBPACK_IMPORTED_MODULE_0__.ZP.error(t("requiredField")),setError(t("requiredField")||"Required field"),void setSubmitting(!1);if(luxon__WEBPACK_IMPORTED_MODULE_3__.ou.now().diff(birthDate,"years").yearsonClose(),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{children:t("ageVerificationText",{minAge})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),onSubmit()},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("fieldset",{name:"birthDate",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("legend",{className:"sr-only",children:t("birthDate")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__.Z,{defaultDate:new Date(Date.now()),onChange:date=>{setBirthDate(date)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-help",children:t("birthDateHelper")}),error&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-error",children:error})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item form-submit",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:submitting,disabled:!birthDate,children:t("confirm")})})]})]})};AgeVerificationModal.displayName="AgeVerificationModal";const __WEBPACK_DEFAULT_EXPORT__=AgeVerificationModal;try{AgeVerificationModal.displayName="AgeVerificationModal",AgeVerificationModal.__docgenInfo={description:"",displayName:"AgeVerificationModal",props:{visible:{defaultValue:{value:"false"},description:"",name:"visible",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(birthDate?: string | undefined) => void"}},minAge:{defaultValue:null,description:"",name:"minAge",required:!0,type:{name:"number"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"]={docgenInfo:AgeVerificationModal.__docgenInfo,name:"AgeVerificationModal",path:"src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Auth/Auth.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_i18next__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hook_form__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hook-form/dist/index.esm.mjs"),_icons_Plus__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Plus.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AuthWidget=({pwdOrTokens,setPwdOrTokens,onFinish,minimumNumberOfRecoveryTokens=1,showTokens=!0,openModal=!1,withModal=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_5__.$)(),{register,handleSubmit,formState:{errors},setError}=(0,react_hook_form__WEBPACK_IMPORTED_MODULE_6__.cI)(),[numTokens,setNumTokens]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(1),[showModal,setShowModal]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!!pwdOrTokens),form=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("form",{name:"memoriAuth",onSubmit:handleSubmit((data=>{"password"===pwdOrTokens&&!data.password?.length||"tokens"===pwdOrTokens&&((data?.tokens?.length||0)t.length)))?setError("tokens",{type:"minLength",message:"Tokens"}):onFinish&&onFinish(data).then((()=>{setShowModal(!1)}))})),className:"memori-auth-widget--form",children:[("password"===pwdOrTokens||!showTokens)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--password-fieldset",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{children:["Password:"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{className:"memori-auth-widget--input",required:!0,type:"password",placeholder:"Password",...register("password",{required:!0})})]}),showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("tokens"),children:t("auth.useRecoveryTokens")||"Recovery tokens"})]})]}),"tokens"===pwdOrTokens&&showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--tokens-fieldset",name:"tokens",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("legend",{children:[t("auth.tokens"),": "]}),(length=numTokens,Array.from({length},((_,i)=>i))).map((idx=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("label",{className:"memori-auth-widget--token",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"password",className:"memori-auth-widget--input",placeholder:"Recovery token",required:!0,autoComplete:"off",...register(`tokens.${idx}`,{required:!0})})},idx))),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{onClick:()=>setNumTokens((t=>t+1)),className:"memori-auth-widget--token-add",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Plus__WEBPACK_IMPORTED_MODULE_3__.default,{}),children:t("auth.addToken")||"Add token"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("password"),children:t("auth.usePassword")||"Password"})]}),"minLength"===errors.tokens?.type&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"memori-auth-widget--error",children:[t("auth.atLeast")||"At least"," ",minimumNumberOfRecoveryTokens]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,className:"memori-auth-widget--submit",children:t("confirm")||"Submit"})]});var length;return withModal?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_2__.Z,{open:openModal||showModal,title:t("auth.title")||"Authentication",onClose:()=>setPwdOrTokens(null),closable:!1,children:form}):form},__WEBPACK_DEFAULT_EXPORT__=AuthWidget;try{AuthWidget.displayName="AuthWidget",AuthWidget.__docgenInfo={description:"",displayName:"AuthWidget",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#AuthWidget"]={docgenInfo:AuthWidget.__docgenInfo,name:"AuthWidget",path:"src/components/Auth/Auth.tsx#AuthWidget"})}catch(__react_docgen_typescript_loader_error){}try{Auth.displayName="Auth",Auth.__docgenInfo={description:"",displayName:"Auth",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#Auth"]={docgenInfo:Auth.__docgenInfo,name:"Auth",path:"src/components/Auth/Auth.tsx#Auth"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const BlockedMemoriBadge=({memoriName,blockedUntil,showGiverInfo=!1,showTitle=!1,marginLeft=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),blockedUntilDate=new Date(blockedUntil);return blockedUntilDate>new Date?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"blocked-memori-badge--tooltip",content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment,{children:[!showGiverInfo&&t("memoriBlockedAnon",{name:memoriName,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&t("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&` ${t("memoriBlockedReasonExceedChats")}`,showGiverInfo&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("br",{}),showGiverInfo&&`\n${t("memoriBlockedGiverHelper")}`]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"blocked-memori-badge "+(marginLeft?" margin-left":""),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"blocked-memori-badge--icon"})}),showTitle&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"blocked-memori-badge--title",children:t("memoriBlockedTitle")})]})}):null},__WEBPACK_DEFAULT_EXPORT__=BlockedMemoriBadge;try{BlockedMemoriBadge.displayName="BlockedMemoriBadge",BlockedMemoriBadge.__docgenInfo={description:"",displayName:"BlockedMemoriBadge",props:{memoriName:{defaultValue:null,description:"",name:"memoriName",required:!0,type:{name:"string"}},blockedUntil:{defaultValue:null,description:"",name:"blockedUntil",required:!0,type:{name:"string"}},showGiverInfo:{defaultValue:{value:"false"},description:"",name:"showGiverInfo",required:!1,type:{name:"boolean"}},showTitle:{defaultValue:{value:"false"},description:"",name:"showTitle",required:!1,type:{name:"boolean"}},marginLeft:{defaultValue:{value:"false"},description:"",name:"marginLeft",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"]={docgenInfo:BlockedMemoriBadge.__docgenInfo,name:"BlockedMemoriBadge",path:"src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChangeMode/ChangeMode.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/radio-group/radio-group.js"),react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChangeMode=({instruct,canInstruct,onChangeMode})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_3__.$)();return canInstruct?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori--changeMode-instruct",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E,{name:"instruct",value:instruct?"instruct":"test",defaultValue:instruct?"instruct":"test",className:"memori--changeMode-instruct-radio",onChange:onChangeMode,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"instruct",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.instruct")||"Instruct"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"test",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.test")||"Test"})})]})}):null},__WEBPACK_DEFAULT_EXPORT__=ChangeMode;try{ChangeMode.displayName="ChangeMode",ChangeMode.__docgenInfo={description:"",displayName:"ChangeMode",props:{instruct:{defaultValue:null,description:"",name:"instruct",required:!1,type:{name:"boolean"}},onChangeMode:{defaultValue:null,description:"",name:"onChangeMode",required:!0,type:{name:'(mode: "instruct" | "test") => void'}},canInstruct:{defaultValue:null,description:"",name:"canInstruct",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChangeMode/ChangeMode.tsx#ChangeMode"]={docgenInfo:ChangeMode.__docgenInfo,name:"ChangeMode",path:"src/components/ChangeMode/ChangeMode.tsx#ChangeMode"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const CompletionProviderStatus=({forceStatus,provider})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[status,setStatus]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(forceStatus??"none"),providerStatus=(provider=>{switch(provider){case"DEFAULT":case"OpenAI":return{getStatus:async()=>{const res=await fetch("https://status.openai.com/api/v2/summary.json");return(await res.json()).status.indicator??"none"},statusPage:"https://status.openai.com/"};default:return{getStatus:async()=>"none",statusPage:""}}})(provider);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{forceStatus||providerStatus.getStatus().then((status=>setStatus(status)))}),[forceStatus,provider]),"none"!==status?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori--completion-provider-status--tooltip",align:"topLeft",content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:t("completionProviderDown",{provider:provider??t("completionProviderFallbackName")})}),!!providerStatus.statusPage?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("a",{href:providerStatus.statusPage,rel:"noopener noreferrer",target:"_blank",children:t("completionProviderCheckStatusPage")})})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"memori--completion-provider-status--icon"})}):null},__WEBPACK_DEFAULT_EXPORT__=CompletionProviderStatus;try{CompletionProviderStatus.displayName="CompletionProviderStatus",CompletionProviderStatus.__docgenInfo={description:"",displayName:"CompletionProviderStatus",props:{forceStatus:{defaultValue:null,description:"",name:"forceStatus",required:!1,type:{name:"string"}},provider:{defaultValue:null,description:"",name:"provider",required:!1,type:{name:"string | null"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"]={docgenInfo:CompletionProviderStatus.__docgenInfo,name:"CompletionProviderStatus",path:"src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/DateSelector/DateSelector.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),luxon__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/luxon/src/luxon.js"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const months={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},DateSelector=(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)((({defaultDate,onChange,disabled=!1})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[date,setDate]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultDate?"string"==typeof defaultDate?luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromISO(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromJSDate(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now());return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{onChange(date)}),[date,onChange]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"memori--date-selector",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"day",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("day"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("day"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.day}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((day=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({day:day+1}),className:"memori--date-selector__select-option",children:day+1},day)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"month",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("month"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("month"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:months["it"===i18n.language?"it":"en"][date.month-1]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:months["it"===i18n.language?"it":"en"].map((month=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{className:"memori--date-selector__select-option",value:date.set({month:months["it"===i18n.language?"it":"en"].findIndex((m=>m===month))+1}),children:month},month)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"year",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("year"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("year"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.year}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now().year-1899).keys()].sort(((a,b)=>b-a)).map((year=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({year:year+1900}),className:"memori--date-selector__select-option",children:year+1900},year)))})})]})})]})}));DateSelector.displayName="DateSelector";const __WEBPACK_DEFAULT_EXPORT__=DateSelector},"./src/components/ExpertsDrawer/ExpertsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer=({open=!1,baseUrl,apiUrl,tenant,experts,onClose})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{open,onClose,className:"memori--experts-drawer",title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h2",{className:"memori--experts-drawer--title",children:t("widget.expertsInTheBoard")}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("ul",{className:"memori--experts-drawer--list",children:experts.map((expert=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("img",{src:`${apiUrl}/api/v1/memoriai/memori/avatar/${expert.expertMemoriID}`,alt:expert.name,onError:e=>{e.currentTarget.src=(0,_helpers_media__WEBPACK_IMPORTED_MODULE_3__.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h3",{className:"memori--experts-drawer--name",children:expert.name}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{className:"memori--experts-drawer--description",children:expert.description})]})]},expert.expertID)))})})};ExpertsDrawer.displayName="ExpertsDrawer";const __WEBPACK_DEFAULT_EXPORT__=ExpertsDrawer;try{ExpertsDrawer.displayName="ExpertsDrawer",ExpertsDrawer.__docgenInfo={description:"",displayName:"ExpertsDrawer",props:{experts:{defaultValue:null,description:"",name:"experts",required:!0,type:{name:"ExpertReference[]"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"]={docgenInfo:ExpertsDrawer.__docgenInfo,name:"ExpertsDrawer",path:"src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/KnownFacts/KnownFacts.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Drawer.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Spin.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_helpers_error__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/helpers/error.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Delete__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/Delete.tsx"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/ui/Select.tsx"),_icons_ChevronLeft__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./src/components/icons/ChevronLeft.tsx"),_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/components/icons/ChevronRight.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts=({apiURL,sessionID,memori,visible=!0,initialKnownFacts=[],closeDrawer})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_14__.$)(),client=(0,_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__.Z)(apiURL),{getKnownFactsPaginated,deleteKnownFact}=client.knownFacts,[knownFacts,setKnownFacts]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts),[numberOfResults,setNumberOfResults]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(25),[pageIndex,setPageIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[knownFactsCount,setKnownFactsCount]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts?.length??0),[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),fetchKnownFacts=async(sessionId,from,howMany)=>{if(sessionID||sessionId){setLoading(!0);try{const{knownFacts,count,...response}=await getKnownFactsPaginated(sessionId??sessionID,from??pageIndex,howMany??numberOfResults);setKnownFacts(knownFacts??[]),setKnownFactsCount(count??0),0!==response.resultCode&&(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode))))}catch(err){console.error("KNOWN_FACTS/FETCH",err),setKnownFacts(initialKnownFacts??[])}setLoading(!1)}};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{fetchKnownFacts()}),[]);const[bulkDeleteModalVisible,setBulkDeleteModalVisible]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[deleteModalVisibleFor,setDeleteModalVisibleFor]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),[selectedRowKeys,setSelectedRowKeys]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,width:"80%",className:"memori-known-facts-drawer",onClose:()=>closeDrawer(),title:t("knownFacts.title"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("p",{children:t("knownFacts.description",{memoriName:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Spin__WEBPACK_IMPORTED_MODULE_4__.Z,{spinning:loading,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:()=>{setBulkDeleteModalVisible(!0)},className:"memori-known-facts-delete-selected",disabled:0===selectedRowKeys?.length,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),loading,children:[t("selected")," (",selectedRowKeys?.length,")"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:bulkDeleteModalVisible,closable:!0,title:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmTitle"):t("knownFacts.deleteConfirmTitle"),description:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmMessage",{number:selectedRowKeys.length}):t("knownFacts.deleteConfirmMessage"),onClose:()=>{setBulkDeleteModalVisible(!1)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setBulkDeleteModalVisible(!1)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const mutations=selectedRowKeys.map((key=>deleteKnownFact(sessionID,key)));Promise.all(mutations).then((responses=>{if(responses.every((r=>0===r.resultCode)))react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setBulkDeleteModalVisible(!1);else{let errored=responses.find((r=>0!==r.resultCode));console.error(errored),void 0!==errored?.resultCode&&react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(errored?.resultCode)))}}))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]}),knownFactsCount>25&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("nav",{className:"memori--table--pagination",children:[knownFactsCount>numberOfResults&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",disabled:0===pageIndex||pageIndex{let from=(pageIndex/numberOfResults-1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(pageIndex/numberOfResults)+1," /"," ",Math.ceil(knownFactsCount/numberOfResults)]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",padded:!1,title:t("next")||"Next",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__.default,{}),disabled:(pageIndex/numberOfResults+1)*numberOfResults>=knownFactsCount,onClick:()=>{let from=(pageIndex/numberOfResults+1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_10__.Z,{options:[{label:`25 / ${t("page")||"page"}`,value:25},{label:`50 / ${t("page")||"page"}`,value:50},{label:`100 / ${t("page")||"page"}`,value:100}],value:numberOfResults,displayValue:`${numberOfResults} / ${t("page")||"page"}`,onChange:value=>{setNumberOfResults(value),setPageIndex(0),fetchKnownFacts(void 0,0,value)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("table",{className:"memori--table",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("thead",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:!!knownFacts?.length&&selectedRowKeys?.length===knownFacts.length,indeterminate:!!knownFacts?.length&&!!selectedRowKeys?.length&&selectedRowKeys?.length!==knownFacts?.length,onChange:e=>{e.target.checked?setSelectedRowKeys(knownFacts.map((kf=>kf.knownFactID))):setSelectedRowKeys([])}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{children:t("knownFacts.text")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"mobile-hidden",children:t("createdAt")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-right",children:t("actions")})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("tbody",{children:knownFacts.map((kf=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:selectedRowKeys?.includes(kf.knownFactID),onChange:e=>{e.target.checked?setSelectedRowKeys((srk=>[...new Set([...srk,kf.knownFactID])])):setSelectedRowKeys((srk=>srk.filter((key=>key!==kf.knownFactID))))}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{children:kf.text}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"mobile-hidden",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("span",{className:"memori--table--date",children:kf.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(kf.creationTimestamp)):"-"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"memori--table--column-right",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--action-column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{danger:!0,ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),disabled:selectedRowKeys?.length>0,title:t("delete")||"Delete",onClick:()=>setDeleteModalVisibleFor(kf.knownFactID)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:deleteModalVisibleFor===kf.knownFactID,closable:!0,title:t("knownFacts.deleteConfirmTitle"),description:t("knownFacts.deleteConfirmMessage"),onClose:()=>{setDeleteModalVisibleFor(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setDeleteModalVisibleFor(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const response=await deleteKnownFact(sessionID,kf.knownFactID);0===response.resultCode?(react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setDeleteModalVisibleFor(void 0)):(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode),{ns:"common"})))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]})})]},kf.knownFactID)))})]})]})]})};KnownFacts.displayName="KnownFacts";const __WEBPACK_DEFAULT_EXPORT__=KnownFacts;try{KnownFacts.displayName="KnownFacts",KnownFacts.__docgenInfo={description:"",displayName:"KnownFacts",props:{apiURL:{defaultValue:null,description:"",name:"apiURL",required:!0,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},initialKnownFacts:{defaultValue:{value:"[]"},description:"",name:"initialKnownFacts",required:!1,type:{name:"KnownFact[]"}},visible:{defaultValue:{value:"true"},description:"",name:"visible",required:!1,type:{name:"boolean"}},closeDrawer:{defaultValue:null,description:"",name:"closeDrawer",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/KnownFacts/KnownFacts.tsx#KnownFacts"]={docgenInfo:KnownFacts.__docgenInfo,name:"KnownFacts",path:"src/components/KnownFacts/KnownFacts.tsx#KnownFacts"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/MemoriWidget/MemoriWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>MemoriWidget_MemoriWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),esm=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),es2019_module=__webpack_require__("./node_modules/standardized-audio-context/build/es2019/module.js"),microsoft_cognitiveservices_speech_sdk=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),luxon=__webpack_require__("./node_modules/luxon/src/luxon.js"),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),PositionDrawer=__webpack_require__("./src/components/PositionDrawer/PositionDrawer.tsx"),Auth=__webpack_require__("./src/components/Auth/Auth.tsx"),Chat_Chat=__webpack_require__("./src/components/Chat/Chat.tsx"),StartPanel=__webpack_require__("./src/components/StartPanel/StartPanel.tsx"),Avatar=__webpack_require__("./src/components/Avatar/Avatar.tsx"),ChangeMode=__webpack_require__("./src/components/ChangeMode/ChangeMode.tsx"),Header=__webpack_require__("./src/components/Header/Header.tsx"),PoweredBy=__webpack_require__("./src/components/PoweredBy/PoweredBy.tsx"),AgeVerificationModal=__webpack_require__("./src/components/AgeVerificationModal/AgeVerificationModal.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.tsx"),KnownFacts=__webpack_require__("./src/components/KnownFacts/KnownFacts.tsx"),ExpertsDrawer=__webpack_require__("./src/components/ExpertsDrawer/ExpertsDrawer.tsx"),LoginDrawer=__webpack_require__("./src/components/LoginDrawer/LoginDrawer.tsx"),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const layouts_FullPage=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,children:[showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps}),(0,jsx_runtime.jsxs)("div",{className:"memori--grid",children:[(0,jsx_runtime.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps}),(0,jsx_runtime.jsx)("div",{id:"extension"})]}),(0,jsx_runtime.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null}),poweredBy]})]})]});try{FullPage.displayName="FullPage",FullPage.__docgenInfo={description:"",displayName:"FullPage",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/FullPage.tsx#FullPage"]={docgenInfo:FullPage.__docgenInfo,name:"FullPage",path:"src/components/layouts/FullPage.tsx#FullPage"})}catch(__react_docgen_typescript_loader_error){}const layouts_Totem=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-totem-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--avatar",children:Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Totem.displayName="Totem",Totem.__docgenInfo={description:"",displayName:"Totem",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Totem.tsx#Totem"]={docgenInfo:Totem.__docgenInfo,name:"Totem",path:"src/components/layouts/Totem.tsx#Totem"})}catch(__react_docgen_typescript_loader_error){}const layouts_Chat=({Header,headerProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-chat-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Chat.displayName="Chat",Chat.__docgenInfo={description:"",displayName:"Chat",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Chat.tsx#Chat"]={docgenInfo:Chat.__docgenInfo,name:"Chat",path:"src/components/layouts/Chat.tsx#Chat"})}catch(__react_docgen_typescript_loader_error){}var Button=__webpack_require__("./src/components/ui/Button.tsx"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),Close=__webpack_require__("./src/components/icons/Close.tsx");const WebsiteAssistantLayout=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>{const{t}=(0,useTranslation.$)(),[collapsed,_setCollapsed]=(0,react.useState)(!0),[expandedKey,setExpandedKey]=(0,react.useState)(),stopAudio=(0,react.useMemo)((()=>chatProps?.stopAudio),[chatProps?.stopAudio]),setCollapsed=collapsed=>{_setCollapsed(collapsed),setExpandedKey(collapsed?void 0:(new Date).toISOString());try{stopAudio?.()}catch(e){console.log(e)}};return(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--"+(collapsed?"collapsed":"expanded"),children:collapsed?(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>setCollapsed(!1),title:t("expand")||"Expand",children:(0,jsx_runtime.jsx)(Blob.Z,{avatar:avatarProps?.memori.avatarURL})})}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-website_assistant-layout",children:[poweredBy,(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>setCollapsed(!0),icon:(0,jsx_runtime.jsx)(Close.default,{}),title:t("close")||"Close"})}),showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps,showSettings:!1,showReload:!1})}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:Avatar&&avatarProps&&(0,react.createElement)(Avatar,{...avatarProps,integrationConfig:avatarProps.integrationConfig?{...avatarProps.integrationConfig,avatarURL:avatarProps.integrationConfig?.avatarURL?`${avatarProps.integrationConfig?.avatarURL.split("#")[0]}#${expandedKey}`:void 0}:{},key:expandedKey})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]})})};WebsiteAssistantLayout.displayName="WebsiteAssistantLayout";const layouts_WebsiteAssistant=WebsiteAssistantLayout;try{WebsiteAssistant.displayName="WebsiteAssistant",WebsiteAssistant.__docgenInfo={description:"",displayName:"WebsiteAssistant",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"]={docgenInfo:WebsiteAssistant.__docgenInfo,name:"WebsiteAssistant",path:"src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"})}catch(__react_docgen_typescript_loader_error){}var translations=__webpack_require__("./src/helpers/translations.ts"),configuration=__webpack_require__("./src/helpers/configuration.ts"),utils=__webpack_require__("./src/helpers/utils.ts"),constants=__webpack_require__("./src/helpers/constants.ts"),error=__webpack_require__("./src/helpers/error.ts");const{deleteSession,getStatistics,initSession}=(0,esm.Z)(),BADGES_MAP=new Map([[0,"๐Ÿ†•"],[10,"๐Ÿน"],[20,"๐Ÿ‡"],[30,"๐Ÿฐ"],[40,"๐Ÿ’ก"],[50,"๐Ÿ†"],[60,"๐Ÿ…"],[70,"๐Ÿฅ‰"],[80,"๐Ÿฅˆ"],[90,"๐Ÿฅ‡"],[100,"๐Ÿ”ฅ"],[110,"๐ŸŽ“"],[120,"๐Ÿค–"],[130,"๐Ÿ‘พ"],[150,"๐ŸŒ"],[180,"๐Ÿ’œ"],[200,"๐Ÿ’™"],[250,"๐Ÿงก"],[300,"๐Ÿ’š"],[350,"๐Ÿ’›"],[400,"๐Ÿ’–"],[450,"๐Ÿ’"],[500,"๐Ÿ–ค"],[550,"โค๏ธ"],[600,"๐Ÿง "]]),getBadge=points=>{const unlockedBadges=Array.from(BADGES_MAP.keys()).filter((k=>k<=points));if(unlockedBadges.length>0){const lastBadge=unlockedBadges[unlockedBadges.length-1];return BADGES_MAP.get(lastBadge)}return""},getNextBadge=badge=>{if("๐Ÿ†•"===badge)return{points:10,badge:"๐Ÿน"};let nextBadgePoints,nextBadge,currentSeen=!1;for(const[key,value]of BADGES_MAP){if(currentSeen){nextBadgePoints=key,nextBadge=value;break}value===badge&&(currentSeen=!0)}return nextBadge&&nextBadgePoints?{points:nextBadgePoints,badge:nextBadge}:void 0},getPointsForBadge=badge=>{let points=0;for(const[key,value]of BADGES_MAP)if(value===badge){points=key;break}return points},typeMessage=(message,waitForPrevious=!0,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const e=new CustomEvent("MemoriTextEntered",{detail:{text:message,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}});document.dispatchEvent(e);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let recognizer,speechConfig,speechSynthesizer,audioDestination,audioContext,memoriPassword;window.getMemoriState=integrationId=>{let widget=integrationId?document.querySelector(`.memori-widget[data-memori-integration="${integrationId}"]`)||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget[data-memori-integration]"):document.querySelector(".memori-widget")||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget");if(!widget)return null;let engineState=widget.dataset?.memoriEngineState;return engineState?JSON.parse(engineState):null},window.typeMessage=typeMessage,window.typeMessageHidden=(message,waitForPrevious=!0,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>typeMessage(message,waitForPrevious,!0,typingText,useLoaderTextAsMsg,hasBatchQueued),window.typeBatchMessages=messages=>{function disableInputs(){document.querySelector("fieldset#chat-fieldset")?.setAttribute("disabled","");const styles="opacity: 0.5; touch-action: none; pointer-events: none;";document.querySelector("textarea.memori-chat-textarea--input")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--send")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--mic")?.setAttribute("style",styles)}function reEnableInputs(){document.querySelector("fieldset#chat-fieldset")?.removeAttribute("disabled"),document.querySelector("textarea.memori-chat-textarea--input")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--send")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--mic")?.removeAttribute("style")}function areInputsDisabled(){return!!document.querySelector("fieldset#chat-fieldset")?.hasAttribute("disabled")}const isSafariIOS=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),stepsGenerator=function*(){yield*messages}();disableInputs();const submitNewMessage=()=>{const next=stepsGenerator.next(),step=next.value;if(step){areInputsDisabled()||disableInputs();let waitForPrevious=step.waitForPrevious;isSafariIOS&&(waitForPrevious=!1),typeMessage(step.message,waitForPrevious,step.hidden,step.typingText,step.useLoaderTextAsMsg,!next.done),isSafariIOS&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),reEnableInputs()}),3e3)}else areInputsDisabled()&&reEnableInputs();if(next.done)return document.removeEventListener("MemoriEndSpeak",submitNewMessage),void(areInputsDisabled()&&reEnableInputs())};document.addEventListener("MemoriEndSpeak",submitNewMessage),submitNewMessage()};let userToken,speakerMuted=!1,memoriSpeaking=!1;const MemoriWidget=({memori,memoriConfigs,memoriLang,multilingual,integration,layout="DEFAULT",customLayout,showInstruct=!1,showShare,preview=!1,embed=!1,showInputs=!0,showDates=!1,showContextPerLine=!1,showSettings=!0,showTypingText=!1,showClear=!1,showLogin=!1,showOnlyLastMessages,height="100vh",secret,baseUrl="https://aisuru.com",apiUrl="https://backend.memori.ai",initialContextVars,initialQuestion,ogImage,sessionID:initialSessionID,tenant,personification,authToken,AZURE_COGNITIVE_SERVICES_TTS_KEY,defaultSpeakerActive=!0,onStateChange,additionalInfo,additionalSettings,customMediaRenderer,userAvatar})=>{const{t,i18n}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const client=(0,esm.Z)(apiUrl),{initSession,postTextEnteredEvent,postPlaceChangedEvent,postDateChangedEvent,postTimeoutEvent,postTagChangedEvent,getSession,getContentQualityIndexes,getExpertReferences}=client,[instruct,setInstruct]=(0,react.useState)(!1),[loginToken,setLoginToken]=(0,react.useState)(additionalInfo?.loginToken??authToken),[user,setUser]=(0,react.useState)({avatarURL:"string"==typeof userAvatar?userAvatar:void 0});(0,react.useEffect)((()=>{loginToken&&!user?.userID&&showLogin&&client.backend.getCurrentUser(loginToken).then((({user,resultCode})=>{user&&0===resultCode?(setUser(user),(0,configuration.A2)("loginToken",loginToken)):(0,configuration.gj)("loginToken")}))}),[loginToken,user?.userID]);const[showLoginDrawer,setShowLoginDrawer]=(0,react.useState)(!1),[clickedStart,setClickedStart]=(0,react.useState)(!1),[gotErrorInOpening,setGotErrorInOpening]=(0,react.useState)(!1),language=memori.culture?.split("-")?.[0]?.toUpperCase()||memoriConfigs?.find((c=>c.memoriConfigID===memori.memoriConfigurationID))?.culture?.split("-")?.[0]?.toUpperCase(),integrationConfig=integration?.customData?JSON.parse(integration.customData):null,isMultilanguageEnabled=void 0!==multilingual?multilingual:!!integrationConfig?.multilanguage,[userLang,setUserLang]=(0,react.useState)(memoriLang??integrationConfig?.lang??language??integrationConfig?.uiLang??i18n.language??"IT"),[loading,setLoading]=(0,react.useState)(!1),[memoriTyping,setMemoriTyping]=(0,react.useState)(!1),[typingText,setTypingText]=(0,react.useState)(),selectedLayout=layout||integrationConfig?.layout||"DEFAULT",[hasUserActivatedSpeak,setHasUserActivatedSpeak]=(0,react.useState)(!1),[hasUserActivatedListening,setHasUserActivatedListening]=(0,react.useState)(!1),[showPositionDrawer,setShowPositionDrawer]=(0,react.useState)(!1),[showSettingsDrawer,setShowSettingsDrawer]=(0,react.useState)(!1),[showKnownFactsDrawer,setShowKnownFactsDrawer]=(0,react.useState)(!1),[showExpertsDrawer,setShowExpertsDrawer]=(0,react.useState)(!1),[muteSpeaker,setMuteSpeaker]=(0,react.useState)(!defaultSpeakerActive),[continuousSpeech,setContinuousSpeech]=(0,react.useState)(!1),[continuousSpeechTimeout,setContinuousSpeechTimeout]=(0,react.useState)(2),[isPlayingAudio,setIsPlayingAudio]=(0,react.useState)(!1),[controlsPosition,setControlsPosition]=(0,react.useState)("center"),[hideEmissions,setHideEmissions]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsPlayingAudio(!!speechSynthesizer),memoriSpeaking=!!speechSynthesizer}),[speechSynthesizer]),(0,react.useEffect)((()=>{let defaultControlsPosition="bottom",microphoneMode=(0,configuration.wm)("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(defaultControlsPosition="bottom",microphoneMode="HOLD_TO_TALK"):defaultControlsPosition=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom",setMuteSpeaker((0,configuration.wm)("muteSpeaker",!defaultSpeakerActive)),speakerMuted=(0,configuration.wm)("muteSpeaker",!defaultSpeakerActive),setContinuousSpeech("CONTINUOUS"===microphoneMode),setContinuousSpeechTimeout((0,configuration.wm)("continuousSpeechTimeout",2)),setControlsPosition((0,configuration.wm)("controlsPosition",defaultControlsPosition)),setHideEmissions((0,configuration.wm)("hideEmissions",!1)),additionalInfo?.loginToken||authToken||(setLoginToken((0,configuration.wm)("loginToken",void 0)),userToken=(0,configuration.wm)("loginToken",void 0))}),[]);const[memoriPwd,setMemoriPwd]=(0,react.useState)(secret),[memoriTokens,setMemoriTokens]=(0,react.useState)(),[authModalState,setAuthModalState]=(0,react.useState)(null),[position,_setPosition]=(0,react.useState)(),applyPosition=async(venue,sessionID)=>{const session=sessionID??sessionId;if(venue&&session){const{currentState,...response}=await postPlaceChangedEvent({sessionId:session,placeName:venue.placeName,latitude:venue.latitude,longitude:venue.longitude,uncertaintyKm:venue.uncertainty??0});currentState&&0===response.resultCode&&setCurrentDialogState({...currentDialogState,...currentState})}},[userMessage,setUserMessage]=(0,react.useState)(""),[listening,setListening]=(0,react.useState)(!1),[history,setHistory]=(0,react.useState)([]),pushMessage=message=>{setHistory((history=>[...history,{...message,media:message.media?.filter((m=>!("text/javascript"===m.mimeType&&m.properties?.executable)))??[]}]))},sendMessage=async(text,media,newSessionId,translate=!0,translatedText,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const sessionID=newSessionId||sessionId||window.getMemoriState()?.sessionID;if(!sessionID||!text?.length)return;hidden||pushMessage({text,translatedText,fromUser:!0,media:media??[],initial:sessionId?!!newSessionId&&newSessionId!==sessionId:!!newSessionId}),setMemoriTyping(!0),setTypingText(typingText);let msg=text,gotError=!1;if(translate&&!instruct&&isMultilanguageEnabled&&userLang.toUpperCase()!==language.toUpperCase()){msg=(await(0,translations.i)(text,language,userLang,baseUrl)).text}const{currentState,...response}=await postTextEnteredEvent({sessionId:sessionID,text:msg});if(0===response.resultCode&¤tState){const emission=useLoaderTextAsMsg&&typingText?typingText:currentState.emission??currentDialogState?.emission;if("X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else if("X2d"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTextEnteredEvent({sessionId:sessionID,text:Math.random().toString().substring(2,8)});if(0===resp.resultCode){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0}else userLang.toLowerCase()!==language.toLowerCase()&&emission&&!instruct&&isMultilanguageEnabled?translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})):(setCurrentDialogState({...currentState,emission}),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),speak(emission)))}else 404===response.resultCode&&(setHistory((h=>[...h.slice(0,h.length-1)])),reopenSession(!1,memoriPwd||memori.secretToken,memoriTokens,instruct&&memori.giverTag?memori.giverTag:void 0,instruct&&memori.giverPIN?memori.giverPIN:void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion).then((state=>{console.info("session timeout"),state?.sessionID&&setTimeout((()=>{sendMessage(text,media,state?.sessionID)}),500)})));hasBatchQueued||(setTypingText(void 0),setMemoriTyping(!1))},translateDialogState=async(state,userLang)=>{const emission=state.emission??currentDialogState?.emission;let translatedState={...state},translatedMsg=null;if(emission&&!instruct&&language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled){const t=await(0,translations.i)(emission,userLang,language,baseUrl);if(state.hints&&state.hints.length>0){const translatedHints=await Promise.all((state.hints??[]).map((async hint=>{const tHint=await(0,translations.i)(hint,userLang,language,baseUrl);return{text:tHint?.text??hint,originalText:hint}})));translatedState={...state,emission:t.text,translatedHints}}else translatedState={...state,emission:t.text,hints:state.hints??("G1"===state.state?currentDialogState?.hints:[])};t.text.length>0&&(translatedMsg={text:t.text,emitter:state.emitter,media:state.media,fromUser:!1,generatedByAI:!!state.completion})}else translatedState={...state,emission},emission&&(translatedMsg={text:emission,emitter:state.emitter,media:state.media,fromUser:!1});return setCurrentDialogState(translatedState),translatedMsg&&pushMessage(translatedMsg),translatedState},minAge=void 0!==memori.ageRestriction?memori.ageRestriction:memori.nsfw?18:memori.enableCompletions?14:0,[birthDate,setBirthDate]=(0,react.useState)(),[showAgeVerification,setShowAgeVerification]=(0,react.useState)(!1),[sessionId,setSessionId]=(0,react.useState)(initialSessionID),[currentDialogState,_setCurrentDialogState]=(0,react.useState)(),setCurrentDialogState=state=>{_setCurrentDialogState(state),onStateChange&&onStateChange(state);const executableSnippets=state?.media?.filter((m=>"text/javascript"===m.mimeType&&!!m.properties?.executable));executableSnippets?.forEach((s=>{try{setTimeout((()=>{console.log("snippet",s),new Function(s.content??"")(),setTimeout((()=>{document.querySelector(".memori-chat--content")?.scrollTo(0,document.querySelector(".memori-chat--content")?.scrollHeight??0)}),400)}),1e3)}catch(e){console.error(e)}}))},fetchSession=async params=>{let storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(birthDate||storageBirthDate||!minAge)if("PUBLIC"===memori.privacyType||memori.secretToken||memoriPwd||memoriTokens){setLoading(!0);try{if(!memori.giverTag&&memori.receivedInvitations?.length){let giverInvitation=memori.receivedInvitations.find((i=>"GIVER"===i.type&&"ACCEPTED"===i.state));giverInvitation&&(memori.giverTag=giverInvitation.tag,memori.giverPIN=giverInvitation.pin)}let referral;try{referral=window.location.href}catch(err){console.error(err)}const session=await initSession({...params,tag:params.tag??personification?.tag,pin:params.pin??personification?.pin,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});if(session?.sessionID&&session?.currentState&&0===session.resultCode)return setSessionId(session.sessionID),setLoading(!1),{dialogState:session.currentState,sessionID:session.sessionID};session?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(session),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===session?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(session),dist.ZP.error(t((0,error.r)(session?.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err),new Error("Error fetching session")}}else setAuthModalState("password");else setShowAgeVerification(!0)},reopenSession=async(updateDialogState=!1,password,recoveryTokens,tag,pin,initialContextVars,initialQuestion,birthDate)=>{setLoading(!0);try{let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(!birthDate&&!storageBirthDate&&minAge)return void setShowAgeVerification(!0);if(!("PUBLIC"===memori.privacyType||password||memori.secretToken||memoriPwd||recoveryTokens||memoriTokens))return void setAuthModalState("password");try{referral=window.location.href}catch(err){console.error(err)}const{sessionID,currentState,...response}=await initSession({memoriID:memori.engineMemoriID??"",password:password||memoriPwd||memori.secretToken,recoveryTokens:recoveryTokens||memoriTokens,tag,pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});if(sessionID&¤tState&&0===response.resultCode)return setSessionId(sessionID),updateDialogState&&(setCurrentDialogState(currentState),currentState.emission&&(history.length<=1?setHistory([{text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0}]):pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0}))),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),setLoading(!1),{dialogState:currentState,sessionID};response?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(response),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===response?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(response),dist.ZP.error(t((0,error.r)(response.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err)}return setLoading(!1),null},changeTag=async(memoriId,sessionId,tag,pin)=>{if(!memoriId||!sessionId)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState,resultCode}=await postTagChangedEvent(sessionId,tag??constants.QV);if(0===resultCode){let textResult=0;if(tag!==constants.QV&&pin&&("X1a"===currentState.state||"X1b"===currentState.state)){const{resultCode:textResultCode}=await postTextEnteredEvent({sessionId,text:pin??""});textResult=textResultCode}if(0===textResult){const{currentState,...response}=await getSession(sessionId);if(0===response.resultCode&¤tState)return{currentState,sessionId,...response}}else if([400,401,403,404,500].includes(resultCode)){console.warn("[APPCONTEXT/CHANGETAG]",resultCode);let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);try{referral=window.location.href}catch(err){console.error(err)}fetchSession({memoriID:memori.engineMemoriID??"",password:secret||memoriPwd||memori.secretToken,tag:memori.giverTag,pin:memori.giverPIN,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}})}else if(currentState)return{currentState,sessionId,resultCode}}}catch(_e){let err=_e;return console.error("[APPCONTEXT/CHANGETAG]",err),Promise.reject(err)}return null};(0,react.useEffect)((()=>()=>{currentDialogState&¤tDialogState?.currentTag===memori.giverTag||(async()=>{sessionId&&memori.giverTag&&memori.giverPIN&&(setHistory([]),await changeTag(memori.engineMemoriID,sessionId,memori.giverTag,memori.giverPIN))})()}),[]);const sendDateChangedEvent=(0,react.useCallback)((async({sessionID,date,state})=>{const session=sessionID??sessionId,dialogState=state??currentDialogState;if(console.log("sendDateChangedEvent",dialogState),!session||!memori.needsDateTime||dialogState?.hints?.length)return;const now=(date?luxon.ou.fromISO(date):luxon.ou.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState,...response}=await postDateChangedEvent(session,now);0===response.resultCode&¤tState&&_setCurrentDialogState((cds=>({...cds,...currentState,hints:currentState.hints?.length?currentState.hints:cds?.hints})))}),[currentDialogState,memori.needsDateTime,sessionId]);(0,react.useEffect)((()=>{if(sessionId&&memori.needsDateTime){sendDateChangedEvent({sessionID:sessionId,state:currentDialogState});let datePolling=setInterval((()=>{sendDateChangedEvent({sessionID:sessionId})}),6e4);return()=>{clearInterval(datePolling)}}}),[memori.needsDateTime,sessionId]);const[userInteractionTimeout,setUserInteractionTimeout]=(0,react.useState)(),timeoutRef=(0,react.useRef)(),clearInteractionTimeout=()=>{userInteractionTimeout&&(clearTimeout(userInteractionTimeout),setUserInteractionTimeout(void 0)),timeoutRef?.current&&(clearTimeout(timeoutRef.current),timeoutRef.current=void 0)},resetInteractionTimeout=()=>{clearInteractionTimeout(),!currentDialogState?.acceptsTimeout||speechSynthesizer||isPlayingAudio||userMessage.length||memoriTyping||listening||setInteractionTimeout()},handleTimeout=async()=>{if(speechSynthesizer||isPlayingAudio||userMessage.length||memoriTyping||listening)resetInteractionTimeout();else if(sessionId&&hasUserActivatedSpeak&¤tDialogState?.acceptsTimeout){const{currentState,...response}=await postTimeoutEvent(sessionId);if(0===response.resultCode&¤tState){const emission=currentState.emission;!instruct&&isMultilanguageEnabled&&userLang!==i18n?.language&&emission&&emission.length>0?translateDialogState({...currentState,emission},userLang).then((ts=>{ts.emission&&speak(ts.emission)})):emission&&emission.length>0&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),speak(emission),setCurrentDialogState({...currentState,hints:currentState.hints??("G1"===currentState.state?currentDialogState?.hints:[])}))}}},setInteractionTimeout=()=>{let timeout=currentDialogState?.timeout;if(!timeout){let timeoutLimit=40,timeoutMinLimit=25;if(timeout=Math.floor(Math.random()*(timeoutLimit-timeoutMinLimit))+timeoutMinLimit,currentDialogState?.emission){timeout+=currentDialogState.emission.length/26.5}}let uiTimeout=setTimeout(handleTimeout,1e3*timeout);setUserInteractionTimeout(uiTimeout),timeoutRef.current=uiTimeout};(0,react.useEffect)((()=>{(userMessage.length||isPlayingAudio||memoriTyping)&&clearInteractionTimeout(),sessionId&&!userMessage.length&&resetInteractionTimeout()}),[currentDialogState?.acceptsTimeout,currentDialogState?.timeout,currentDialogState?.state,isPlayingAudio,sessionId,history,userMessage,memoriTyping]),(0,react.useEffect)((()=>()=>{setHasUserActivatedSpeak(!1),setClickedStart(!1),clearInteractionTimeout(),timeoutRef.current=void 0}),[]);const getTTSVoice=(0,react.useCallback)((lang=>{let voice="",voiceLang=(lang??memori.culture?.split("-")?.[0]??i18n.language??"IT").toUpperCase(),voiceType=memori.voiceType;if(memori.enableBoardOfExperts&¤tDialogState?.emitter){experts?.find((e=>e.name===currentDialogState?.emitter))}switch(voiceLang){case"IT":voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":voice=""+("MALE"===voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":voice=""+("MALE"===voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":voice=""+("MALE"===voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":voice=""+("MALE"===voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":voice=""+("MALE"===voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":voice=""+("MALE"===voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":voice=""+("MALE"===voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":voice=""+("MALE"===voiceType?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":voice=""+("MALE"===voiceType?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;default:voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return voice}),[memori.voiceType,memori.enableBoardOfExperts,currentDialogState?.emitter,i18n.language,memori.culture]),getCultureCodeByLanguage=lang=>{let voice="";switch((lang||memori.culture?.split("-")?.[0]||i18n.language||"IT").toUpperCase()){case"IT":default:voice="it-IT";break;case"DE":voice="de-DE";break;case"EN":voice="en-GB";break;case"ES":voice="es-ES";break;case"FR":voice="fr-FR";break;case"PT":voice="pt-PT";break;case"UK":voice="uk-UK";break;case"RU":voice="ru-RU";break;case"PL":voice="pl-PL";break;case"FI":voice="fi-FI"}return voice},[phonemesMap,setPhonemesMap]=(0,react.useState)();(0,react.useEffect)((()=>{(async()=>{try{const lexiconReq=await fetch(`${baseUrl||"https://aisuru.com"}/api/lexiconmap`);return await lexiconReq.json()}catch(err){console.error(err)}})().then((lexicon=>{setPhonemesMap(lexicon)}))}),[]);const emitEndSpeakEvent=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},speak=text=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY||preview)return void emitEndSpeakEvent();if(stopListening(),preview)return;if(muteSpeaker||speakerMuted)return memoriSpeaking=!1,setMemoriTyping(!1),emitEndSpeakEvent(),void(continuousSpeech&&setListeningTimeout());audioDestination&&audioDestination.pause();let isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===audioContext.state)return void audioContext.resume().then((()=>speak(text)));if("closed"===audioContext.state){audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}else if("suspended"===audioContext.state){stopAudio(),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}if(!speechSynthesizer){isIOS||(audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination);let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)}const source=audioContext.createBufferSource();source.addEventListener("ended",(()=>{setIsPlayingAudio(!1),memoriSpeaking=!1})),audioDestination.onAudioEnd=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1,source.disconnect(),emitEndSpeakEvent(),onEndSpeakStartListen()},speechSynthesizer.speakSsmlAsync(`${((text,lang)=>{if(!phonemesMap)return text;const phonemes={...phonemesMap.common??{},...tenant?.id&&phonemesMap[tenant.id]?phonemesMap[tenant.id]:{}};return Object.keys(phonemes).map((word=>({word,phoneme:phonemes[word][lang.toLowerCase()]??phonemes[word].default,caseSensitive:phonemes[word].caseSensitive}))).reduce(((acc,{word,phoneme,caseSensitive})=>acc.replace(new RegExp(`\\b${word}\\b`,caseSensitive?"g":"gi"),`${word}`)),text)})((text=>{const el=document.createElement("textarea");return el.textContent=text,el.innerHTML})((0,utils.h)(text)),userLang.toLowerCase())}`,(result=>{if(result){setIsPlayingAudio(!0),memoriSpeaking=!0;try{audioContext.decodeAudioData(result.audioData,(function(buffer){source.buffer=buffer,source.connect(audioContext.destination),(history.length<1||isSafari&&isIOS)&&source.start(0)})),audioContext.onstatechange=()=>{"suspended"===audioContext.state||"closed"===audioContext.state?(source.disconnect(),setIsPlayingAudio(!1),memoriSpeaking=!1):"interrupted"===audioContext.state&&audioContext.resume()},audioContext.resume(),speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null)}catch(e){console.error("speak error: ",e),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),emitEndSpeakEvent()}}else audioContext.resume(),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()}),(error=>{console.error("speak:",error),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()})),setMemoriTyping(!1)},stopAudio=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1;try{speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),"closed"!==audioContext.state&&audioContext.close(),audioDestination&&(audioDestination.pause(),audioDestination.close())}catch(e){console.error("stopAudio error: ",e)}};(0,react.useEffect)((()=>{let textarea=document.querySelector("#chat-fieldset textarea");textarea&&textarea.focus()}),[currentDialogState?.emission]);const[transcript,setTranscript]=(0,react.useState)(""),resetTranscript=()=>setTranscript(""),[transcriptTimeout,setTranscriptTimeout]=(0,react.useState)(null),setListeningTimeout=()=>{let timeout=setTimeout((async()=>{clearListening();const message=(0,utils.vw)(transcript);message.length>0&&listening?(sendMessage(message),resetTranscript(),setUserMessage("")):listening&&resetInteractionTimeout()}),1e3*continuousSpeechTimeout);setTranscriptTimeout(timeout)},clearListeningTimeout=()=>{transcriptTimeout&&(clearTimeout(transcriptTimeout),setTranscriptTimeout(null))};(0,react.useEffect)((()=>{clearListeningTimeout(),continuousSpeech&&setListeningTimeout(),resetInteractionTimeout()}),[transcript]);const startListening=()=>{if(AZURE_COGNITIVE_SERVICES_TTS_KEY){clearListening(),setTranscript(""),resetTranscript();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(_stream){setHasUserActivatedListening(!0),speechConfig||(speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang));const audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromDefaultMicrophoneInput();recognizer=new microsoft_cognitiveservices_speech_sdk.SpeechRecognizer(speechConfig,audioConfig),setListening(!0),recognizer.recognized=(_s,e)=>{if(e.result.text)if(e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.RecognizedSpeech){let transcript=e.result.text;if(setTranscript(transcript||""),transcript?.length>0){const transcriptMessage=(0,utils.vw)(transcript);transcriptMessage.length>0&&setUserMessage((msg=>`${msg} ${transcriptMessage}`))}}else e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},recognizer.canceled=(_s,e)=>{e.reason===microsoft_cognitiveservices_speech_sdk.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${e.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${e.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),stopListening()},recognizer.sessionStopped=(_s,_e)=>{stopListening()},resetTranscript(),recognizer.startContinuousRecognitionAsync()})).catch(console.error)}catch(error){console.error(error)}}},stopListening=()=>{recognizer&&(recognizer.stopContinuousRecognitionAsync(),recognizer.close(),recognizer=null),setListening(!1)},clearListening=()=>{setHasUserActivatedListening(!1),stopListening(),clearListeningTimeout()},resetUIEffects=()=>{try{clearListening(),clearInteractionTimeout(),setClickedStart(!1),timeoutRef.current=void 0,stopAudio()}catch(e){console.log("Error: resetUIEffects",e)}};(0,react.useEffect)((()=>()=>{resetUIEffects()}),[]),(0,react.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",resetUIEffects),()=>{document.removeEventListener("MemoriResetUIEffects",resetUIEffects)})),[]),(0,react.useEffect)((()=>{"Z0"===currentDialogState?.state&&clearListening()}),[currentDialogState?.state]);const[requestedListening,setRequestedListening]=(0,react.useState)(!1),onEndSpeakStartListen=(0,react.useCallback)((_e=>{isPlayingAudio&&speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),!continuousSpeech||!hasUserActivatedListening&&requestedListening||(setRequestedListening(!0),startListening())}),[continuousSpeech,hasUserActivatedListening]);(0,react.useEffect)((()=>{history.length>1&&!isPlayingAudio&&continuousSpeech&&(hasUserActivatedListening||!requestedListening)?startListening():isPlayingAudio&&listening&&stopListening()}),[isPlayingAudio]),(0,react.useEffect)((()=>{listening&&(clearListening(),resetTranscript(),setUserMessage(""),startListening())}),[language]);const[sendOnEnter,setSendOnEnter]=(0,react.useState)("keypress");(0,react.useEffect)((()=>{const stored=(0,configuration.wm)("sendOnEnter","keypress");window.innerWidth<=768?setSendOnEnter("click"):setSendOnEnter(stored)}),[]),(0,react.useEffect)((()=>{(0,configuration.A2)("sendOnEnter",sendOnEnter)}),[sendOnEnter]);const[attachmentsMenuOpen,setAttachmentsMenuOpen]=(0,react.useState)(),globalBackground=integrationConfig?.globalBackground,globalBackgroundUrl=globalBackground?`url(${globalBackground})`:null,integrationProperties=integration?{"--memori-chat-bubble-bg":"#fff",...integrationConfig&&!showInstruct?{"--memori-text-color":integrationConfig.textColor??"#000"}:{},...integrationConfig?.buttonBgColor?{"--memori-button-bg":integrationConfig.buttonBgColor,"--memori-primary":integrationConfig.buttonBgColor}:{},...integrationConfig?.buttonTextColor?{"--memori-button-text":integrationConfig.buttonTextColor}:{},...integrationConfig?.blurBackground?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...integrationConfig?.innerBgColor?{"--memori-inner-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig.innerBgAlpha??.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig?.innerBgAlpha??.4})`}:{"--memori-inner-content-pad":"0px"}}:{},integrationStylesheet=`\n ${preview?"#preview,":"WEBSITE_ASSISTANT"===selectedLayout?"":":root,"} .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(integrationProperties).map((([key,value])=>`${key}: ${value};`)).join("\n")}\n }\n `,showAIicon=void 0===integrationConfig?.showAIicon||integrationConfig?.showAIicon,[avatar3dVisible,setAvatar3dVisible]=(0,react.useState)(!1);(0,react.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===selectedLayout||"FULLPAGE"!==selectedLayout)&&setAvatar3dVisible(!0)}),[]);const[gamificationLevel,setGamificationLevel]=(0,react.useState)();(0,react.useEffect)((()=>{memori.engineMemoriID&&(async memoriID=>{let gamificationPoints,unansQuestions;try{const{contentQualityIndex,answerQualityIndex,unansweredQuestions,...cqResp}=await getContentQualityIndexes(memoriID);0===cqResp.resultCode&&(gamificationPoints=contentQualityIndex,unansQuestions=unansweredQuestions)}catch(_e){let err=_e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",err)}return{points:gamificationPoints??0,unansweredQuestions:unansQuestions??0}})(memori.engineMemoriID).then((value=>{setGamificationLevel((points=>{const roundedPoints=Math.round(points),badge=getBadge(roundedPoints);return{points:roundedPoints,badge,pointsForCurrentBadge:getPointsForBadge(badge),nextBadge:getNextBadge(badge)}})(value.points))})).catch(console.error)}),[memori.engineMemoriID]),(0,react.useEffect)((()=>{if(integrationConfig?.seoTitle){let meta=document.createElement("meta");meta.setAttribute("property","og:title"),meta.setAttribute("content",integrationConfig.seoTitle),document.head.append(meta)}if(integrationConfig?.seoDescription){let meta=document.createElement("meta");meta.setAttribute("property","og:description"),meta.setAttribute("content",integrationConfig.seoDescription),document.head.append(meta)}if(integrationConfig?.seoUrl){let meta=document.createElement("meta");meta.setAttribute("property","og:url"),meta.setAttribute("content",integrationConfig.seoUrl),document.head.append(meta)}let image=ogImage||memori.avatarURL;if(integrationConfig?.seoImageShowAvatar&&image){let meta=document.createElement("meta");meta.setAttribute("property","og:image"),meta.setAttribute("content",image),document.head.append(meta)}}),[integrationConfig,memori.avatarURL,ogImage]);const memoriTextEnteredHandler=(0,react.useCallback)((e=>{const{text,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}=e.detail;text&&(waitForPrevious&&!speakerMuted&&(memoriSpeaking||memoriTyping)?setTimeout((()=>{memoriTextEnteredHandler(e)}),1e3):(stopListening(),stopAudio(),sendMessage(text,void 0,void 0,void 0,void 0,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued)))}),[sessionId,isPlayingAudio,memoriTyping,userLang]);(0,react.useEffect)((()=>(document.addEventListener("MemoriTextEntered",memoriTextEnteredHandler),()=>{document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler)})),[sessionId,userLang]);const onClickStart=(0,react.useCallback)((async session=>{const sessionID=session?.sessionID||sessionId,dialogState=session?.dialogState||currentDialogState;setClickedStart(!0);let memoriAudioElement=document.getElementById("memori-audio"),isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");memoriAudioElement&&isSafari&&(memoriAudioElement.muted=!1,memoriAudioElement.play().catch((e=>{console.error("error playing intro audio",e)})));let storageBirthDate=(0,configuration.wm)("birthDate",void 0),birth=birthDate||storageBirthDate||void 0;if(sessionID||!minAge||birth){if(!sessionID&&"PUBLIC"!==memori.privacyType&&!memori.secretToken&&!memoriPwd&&!memoriTokens||!sessionID&&gotErrorInOpening)return setAuthModalState("password"),void setClickedStart(!1);if(!sessionID){setClickedStart(!1),setGotErrorInOpening(!1);const session=await fetchSession({memoriID:memori.engineMemoriID,password:secret||memoriPwd||memori.secretToken,tag:personification?.tag,pin:personification?.pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birth,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang)}});return void(session?.dialogState?(setHistory([]),translateDialogState(session.dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))):await onClickStart(session||void 0))}if(initialSessionID){const{currentState,...response}=await getSession(sessionID);if(0!==response.resultCode||!currentState)return console.debug("session expired, opening new session"),setGotErrorInOpening(!0),setSessionId(void 0),setClickedStart(!1),void await onClickStart();if(setHistory([]),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),instruct&&memori.giverTag&¤tDialogState?.currentTag!==memori.giverTag)try{console.debug("change tag #0"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,memori.giverTag,memori.giverPIN);if(!session||0!==session.resultCode)throw console.error("session #1",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #2",e),reopenSession(!0,memori?.secretToken,void 0,memori?.giverTag,memori?.giverPIN,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(!instruct&&personification&¤tDialogState?.currentTag!==personification.tag)try{console.debug("change tag #3"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,personification.tag,personification.pin);if(!session||0!==session.resultCode)throw console.error("session #4",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #5",e),reopenSession(!0,memori?.secretToken,void 0,personification.tag,personification.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(instruct||personification||currentDialogState?.currentTag===constants.QV)translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}));else try{console.debug("change tag #6"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,constants.QV);if(!session||0!==session.resultCode)throw console.error("session #7",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #8",e),reopenSession(!0,memori?.secretToken,void 0,void 0,void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState})}else setHistory([]),translateDialogState(dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else setShowAgeVerification(!0),setClickedStart(!1)}),[memoriPwd,memori,memoriTokens,birthDate,sessionId,userLang,position]);(0,react.useEffect)((()=>{const targetNode=document.querySelector(`memori-client[memoriname="${memori.name}"]`)||document.querySelector(`memori-client[memoriid="${memori.memoriID}"]`)||document.querySelector("memori-client");if(!targetNode)return;const observer=new MutationObserver(((mutationList,_observer)=>{for(const mutation of mutationList)"attributes"===mutation.type&&"authtoken"===mutation.attributeName?.toLowerCase()&&("MEMORI-CLIENT"===mutation.target.nodeName?(setLoginToken(mutation.target.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0):(setLoginToken(mutation.target?.parentElement?.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0))}));return observer.observe(targetNode,{attributes:!0,childList:!1,subtree:!1}),()=>{observer.disconnect()}}),[]);const[experts,setExperts]=(0,react.useState)(),fetchExperts=(0,react.useCallback)((async()=>{if(sessionId&&memori?.enableBoardOfExperts)try{const{experts,count,...resp}=await getExpertReferences(sessionId);0===resp.resultCode?setExperts(experts):console.warn("Error fetching experts",resp)}catch(err){console.warn(err)}}),[sessionId,memori?.enableBoardOfExperts]);(0,react.useEffect)((()=>{fetchExperts()}),[sessionId,fetchExperts]);const showFullHistory=void 0===showOnlyLastMessages?"TOTEM"!==layout&&"WEBSITE_ASSISTANT"!==layout:!showOnlyLastMessages,headerProps={memori,tenant,history,showShare:showShare??integrationConfig?.showShare??!0,position,setShowPositionDrawer,setShowSettingsDrawer,setShowKnownFactsDrawer,setShowExpertsDrawer,showSpeaker:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,speakerMuted:muteSpeaker||speakerMuted,setSpeakerMuted:mute=>{if(speakerMuted=!!mute,setMuteSpeaker(mute),(0,configuration.A2)("muteSpeaker",!!mute),mute)stopAudio();else{audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}},showSettings,hasUserActivatedSpeak,showReload:"TOTEM"===selectedLayout,showClear,clearHistory:()=>setHistory((h=>h.slice(-1))),showLogin,setShowLoginDrawer,loginToken,user,sessionID:sessionId},avatarProps={memori,integration,integrationConfig,tenant,instruct,avatar3dVisible,setAvatar3dVisible,hasUserActivatedSpeak,isPlayingAudio:isPlayingAudio&&!muteSpeaker,loading:!!memoriTyping,baseUrl,apiUrl},startPanelProps={memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer:()=>setShowPositionDrawer(!0),integrationConfig,instruct,sessionId,clickedStart,onClickStart,initializeTTS:()=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY)return;speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),(0,utils.xZ)()&&(speechConfig.speechSynthesisOutputFormat=microsoft_cognitiveservices_speech_sdk.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination),audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination;let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)},isUserLoggedIn:!!loginToken&&!!user?.userID,showLogin,setShowLoginDrawer,user},chatProps={memori,sessionID:sessionId||"",tenant,translateTo:isMultilanguageEnabled&&userLang.toUpperCase()!==(memori.culture?.split("-")?.[0]??i18n.language??"IT")?.toUpperCase()?userLang:void 0,baseUrl,apiUrl,layout,memoriTyping,typingText,showTypingText,history:showFullHistory?history:history.slice(-2),authToken:loginToken??userToken??additionalInfo?.loginToken??authToken,dialogState:currentDialogState,setDialogState:setCurrentDialogState,pushMessage,simulateUserPrompt:(text,translatedText)=>{stopListening(),stopAudio(),sendMessage(text,void 0,void 0,!1,translatedText)},showDates,showContextPerLine,showAIicon,client,selectReceiverTag:async tag=>{if(sessionId)try{const{currentState,...resp}=await postTagChangedEvent(sessionId,tag);if(0===resp.resultCode)if(pushMessage({text:tag,fromUser:!0}),"X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await client.postTagChangedEvent(sessionId,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1})):(console.error(resp),dist.ZP.error(t((0,error.r)(resp.resultCode))))}else setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1});else console.error(resp,tag,currentDialogState?.knownTags?.[tag]),dist.ZP.error(t((0,error.r)(resp.resultCode)))}catch(e){let err=e;console.error(err),dist.ZP.error(err.message)}},preview,sendOnEnter,setSendOnEnter,microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen,setAttachmentsMenuOpen,instruct,showInputs,showMicrophone:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,userMessage,onChangeUserMessage:value=>{if(!value||"\n"===value||""===value.trim())return setUserMessage(""),void resetInteractionTimeout();setUserMessage(value),clearInteractionTimeout()},sendMessage:msg=>{stopAudio(),stopListening(),sendMessage(msg),setUserMessage(""),resetTranscript()},stopListening:clearListening,startListening,stopAudio,resetTranscript,listening,isPlayingAudio,customMediaRenderer,user,userAvatar,experts},integrationBackground=integration&&globalBackgroundUrl?(0,jsx_runtime.jsx)("div",{className:"memori--global-background",children:(0,jsx_runtime.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:globalBackgroundUrl}})}):(0,jsx_runtime.jsx)("div",{className:"memori--global-background no-background-image"}),integrationStyle=integration?(0,jsx_runtime.jsx)("style",{dangerouslySetInnerHTML:{__html:integrationStylesheet}}):null,changeModeProps={canInstruct:!!memori.giverTag,instruct:!!instruct,onChangeMode:mode=>{setInstruct("instruct"===mode),setHasUserActivatedSpeak(!1),setClickedStart(!1)}},poweredBy=(0,jsx_runtime.jsx)(PoweredBy.Z,{tenant,userLang,integrationID:integration?.integrationID,memoriHash:`${memori.ownerTenantName}-${memori.ownerUserName}-${memori.name}`}),Layout=customLayout||("TOTEM"===selectedLayout?layouts_Totem:"CHAT"===selectedLayout?layouts_Chat:"FULLPAGE"===selectedLayout?layouts_FullPage:"WEBSITE_ASSISTANT"===selectedLayout?layouts_WebsiteAssistant:layouts_FullPage);return(0,jsx_runtime.jsxs)("div",{className:classnames_default()("memori","memori-widget",`memori-layout-${layout.toLowerCase()}`,`memori-controls-${controlsPosition.toLowerCase()}`,`memori--avatar-${integrationConfig?.avatar||"default"}`,{"memori--preview":preview,"memori--embed":embed,"memori--with-integration":integration,"memori--with-speechkey":!!AZURE_COGNITIVE_SERVICES_TTS_KEY,"memori--active":hasUserActivatedSpeak,"memori--hide-emissions":hideEmissions,"memori--has-active-session":!!sessionId}),"data-memori-name":memori?.name,"data-memori-id":memori?.engineMemoriID,"data-memori-secondary-id":memori?.memoriID,"data-memori-session-id":sessionId,"data-memori-integration":integration?.integrationID,"data-memori-engine-state":JSON.stringify({...currentDialogState,sessionID:sessionId}),style:{height},children:[(0,jsx_runtime.jsx)(Layout,{Header:Header.Z,headerProps,Avatar:Avatar.Z,avatarProps,Chat:Chat_Chat.Z,chatProps,StartPanel:StartPanel.Z,startPanelProps,integrationStyle,integrationBackground,ChangeMode:ChangeMode.Z,changeModeProps,poweredBy,sessionId,hasUserActivatedSpeak,showInstruct,loading}),(0,jsx_runtime.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),isClient&&(0,jsx_runtime.jsx)(Auth.Z,{withModal:!0,pwdOrTokens:authModalState,openModal:!!authModalState,setPwdOrTokens:setAuthModalState,showTokens:"SECRET"===memori.privacyType,onFinish:async values=>{values.password&&setMemoriPwd(values.password),values.password&&(memoriPassword=values.password),values.tokens&&setMemoriTokens(values.tokens),reopenSession(!sessionId,values.password,values.tokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setAuthModalState(null),setGotErrorInOpening(!0)}))},minimumNumberOfRecoveryTokens:memori?.minimumNumberOfRecoveryTokens??1}),isClient&&(0,jsx_runtime.jsx)(AgeVerificationModal.Z,{visible:showAgeVerification,minAge,onClose:birthDate=>{birthDate?(setBirthDate(birthDate),(0,configuration.A2)("birthDate",birthDate),reopenSession(!sessionId,memoriPassword||memoriPwd||memori?.secretToken,memoriTokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setShowAgeVerification(!1),setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setShowAgeVerification(!1),setGotErrorInOpening(!0)}))):(setShowAgeVerification(!1),setClickedStart(!1))}}),showSettingsDrawer&&(0,jsx_runtime.jsx)(SettingsDrawer.Z,{layout:selectedLayout,open:!!showSettingsDrawer,onClose:()=>setShowSettingsDrawer(!1),microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout,setMicrophoneMode:mode=>setContinuousSpeech("CONTINUOUS"===mode),setContinuousSpeechTimeout,controlsPosition,setControlsPosition,hideEmissions,setHideEmissions,additionalSettings}),showPositionDrawer&&(0,jsx_runtime.jsx)(PositionDrawer.Z,{open:!!showPositionDrawer,venue:position,setVenue:venue=>{_setPosition(venue),applyPosition(venue)},onClose:position=>{position&&applyPosition(position),setShowPositionDrawer(!1)}}),showKnownFactsDrawer&&sessionId&&(0,jsx_runtime.jsx)(KnownFacts.Z,{apiURL:apiUrl,memori,sessionID:sessionId,visible:showKnownFactsDrawer,closeDrawer:()=>setShowKnownFactsDrawer(!1)}),showExpertsDrawer&&!!experts&&(0,jsx_runtime.jsx)(ExpertsDrawer.Z,{apiUrl,baseUrl,tenant,experts,open:showExpertsDrawer,onClose:()=>setShowExpertsDrawer(!1)}),showLoginDrawer&&tenant?.id&&(0,jsx_runtime.jsx)(LoginDrawer.Z,{tenant,apiUrl,open:!!showLoginDrawer,user,loginToken,onClose:()=>setShowLoginDrawer(!1),onLogin:(user,token)=>{setUser(user),setLoginToken(token),userToken=token,setShowLoginDrawer(!1),(0,configuration.A2)("loginToken",token)},onLogout:()=>{loginToken&&client.backend.userLogout(loginToken).then((()=>{setShowLoginDrawer(!1),setUser(void 0),setLoginToken(void 0),userToken=void 0,(0,configuration.gj)("loginToken")}))}})]})};MemoriWidget.displayName="MemoriWidget";const MemoriWidget_MemoriWidget=MemoriWidget;try{MemoriWidget.displayName="MemoriWidget",MemoriWidget.__docgenInfo={description:"",displayName:"MemoriWidget",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},memoriConfigs:{defaultValue:null,description:"",name:"memoriConfigs",required:!1,type:{name:"MemoriConfig[]"}},memoriLang:{defaultValue:null,description:"",name:"memoriLang",required:!1,type:{name:"string"}},multilingual:{defaultValue:null,description:"",name:"multilingual",required:!1,type:{name:"boolean"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},layout:{defaultValue:{value:"DEFAULT"},description:"",name:"layout",required:!1,type:{name:"enum",value:[{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'}]}},customLayout:{defaultValue:null,description:"",name:"customLayout",required:!1,type:{name:"FC"}},showShare:{defaultValue:null,description:"",name:"showShare",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},showInputs:{defaultValue:{value:"true"},description:"",name:"showInputs",required:!1,type:{name:"boolean"}},showDates:{defaultValue:{value:"false"},description:"",name:"showDates",required:!1,type:{name:"boolean"}},showContextPerLine:{defaultValue:{value:"false"},description:"",name:"showContextPerLine",required:!1,type:{name:"boolean"}},showSettings:{defaultValue:{value:"true"},description:"",name:"showSettings",required:!1,type:{name:"boolean"}},showClear:{defaultValue:{value:"false"},description:"",name:"showClear",required:!1,type:{name:"boolean"}},showOnlyLastMessages:{defaultValue:null,description:"",name:"showOnlyLastMessages",required:!1,type:{name:"boolean"}},showTypingText:{defaultValue:{value:"false"},description:"",name:"showTypingText",required:!1,type:{name:"boolean"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},preview:{defaultValue:{value:"false"},description:"",name:"preview",required:!1,type:{name:"boolean"}},embed:{defaultValue:{value:"false"},description:"",name:"embed",required:!1,type:{name:"boolean"}},height:{defaultValue:{value:"100vh"},description:"",name:"height",required:!1,type:{name:"string | number"}},secret:{defaultValue:null,description:"",name:"secret",required:!1,type:{name:"string"}},baseUrl:{defaultValue:{value:"https://aisuru.com"},description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:{value:"https://backend.memori.ai"},description:"",name:"apiUrl",required:!1,type:{name:"string"}},initialContextVars:{defaultValue:null,description:"",name:"initialContextVars",required:!1,type:{name:"{ [key: string]: string; }"}},initialQuestion:{defaultValue:null,description:"",name:"initialQuestion",required:!1,type:{name:"string"}},ogImage:{defaultValue:null,description:"",name:"ogImage",required:!1,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!1,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},personification:{defaultValue:null,description:"",name:"personification",required:!1,type:{name:"{ name?: string; tag: string; pin: string; }"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}},AZURE_COGNITIVE_SERVICES_TTS_KEY:{defaultValue:null,description:"",name:"AZURE_COGNITIVE_SERVICES_TTS_KEY",required:!1,type:{name:"string"}},defaultSpeakerActive:{defaultValue:{value:"true"},description:"",name:"defaultSpeakerActive",required:!1,type:{name:"boolean"}},onStateChange:{defaultValue:null,description:"",name:"onStateChange",required:!1,type:{name:"((state?: DialogState) => void)"}},additionalInfo:{defaultValue:null,description:"",name:"additionalInfo",required:!1,type:{name:"({ loginToken?: string; language?: string; referral?: string | undefined; } & { [key: string]: string; }) | undefined"}},customMediaRenderer:{defaultValue:null,description:"",name:"customMediaRenderer",required:!1,type:{name:"((mimeType: string) => Element | null)"}},additionalSettings:{defaultValue:null,description:"",name:"additionalSettings",required:!1,type:{name:"Element | null"}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"]={docgenInfo:MemoriWidget.__docgenInfo,name:"MemoriWidget",path:"src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PositionDrawer/PositionDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Drawer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PositionDrawer=({open,onClose,venue,setVenue})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori-position-drawer",open,onClose:()=>onClose(venue),title:t("widget.position")||"Position",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__.Z,{venue,setVenue,showUncertainty:!1})})};PositionDrawer.displayName="PositionDrawer";const __WEBPACK_DEFAULT_EXPORT__=PositionDrawer;try{PositionDrawer.displayName="PositionDrawer",PositionDrawer.__docgenInfo={description:"",displayName:"PositionDrawer",props:{open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"]={docgenInfo:PositionDrawer.__docgenInfo,name:"PositionDrawer",path:"src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PoweredBy/PoweredBy.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PoweredBy=({tenant,userLang="en",integrationID,memoriHash})=>{const tenantId="memorytwin"===tenant?.theme?"memorytwin":"twincreator"===tenant?.theme?"twincreator":"aisuru";return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div",{className:"memori--powered-by",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img",{src:`https://aisuru.com/images/${tenantId}/logo.png`,alt:""}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a",{href:`https://memori.ai/${"it"===userLang?.toLowerCase()?"it":"en"}${integrationID?`?integrationID=${integrationID}`:""}${memoriHash?`${integrationID?"&":"?"}memori=${memoriHash}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})};PoweredBy.displayName="PoweredBy";const __WEBPACK_DEFAULT_EXPORT__=PoweredBy;try{PoweredBy.displayName="PoweredBy",PoweredBy.__docgenInfo={description:"",displayName:"PoweredBy",props:{tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},userLang:{defaultValue:{value:"en"},description:"",name:"userLang",required:!1,type:{name:"string"}},integrationID:{defaultValue:null,description:"",name:"integrationID",required:!1,type:{name:"string"}},memoriHash:{defaultValue:null,description:"",name:"memoriHash",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PoweredBy/PoweredBy.tsx#PoweredBy"]={docgenInfo:PoweredBy.__docgenInfo,name:"PoweredBy",path:"src/components/PoweredBy/PoweredBy.tsx#PoweredBy"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/StartPanel/StartPanel.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./src/helpers/media.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_helpers_translations__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/helpers/translations.ts"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Translation__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Translation.tsx"),_helpers_constants__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/helpers/constants.ts"),_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx"),_icons_AI__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/icons/AI.tsx"),_icons_Group__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Group.tsx"),_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/DeepThought.tsx"),_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/react/jsx-runtime.js");const StartPanel=({memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer,integrationConfig,instruct=!1,clickedStart,onClickStart,initializeTTS,_TEST_forceProviderStatus,isUserLoggedIn=!1,user,showLogin=!1,setShowLoginDrawer})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_11__.$)(),[translatedDescription,setTranslatedDescription]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(memori.description),[showTranslation,setShowTranslation]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!0);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{(i18n.language?.toUpperCase()??"IT")!==(language?.toUpperCase()??"IT")&&memori.description?.length&&(0,_helpers_translations__WEBPACK_IMPORTED_MODULE_12__.i)(memori.description,i18n.language?.toUpperCase()??"IT",language,baseUrl).then((value=>{setTranslatedDescription(value.text)})).catch(console.error)}),[i18n.language,language,memori.description,baseUrl]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--start-panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"cover",tenantID:tenant?.id,resourceURI:memori.coverURL,baseURL:baseUrl,apiURL:apiUrl})}"), url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"cover",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})}")`},children:[!!gamificationLevel?.badge?.length&&!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--gamification-badge",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{"aria-label":`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:gamificationLevel.badge})})}),!!memori.enableCompletions&&!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--completions-enabled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("completionsEnabled"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{"aria-label":t("completionsEnabled")||"Completions",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_AI__WEBPACK_IMPORTED_MODULE_6__.default,{})})})}),!!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--board-of-experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("boardOfExperts"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{"aria-label":t("boardOfExperts")||"Board of Experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Group__WEBPACK_IMPORTED_MODULE_7__.default,{})})})}),!!memori.nsfw&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--nsfw",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("nsfw"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{title:t("nsfw")||"NSFW",children:"๐Ÿ”ž"})})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("picture",{className:"memori--avatar",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("source",{src:memori.avatarURL??(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("img",{alt:memori.name,src:memori.avatarURL&&memori.avatarURL.length>0?(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"avatar",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("h2",{className:"memori--title",children:memori.name}),memori.needsPosition&&!position&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--needsPosition",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t("write_and_speak.requirePosition")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>openPositionDrawer(),className:"memori--start-button",children:t("widget.position")})]}),(memori.needsPosition&&position||!memori.needsPosition)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--description",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{className:"memori--description-text",children:translatedDescription&&showTranslation?translatedDescription:memori.description}),translatedDescription!==memori.description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,className:"memori--translation-toggle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Translation__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>{setShowTranslation((show=>!show))},children:t(showTranslation?"showOriginalText":"showTranslatedText")})]}),integrationConfig?.multilanguage&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--language-chooser",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("label",{id:"user-lang-pref-label",htmlFor:"user-lang-pref",children:t("write_and_speak.iWantToTalkToIn",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("select",{id:"user-lang-pref",className:"memori-select--button",value:(userLang??i18n.language).toUpperCase(),"aria-labelledby":"user-lang-pref-label",onChange:e=>{setUserLang(e.target.value)},children:_helpers_constants__WEBPACK_IMPORTED_MODULE_4__.cG.map((lang=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("option",{value:lang.value,"aria-label":lang.label,children:lang.label},lang.value)))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,disabled:!!memori.blockedUntil&&!memori.isGiver,loading:clickedStart,onClick:_e=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}initializeTTS&&initializeTTS(),onClickStart&&onClickStart()},className:"memori--start-button",children:t("write_and_speak."+(instruct?"instructButton":"tryMeButton"))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__.Z,{provider:memori.completionProvider,forceStatus:_TEST_forceProviderStatus}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{className:"memori--start-description",children:t(instruct?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),!!memori.blockedUntil&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__.Z,{memoriName:memori.name,blockedUntil:memori.blockedUntil,showGiverInfo:memori.isGiver,showTitle:!0,marginLeft:!0}),!!memori.enableDeepThought&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--deep-thought-disclaimer",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("deepThoughtHelper"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__.default,{})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("h2",{children:t(isUserLoggedIn&&user?.pAndCUAccepted?"deepThoughtDisclaimerTitle":"deepThought")}),isUserLoggedIn&&!user?.pAndCUAccepted&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t("deepThoughtPreDisclaimerNotAllowed")}),!isUserLoggedIn&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t("deepThoughtPreDisclaimerUnlogged")}),!isUserLoggedIn&&showLogin&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,padded:!1,onClick:()=>setShowLoginDrawer(!0),children:"Login"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{className:"memori--deep-thought-disclaimer-text",children:t("deepThoughtDisclaimer")})]})]})]})};StartPanel.displayName="StartPanel";const __WEBPACK_DEFAULT_EXPORT__=StartPanel;try{StartPanel.displayName="StartPanel",StartPanel.__docgenInfo={description:"",displayName:"StartPanel",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},gamificationLevel:{defaultValue:null,description:"",name:"gamificationLevel",required:!1,type:{name:"GamificationLevel"}},language:{defaultValue:null,description:"",name:"language",required:!1,type:{name:"string"}},userLang:{defaultValue:null,description:"",name:"userLang",required:!1,type:{name:"string"}},setUserLang:{defaultValue:null,description:"",name:"setUserLang",required:!0,type:{name:"(lang: string) => void"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},position:{defaultValue:null,description:"",name:"position",required:!1,type:{name:"Venue"}},openPositionDrawer:{defaultValue:null,description:"",name:"openPositionDrawer",required:!0,type:{name:"() => void"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},clickedStart:{defaultValue:null,description:"",name:"clickedStart",required:!1,type:{name:"boolean"}},onClickStart:{defaultValue:null,description:"",name:"onClickStart",required:!1,type:{name:"(() => void)"}},initializeTTS:{defaultValue:null,description:"",name:"initializeTTS",required:!1,type:{name:"(() => void)"}},_TEST_forceProviderStatus:{defaultValue:null,description:"",name:"_TEST_forceProviderStatus",required:!1,type:{name:"string"}},isUserLoggedIn:{defaultValue:{value:"false"},description:"",name:"isUserLoggedIn",required:!1,type:{name:"boolean"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},setShowLoginDrawer:{defaultValue:null,description:"",name:"setShowLoginDrawer",required:!0,type:{name:"(show: boolean) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/StartPanel/StartPanel.tsx#StartPanel"]={docgenInfo:StartPanel.__docgenInfo,name:"StartPanel",path:"src/components/StartPanel/StartPanel.tsx#StartPanel"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>getPlaceName(i),placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",outlined:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3})}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3})}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'ยฉ OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronLeft.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronLeft=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M15 18L9 12 15 6"})});ChevronLeft.displayName="ChevronLeft";const __WEBPACK_DEFAULT_EXPORT__=ChevronLeft;try{ChevronLeft.displayName="ChevronLeft",ChevronLeft.__docgenInfo={description:"",displayName:"ChevronLeft",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronLeft.tsx#ChevronLeft"]={docgenInfo:ChevronLeft.__docgenInfo,name:"ChevronLeft",path:"src/components/icons/ChevronLeft.tsx#ChevronLeft"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronRight.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronRight=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9 18L15 12 9 6"})});ChevronRight.displayName="ChevronRight";const __WEBPACK_DEFAULT_EXPORT__=ChevronRight;try{ChevronRight.displayName="ChevronRight",ChevronRight.__docgenInfo={description:"",displayName:"ChevronRight",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronRight.tsx#ChevronRight"]={docgenInfo:ChevronRight.__docgenInfo,name:"ChevronRight",path:"src/components/icons/ChevronRight.tsx#ChevronRight"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Delete.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Delete=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});Delete.displayName="Delete";const __WEBPACK_DEFAULT_EXPORT__=Delete;try{Delete.displayName="Delete",Delete.__docgenInfo={description:"",displayName:"Delete",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Delete.tsx#Delete"]={docgenInfo:Delete.__docgenInfo,name:"Delete",path:"src/components/icons/Delete.tsx#Delete"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Plus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Plus=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"})]});Plus.displayName="Plus";const __WEBPACK_DEFAULT_EXPORT__=Plus;try{Plus.displayName="Plus",Plus.__docgenInfo={description:"",displayName:"Plus",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Plus.tsx#Plus"]={docgenInfo:Plus.__docgenInfo,name:"Plus",path:"src/components/icons/Plus.tsx#Plus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Translation.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Translation=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4c-1.3-3.2-4.3-5.4-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z"})]});Translation.displayName="Translation";const __WEBPACK_DEFAULT_EXPORT__=Translation;try{Translation.displayName="Translation",Translation.__docgenInfo={description:"",displayName:"Translation",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Translation.tsx#Translation"]={docgenInfo:Translation.__docgenInfo,name:"Translation",path:"src/components/icons/Translation.tsx#Translation"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Warning.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Warning=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});Warning.displayName="Warning";const __WEBPACK_DEFAULT_EXPORT__=Warning;try{Warning.displayName="Warning",Warning.__docgenInfo={description:"",displayName:"Warning",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Warning.tsx#Warning"]={docgenInfo:Warning.__docgenInfo,name:"Warning",path:"src/components/icons/Warning.tsx#Warning"})}catch(__react_docgen_typescript_loader_error){}},"?875c":()=>{},"?f824":()=>{},"?a523":()=>{},"?540f":()=>{},"?71f6":()=>{},"?3dbe":()=>{},"?c417":()=>{}}]); \ No newline at end of file +(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2357],{"./src/components/AgeVerificationModal/AgeVerificationModal.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_i18next__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_hot_toast__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),luxon__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/luxon/src/luxon.js"),_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/DateSelector/DateSelector.tsx"),react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/index.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AgeVerificationModal=({visible=!1,onClose,minAge})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_7__.$)(),[birthDate,setBirthDate]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[error,setError]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(),[submitting,setSubmitting]=(0,react__WEBPACK_IMPORTED_MODULE_5__.useState)(!1),onSubmit=(0,react__WEBPACK_IMPORTED_MODULE_5__.useCallback)((()=>{if(setSubmitting(!0),!birthDate)return react_hot_toast__WEBPACK_IMPORTED_MODULE_0__.ZP.error(t("requiredField")),setError(t("requiredField")||"Required field"),void setSubmitting(!1);if(luxon__WEBPACK_IMPORTED_MODULE_3__.ou.now().diff(birthDate,"years").yearsonClose(),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{children:t("ageVerificationText",{minAge})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),onSubmit()},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)("fieldset",{name:"birthDate",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("legend",{className:"sr-only",children:t("birthDate")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_DateSelector_DateSelector__WEBPACK_IMPORTED_MODULE_4__.Z,{defaultDate:new Date(Date.now()),onChange:date=>{setBirthDate(date)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-help",children:t("birthDateHelper")}),error&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("p",{className:"form-item-error",children:error})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)("div",{className:"form-item form-submit",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:submitting,disabled:!birthDate,children:t("confirm")})})]})]})};AgeVerificationModal.displayName="AgeVerificationModal";const __WEBPACK_DEFAULT_EXPORT__=AgeVerificationModal;try{AgeVerificationModal.displayName="AgeVerificationModal",AgeVerificationModal.__docgenInfo={description:"",displayName:"AgeVerificationModal",props:{visible:{defaultValue:{value:"false"},description:"",name:"visible",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(birthDate?: string | undefined) => void"}},minAge:{defaultValue:null,description:"",name:"minAge",required:!0,type:{name:"number"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"]={docgenInfo:AgeVerificationModal.__docgenInfo,name:"AgeVerificationModal",path:"src/components/AgeVerificationModal/AgeVerificationModal.tsx#AgeVerificationModal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/Auth/Auth.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_i18next__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hook_form__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hook-form/dist/index.esm.mjs"),_icons_Plus__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Plus.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const AuthWidget=({pwdOrTokens,setPwdOrTokens,onFinish,minimumNumberOfRecoveryTokens=1,showTokens=!0,openModal=!1,withModal=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_5__.$)(),{register,handleSubmit,formState:{errors},setError}=(0,react_hook_form__WEBPACK_IMPORTED_MODULE_6__.cI)(),[numTokens,setNumTokens]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(1),[showModal,setShowModal]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!!pwdOrTokens),form=(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("form",{name:"memoriAuth",onSubmit:handleSubmit((data=>{"password"===pwdOrTokens&&!data.password?.length||"tokens"===pwdOrTokens&&((data?.tokens?.length||0)t.length)))?setError("tokens",{type:"minLength",message:"Tokens"}):onFinish&&onFinish(data).then((()=>{setShowModal(!1)}))})),className:"memori-auth-widget--form",children:[("password"===pwdOrTokens||!showTokens)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--password-fieldset",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("label",{children:["Password:"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{className:"memori-auth-widget--input",required:!0,type:"password",placeholder:"Password",...register("password",{required:!0})})]}),showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("tokens"),children:t("auth.useRecoveryTokens")||"Recovery tokens"})]})]}),"tokens"===pwdOrTokens&&showTokens&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("fieldset",{className:"memori-auth-widget--tokens-fieldset",name:"tokens",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("legend",{children:[t("auth.tokens"),": "]}),(length=numTokens,Array.from({length},((_,i)=>i))).map((idx=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("label",{className:"memori-auth-widget--token",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("input",{type:"password",className:"memori-auth-widget--input",placeholder:"Recovery token",required:!0,autoComplete:"off",...register(`tokens.${idx}`,{required:!0})})},idx))),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{onClick:()=>setNumTokens((t=>t+1)),className:"memori-auth-widget--token-add",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_icons_Plus__WEBPACK_IMPORTED_MODULE_3__.default,{}),children:t("auth.addToken")||"Add token"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{outlined:!0,onClick:()=>setPwdOrTokens("password"),children:t("auth.usePassword")||"Password"})]}),"minLength"===errors.tokens?.type&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div",{className:"memori-auth-widget--error",children:[t("auth.atLeast")||"At least"," ",minimumNumberOfRecoveryTokens]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,className:"memori-auth-widget--submit",children:t("confirm")||"Submit"})]});var length;return withModal?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_2__.Z,{open:openModal||showModal,title:t("auth.title")||"Authentication",onClose:()=>setPwdOrTokens(null),closable:!1,children:form}):form},__WEBPACK_DEFAULT_EXPORT__=AuthWidget;try{AuthWidget.displayName="AuthWidget",AuthWidget.__docgenInfo={description:"",displayName:"AuthWidget",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#AuthWidget"]={docgenInfo:AuthWidget.__docgenInfo,name:"AuthWidget",path:"src/components/Auth/Auth.tsx#AuthWidget"})}catch(__react_docgen_typescript_loader_error){}try{Auth.displayName="Auth",Auth.__docgenInfo={description:"",displayName:"Auth",props:{pwdOrTokens:{defaultValue:null,description:"",name:"pwdOrTokens",required:!0,type:{name:'"password" | "tokens" | null'}},setPwdOrTokens:{defaultValue:null,description:"",name:"setPwdOrTokens",required:!0,type:{name:'(state: "password" | "tokens" | null) => void'}},onFinish:{defaultValue:null,description:"",name:"onFinish",required:!1,type:{name:"((values: AuthInputs) => Promise)"}},minimumNumberOfRecoveryTokens:{defaultValue:{value:"1"},description:"",name:"minimumNumberOfRecoveryTokens",required:!1,type:{name:"number"}},showTokens:{defaultValue:{value:"true"},description:"",name:"showTokens",required:!1,type:{name:"boolean"}},withModal:{defaultValue:{value:"false"},description:"",name:"withModal",required:!1,type:{name:"boolean"}},openModal:{defaultValue:{value:"false"},description:"",name:"openModal",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/Auth/Auth.tsx#Auth"]={docgenInfo:Auth.__docgenInfo,name:"Auth",path:"src/components/Auth/Auth.tsx#Auth"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const BlockedMemoriBadge=({memoriName,blockedUntil,showGiverInfo=!1,showTitle=!1,marginLeft=!1})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),blockedUntilDate=new Date(blockedUntil);return blockedUntilDate>new Date?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"blocked-memori-badge--tooltip",content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.Fragment,{children:[!showGiverInfo&&t("memoriBlockedAnon",{name:memoriName,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&t("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(blockedUntilDate)}),showGiverInfo&&` ${t("memoriBlockedReasonExceedChats")}`,showGiverInfo&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("br",{}),showGiverInfo&&`\n${t("memoriBlockedGiverHelper")}`]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"blocked-memori-badge "+(marginLeft?" margin-left":""),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"blocked-memori-badge--icon"})}),showTitle&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"blocked-memori-badge--title",children:t("memoriBlockedTitle")})]})}):null},__WEBPACK_DEFAULT_EXPORT__=BlockedMemoriBadge;try{BlockedMemoriBadge.displayName="BlockedMemoriBadge",BlockedMemoriBadge.__docgenInfo={description:"",displayName:"BlockedMemoriBadge",props:{memoriName:{defaultValue:null,description:"",name:"memoriName",required:!0,type:{name:"string"}},blockedUntil:{defaultValue:null,description:"",name:"blockedUntil",required:!0,type:{name:"string"}},showGiverInfo:{defaultValue:{value:"false"},description:"",name:"showGiverInfo",required:!1,type:{name:"boolean"}},showTitle:{defaultValue:{value:"false"},description:"",name:"showTitle",required:!1,type:{name:"boolean"}},marginLeft:{defaultValue:{value:"false"},description:"",name:"marginLeft",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"]={docgenInfo:BlockedMemoriBadge.__docgenInfo,name:"BlockedMemoriBadge",path:"src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx#BlockedMemoriBadge"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ChangeMode/ChangeMode.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/radio-group/radio-group.js"),react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChangeMode=({instruct,canInstruct,onChangeMode})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_3__.$)();return canInstruct?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",{className:"memori--changeMode-instruct",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E,{name:"instruct",value:instruct?"instruct":"test",defaultValue:instruct?"instruct":"test",className:"memori--changeMode-instruct-radio",onChange:onChangeMode,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"instruct",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.instruct")||"Instruct"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.E.Option,{value:"test",className:"memori--changeMode-instruct-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:checked,children:t("widget.test")||"Test"})})]})}):null},__WEBPACK_DEFAULT_EXPORT__=ChangeMode;try{ChangeMode.displayName="ChangeMode",ChangeMode.__docgenInfo={description:"",displayName:"ChangeMode",props:{instruct:{defaultValue:null,description:"",name:"instruct",required:!1,type:{name:"boolean"}},onChangeMode:{defaultValue:null,description:"",name:"onChangeMode",required:!0,type:{name:'(mode: "instruct" | "test") => void'}},canInstruct:{defaultValue:null,description:"",name:"canInstruct",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ChangeMode/ChangeMode.tsx#ChangeMode"]={docgenInfo:ChangeMode.__docgenInfo,name:"ChangeMode",path:"src/components/ChangeMode/ChangeMode.tsx#ChangeMode"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_icons_Warning__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Warning.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const CompletionProviderStatus=({forceStatus,provider})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[status,setStatus]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(forceStatus??"none"),providerStatus=(provider=>{switch(provider){case"DEFAULT":case"OpenAI":return{getStatus:async()=>{const res=await fetch("https://status.openai.com/api/v2/summary.json");return(await res.json()).status.indicator??"none"},statusPage:"https://status.openai.com/"};default:return{getStatus:async()=>"none",statusPage:""}}})(provider);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{forceStatus||providerStatus.getStatus().then((status=>setStatus(status)))}),[forceStatus,provider]),"none"!==status?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori--completion-provider-status--tooltip",align:"topLeft",content:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:t("completionProviderDown",{provider:provider??t("completionProviderFallbackName")})}),!!providerStatus.statusPage?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("a",{href:providerStatus.statusPage,rel:"noopener noreferrer",target:"_blank",children:t("completionProviderCheckStatusPage")})})]}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Warning__WEBPACK_IMPORTED_MODULE_2__.default,{className:"memori--completion-provider-status--icon"})}):null},__WEBPACK_DEFAULT_EXPORT__=CompletionProviderStatus;try{CompletionProviderStatus.displayName="CompletionProviderStatus",CompletionProviderStatus.__docgenInfo={description:"",displayName:"CompletionProviderStatus",props:{forceStatus:{defaultValue:null,description:"",name:"forceStatus",required:!1,type:{name:"string"}},provider:{defaultValue:null,description:"",name:"provider",required:!1,type:{name:"string | null"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"]={docgenInfo:CompletionProviderStatus.__docgenInfo,name:"CompletionProviderStatus",path:"src/components/CompletionProviderStatus/CompletionProviderStatus.tsx#CompletionProviderStatus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/DateSelector/DateSelector.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),luxon__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/luxon/src/luxon.js"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const months={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},DateSelector=(0,react__WEBPACK_IMPORTED_MODULE_0__.memo)((({defaultDate,onChange,disabled=!1})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)(),[date,setDate]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(defaultDate?"string"==typeof defaultDate?luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromISO(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.fromJSDate(defaultDate):luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now());return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{onChange(date)}),[date,onChange]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:"memori--date-selector",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"day",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("day"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("day"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.day}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((day=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({day:day+1}),className:"memori--date-selector__select-option",children:day+1},day)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"month",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("month"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("month"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:months["it"===i18n.language?"it":"en"][date.month-1]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:months["it"===i18n.language?"it":"en"].map((month=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{className:"memori--date-selector__select-option",value:date.set({month:months["it"===i18n.language?"it":"en"].findIndex((m=>m===month))+1}),children:month},month)))})})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori--date-selector__select",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R,{value:date,onChange:value=>{setDate(value)},disabled,name:"year",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Label,{className:"memori--date-selector__select-label",children:[t("year"),":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Button,{"aria-label":t("year"),className:"memori--date-selector__select-button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--value",children:date.year}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Options,{className:"memori--date-selector__select-options",children:[...Array(luxon__WEBPACK_IMPORTED_MODULE_1__.ou.now().year-1899).keys()].sort(((a,b)=>b-a)).map((year=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.R.Option,{value:date.set({year:year+1900}),className:"memori--date-selector__select-option",children:year+1900},year)))})})]})})]})}));DateSelector.displayName="DateSelector";const __WEBPACK_DEFAULT_EXPORT__=DateSelector},"./src/components/ExpertsDrawer/ExpertsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer=({open=!1,baseUrl,apiUrl,tenant,experts,onClose})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{open,onClose,className:"memori--experts-drawer",title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h2",{className:"memori--experts-drawer--title",children:t("widget.expertsInTheBoard")}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("ul",{className:"memori--experts-drawer--list",children:experts.map((expert=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("img",{src:`${apiUrl}/api/v1/memoriai/memori/avatar/${expert.expertMemoriID}`,alt:expert.name,onError:e=>{e.currentTarget.src=(0,_helpers_media__WEBPACK_IMPORTED_MODULE_3__.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h3",{className:"memori--experts-drawer--name",children:expert.name}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{className:"memori--experts-drawer--description",children:expert.description})]})]},expert.expertID)))})})};ExpertsDrawer.displayName="ExpertsDrawer";const __WEBPACK_DEFAULT_EXPORT__=ExpertsDrawer;try{ExpertsDrawer.displayName="ExpertsDrawer",ExpertsDrawer.__docgenInfo={description:"",displayName:"ExpertsDrawer",props:{experts:{defaultValue:null,description:"",name:"experts",required:!0,type:{name:"ExpertReference[]"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"]={docgenInfo:ExpertsDrawer.__docgenInfo,name:"ExpertsDrawer",path:"src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/KnownFacts/KnownFacts.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Drawer.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Spin.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_helpers_error__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/helpers/error.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Delete__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/Delete.tsx"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/ui/Select.tsx"),_icons_ChevronLeft__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./src/components/icons/ChevronLeft.tsx"),_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/components/icons/ChevronRight.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts=({apiURL,sessionID,memori,visible=!0,initialKnownFacts=[],closeDrawer})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_14__.$)(),client=(0,_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__.Z)(apiURL),{getKnownFactsPaginated,deleteKnownFact}=client.knownFacts,[knownFacts,setKnownFacts]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts),[numberOfResults,setNumberOfResults]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(25),[pageIndex,setPageIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[knownFactsCount,setKnownFactsCount]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts?.length??0),[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),fetchKnownFacts=async(sessionId,from,howMany)=>{if(sessionID||sessionId){setLoading(!0);try{const{knownFacts,count,...response}=await getKnownFactsPaginated(sessionId??sessionID,from??pageIndex,howMany??numberOfResults);setKnownFacts(knownFacts??[]),setKnownFactsCount(count??0),0!==response.resultCode&&(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode))))}catch(err){console.error("KNOWN_FACTS/FETCH",err),setKnownFacts(initialKnownFacts??[])}setLoading(!1)}};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{fetchKnownFacts()}),[]);const[bulkDeleteModalVisible,setBulkDeleteModalVisible]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[deleteModalVisibleFor,setDeleteModalVisibleFor]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),[selectedRowKeys,setSelectedRowKeys]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,width:"80%",className:"memori-known-facts-drawer",onClose:()=>closeDrawer(),title:t("knownFacts.title"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("p",{children:t("knownFacts.description",{memoriName:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Spin__WEBPACK_IMPORTED_MODULE_4__.Z,{spinning:loading,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:()=>{setBulkDeleteModalVisible(!0)},className:"memori-known-facts-delete-selected",disabled:0===selectedRowKeys?.length,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),loading,children:[t("selected")," (",selectedRowKeys?.length,")"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:bulkDeleteModalVisible,closable:!0,title:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmTitle"):t("knownFacts.deleteConfirmTitle"),description:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmMessage",{number:selectedRowKeys.length}):t("knownFacts.deleteConfirmMessage"),onClose:()=>{setBulkDeleteModalVisible(!1)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setBulkDeleteModalVisible(!1)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const mutations=selectedRowKeys.map((key=>deleteKnownFact(sessionID,key)));Promise.all(mutations).then((responses=>{if(responses.every((r=>0===r.resultCode)))react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setBulkDeleteModalVisible(!1);else{let errored=responses.find((r=>0!==r.resultCode));console.error(errored),void 0!==errored?.resultCode&&react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(errored?.resultCode)))}}))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]}),knownFactsCount>25&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("nav",{className:"memori--table--pagination",children:[knownFactsCount>numberOfResults&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",disabled:0===pageIndex||pageIndex{let from=(pageIndex/numberOfResults-1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(pageIndex/numberOfResults)+1," /"," ",Math.ceil(knownFactsCount/numberOfResults)]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",padded:!1,title:t("next")||"Next",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__.default,{}),disabled:(pageIndex/numberOfResults+1)*numberOfResults>=knownFactsCount,onClick:()=>{let from=(pageIndex/numberOfResults+1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_10__.Z,{options:[{label:`25 / ${t("page")||"page"}`,value:25},{label:`50 / ${t("page")||"page"}`,value:50},{label:`100 / ${t("page")||"page"}`,value:100}],value:numberOfResults,displayValue:`${numberOfResults} / ${t("page")||"page"}`,onChange:value=>{setNumberOfResults(value),setPageIndex(0),fetchKnownFacts(void 0,0,value)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("table",{className:"memori--table",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("thead",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:!!knownFacts?.length&&selectedRowKeys?.length===knownFacts.length,indeterminate:!!knownFacts?.length&&!!selectedRowKeys?.length&&selectedRowKeys?.length!==knownFacts?.length,onChange:e=>{e.target.checked?setSelectedRowKeys(knownFacts.map((kf=>kf.knownFactID))):setSelectedRowKeys([])}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{children:t("knownFacts.text")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"mobile-hidden",children:t("createdAt")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-right",children:t("actions")})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("tbody",{children:knownFacts.map((kf=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:selectedRowKeys?.includes(kf.knownFactID),onChange:e=>{e.target.checked?setSelectedRowKeys((srk=>[...new Set([...srk,kf.knownFactID])])):setSelectedRowKeys((srk=>srk.filter((key=>key!==kf.knownFactID))))}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{children:kf.text}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"mobile-hidden",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("span",{className:"memori--table--date",children:kf.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(kf.creationTimestamp)):"-"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"memori--table--column-right",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--action-column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{danger:!0,ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),disabled:selectedRowKeys?.length>0,title:t("delete")||"Delete",onClick:()=>setDeleteModalVisibleFor(kf.knownFactID)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:deleteModalVisibleFor===kf.knownFactID,closable:!0,title:t("knownFacts.deleteConfirmTitle"),description:t("knownFacts.deleteConfirmMessage"),onClose:()=>{setDeleteModalVisibleFor(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setDeleteModalVisibleFor(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const response=await deleteKnownFact(sessionID,kf.knownFactID);0===response.resultCode?(react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setDeleteModalVisibleFor(void 0)):(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode),{ns:"common"})))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]})})]},kf.knownFactID)))})]})]})]})};KnownFacts.displayName="KnownFacts";const __WEBPACK_DEFAULT_EXPORT__=KnownFacts;try{KnownFacts.displayName="KnownFacts",KnownFacts.__docgenInfo={description:"",displayName:"KnownFacts",props:{apiURL:{defaultValue:null,description:"",name:"apiURL",required:!0,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},initialKnownFacts:{defaultValue:{value:"[]"},description:"",name:"initialKnownFacts",required:!1,type:{name:"KnownFact[]"}},visible:{defaultValue:{value:"true"},description:"",name:"visible",required:!1,type:{name:"boolean"}},closeDrawer:{defaultValue:null,description:"",name:"closeDrawer",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/KnownFacts/KnownFacts.tsx#KnownFacts"]={docgenInfo:KnownFacts.__docgenInfo,name:"KnownFacts",path:"src/components/KnownFacts/KnownFacts.tsx#KnownFacts"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/MemoriWidget/MemoriWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>MemoriWidget_MemoriWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),esm=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),es2019_module=__webpack_require__("./node_modules/standardized-audio-context/build/es2019/module.js"),microsoft_cognitiveservices_speech_sdk=__webpack_require__("./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),luxon=__webpack_require__("./node_modules/luxon/src/luxon.js"),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),PositionDrawer=__webpack_require__("./src/components/PositionDrawer/PositionDrawer.tsx"),Auth=__webpack_require__("./src/components/Auth/Auth.tsx"),Chat_Chat=__webpack_require__("./src/components/Chat/Chat.tsx"),StartPanel=__webpack_require__("./src/components/StartPanel/StartPanel.tsx"),Avatar=__webpack_require__("./src/components/Avatar/Avatar.tsx"),ChangeMode=__webpack_require__("./src/components/ChangeMode/ChangeMode.tsx"),Header=__webpack_require__("./src/components/Header/Header.tsx"),PoweredBy=__webpack_require__("./src/components/PoweredBy/PoweredBy.tsx"),AgeVerificationModal=__webpack_require__("./src/components/AgeVerificationModal/AgeVerificationModal.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.tsx"),KnownFacts=__webpack_require__("./src/components/KnownFacts/KnownFacts.tsx"),ExpertsDrawer=__webpack_require__("./src/components/ExpertsDrawer/ExpertsDrawer.tsx"),LoginDrawer=__webpack_require__("./src/components/LoginDrawer/LoginDrawer.tsx"),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const layouts_FullPage=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,children:[showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps}),(0,jsx_runtime.jsxs)("div",{className:"memori--grid",children:[(0,jsx_runtime.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps}),(0,jsx_runtime.jsx)("div",{id:"extension"})]}),(0,jsx_runtime.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null}),poweredBy]})]})]});try{FullPage.displayName="FullPage",FullPage.__docgenInfo={description:"",displayName:"FullPage",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/FullPage.tsx#FullPage"]={docgenInfo:FullPage.__docgenInfo,name:"FullPage",path:"src/components/layouts/FullPage.tsx#FullPage"})}catch(__react_docgen_typescript_loader_error){}const layouts_Totem=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-totem-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--avatar",children:Avatar&&avatarProps&&(0,jsx_runtime.jsx)(Avatar,{...avatarProps})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-totem-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Totem.displayName="Totem",Totem.__docgenInfo={description:"",displayName:"Totem",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Totem.tsx#Totem"]={docgenInfo:Totem.__docgenInfo,name:"Totem",path:"src/components/layouts/Totem.tsx#Totem"})}catch(__react_docgen_typescript_loader_error){}const layouts_Chat=({Header,headerProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,integrationBackground,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,integrationBackground,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-chat-layout",children:[poweredBy,showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-chat-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]});try{Chat.displayName="Chat",Chat.__docgenInfo={description:"",displayName:"Chat",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/Chat.tsx#Chat"]={docgenInfo:Chat.__docgenInfo,name:"Chat",path:"src/components/layouts/Chat.tsx#Chat"})}catch(__react_docgen_typescript_loader_error){}var Button=__webpack_require__("./src/components/ui/Button.tsx"),Blob=__webpack_require__("./src/components/Blob/Blob.tsx"),Close=__webpack_require__("./src/components/icons/Close.tsx");const WebsiteAssistantLayout=({Header,headerProps,Avatar,avatarProps,Chat,chatProps,StartPanel,startPanelProps,integrationStyle,ChangeMode,changeModeProps,sessionId,hasUserActivatedSpeak,showInstruct=!1,loading=!1,poweredBy})=>{const{t}=(0,useTranslation.$)(),[collapsed,_setCollapsed]=(0,react.useState)(!0),[expandedKey,setExpandedKey]=(0,react.useState)(),stopAudio=(0,react.useMemo)((()=>chatProps?.stopAudio),[chatProps?.stopAudio]),setCollapsed=collapsed=>{_setCollapsed(collapsed),setExpandedKey(collapsed?void 0:(new Date).toISOString());try{stopAudio?.()}catch(e){console.log(e)}};return(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--"+(collapsed?"collapsed":"expanded"),children:collapsed?(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>setCollapsed(!1),title:t("expand")||"Expand",children:(0,jsx_runtime.jsx)(Blob.Z,{avatar:avatarProps?.memori.avatarURL})})}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[integrationStyle,(0,jsx_runtime.jsxs)(Spin.Z,{spinning:loading,className:"memori-website_assistant-layout",children:[poweredBy,(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,jsx_runtime.jsx)(Button.Z,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>setCollapsed(!0),icon:(0,jsx_runtime.jsx)(Close.default,{}),title:t("close")||"Close"})}),showInstruct&&ChangeMode&&changeModeProps&&(0,jsx_runtime.jsx)(ChangeMode,{...changeModeProps}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--header",children:Header&&headerProps&&(0,jsx_runtime.jsx)(Header,{...headerProps,showSettings:!1,showReload:!1})}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:Avatar&&avatarProps&&(0,react.createElement)(Avatar,{...avatarProps,integrationConfig:avatarProps.integrationConfig?{...avatarProps.integrationConfig,avatarURL:avatarProps.integrationConfig?.avatarURL?`${avatarProps.integrationConfig?.avatarURL.split("#")[0]}#${expandedKey}`:void 0}:{},key:expandedKey})}),(0,jsx_runtime.jsx)("div",{id:"extension"}),(0,jsx_runtime.jsx)("div",{className:"memori-website_assistant-layout--controls",children:sessionId&&hasUserActivatedSpeak&&Chat&&chatProps?(0,jsx_runtime.jsx)(Chat,{...chatProps}):startPanelProps?(0,jsx_runtime.jsx)(StartPanel,{...startPanelProps}):null})]})]})})};WebsiteAssistantLayout.displayName="WebsiteAssistantLayout";const layouts_WebsiteAssistant=WebsiteAssistantLayout;try{WebsiteAssistant.displayName="WebsiteAssistant",WebsiteAssistant.__docgenInfo={description:"",displayName:"WebsiteAssistant",props:{Header:{defaultValue:null,description:"",name:"Header",required:!1,type:{name:"FC"}},headerProps:{defaultValue:null,description:"",name:"headerProps",required:!1,type:{name:"Props"}},Avatar:{defaultValue:null,description:"",name:"Avatar",required:!0,type:{name:"NamedExoticComponent"}},avatarProps:{defaultValue:null,description:"",name:"avatarProps",required:!1,type:{name:"Props"}},Chat:{defaultValue:null,description:"",name:"Chat",required:!1,type:{name:"NamedExoticComponent"}},chatProps:{defaultValue:null,description:"",name:"chatProps",required:!1,type:{name:"Props"}},StartPanel:{defaultValue:null,description:"",name:"StartPanel",required:!0,type:{name:"FC"}},startPanelProps:{defaultValue:null,description:"",name:"startPanelProps",required:!1,type:{name:"Props"}},integrationStyle:{defaultValue:null,description:"",name:"integrationStyle",required:!1,type:{name:"Element | null"}},integrationBackground:{defaultValue:null,description:"",name:"integrationBackground",required:!1,type:{name:"Element | null"}},ChangeMode:{defaultValue:null,description:"",name:"ChangeMode",required:!1,type:{name:"FC"}},changeModeProps:{defaultValue:null,description:"",name:"changeModeProps",required:!1,type:{name:"Props"}},poweredBy:{defaultValue:null,description:"",name:"poweredBy",required:!1,type:{name:"Element | null"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},hasUserActivatedSpeak:{defaultValue:null,description:"",name:"hasUserActivatedSpeak",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"]={docgenInfo:WebsiteAssistant.__docgenInfo,name:"WebsiteAssistant",path:"src/components/layouts/WebsiteAssistant.tsx#WebsiteAssistant"})}catch(__react_docgen_typescript_loader_error){}var translations=__webpack_require__("./src/helpers/translations.ts"),configuration=__webpack_require__("./src/helpers/configuration.ts"),utils=__webpack_require__("./src/helpers/utils.ts"),constants=__webpack_require__("./src/helpers/constants.ts"),error=__webpack_require__("./src/helpers/error.ts");const{deleteSession,getStatistics,initSession}=(0,esm.Z)(),BADGES_MAP=new Map([[0,"๐Ÿ†•"],[10,"๐Ÿน"],[20,"๐Ÿ‡"],[30,"๐Ÿฐ"],[40,"๐Ÿ’ก"],[50,"๐Ÿ†"],[60,"๐Ÿ…"],[70,"๐Ÿฅ‰"],[80,"๐Ÿฅˆ"],[90,"๐Ÿฅ‡"],[100,"๐Ÿ”ฅ"],[110,"๐ŸŽ“"],[120,"๐Ÿค–"],[130,"๐Ÿ‘พ"],[150,"๐ŸŒ"],[180,"๐Ÿ’œ"],[200,"๐Ÿ’™"],[250,"๐Ÿงก"],[300,"๐Ÿ’š"],[350,"๐Ÿ’›"],[400,"๐Ÿ’–"],[450,"๐Ÿ’"],[500,"๐Ÿ–ค"],[550,"โค๏ธ"],[600,"๐Ÿง "]]),getBadge=points=>{const unlockedBadges=Array.from(BADGES_MAP.keys()).filter((k=>k<=points));if(unlockedBadges.length>0){const lastBadge=unlockedBadges[unlockedBadges.length-1];return BADGES_MAP.get(lastBadge)}return""},getNextBadge=badge=>{if("๐Ÿ†•"===badge)return{points:10,badge:"๐Ÿน"};let nextBadgePoints,nextBadge,currentSeen=!1;for(const[key,value]of BADGES_MAP){if(currentSeen){nextBadgePoints=key,nextBadge=value;break}value===badge&&(currentSeen=!0)}return nextBadge&&nextBadgePoints?{points:nextBadgePoints,badge:nextBadge}:void 0},getPointsForBadge=badge=>{let points=0;for(const[key,value]of BADGES_MAP)if(value===badge){points=key;break}return points},typeMessage=(message,waitForPrevious=!0,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const e=new CustomEvent("MemoriTextEntered",{detail:{text:message,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}});document.dispatchEvent(e);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let recognizer,speechConfig,speechSynthesizer,audioDestination,audioContext,memoriPassword;window.getMemoriState=integrationId=>{let widget=integrationId?document.querySelector(`.memori-widget[data-memori-integration="${integrationId}"]`)||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget[data-memori-integration]"):document.querySelector(".memori-widget")||document.querySelector("memori-client")?.shadowRoot?.querySelector(".memori-widget");if(!widget)return null;let engineState=widget.dataset?.memoriEngineState;return engineState?JSON.parse(engineState):null},window.typeMessage=typeMessage,window.typeMessageHidden=(message,waitForPrevious=!0,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>typeMessage(message,waitForPrevious,!0,typingText,useLoaderTextAsMsg,hasBatchQueued),window.typeBatchMessages=messages=>{function disableInputs(){document.querySelector("fieldset#chat-fieldset")?.setAttribute("disabled","");const styles="opacity: 0.5; touch-action: none; pointer-events: none;";document.querySelector("textarea.memori-chat-textarea--input")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--send")?.setAttribute("style",styles),document.querySelector("button.memori-chat-inputs--mic")?.setAttribute("style",styles)}function reEnableInputs(){document.querySelector("fieldset#chat-fieldset")?.removeAttribute("disabled"),document.querySelector("textarea.memori-chat-textarea--input")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--send")?.removeAttribute("style"),document.querySelector("button.memori-chat-inputs--mic")?.removeAttribute("style")}function areInputsDisabled(){return!!document.querySelector("fieldset#chat-fieldset")?.hasAttribute("disabled")}const isSafariIOS=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),stepsGenerator=function*(){yield*messages}();disableInputs();const submitNewMessage=()=>{const next=stepsGenerator.next(),step=next.value;if(step){areInputsDisabled()||disableInputs();let waitForPrevious=step.waitForPrevious;isSafariIOS&&(waitForPrevious=!1),typeMessage(step.message,waitForPrevious,step.hidden,step.typingText,step.useLoaderTextAsMsg,!next.done),isSafariIOS&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),reEnableInputs()}),3e3)}else areInputsDisabled()&&reEnableInputs();if(next.done)return document.removeEventListener("MemoriEndSpeak",submitNewMessage),void(areInputsDisabled()&&reEnableInputs())};document.addEventListener("MemoriEndSpeak",submitNewMessage),submitNewMessage()};let userToken,speakerMuted=!1,memoriSpeaking=!1;const MemoriWidget=({memori,memoriConfigs,memoriLang,multilingual,integration,layout="DEFAULT",customLayout,showInstruct=!1,showShare,preview=!1,embed=!1,showInputs=!0,showDates=!1,showContextPerLine=!1,showSettings=!0,showTypingText=!1,showClear=!1,showLogin=!1,showOnlyLastMessages,height="100vh",secret,baseUrl="https://aisuru.com",apiUrl="https://backend.memori.ai",initialContextVars,initialQuestion,ogImage,sessionID:initialSessionID,tenant,personification,authToken,AZURE_COGNITIVE_SERVICES_TTS_KEY,defaultSpeakerActive=!0,onStateChange,additionalInfo,additionalSettings,customMediaRenderer,userAvatar})=>{const{t,i18n}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsClient(!0)}),[]);const client=(0,esm.Z)(apiUrl),{initSession,postTextEnteredEvent,postPlaceChangedEvent,postDateChangedEvent,postTimeoutEvent,postTagChangedEvent,getSession,getContentQualityIndexes,getExpertReferences}=client,[instruct,setInstruct]=(0,react.useState)(!1),[loginToken,setLoginToken]=(0,react.useState)(additionalInfo?.loginToken??authToken),[user,setUser]=(0,react.useState)({avatarURL:"string"==typeof userAvatar?userAvatar:void 0});(0,react.useEffect)((()=>{loginToken&&!user?.userID&&showLogin&&client.backend.getCurrentUser(loginToken).then((({user,resultCode})=>{user&&0===resultCode?(setUser(user),(0,configuration.A2)("loginToken",loginToken)):(0,configuration.gj)("loginToken")}))}),[loginToken,user?.userID]);const[showLoginDrawer,setShowLoginDrawer]=(0,react.useState)(!1),[clickedStart,setClickedStart]=(0,react.useState)(!1),[gotErrorInOpening,setGotErrorInOpening]=(0,react.useState)(!1),language=memori.culture?.split("-")?.[0]?.toUpperCase()||memoriConfigs?.find((c=>c.memoriConfigID===memori.memoriConfigurationID))?.culture?.split("-")?.[0]?.toUpperCase(),integrationConfig=integration?.customData?JSON.parse(integration.customData):null,isMultilanguageEnabled=void 0!==multilingual?multilingual:!!integrationConfig?.multilanguage,[userLang,setUserLang]=(0,react.useState)(memoriLang??integrationConfig?.lang??language??integrationConfig?.uiLang??i18n.language??"IT"),[loading,setLoading]=(0,react.useState)(!1),[memoriTyping,setMemoriTyping]=(0,react.useState)(!1),[typingText,setTypingText]=(0,react.useState)(),selectedLayout=layout||integrationConfig?.layout||"DEFAULT",[hasUserActivatedSpeak,setHasUserActivatedSpeak]=(0,react.useState)(!1),[hasUserActivatedListening,setHasUserActivatedListening]=(0,react.useState)(!1),[showPositionDrawer,setShowPositionDrawer]=(0,react.useState)(!1),[showSettingsDrawer,setShowSettingsDrawer]=(0,react.useState)(!1),[showKnownFactsDrawer,setShowKnownFactsDrawer]=(0,react.useState)(!1),[showExpertsDrawer,setShowExpertsDrawer]=(0,react.useState)(!1),[muteSpeaker,setMuteSpeaker]=(0,react.useState)(!defaultSpeakerActive),[continuousSpeech,setContinuousSpeech]=(0,react.useState)(!1),[continuousSpeechTimeout,setContinuousSpeechTimeout]=(0,react.useState)(2),[isPlayingAudio,setIsPlayingAudio]=(0,react.useState)(!1),[controlsPosition,setControlsPosition]=(0,react.useState)("center"),[hideEmissions,setHideEmissions]=(0,react.useState)(!1);(0,react.useEffect)((()=>{setIsPlayingAudio(!!speechSynthesizer),memoriSpeaking=!!speechSynthesizer}),[speechSynthesizer]),(0,react.useEffect)((()=>{let defaultControlsPosition="bottom",microphoneMode=(0,configuration.wm)("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(defaultControlsPosition="bottom",microphoneMode="HOLD_TO_TALK"):defaultControlsPosition=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom",setMuteSpeaker((0,configuration.wm)("muteSpeaker",!defaultSpeakerActive)),speakerMuted=(0,configuration.wm)("muteSpeaker",!defaultSpeakerActive),setContinuousSpeech("CONTINUOUS"===microphoneMode),setContinuousSpeechTimeout((0,configuration.wm)("continuousSpeechTimeout",2)),setControlsPosition((0,configuration.wm)("controlsPosition",defaultControlsPosition)),setHideEmissions((0,configuration.wm)("hideEmissions",!1)),additionalInfo?.loginToken||authToken||(setLoginToken((0,configuration.wm)("loginToken",void 0)),userToken=(0,configuration.wm)("loginToken",void 0))}),[]);const[memoriPwd,setMemoriPwd]=(0,react.useState)(secret),[memoriTokens,setMemoriTokens]=(0,react.useState)(),[authModalState,setAuthModalState]=(0,react.useState)(null),[position,_setPosition]=(0,react.useState)(),applyPosition=async(venue,sessionID)=>{const session=sessionID??sessionId;if(venue&&session){const{currentState,...response}=await postPlaceChangedEvent({sessionId:session,placeName:venue.placeName,latitude:venue.latitude,longitude:venue.longitude,uncertaintyKm:venue.uncertainty??0});currentState&&0===response.resultCode&&setCurrentDialogState({...currentDialogState,...currentState})}},[userMessage,setUserMessage]=(0,react.useState)(""),[listening,setListening]=(0,react.useState)(!1),[history,setHistory]=(0,react.useState)([]),pushMessage=message=>{setHistory((history=>[...history,{...message,media:message.media?.filter((m=>!("text/javascript"===m.mimeType&&m.properties?.executable)))??[]}]))},sendMessage=async(text,media,newSessionId,translate=!0,translatedText,hidden=!1,typingText,useLoaderTextAsMsg=!1,hasBatchQueued=!1)=>{const sessionID=newSessionId||sessionId||window.getMemoriState()?.sessionID;if(!sessionID||!text?.length)return;hidden||pushMessage({text,translatedText,fromUser:!0,media:media??[],initial:sessionId?!!newSessionId&&newSessionId!==sessionId:!!newSessionId}),setMemoriTyping(!0),setTypingText(typingText);let msg=text,gotError=!1;if(translate&&!instruct&&isMultilanguageEnabled&&userLang.toUpperCase()!==language.toUpperCase()){msg=(await(0,translations.i)(text,language,userLang,baseUrl)).text}const{currentState,...response}=await postTextEnteredEvent({sessionId:sessionID,text:msg});if(0===response.resultCode&¤tState){const emission=useLoaderTextAsMsg&&typingText?typingText:currentState.emission??currentDialogState?.emission;if("X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else if("X2d"===currentState.state&&memori.giverTag){const{currentState,...resp}=await postTextEnteredEvent({sessionId:sessionID,text:Math.random().toString().substring(2,8)});if(0===resp.resultCode){const{currentState,...resp}=await postTagChangedEvent(sessionID,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1}),speak(emission))):(console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0)}else console.error(response,resp),dist.ZP.error(t((0,error.r)(resp.resultCode))),gotError=!0}else userLang.toLowerCase()!==language.toLowerCase()&&emission&&!instruct&&isMultilanguageEnabled?translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})):(setCurrentDialogState({...currentState,emission}),emission&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),speak(emission)))}else 404===response.resultCode&&(setHistory((h=>[...h.slice(0,h.length-1)])),reopenSession(!1,memoriPwd||memori.secretToken,memoriTokens,instruct&&memori.giverTag?memori.giverTag:void 0,instruct&&memori.giverPIN?memori.giverPIN:void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion).then((state=>{console.info("session timeout"),state?.sessionID&&setTimeout((()=>{sendMessage(text,media,state?.sessionID)}),500)})));hasBatchQueued||(setTypingText(void 0),setMemoriTyping(!1))},translateDialogState=async(state,userLang)=>{const emission=state.emission??currentDialogState?.emission;let translatedState={...state},translatedMsg=null;if(emission&&!instruct&&language.toUpperCase()!==userLang.toUpperCase()&&isMultilanguageEnabled){const t=await(0,translations.i)(emission,userLang,language,baseUrl);if(state.hints&&state.hints.length>0){const translatedHints=await Promise.all((state.hints??[]).map((async hint=>{const tHint=await(0,translations.i)(hint,userLang,language,baseUrl);return{text:tHint?.text??hint,originalText:hint}})));translatedState={...state,emission:t.text,translatedHints}}else translatedState={...state,emission:t.text,hints:state.hints??("G1"===state.state?currentDialogState?.hints:[])};t.text.length>0&&(translatedMsg={text:t.text,emitter:state.emitter,media:state.media,fromUser:!1,generatedByAI:!!state.completion})}else translatedState={...state,emission},emission&&(translatedMsg={text:emission,emitter:state.emitter,media:state.media,fromUser:!1});return setCurrentDialogState(translatedState),translatedMsg&&pushMessage(translatedMsg),translatedState},minAge=void 0!==memori.ageRestriction?memori.ageRestriction:memori.nsfw?18:memori.enableCompletions?14:0,[birthDate,setBirthDate]=(0,react.useState)(),[showAgeVerification,setShowAgeVerification]=(0,react.useState)(!1),[sessionId,setSessionId]=(0,react.useState)(initialSessionID),[currentDialogState,_setCurrentDialogState]=(0,react.useState)(),setCurrentDialogState=state=>{_setCurrentDialogState(state),onStateChange&&onStateChange(state);const executableSnippets=state?.media?.filter((m=>"text/javascript"===m.mimeType&&!!m.properties?.executable));executableSnippets?.forEach((s=>{try{setTimeout((()=>{console.log("snippet",s),new Function(s.content??"")(),setTimeout((()=>{document.querySelector(".memori-chat--content")?.scrollTo(0,document.querySelector(".memori-chat--content")?.scrollHeight??0)}),400)}),1e3)}catch(e){console.error(e)}}))},fetchSession=async params=>{let storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(birthDate||storageBirthDate||!minAge)if("PUBLIC"===memori.privacyType||memori.secretToken||memoriPwd||memoriTokens){setLoading(!0);try{if(!memori.giverTag&&memori.receivedInvitations?.length){let giverInvitation=memori.receivedInvitations.find((i=>"GIVER"===i.type&&"ACCEPTED"===i.state));giverInvitation&&(memori.giverTag=giverInvitation.tag,memori.giverPIN=giverInvitation.pin)}let referral;try{referral=window.location.href}catch(err){console.error(err)}const session=await initSession({...params,tag:params.tag??personification?.tag,pin:params.pin??personification?.pin,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});if(session?.sessionID&&session?.currentState&&0===session.resultCode)return setSessionId(session.sessionID),setLoading(!1),{dialogState:session.currentState,sessionID:session.sessionID};session?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(session),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===session?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(session),dist.ZP.error(t((0,error.r)(session?.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err),new Error("Error fetching session")}}else setAuthModalState("password");else setShowAgeVerification(!0)},reopenSession=async(updateDialogState=!1,password,recoveryTokens,tag,pin,initialContextVars,initialQuestion,birthDate)=>{setLoading(!0);try{let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);if(!birthDate&&!storageBirthDate&&minAge)return void setShowAgeVerification(!0);if(!("PUBLIC"===memori.privacyType||password||memori.secretToken||memoriPwd||recoveryTokens||memoriTokens))return void setAuthModalState("password");try{referral=window.location.href}catch(err){console.error(err)}const{sessionID,currentState,...response}=await initSession({memoriID:memori.engineMemoriID??"",password:password||memoriPwd||memori.secretToken,recoveryTokens:recoveryTokens||memoriTokens,tag,pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}});if(sessionID&¤tState&&0===response.resultCode)return setSessionId(sessionID),updateDialogState&&(setCurrentDialogState(currentState),currentState.emission&&(history.length<=1?setHistory([{text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0}]):pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,initial:!0}))),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),setLoading(!1),{dialogState:currentState,sessionID};response?.resultMessage.startsWith("This Memori is aged restricted")?(console.error(response),dist.ZP.error(t("underageTwinSession",{age:minAge})),setGotErrorInOpening(!0)):403===response?.resultCode?(setMemoriPwd(void 0),setAuthModalState("password")):(console.error(response),dist.ZP.error(t((0,error.r)(response.resultCode))),setGotErrorInOpening(!0))}catch(err){console.error(err)}return setLoading(!1),null},changeTag=async(memoriId,sessionId,tag,pin)=>{if(!memoriId||!sessionId)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState,resultCode}=await postTagChangedEvent(sessionId,tag??constants.QV);if(0===resultCode){let textResult=0;if(tag!==constants.QV&&pin&&("X1a"===currentState.state||"X1b"===currentState.state)){const{resultCode:textResultCode}=await postTextEnteredEvent({sessionId,text:pin??""});textResult=textResultCode}if(0===textResult){const{currentState,...response}=await getSession(sessionId);if(0===response.resultCode&¤tState)return{currentState,sessionId,...response}}else if([400,401,403,404,500].includes(resultCode)){console.warn("[APPCONTEXT/CHANGETAG]",resultCode);let referral,storageBirthDate=(0,configuration.wm)("birthDate",void 0);try{referral=window.location.href}catch(err){console.error(err)}fetchSession({memoriID:memori.engineMemoriID??"",password:secret||memoriPwd||memori.secretToken,tag:memori.giverTag,pin:memori.giverPIN,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birthDate||storageBirthDate||void 0,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang),referral}})}else if(currentState)return{currentState,sessionId,resultCode}}}catch(_e){let err=_e;return console.error("[APPCONTEXT/CHANGETAG]",err),Promise.reject(err)}return null};(0,react.useEffect)((()=>()=>{currentDialogState&¤tDialogState?.currentTag===memori.giverTag||(async()=>{sessionId&&memori.giverTag&&memori.giverPIN&&(setHistory([]),await changeTag(memori.engineMemoriID,sessionId,memori.giverTag,memori.giverPIN))})()}),[]);const sendDateChangedEvent=(0,react.useCallback)((async({sessionID,date,state})=>{const session=sessionID??sessionId,dialogState=state??currentDialogState;if(console.log("sendDateChangedEvent",dialogState),!session||!memori.needsDateTime||dialogState?.hints?.length)return;const now=(date?luxon.ou.fromISO(date):luxon.ou.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState,...response}=await postDateChangedEvent(session,now);0===response.resultCode&¤tState&&_setCurrentDialogState((cds=>({...cds,...currentState,hints:currentState.hints?.length?currentState.hints:cds?.hints})))}),[currentDialogState,memori.needsDateTime,sessionId]);(0,react.useEffect)((()=>{if(sessionId&&memori.needsDateTime){sendDateChangedEvent({sessionID:sessionId,state:currentDialogState});let datePolling=setInterval((()=>{sendDateChangedEvent({sessionID:sessionId})}),6e4);return()=>{clearInterval(datePolling)}}}),[memori.needsDateTime,sessionId]);const[userInteractionTimeout,setUserInteractionTimeout]=(0,react.useState)(),timeoutRef=(0,react.useRef)(),clearInteractionTimeout=()=>{userInteractionTimeout&&(clearTimeout(userInteractionTimeout),setUserInteractionTimeout(void 0)),timeoutRef?.current&&(clearTimeout(timeoutRef.current),timeoutRef.current=void 0)},resetInteractionTimeout=()=>{clearInteractionTimeout(),!currentDialogState?.acceptsTimeout||speechSynthesizer||isPlayingAudio||userMessage.length||memoriTyping||listening||setInteractionTimeout()},handleTimeout=async()=>{if(speechSynthesizer||isPlayingAudio||userMessage.length||memoriTyping||listening)resetInteractionTimeout();else if(sessionId&&hasUserActivatedSpeak&¤tDialogState?.acceptsTimeout){const{currentState,...response}=await postTimeoutEvent(sessionId);if(0===response.resultCode&¤tState){const emission=currentState.emission;!instruct&&isMultilanguageEnabled&&userLang!==i18n?.language&&emission&&emission.length>0?translateDialogState({...currentState,emission},userLang).then((ts=>{ts.emission&&speak(ts.emission)})):emission&&emission.length>0&&(pushMessage({text:emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1,generatedByAI:!!currentState.completion}),speak(emission),setCurrentDialogState({...currentState,hints:currentState.hints??("G1"===currentState.state?currentDialogState?.hints:[])}))}}},setInteractionTimeout=()=>{let timeout=currentDialogState?.timeout;if(!timeout){let timeoutLimit=40,timeoutMinLimit=25;if(timeout=Math.floor(Math.random()*(timeoutLimit-timeoutMinLimit))+timeoutMinLimit,currentDialogState?.emission){timeout+=currentDialogState.emission.length/26.5}}let uiTimeout=setTimeout(handleTimeout,1e3*timeout);setUserInteractionTimeout(uiTimeout),timeoutRef.current=uiTimeout};(0,react.useEffect)((()=>{(userMessage.length||isPlayingAudio||memoriTyping)&&clearInteractionTimeout(),sessionId&&!userMessage.length&&resetInteractionTimeout()}),[currentDialogState?.acceptsTimeout,currentDialogState?.timeout,currentDialogState?.state,isPlayingAudio,sessionId,history,userMessage,memoriTyping]),(0,react.useEffect)((()=>()=>{setHasUserActivatedSpeak(!1),setClickedStart(!1),clearInteractionTimeout(),timeoutRef.current=void 0}),[]);const getTTSVoice=(0,react.useCallback)((lang=>{let voice="",voiceLang=(lang??memori.culture?.split("-")?.[0]??i18n.language??"IT").toUpperCase(),voiceType=memori.voiceType;if(memori.enableBoardOfExperts&¤tDialogState?.emitter){experts?.find((e=>e.name===currentDialogState?.emitter))}switch(voiceLang){case"IT":voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":voice=""+("MALE"===voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":voice=""+("MALE"===voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":voice=""+("MALE"===voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":voice=""+("MALE"===voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":voice=""+("MALE"===voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":voice=""+("MALE"===voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":voice=""+("MALE"===voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":voice=""+("MALE"===voiceType?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":voice=""+("MALE"===voiceType?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;default:voice=""+("MALE"===voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return voice}),[memori.voiceType,memori.enableBoardOfExperts,currentDialogState?.emitter,i18n.language,memori.culture]),getCultureCodeByLanguage=lang=>{let voice="";switch((lang||memori.culture?.split("-")?.[0]||i18n.language||"IT").toUpperCase()){case"IT":default:voice="it-IT";break;case"DE":voice="de-DE";break;case"EN":voice="en-GB";break;case"ES":voice="es-ES";break;case"FR":voice="fr-FR";break;case"PT":voice="pt-PT";break;case"UK":voice="uk-UK";break;case"RU":voice="ru-RU";break;case"PL":voice="pl-PL";break;case"FI":voice="fi-FI"}return voice},[phonemesMap,setPhonemesMap]=(0,react.useState)();(0,react.useEffect)((()=>{(async()=>{try{const lexiconReq=await fetch(`${baseUrl||"https://aisuru.com"}/api/lexiconmap`);return await lexiconReq.json()}catch(err){console.error(err)}})().then((lexicon=>{setPhonemesMap(lexicon)}))}),[]);const emitEndSpeakEvent=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},speak=text=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY||preview)return void emitEndSpeakEvent();if(stopListening(),preview)return;if(muteSpeaker||speakerMuted)return memoriSpeaking=!1,setMemoriTyping(!1),emitEndSpeakEvent(),void(continuousSpeech&&setListeningTimeout());audioDestination&&audioDestination.pause();let isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),isIOS=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===audioContext.state)return void audioContext.resume().then((()=>speak(text)));if("closed"===audioContext.state){audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}else if("suspended"===audioContext.state){stopAudio(),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}if(!speechSynthesizer){isIOS||(audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination);let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)}const source=audioContext.createBufferSource();source.addEventListener("ended",(()=>{setIsPlayingAudio(!1),memoriSpeaking=!1})),audioDestination.onAudioEnd=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1,source.disconnect(),emitEndSpeakEvent(),onEndSpeakStartListen()},speechSynthesizer.speakSsmlAsync(`${((text,lang)=>{if(!phonemesMap)return text;const phonemes={...phonemesMap.common??{},...tenant?.id&&phonemesMap[tenant.id]?phonemesMap[tenant.id]:{}};return Object.keys(phonemes).map((word=>({word,phoneme:phonemes[word][lang.toLowerCase()]??phonemes[word].default,caseSensitive:phonemes[word].caseSensitive}))).reduce(((acc,{word,phoneme,caseSensitive})=>acc.replace(new RegExp(`\\b${word}\\b`,caseSensitive?"g":"gi"),`${word}`)),text)})((text=>{const el=document.createElement("textarea");return el.textContent=text,el.innerHTML})((0,utils.h)(text)),userLang.toLowerCase())}`,(result=>{if(result){setIsPlayingAudio(!0),memoriSpeaking=!0;try{audioContext.decodeAudioData(result.audioData,(function(buffer){source.buffer=buffer,source.connect(audioContext.destination),(history.length<1||isSafari&&isIOS)&&source.start(0)})),audioContext.onstatechange=()=>{"suspended"===audioContext.state||"closed"===audioContext.state?(source.disconnect(),setIsPlayingAudio(!1),memoriSpeaking=!1):"interrupted"===audioContext.state&&audioContext.resume()},audioContext.resume(),speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null)}catch(e){console.error("speak error: ",e),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),emitEndSpeakEvent()}}else audioContext.resume(),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()}),(error=>{console.error("speak:",error),window.speechSynthesis.speak(new SpeechSynthesisUtterance(text)),setIsPlayingAudio(!1),memoriSpeaking=!1,emitEndSpeakEvent()})),setMemoriTyping(!1)},stopAudio=()=>{setIsPlayingAudio(!1),memoriSpeaking=!1;try{speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),"closed"!==audioContext.state&&audioContext.close(),audioDestination&&(audioDestination.pause(),audioDestination.close())}catch(e){console.error("stopAudio error: ",e)}};(0,react.useEffect)((()=>{let textarea=document.querySelector("#chat-fieldset textarea");textarea&&textarea.focus()}),[currentDialogState?.emission]);const[transcript,setTranscript]=(0,react.useState)(""),resetTranscript=()=>setTranscript(""),[transcriptTimeout,setTranscriptTimeout]=(0,react.useState)(null),setListeningTimeout=()=>{let timeout=setTimeout((async()=>{clearListening();const message=(0,utils.vw)(transcript);message.length>0&&listening?(sendMessage(message),resetTranscript(),setUserMessage("")):listening&&resetInteractionTimeout()}),1e3*continuousSpeechTimeout);setTranscriptTimeout(timeout)},clearListeningTimeout=()=>{transcriptTimeout&&(clearTimeout(transcriptTimeout),setTranscriptTimeout(null))};(0,react.useEffect)((()=>{clearListeningTimeout(),continuousSpeech&&setListeningTimeout(),resetInteractionTimeout()}),[transcript]);const startListening=()=>{if(AZURE_COGNITIVE_SERVICES_TTS_KEY){clearListening(),setTranscript(""),resetTranscript();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(_stream){setHasUserActivatedListening(!0),speechConfig||(speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang));const audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromDefaultMicrophoneInput();recognizer=new microsoft_cognitiveservices_speech_sdk.SpeechRecognizer(speechConfig,audioConfig),setListening(!0),recognizer.recognized=(_s,e)=>{if(e.result.text)if(e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.RecognizedSpeech){let transcript=e.result.text;if(setTranscript(transcript||""),transcript?.length>0){const transcriptMessage=(0,utils.vw)(transcript);transcriptMessage.length>0&&setUserMessage((msg=>`${msg} ${transcriptMessage}`))}}else e.result.reason===microsoft_cognitiveservices_speech_sdk.ResultReason.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},recognizer.canceled=(_s,e)=>{e.reason===microsoft_cognitiveservices_speech_sdk.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${e.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${e.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),stopListening()},recognizer.sessionStopped=(_s,_e)=>{stopListening()},resetTranscript(),recognizer.startContinuousRecognitionAsync()})).catch(console.error)}catch(error){console.error(error)}}},stopListening=()=>{recognizer&&(recognizer.stopContinuousRecognitionAsync(),recognizer.close(),recognizer=null),setListening(!1)},clearListening=()=>{setHasUserActivatedListening(!1),stopListening(),clearListeningTimeout()},resetUIEffects=()=>{try{clearListening(),clearInteractionTimeout(),setClickedStart(!1),timeoutRef.current=void 0,stopAudio()}catch(e){console.log("Error: resetUIEffects",e)}};(0,react.useEffect)((()=>()=>{resetUIEffects()}),[]),(0,react.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",resetUIEffects),()=>{document.removeEventListener("MemoriResetUIEffects",resetUIEffects)})),[]),(0,react.useEffect)((()=>{"Z0"===currentDialogState?.state&&clearListening()}),[currentDialogState?.state]);const[requestedListening,setRequestedListening]=(0,react.useState)(!1),onEndSpeakStartListen=(0,react.useCallback)((_e=>{isPlayingAudio&&speechSynthesizer&&(speechSynthesizer.close(),speechSynthesizer=null),!continuousSpeech||!hasUserActivatedListening&&requestedListening||(setRequestedListening(!0),startListening())}),[continuousSpeech,hasUserActivatedListening]);(0,react.useEffect)((()=>{history.length>1&&!isPlayingAudio&&continuousSpeech&&(hasUserActivatedListening||!requestedListening)?startListening():isPlayingAudio&&listening&&stopListening()}),[isPlayingAudio]),(0,react.useEffect)((()=>{listening&&(clearListening(),resetTranscript(),setUserMessage(""),startListening())}),[language]);const[sendOnEnter,setSendOnEnter]=(0,react.useState)("keypress");(0,react.useEffect)((()=>{const stored=(0,configuration.wm)("sendOnEnter","keypress");window.innerWidth<=768?setSendOnEnter("click"):setSendOnEnter(stored)}),[]),(0,react.useEffect)((()=>{(0,configuration.A2)("sendOnEnter",sendOnEnter)}),[sendOnEnter]);const[attachmentsMenuOpen,setAttachmentsMenuOpen]=(0,react.useState)(),globalBackground=integrationConfig?.globalBackground,globalBackgroundUrl=globalBackground?`url(${globalBackground})`:null,integrationProperties=integration?{"--memori-chat-bubble-bg":"#fff",...integrationConfig&&!showInstruct?{"--memori-text-color":integrationConfig.textColor??"#000"}:{},...integrationConfig?.buttonBgColor?{"--memori-button-bg":integrationConfig.buttonBgColor,"--memori-primary":integrationConfig.buttonBgColor}:{},...integrationConfig?.buttonTextColor?{"--memori-button-text":integrationConfig.buttonTextColor}:{},...integrationConfig?.blurBackground?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...integrationConfig?.innerBgColor?{"--memori-inner-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig.innerBgAlpha??.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===integrationConfig.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${integrationConfig?.innerBgAlpha??.4})`}:{"--memori-inner-content-pad":"0px"}}:{},integrationStylesheet=`\n ${preview?"#preview,":"WEBSITE_ASSISTANT"===selectedLayout?"":":root,"} .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(integrationProperties).map((([key,value])=>`${key}: ${value};`)).join("\n")}\n }\n `,showAIicon=void 0===integrationConfig?.showAIicon||integrationConfig?.showAIicon,[avatar3dVisible,setAvatar3dVisible]=(0,react.useState)(!1);(0,react.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===selectedLayout||"FULLPAGE"!==selectedLayout)&&setAvatar3dVisible(!0)}),[]);const[gamificationLevel,setGamificationLevel]=(0,react.useState)();(0,react.useEffect)((()=>{memori.engineMemoriID&&(async memoriID=>{let gamificationPoints,unansQuestions;try{const{contentQualityIndex,answerQualityIndex,unansweredQuestions,...cqResp}=await getContentQualityIndexes(memoriID);0===cqResp.resultCode&&(gamificationPoints=contentQualityIndex,unansQuestions=unansweredQuestions)}catch(_e){let err=_e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",err)}return{points:gamificationPoints??0,unansweredQuestions:unansQuestions??0}})(memori.engineMemoriID).then((value=>{setGamificationLevel((points=>{const roundedPoints=Math.round(points),badge=getBadge(roundedPoints);return{points:roundedPoints,badge,pointsForCurrentBadge:getPointsForBadge(badge),nextBadge:getNextBadge(badge)}})(value.points))})).catch(console.error)}),[memori.engineMemoriID]),(0,react.useEffect)((()=>{if(integrationConfig?.seoTitle){let meta=document.createElement("meta");meta.setAttribute("property","og:title"),meta.setAttribute("content",integrationConfig.seoTitle),document.head.append(meta)}if(integrationConfig?.seoDescription){let meta=document.createElement("meta");meta.setAttribute("property","og:description"),meta.setAttribute("content",integrationConfig.seoDescription),document.head.append(meta)}if(integrationConfig?.seoUrl){let meta=document.createElement("meta");meta.setAttribute("property","og:url"),meta.setAttribute("content",integrationConfig.seoUrl),document.head.append(meta)}let image=ogImage||memori.avatarURL;if(integrationConfig?.seoImageShowAvatar&&image){let meta=document.createElement("meta");meta.setAttribute("property","og:image"),meta.setAttribute("content",image),document.head.append(meta)}}),[integrationConfig,memori.avatarURL,ogImage]);const memoriTextEnteredHandler=(0,react.useCallback)((e=>{const{text,waitForPrevious,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued}=e.detail;text&&(waitForPrevious&&!speakerMuted&&(memoriSpeaking||memoriTyping)?setTimeout((()=>{memoriTextEnteredHandler(e)}),1e3):(stopListening(),stopAudio(),sendMessage(text,void 0,void 0,void 0,void 0,hidden,typingText,useLoaderTextAsMsg,hasBatchQueued)))}),[sessionId,isPlayingAudio,memoriTyping,userLang]);(0,react.useEffect)((()=>(document.addEventListener("MemoriTextEntered",memoriTextEnteredHandler),()=>{document.removeEventListener("MemoriTextEntered",memoriTextEnteredHandler)})),[sessionId,userLang]);const onClickStart=(0,react.useCallback)((async session=>{const sessionID=session?.sessionID||sessionId,dialogState=session?.dialogState||currentDialogState;setClickedStart(!0);let memoriAudioElement=document.getElementById("memori-audio"),isSafari=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");memoriAudioElement&&isSafari&&(memoriAudioElement.muted=!1,memoriAudioElement.play().catch((e=>{console.error("error playing intro audio",e)})));let storageBirthDate=(0,configuration.wm)("birthDate",void 0),birth=birthDate||storageBirthDate||void 0;if(sessionID||!minAge||birth){if(!sessionID&&"PUBLIC"!==memori.privacyType&&!memori.secretToken&&!memoriPwd&&!memoriTokens||!sessionID&&gotErrorInOpening)return setAuthModalState("password"),void setClickedStart(!1);if(!sessionID){setClickedStart(!1),setGotErrorInOpening(!1);const session=await fetchSession({memoriID:memori.engineMemoriID,password:secret||memoriPwd||memori.secretToken,tag:personification?.tag,pin:personification?.pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate:birth,additionalInfo:{...additionalInfo||{},loginToken:userToken??loginToken??additionalInfo?.loginToken??authToken,language:getCultureCodeByLanguage(userLang)}});return void(session?.dialogState?(setHistory([]),translateDialogState(session.dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))):await onClickStart(session||void 0))}if(initialSessionID){const{currentState,...response}=await getSession(sessionID);if(0!==response.resultCode||!currentState)return console.debug("session expired, opening new session"),setGotErrorInOpening(!0),setSessionId(void 0),setClickedStart(!1),void await onClickStart();if(setHistory([]),position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState}),instruct&&memori.giverTag&¤tDialogState?.currentTag!==memori.giverTag)try{console.debug("change tag #0"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,memori.giverTag,memori.giverPIN);if(!session||0!==session.resultCode)throw console.error("session #1",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #2",e),reopenSession(!0,memori?.secretToken,void 0,memori?.giverTag,memori?.giverPIN,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(!instruct&&personification&¤tDialogState?.currentTag!==personification.tag)try{console.debug("change tag #3"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,personification.tag,personification.pin);if(!session||0!==session.resultCode)throw console.error("session #4",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #5",e),reopenSession(!0,memori?.secretToken,void 0,personification.tag,personification.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}else if(instruct||personification||currentDialogState?.currentTag===constants.QV)translateDialogState(currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}));else try{console.debug("change tag #6"),await changeTag(memori.engineMemoriID,sessionID,"-");const session=await changeTag(memori.engineMemoriID,sessionID,constants.QV);if(!session||0!==session.resultCode)throw console.error("session #7",session),new Error("No session");translateDialogState(session.currentState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}catch(e){console.error("session #8",e),reopenSession(!0,memori?.secretToken,void 0,void 0,void 0,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birth).then((()=>{setHasUserActivatedSpeak(!0)}))}position&&applyPosition(position,sessionID),memori.needsDateTime&&sendDateChangedEvent({sessionID,state:currentState})}else setHistory([]),translateDialogState(dialogState,userLang).then((ts=>{ts.emission&&speak(ts.emission)})).finally((()=>{setHasUserActivatedSpeak(!0)}))}else setShowAgeVerification(!0),setClickedStart(!1)}),[memoriPwd,memori,memoriTokens,birthDate,sessionId,userLang,position]);(0,react.useEffect)((()=>{const targetNode=document.querySelector(`memori-client[memoriname="${memori.name}"]`)||document.querySelector(`memori-client[memoriid="${memori.memoriID}"]`)||document.querySelector("memori-client");if(!targetNode)return;const observer=new MutationObserver(((mutationList,_observer)=>{for(const mutation of mutationList)"attributes"===mutation.type&&"authtoken"===mutation.attributeName?.toLowerCase()&&("MEMORI-CLIENT"===mutation.target.nodeName?(setLoginToken(mutation.target.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0):(setLoginToken(mutation.target?.parentElement?.getAttribute("authtoken")||void 0),userToken=mutation.target.getAttribute("authtoken")||void 0))}));return observer.observe(targetNode,{attributes:!0,childList:!1,subtree:!1}),()=>{observer.disconnect()}}),[]);const[experts,setExperts]=(0,react.useState)(),fetchExperts=(0,react.useCallback)((async()=>{if(sessionId&&memori?.enableBoardOfExperts)try{const{experts,count,...resp}=await getExpertReferences(sessionId);0===resp.resultCode?setExperts(experts):console.warn("Error fetching experts",resp)}catch(err){console.warn(err)}}),[sessionId,memori?.enableBoardOfExperts]);(0,react.useEffect)((()=>{fetchExperts()}),[sessionId,fetchExperts]);const showFullHistory=void 0===showOnlyLastMessages?"TOTEM"!==layout&&"WEBSITE_ASSISTANT"!==layout:!showOnlyLastMessages,headerProps={memori,tenant,history,showShare:showShare??integrationConfig?.showShare??!0,position,setShowPositionDrawer,setShowSettingsDrawer,setShowKnownFactsDrawer,setShowExpertsDrawer,showSpeaker:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,speakerMuted:muteSpeaker||speakerMuted,setSpeakerMuted:mute=>{if(speakerMuted=!!mute,setMuteSpeaker(mute),(0,configuration.A2)("muteSpeaker",!!mute),mute)stopAudio();else{audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination)}},showSettings,hasUserActivatedSpeak,showReload:"TOTEM"===selectedLayout,showClear,clearHistory:()=>setHistory((h=>h.slice(-1))),showLogin,setShowLoginDrawer,loginToken,user,sessionID:sessionId},avatarProps={memori,integration,integrationConfig,tenant,instruct,avatar3dVisible,setAvatar3dVisible,hasUserActivatedSpeak,isPlayingAudio:isPlayingAudio&&!muteSpeaker,loading:!!memoriTyping,baseUrl,apiUrl},startPanelProps={memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer:()=>setShowPositionDrawer(!0),integrationConfig,instruct,sessionId,clickedStart,onClickStart,initializeTTS:()=>{if(!AZURE_COGNITIVE_SERVICES_TTS_KEY)return;speechConfig=microsoft_cognitiveservices_speech_sdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY,"eastus"),speechConfig.speechSynthesisLanguage=getCultureCodeByLanguage(userLang),speechConfig.speechSynthesisVoiceName=getTTSVoice(userLang),speechConfig.speechRecognitionLanguage=getCultureCodeByLanguage(userLang),(0,utils.xZ)()&&(speechConfig.speechSynthesisOutputFormat=microsoft_cognitiveservices_speech_sdk.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),audioContext=new es2019_module.Hm;let buffer=audioContext.createBuffer(1,1e4,22050),source=audioContext.createBufferSource();source.buffer=buffer,source.connect(audioContext.destination),audioDestination=new microsoft_cognitiveservices_speech_sdk.SpeakerAudioDestination;let audioConfig=microsoft_cognitiveservices_speech_sdk.AudioConfig.fromSpeakerOutput(audioDestination);speechSynthesizer=new microsoft_cognitiveservices_speech_sdk.SpeechSynthesizer(speechConfig,audioConfig)},isUserLoggedIn:!!loginToken&&!!user?.userID,showLogin,setShowLoginDrawer,user},chatProps={memori,sessionID:sessionId||"",tenant,translateTo:isMultilanguageEnabled&&userLang.toUpperCase()!==(memori.culture?.split("-")?.[0]??i18n.language??"IT")?.toUpperCase()?userLang:void 0,baseUrl,apiUrl,layout,memoriTyping,typingText,showTypingText,history:showFullHistory?history:history.slice(-2),authToken:loginToken??userToken??additionalInfo?.loginToken??authToken,dialogState:currentDialogState,setDialogState:setCurrentDialogState,pushMessage,simulateUserPrompt:(text,translatedText)=>{stopListening(),stopAudio(),sendMessage(text,void 0,void 0,!1,translatedText)},showDates,showContextPerLine,showAIicon,client,selectReceiverTag:async tag=>{if(sessionId)try{const{currentState,...resp}=await postTagChangedEvent(sessionId,tag);if(0===resp.resultCode)if(pushMessage({text:tag,fromUser:!0}),"X4"===currentState.state&&memori.giverTag){const{currentState,...resp}=await client.postTagChangedEvent(sessionId,memori.giverTag);0===resp.resultCode?(setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1})):(console.error(resp),dist.ZP.error(t((0,error.r)(resp.resultCode))))}else setCurrentDialogState(currentState),currentState.emission&&pushMessage({text:currentState.emission,emitter:currentState.emitter,media:currentState.media,fromUser:!1});else console.error(resp,tag,currentDialogState?.knownTags?.[tag]),dist.ZP.error(t((0,error.r)(resp.resultCode)))}catch(e){let err=e;console.error(err),dist.ZP.error(err.message)}},preview,sendOnEnter,setSendOnEnter,microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen,setAttachmentsMenuOpen,instruct,showInputs,showMicrophone:!!AZURE_COGNITIVE_SERVICES_TTS_KEY,userMessage,onChangeUserMessage:value=>{if(!value||"\n"===value||""===value.trim())return setUserMessage(""),void resetInteractionTimeout();setUserMessage(value),clearInteractionTimeout()},sendMessage:msg=>{stopAudio(),stopListening(),sendMessage(msg),setUserMessage(""),resetTranscript()},stopListening:clearListening,startListening,stopAudio,resetTranscript,listening,isPlayingAudio,customMediaRenderer,user,userAvatar,experts},integrationBackground=integration&&globalBackgroundUrl?(0,jsx_runtime.jsx)("div",{className:"memori--global-background",children:(0,jsx_runtime.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:globalBackgroundUrl}})}):(0,jsx_runtime.jsx)("div",{className:"memori--global-background no-background-image"}),integrationStyle=integration?(0,jsx_runtime.jsx)("style",{dangerouslySetInnerHTML:{__html:integrationStylesheet}}):null,changeModeProps={canInstruct:!!memori.giverTag,instruct:!!instruct,onChangeMode:mode=>{setInstruct("instruct"===mode),setHasUserActivatedSpeak(!1),setClickedStart(!1)}},poweredBy=(0,jsx_runtime.jsx)(PoweredBy.Z,{tenant,userLang,integrationID:integration?.integrationID,memoriHash:`${memori.ownerTenantName}-${memori.ownerUserName}-${memori.name}`}),Layout=customLayout||("TOTEM"===selectedLayout?layouts_Totem:"CHAT"===selectedLayout?layouts_Chat:"FULLPAGE"===selectedLayout?layouts_FullPage:"WEBSITE_ASSISTANT"===selectedLayout?layouts_WebsiteAssistant:layouts_FullPage);return(0,jsx_runtime.jsxs)("div",{className:classnames_default()("memori","memori-widget",`memori-layout-${layout.toLowerCase()}`,`memori-controls-${controlsPosition.toLowerCase()}`,`memori--avatar-${integrationConfig?.avatar||"default"}`,{"memori--preview":preview,"memori--embed":embed,"memori--with-integration":integration,"memori--with-speechkey":!!AZURE_COGNITIVE_SERVICES_TTS_KEY,"memori--active":hasUserActivatedSpeak,"memori--hide-emissions":hideEmissions,"memori--has-active-session":!!sessionId}),"data-memori-name":memori?.name,"data-memori-id":memori?.engineMemoriID,"data-memori-secondary-id":memori?.memoriID,"data-memori-session-id":sessionId,"data-memori-integration":integration?.integrationID,"data-memori-engine-state":JSON.stringify({...currentDialogState,sessionID:sessionId}),style:{height},children:[(0,jsx_runtime.jsx)(Layout,{Header:Header.Z,headerProps,Avatar:Avatar.Z,avatarProps,Chat:Chat_Chat.Z,chatProps,StartPanel:StartPanel.Z,startPanelProps,integrationStyle,integrationBackground,ChangeMode:ChangeMode.Z,changeModeProps,poweredBy,sessionId,hasUserActivatedSpeak,showInstruct,loading}),(0,jsx_runtime.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),isClient&&(0,jsx_runtime.jsx)(Auth.Z,{withModal:!0,pwdOrTokens:authModalState,openModal:!!authModalState,setPwdOrTokens:setAuthModalState,showTokens:"SECRET"===memori.privacyType,onFinish:async values=>{values.password&&setMemoriPwd(values.password),values.password&&(memoriPassword=values.password),values.tokens&&setMemoriTokens(values.tokens),reopenSession(!sessionId,values.password,values.tokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setAuthModalState(null),setGotErrorInOpening(!0)}))},minimumNumberOfRecoveryTokens:memori?.minimumNumberOfRecoveryTokens??1}),isClient&&(0,jsx_runtime.jsx)(AgeVerificationModal.Z,{visible:showAgeVerification,minAge,onClose:birthDate=>{birthDate?(setBirthDate(birthDate),(0,configuration.A2)("birthDate",birthDate),reopenSession(!sessionId,memoriPassword||memoriPwd||memori?.secretToken,memoriTokens,instruct?memori.giverTag:personification?.tag,instruct?memori.giverPIN:personification?.pin,{PATHNAME:window.location.pathname,ROUTE:window.location.pathname?.split("/")?.pop()||"",...initialContextVars||{}},initialQuestion,birthDate).then((state=>{setShowAgeVerification(!1),setAuthModalState(null),onClickStart(state||void 0)})).catch((()=>{setShowAgeVerification(!1),setGotErrorInOpening(!0)}))):(setShowAgeVerification(!1),setClickedStart(!1))}}),showSettingsDrawer&&(0,jsx_runtime.jsx)(SettingsDrawer.Z,{layout:selectedLayout,open:!!showSettingsDrawer,onClose:()=>setShowSettingsDrawer(!1),microphoneMode:continuousSpeech?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout,setMicrophoneMode:mode=>setContinuousSpeech("CONTINUOUS"===mode),setContinuousSpeechTimeout,controlsPosition,setControlsPosition,hideEmissions,setHideEmissions,additionalSettings}),showPositionDrawer&&(0,jsx_runtime.jsx)(PositionDrawer.Z,{open:!!showPositionDrawer,venue:position,setVenue:venue=>{_setPosition(venue),applyPosition(venue)},onClose:position=>{position&&applyPosition(position),setShowPositionDrawer(!1)}}),showKnownFactsDrawer&&sessionId&&(0,jsx_runtime.jsx)(KnownFacts.Z,{apiURL:apiUrl,memori,sessionID:sessionId,visible:showKnownFactsDrawer,closeDrawer:()=>setShowKnownFactsDrawer(!1)}),showExpertsDrawer&&!!experts&&(0,jsx_runtime.jsx)(ExpertsDrawer.Z,{apiUrl,baseUrl,tenant,experts,open:showExpertsDrawer,onClose:()=>setShowExpertsDrawer(!1)}),showLoginDrawer&&tenant?.id&&(0,jsx_runtime.jsx)(LoginDrawer.Z,{tenant,apiUrl,open:!!showLoginDrawer,user,loginToken,onClose:()=>setShowLoginDrawer(!1),onLogin:(user,token)=>{setUser(user),setLoginToken(token),userToken=token,setShowLoginDrawer(!1),(0,configuration.A2)("loginToken",token)},onLogout:()=>{loginToken&&client.backend.userLogout(loginToken).then((()=>{setShowLoginDrawer(!1),setUser(void 0),setLoginToken(void 0),userToken=void 0,(0,configuration.gj)("loginToken")}))}})]})};MemoriWidget.displayName="MemoriWidget";const MemoriWidget_MemoriWidget=MemoriWidget;try{MemoriWidget.displayName="MemoriWidget",MemoriWidget.__docgenInfo={description:"",displayName:"MemoriWidget",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},memoriConfigs:{defaultValue:null,description:"",name:"memoriConfigs",required:!1,type:{name:"MemoriConfig[]"}},memoriLang:{defaultValue:null,description:"",name:"memoriLang",required:!1,type:{name:"string"}},multilingual:{defaultValue:null,description:"",name:"multilingual",required:!1,type:{name:"boolean"}},integration:{defaultValue:null,description:"",name:"integration",required:!1,type:{name:"Integration"}},layout:{defaultValue:{value:"DEFAULT"},description:"",name:"layout",required:!1,type:{name:"enum",value:[{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'}]}},customLayout:{defaultValue:null,description:"",name:"customLayout",required:!1,type:{name:"FC"}},showShare:{defaultValue:null,description:"",name:"showShare",required:!1,type:{name:"boolean"}},showInstruct:{defaultValue:{value:"false"},description:"",name:"showInstruct",required:!1,type:{name:"boolean"}},showInputs:{defaultValue:{value:"true"},description:"",name:"showInputs",required:!1,type:{name:"boolean"}},showDates:{defaultValue:{value:"false"},description:"",name:"showDates",required:!1,type:{name:"boolean"}},showContextPerLine:{defaultValue:{value:"false"},description:"",name:"showContextPerLine",required:!1,type:{name:"boolean"}},showSettings:{defaultValue:{value:"true"},description:"",name:"showSettings",required:!1,type:{name:"boolean"}},showClear:{defaultValue:{value:"false"},description:"",name:"showClear",required:!1,type:{name:"boolean"}},showOnlyLastMessages:{defaultValue:null,description:"",name:"showOnlyLastMessages",required:!1,type:{name:"boolean"}},showTypingText:{defaultValue:{value:"false"},description:"",name:"showTypingText",required:!1,type:{name:"boolean"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},preview:{defaultValue:{value:"false"},description:"",name:"preview",required:!1,type:{name:"boolean"}},embed:{defaultValue:{value:"false"},description:"",name:"embed",required:!1,type:{name:"boolean"}},height:{defaultValue:{value:"100vh"},description:"",name:"height",required:!1,type:{name:"string | number"}},secret:{defaultValue:null,description:"",name:"secret",required:!1,type:{name:"string"}},baseUrl:{defaultValue:{value:"https://aisuru.com"},description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:{value:"https://backend.memori.ai"},description:"",name:"apiUrl",required:!1,type:{name:"string"}},initialContextVars:{defaultValue:null,description:"",name:"initialContextVars",required:!1,type:{name:"{ [key: string]: string; }"}},initialQuestion:{defaultValue:null,description:"",name:"initialQuestion",required:!1,type:{name:"string"}},ogImage:{defaultValue:null,description:"",name:"ogImage",required:!1,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!1,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},personification:{defaultValue:null,description:"",name:"personification",required:!1,type:{name:"{ name?: string; tag: string; pin: string; }"}},authToken:{defaultValue:null,description:"",name:"authToken",required:!1,type:{name:"string"}},AZURE_COGNITIVE_SERVICES_TTS_KEY:{defaultValue:null,description:"",name:"AZURE_COGNITIVE_SERVICES_TTS_KEY",required:!1,type:{name:"string"}},defaultSpeakerActive:{defaultValue:{value:"true"},description:"",name:"defaultSpeakerActive",required:!1,type:{name:"boolean"}},onStateChange:{defaultValue:null,description:"",name:"onStateChange",required:!1,type:{name:"((state?: DialogState) => void)"}},additionalInfo:{defaultValue:null,description:"",name:"additionalInfo",required:!1,type:{name:"({ loginToken?: string; language?: string; referral?: string | undefined; } & { [key: string]: string; }) | undefined"}},customMediaRenderer:{defaultValue:null,description:"",name:"customMediaRenderer",required:!1,type:{name:"((mimeType: string) => Element | null)"}},additionalSettings:{defaultValue:null,description:"",name:"additionalSettings",required:!1,type:{name:"Element | null"}},userAvatar:{defaultValue:null,description:"",name:"userAvatar",required:!1,type:{name:"string | Element"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"]={docgenInfo:MemoriWidget.__docgenInfo,name:"MemoriWidget",path:"src/components/MemoriWidget/MemoriWidget.tsx#MemoriWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PositionDrawer/PositionDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Drawer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PositionDrawer=({open,onClose,venue,setVenue})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori-position-drawer",open,onClose:()=>onClose(venue),title:t("widget.position")||"Position",animated:!1,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__.Z,{venue,setVenue,showUncertainty:!1})})};PositionDrawer.displayName="PositionDrawer";const __WEBPACK_DEFAULT_EXPORT__=PositionDrawer;try{PositionDrawer.displayName="PositionDrawer",PositionDrawer.__docgenInfo={description:"",displayName:"PositionDrawer",props:{open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"]={docgenInfo:PositionDrawer.__docgenInfo,name:"PositionDrawer",path:"src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PoweredBy/PoweredBy.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PoweredBy=({tenant,userLang="en",integrationID,memoriHash})=>{const tenantId="memorytwin"===tenant?.theme?"memorytwin":"twincreator"===tenant?.theme?"twincreator":"aisuru";return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div",{className:"memori--powered-by",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img",{src:`https://aisuru.com/images/${tenantId}/logo.png`,alt:""}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("a",{href:`https://memori.ai/${"it"===userLang?.toLowerCase()?"it":"en"}${integrationID?`?integrationID=${integrationID}`:""}${memoriHash?`${integrationID?"&":"?"}memori=${memoriHash}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})};PoweredBy.displayName="PoweredBy";const __WEBPACK_DEFAULT_EXPORT__=PoweredBy;try{PoweredBy.displayName="PoweredBy",PoweredBy.__docgenInfo={description:"",displayName:"PoweredBy",props:{tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},userLang:{defaultValue:{value:"en"},description:"",name:"userLang",required:!1,type:{name:"string"}},integrationID:{defaultValue:null,description:"",name:"integrationID",required:!1,type:{name:"string"}},memoriHash:{defaultValue:null,description:"",name:"memoriHash",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PoweredBy/PoweredBy.tsx#PoweredBy"]={docgenInfo:PoweredBy.__docgenInfo,name:"PoweredBy",path:"src/components/PoweredBy/PoweredBy.tsx#PoweredBy"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/StartPanel/StartPanel.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./src/helpers/media.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Tooltip.tsx"),_helpers_translations__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/helpers/translations.ts"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Translation__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Translation.tsx"),_helpers_constants__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/helpers/constants.ts"),_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx"),_icons_AI__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/components/icons/AI.tsx"),_icons_Group__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/components/icons/Group.tsx"),_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/DeepThought.tsx"),_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/CompletionProviderStatus/CompletionProviderStatus.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/react/jsx-runtime.js");const StartPanel=({memori,tenant,gamificationLevel,language,userLang,setUserLang,baseUrl,apiUrl,position,openPositionDrawer,integrationConfig,instruct=!1,clickedStart,onClickStart,initializeTTS,_TEST_forceProviderStatus,isUserLoggedIn=!1,user,showLogin=!1,setShowLoginDrawer})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_11__.$)(),[translatedDescription,setTranslatedDescription]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(memori.description),[showTranslation,setShowTranslation]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!0);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{(i18n.language?.toUpperCase()??"IT")!==(language?.toUpperCase()??"IT")&&memori.description?.length&&(0,_helpers_translations__WEBPACK_IMPORTED_MODULE_12__.i)(memori.description,i18n.language?.toUpperCase()??"IT",language,baseUrl).then((value=>{setTranslatedDescription(value.text)})).catch(console.error)}),[i18n.language,language,memori.description,baseUrl]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--start-panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"cover",tenantID:tenant?.id,resourceURI:memori.coverURL,baseURL:baseUrl,apiURL:apiUrl})}"), url("${(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"cover",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})}")`},children:[!!gamificationLevel?.badge?.length&&!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--gamification-badge",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{"aria-label":`${t("gamification.level")} ${gamificationLevel.badge}, ${gamificationLevel.points} ${t("gamification.points")}`,children:gamificationLevel.badge})})}),!!memori.enableCompletions&&!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--completions-enabled",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("completionsEnabled"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{"aria-label":t("completionsEnabled")||"Completions",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_AI__WEBPACK_IMPORTED_MODULE_6__.default,{})})})}),!!memori.enableBoardOfExperts&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--board-of-experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("boardOfExperts"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{"aria-label":t("boardOfExperts")||"Board of Experts",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Group__WEBPACK_IMPORTED_MODULE_7__.default,{})})})}),!!memori.nsfw&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("div",{className:"memori--nsfw",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("nsfw"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{title:t("nsfw")||"NSFW",children:"๐Ÿ”ž"})})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("picture",{className:"memori--avatar",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("source",{src:memori.avatarURL??(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("img",{alt:memori.name,src:memori.avatarURL&&memori.avatarURL.length>0?(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"avatar",tenantID:tenant?.id,resourceURI:memori.avatarURL,baseURL:baseUrl,apiURL:apiUrl}):(0,_helpers_media__WEBPACK_IMPORTED_MODULE_13__.v)({type:"avatar",tenantID:tenant?.id,baseURL:baseUrl,apiURL:apiUrl})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("h2",{className:"memori--title",children:memori.name}),memori.needsPosition&&!position&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--needsPosition",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t("write_and_speak.requirePosition")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,onClick:()=>openPositionDrawer(),className:"memori--start-button",children:t("widget.position")})]}),(memori.needsPosition&&position||!memori.needsPosition)&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--description",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("p",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("span",{className:"memori--description-text",children:translatedDescription&&showTranslation?translatedDescription:memori.description}),translatedDescription!==memori.description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,className:"memori--translation-toggle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_Translation__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>{setShowTranslation((show=>!show))},children:t(showTranslation?"showOriginalText":"showTranslatedText")})]}),integrationConfig?.multilanguage&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--language-chooser",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("label",{id:"user-lang-pref-label",htmlFor:"user-lang-pref",children:t("write_and_speak.iWantToTalkToIn",{name:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("select",{id:"user-lang-pref",className:"memori-select--button",value:(userLang??i18n.language).toUpperCase(),"aria-labelledby":"user-lang-pref-label",onChange:e=>{setUserLang(e.target.value)},children:_helpers_constants__WEBPACK_IMPORTED_MODULE_4__.cG.map((lang=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("option",{value:lang.value,"aria-label":lang.label,children:lang.label},lang.value)))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,disabled:!!memori.blockedUntil&&!memori.isGiver,loading:clickedStart,onClick:_e=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}initializeTTS&&initializeTTS(),onClickStart&&onClickStart()},className:"memori--start-button",children:t("write_and_speak."+(instruct?"instructButton":"tryMeButton"))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_CompletionProviderStatus_CompletionProviderStatus__WEBPACK_IMPORTED_MODULE_9__.Z,{provider:memori.completionProvider,forceStatus:_TEST_forceProviderStatus}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{className:"memori--start-description",children:t(instruct?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),!!memori.blockedUntil&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_BlockedMemoriBadge_BlockedMemoriBadge__WEBPACK_IMPORTED_MODULE_5__.Z,{memoriName:memori.name,blockedUntil:memori.blockedUntil,showGiverInfo:memori.isGiver,showTitle:!0,marginLeft:!0}),!!memori.enableDeepThought&&!instruct&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsxs)("div",{className:"memori--deep-thought-disclaimer",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Tooltip__WEBPACK_IMPORTED_MODULE_1__.Z,{align:"left",content:t("deepThoughtHelper"),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_icons_DeepThought__WEBPACK_IMPORTED_MODULE_8__.default,{})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("h2",{children:t(isUserLoggedIn&&user?.pAndCUAccepted?"deepThoughtDisclaimerTitle":"deepThought")}),isUserLoggedIn&&!user?.pAndCUAccepted&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t("deepThoughtPreDisclaimerNotAllowed")}),!isUserLoggedIn&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:t("deepThoughtPreDisclaimerUnlogged")}),!isUserLoggedIn&&showLogin&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{outlined:!0,padded:!1,onClick:()=>setShowLoginDrawer(!0),children:"Login"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_10__.jsx)("p",{className:"memori--deep-thought-disclaimer-text",children:t("deepThoughtDisclaimer")})]})]})]})};StartPanel.displayName="StartPanel";const __WEBPACK_DEFAULT_EXPORT__=StartPanel;try{StartPanel.displayName="StartPanel",StartPanel.__docgenInfo={description:"",displayName:"StartPanel",props:{memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},gamificationLevel:{defaultValue:null,description:"",name:"gamificationLevel",required:!1,type:{name:"GamificationLevel"}},language:{defaultValue:null,description:"",name:"language",required:!1,type:{name:"string"}},userLang:{defaultValue:null,description:"",name:"userLang",required:!1,type:{name:"string"}},setUserLang:{defaultValue:null,description:"",name:"setUserLang",required:!0,type:{name:"(lang: string) => void"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!1,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!1,type:{name:"string"}},position:{defaultValue:null,description:"",name:"position",required:!1,type:{name:"Venue"}},openPositionDrawer:{defaultValue:null,description:"",name:"openPositionDrawer",required:!0,type:{name:"() => void"}},integrationConfig:{defaultValue:null,description:"",name:"integrationConfig",required:!1,type:{name:"{ [key: string]: any; }"}},instruct:{defaultValue:{value:"false"},description:"",name:"instruct",required:!1,type:{name:"boolean"}},sessionId:{defaultValue:null,description:"",name:"sessionId",required:!1,type:{name:"string"}},clickedStart:{defaultValue:null,description:"",name:"clickedStart",required:!1,type:{name:"boolean"}},onClickStart:{defaultValue:null,description:"",name:"onClickStart",required:!1,type:{name:"(() => void)"}},initializeTTS:{defaultValue:null,description:"",name:"initializeTTS",required:!1,type:{name:"(() => void)"}},_TEST_forceProviderStatus:{defaultValue:null,description:"",name:"_TEST_forceProviderStatus",required:!1,type:{name:"string"}},isUserLoggedIn:{defaultValue:{value:"false"},description:"",name:"isUserLoggedIn",required:!1,type:{name:"boolean"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},showLogin:{defaultValue:{value:"false"},description:"",name:"showLogin",required:!1,type:{name:"boolean"}},setShowLoginDrawer:{defaultValue:null,description:"",name:"setShowLoginDrawer",required:!0,type:{name:"(show: boolean) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/StartPanel/StartPanel.tsx#StartPanel"]={docgenInfo:StartPanel.__docgenInfo,name:"StartPanel",path:"src/components/StartPanel/StartPanel.tsx#StartPanel"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?.latitude&&venue?.longitude?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>i?getPlaceName(i):"",placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",outlined:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3})}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3})}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'ยฉ OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronLeft.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronLeft=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M15 18L9 12 15 6"})});ChevronLeft.displayName="ChevronLeft";const __WEBPACK_DEFAULT_EXPORT__=ChevronLeft;try{ChevronLeft.displayName="ChevronLeft",ChevronLeft.__docgenInfo={description:"",displayName:"ChevronLeft",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronLeft.tsx#ChevronLeft"]={docgenInfo:ChevronLeft.__docgenInfo,name:"ChevronLeft",path:"src/components/icons/ChevronLeft.tsx#ChevronLeft"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronRight.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronRight=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9 18L15 12 9 6"})});ChevronRight.displayName="ChevronRight";const __WEBPACK_DEFAULT_EXPORT__=ChevronRight;try{ChevronRight.displayName="ChevronRight",ChevronRight.__docgenInfo={description:"",displayName:"ChevronRight",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronRight.tsx#ChevronRight"]={docgenInfo:ChevronRight.__docgenInfo,name:"ChevronRight",path:"src/components/icons/ChevronRight.tsx#ChevronRight"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Delete.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Delete=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});Delete.displayName="Delete";const __WEBPACK_DEFAULT_EXPORT__=Delete;try{Delete.displayName="Delete",Delete.__docgenInfo={description:"",displayName:"Delete",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Delete.tsx#Delete"]={docgenInfo:Delete.__docgenInfo,name:"Delete",path:"src/components/icons/Delete.tsx#Delete"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Plus.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Plus=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"})]});Plus.displayName="Plus";const __WEBPACK_DEFAULT_EXPORT__=Plus;try{Plus.displayName="Plus",Plus.__docgenInfo={description:"",displayName:"Plus",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Plus.tsx#Plus"]={docgenInfo:Plus.__docgenInfo,name:"Plus",path:"src/components/icons/Plus.tsx#Plus"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Translation.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Translation=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4c-1.3-3.2-4.3-5.4-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z"})]});Translation.displayName="Translation";const __WEBPACK_DEFAULT_EXPORT__=Translation;try{Translation.displayName="Translation",Translation.__docgenInfo={description:"",displayName:"Translation",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Translation.tsx#Translation"]={docgenInfo:Translation.__docgenInfo,name:"Translation",path:"src/components/icons/Translation.tsx#Translation"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Warning.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Warning=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});Warning.displayName="Warning";const __WEBPACK_DEFAULT_EXPORT__=Warning;try{Warning.displayName="Warning",Warning.__docgenInfo={description:"",displayName:"Warning",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Warning.tsx#Warning"]={docgenInfo:Warning.__docgenInfo,name:"Warning",path:"src/components/icons/Warning.tsx#Warning"})}catch(__react_docgen_typescript_loader_error){}},"?875c":()=>{},"?f824":()=>{},"?a523":()=>{},"?540f":()=>{},"?71f6":()=>{},"?3dbe":()=>{},"?c417":()=>{}}]); \ No newline at end of file diff --git a/514.ce59fd2d.iframe.bundle.js b/514.7f3a43db.iframe.bundle.js similarity index 63% rename from 514.ce59fd2d.iframe.bundle.js rename to 514.7f3a43db.iframe.bundle.js index e881c9ac..65c117b2 100644 --- a/514.ce59fd2d.iframe.bundle.js +++ b/514.7f3a43db.iframe.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[514],{"./src/components/LoginDrawer/LoginDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),react_i18next__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),_helpers_error__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/helpers/error.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const mailRegEx=/^\w+([.-]?[+]?\w+)*@\w+([.-]?\w+)*(\.\w{2,})+$/,LoginDrawer=({open=!1,onClose,onLogin,onLogout,user,loginToken,tenant,apiUrl,__TEST__needMissingData=!1})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)(),lang="it"===i18n.language?"it":"en",client=(0,_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_5__.Z)(apiUrl),{userLogin,updateUser}=client.backend,[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[needsMissingData,setNeedsMissingData]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(__TEST__needMissingData?{token:"token",birthDate:!0,tnCAndPPAccepted:!0}:{}),[error,setError]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),[redirectTo,setRedirectTo]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{setRedirectTo(window.location.href)}),[]);const isUserLoggedIn=user?.userID&&loginToken;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__.Z,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori--login-drawer",{"memori--login-drawer--logged":isUserLoggedIn}),title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h2",{className:"memori--login-drawer--title",children:isUserLoggedIn?t("login.loggedDrawerTitle",{name:user.userName}):t("login.loginDrawerTitle")}),children:isUserLoggedIn?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--login-drawer--logged",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,onClick:()=>{onLogout()},children:t("login.logout")})}):needsMissingData?.token?.length?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h3",{children:t("login.missingData")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:t("login.missingDataHelper")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{e.preventDefault();const form=e.currentTarget,birthDate=form.birthDate?.value,tnCAndPPAccepted=form.tnCAndPPAccepted?.checked,pAndCUAccepted=form.pAndCUAccepted?.checked;if(!user?.userID||!needsMissingData?.token)return;if(!birthDate||!tnCAndPPAccepted)return void setError(t("missingData"));let newUser={userID:user.userID,birthDate:user?.birthDate||!needsMissingData.birthDate?void 0:birthDate,tnCAndPPAccepted:tnCAndPPAccepted||user?.tnCAndPPAccepted,tnCAndPPAcceptanceDate:tnCAndPPAccepted?(new Date).toISOString():void 0,pAndCUAccepted:pAndCUAccepted||user?.pAndCUAccepted,pAndCUAcceptanceDate:pAndCUAccepted?(new Date).toISOString():void 0};const{user:patchedUser,...resp}=await updateUser(needsMissingData.token,user.userID,newUser);0!==resp.resultCode?(console.error(resp),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(resp.resultCode),{ns:"common"})),setError(resp.resultMessage)):(react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.success(t("success")),onLogin(patchedUser||newUser,needsMissingData.token))},children:[needsMissingData.birthDate&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{htmlFor:"#birthDate",children:[t("login.birthDate"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:t("login.birthDateHelper")})})]}),needsMissingData?.tnCAndPPAccepted&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{className:"memori-checkbox",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",className:"memori-checkbox--input"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--text",children:[t("login.privacyLabel")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`https://memori.ai/${lang}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:t("login.privacyAndCookiePolicy")})," ",t("login.and")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`https://memori.ai/${lang}/tos`,target:"_blank",rel:"noopener noreferrer",children:t("login.termsOfService")})]})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{className:"memori-checkbox",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",defaultChecked:user?.pAndCUAccepted,className:"memori-checkbox--input"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--text",children:[t("login.pAndCUAccepted")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("em",{children:["(",t("login.optional"),")"]})})]})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:t("login.goToAccountToChangeYourPreferences")})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:t("login.deepThoughtExplaination")})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,loading,children:t("login.save")})]})]}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:e=>{e.preventDefault();const form=e.currentTarget,userNameOrEmail=form.userNameOrEmail.value,password=form.password.value,user=mailRegEx.test(userNameOrEmail)?{tenant:tenant?.id,eMail:userNameOrEmail,password}:{tenant:tenant?.id,userName:userNameOrEmail,password};setLoading(!0),setError(null),userLogin(user).then((data=>{0!==data.resultCode?(console.error(data),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(data.resultCode),{ns:"common"})),setError(data.resultMessage)):data.user&&data.token&&(onLogin(data.user,data.token),data.user?.tnCAndPPAccepted&&data.user?.birthDate||setNeedsMissingData({token:data.token,birthDate:!data.user?.birthDate,tnCAndPPAccepted:!data.user?.tnCAndPPAccepted}))})).catch((err=>{console.error("[LOGIN]",err),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.error(err),err.message&&setError(err.message)})).finally((()=>{setLoading(!1)}))},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{htmlFor:"#userNameOrEmail",children:[t("login.userNameOrEmail"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{id:"userNameOrEmail",name:"userNameOrEmail",required:!0,autoComplete:"email",placeholder:"Username/email"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{htmlFor:"#password",children:["Password",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"password",placeholder:"Password"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,loading,children:t("login.login")}),tenant?.disableRegistration?tenant.adminEmail?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--login-drawer--signup",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:t("login.registrationDisabled")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("p",{children:[t("login.contactAdmin"),":"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`mailto:${tenant.adminEmail}`,children:tenant.adminEmail})]})]}):null:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("p",{className:"memori--login-drawer--signup",children:[t("login.newUserSignUp")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`https://${tenant.name||"www.aisuru.com"}/${lang}/auth?signup=1&redirectTo=${redirectTo}`,children:t("login.signUp")})]})]}),error&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:error})]})})};LoginDrawer.displayName="LoginDrawer";const __WEBPACK_DEFAULT_EXPORT__=LoginDrawer;try{LoginDrawer.displayName="LoginDrawer",LoginDrawer.__docgenInfo={description:"",displayName:"LoginDrawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},loginToken:{defaultValue:null,description:"",name:"loginToken",required:!1,type:{name:"string"}},onLogin:{defaultValue:null,description:"",name:"onLogin",required:!0,type:{name:"(user: User, token: string) => void"}},onLogout:{defaultValue:null,description:"",name:"onLogout",required:!0,type:{name:"() => void"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!0,type:{name:"Tenant"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},__TEST__needMissingData:{defaultValue:{value:"false"},description:"",name:"__TEST__needMissingData",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/LoginDrawer/LoginDrawer.tsx#LoginDrawer"]={docgenInfo:LoginDrawer.__docgenInfo,name:"LoginDrawer",path:"src/components/LoginDrawer/LoginDrawer.tsx#LoginDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/error.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{r:()=>getErrori18nKey});const BACKEND_ERRORS=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,TENANT_ALREADY_EXISTS:-6,TENANT_MISSING_DESCRIPTION:-7,TENANT_CANT_SET_COMPLETION_PROVIDER:-8,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_TOO_MANY_ATTEMPTS:-38,USER_MUST_ACCEPT_TNC_AND_PP:-39,USER_BIRTH_DATE_CANT_BE_CHANGED:-40,USER_CANT_SET_COMPLETION_PROVIDER:-41,USER_CANT_ENABLE_DEEP_THOUGHT:-42,USER_CANT_ENABLE_DCM_INTEGRATION:-43,USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS:-44,MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS:-45,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,SESSION_EXPIRED:-103,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS:-215,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,MEMORI_FEATURE_REQUIRES_SUBSCRIPTION:-271,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905,NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD:-1001,PROCESS_INVALID_TYPE:-1401,PROCESS_ALREADY_RUNNING:-1401,PROCESS_NOT_FOUND:-1402,IMPORTCSV_MISSING_ROWS:-1501,IMPORTCSV_MISSING_CSV:-1502,IMPORTCSV_MISSING_SEPARATOR:-1503,IMPORTCSV_INVALID_SEPARATOR:-1504,IMPORTCSV_MISSING_HEADERS:-1505,IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1506,IMPORTCSV_UNDETECTABLE_CHAR_ENCODING:-1521,IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI:-1531,IMPORTTXT_MISSING_ROWS:-1601,IMPORTTXT_INVALID_GRANULARITY:-1602,IMPORTTXT_UNDETECTABLE_CHAR_ENCODING:-1621,IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI:-1631,IMPORTTXT_IMPORT_LIMIT_EXCEEDED:-1632,IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY:-1633,IMPORTTXT_IMPORT_REQUIRES_PAYING:-1634,EXPORTCSV_MISSING_CSV_SPECS:-1801,EXPORTCSV_MISSING_SEPARATOR:-1802,EXPORTCSV_INVALID_SEPARATOR:-1803,EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1804,EXPORTCSV_MISSING_NEW_LINE_CHAR:-1805,EXPORTCSV_INVALID_NEW_LINE_CHAR:-1806,EXPORTCSV_MISSING_PASSWORD:-1811,EXPORTJSONL_MISSING_JSONL_SPECS:-1821,EXPORTJSONL_MISSING_PLATFORM:-1822,EXPORTJSONL_INVALID_PLATFORM:-1823,EXPORTJSONL_MISSING_PASSWORD:-1831,EXPORTJSONL_EXPORT_REQUIRES_PAYING:-1832,ANALYSIS_MISSING_QUERY:-1901,ANALYSIS_CANT_ANALYZE_SECRET_MEMORI:-1902,ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT:-1903,BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS:-2001,BADGE_ASSIGNMENT_MISSING_REF_ID:-2002,BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND:-2003,BADGE_ASSIGNMENT_MISSING_ASSERTION_URL:-2004,BADGE_ASSIGNMENT_MISSING_BADGE_URL:-2005,BADGE_ASSIGNMENT_MISSING_ISSUER_URL:-2006,BADGE_ASSIGNMENT_INVALID_URL:-2007,BADGE_ASSIGNMENT_MISSING_RECIPIENT:-2021,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE:-2022,BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY:-2023,BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE:-2024,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE:-2025,BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY:-2026,BADGE_NOT_FOUND:-2051,OUTCOME_NO_DCM_CONFIGURED:-2071,OUTCOME_USER_BADGES_DISABLED:-2072}).map((([key,value])=>[value,key]))),getErrori18nKey=errorCode=>{if(!errorCode)return"error.generic";if(401===errorCode||403===errorCode)return"error.unauthorized";if(404===errorCode)return"error.notFound";if(422===errorCode)return"error.unprocessableEntity";if(500===errorCode)return"internal server error";let error=BACKEND_ERRORS.get(errorCode);return error?`errors.${error}`:"error.generic"}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[514],{"./src/components/LoginDrawer/LoginDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),react_i18next__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),_helpers_error__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./src/helpers/error.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/react/jsx-runtime.js");const mailRegEx=/^\w+([.-]?[+]?\w+)*@\w+([.-]?\w+)*(\.\w{2,})+$/,LoginDrawer=({open=!1,onClose,onLogin,onLogout,user,loginToken,tenant,apiUrl,__TEST__needMissingData=!1})=>{const{t,i18n}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_8__.$)(),lang="it"===i18n.language?"it":"en",client=(0,_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_5__.Z)(apiUrl),{userLogin,updateUser}=client.backend,[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[needsMissingData,setNeedsMissingData]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(__TEST__needMissingData?{token:"token",birthDate:!0,tnCAndPPAccepted:!0}:{}),[error,setError]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),[redirectTo,setRedirectTo]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{setRedirectTo(window.location.href)}),[]);const isUserLoggedIn=user?.userID&&loginToken;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_2__.Z,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori--login-drawer",{"memori--login-drawer--logged":isUserLoggedIn}),title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h2",{className:"memori--login-drawer--title",children:isUserLoggedIn?t("login.loggedDrawerTitle",{name:user.userName}):t("login.loginDrawerTitle")}),children:isUserLoggedIn?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div",{className:"memori--login-drawer--logged",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{primary:!0,onClick:()=>{onLogout()},children:t("login.logout")})}):needsMissingData?.token?.length?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("h3",{children:t("login.missingData")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:t("login.missingDataHelper")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{e.preventDefault();const form=e.currentTarget,birthDate=form.birthDate?.value,tnCAndPPAccepted=form.tnCAndPPAccepted?.checked,pAndCUAccepted=form.pAndCUAccepted?.checked;if(!user?.userID||!needsMissingData?.token)return;if(!birthDate||!tnCAndPPAccepted)return void setError(t("missingData"));let newUser={userID:user.userID,birthDate:user?.birthDate||!needsMissingData.birthDate?void 0:birthDate,tnCAndPPAccepted:tnCAndPPAccepted||user?.tnCAndPPAccepted,tnCAndPPAcceptanceDate:tnCAndPPAccepted?(new Date).toISOString():void 0,pAndCUAccepted:pAndCUAccepted||user?.pAndCUAccepted,pAndCUAcceptanceDate:pAndCUAccepted?(new Date).toISOString():void 0};const{user:patchedUser,...resp}=await updateUser(needsMissingData.token,user.userID,newUser);0!==resp.resultCode?(console.error(resp),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(resp.resultCode),{ns:"common"})),setError(resp.resultMessage)):(react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.success(t("success")),onLogin(patchedUser||newUser,needsMissingData.token))},children:[needsMissingData.birthDate&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{htmlFor:"#birthDate",children:[t("login.birthDate"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:t("login.birthDateHelper")})})]}),needsMissingData?.tnCAndPPAccepted&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{className:"memori-checkbox",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",className:"memori-checkbox--input"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--text",children:[t("login.privacyLabel")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`https://memori.ai/${lang}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:t("login.privacyAndCookiePolicy")})," ",t("login.and")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`https://memori.ai/${lang}/tos`,target:"_blank",rel:"noopener noreferrer",children:t("login.termsOfService")})]})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{className:"memori-checkbox",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",defaultChecked:user?.pAndCUAccepted,className:"memori-checkbox--input"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("span",{className:"memori-checkbox--text",children:[t("login.pAndCUAccepted")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("em",{children:["(",t("login.optional"),")"]})})]})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:t("login.goToAccountToChangeYourPreferences")})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("small",{children:t("login.deepThoughtExplaination")})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,loading,children:t("login.save")})]})]}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:e=>{e.preventDefault();const form=e.currentTarget,userNameOrEmail=form.userNameOrEmail.value,password=form.password.value,user=mailRegEx.test(userNameOrEmail)?{tenant:tenant?.id,eMail:userNameOrEmail,password}:{tenant:tenant?.id,userName:userNameOrEmail,password};setLoading(!0),setError(null),userLogin(user).then((data=>{0!==data.resultCode?(console.error(data),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_6__.r)(data.resultCode),{ns:"common"})),setError(data.resultMessage)):data.user&&data.token&&(onLogin(data.user,data.token),data.user?.tnCAndPPAccepted&&data.user?.birthDate||setNeedsMissingData({token:data.token,birthDate:!data.user?.birthDate,tnCAndPPAccepted:!data.user?.tnCAndPPAccepted}))})).catch((err=>{console.error("[LOGIN]",err),react_hot_toast__WEBPACK_IMPORTED_MODULE_3__.ZP.error(err),err.message&&setError(err.message)})).finally((()=>{setLoading(!1)}))},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{htmlFor:"#userNameOrEmail",children:[t("login.userNameOrEmail"),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{id:"userNameOrEmail",name:"userNameOrEmail",required:!0,autoComplete:"email",placeholder:"Username/email"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("label",{htmlFor:"#password",children:["Password",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"password",placeholder:"Password"})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_1__.Z,{htmlType:"submit",primary:!0,loading,children:t("login.login")}),tenant?.disableRegistration?tenant.adminEmail?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("div",{className:"memori--login-drawer--signup",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{children:t("login.registrationDisabled")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("p",{children:[t("login.contactAdmin"),":"," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`mailto:${tenant.adminEmail}`,children:tenant.adminEmail})]})]}):null:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)("p",{className:"memori--login-drawer--signup",children:[t("login.newUserSignUp")," ",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("a",{href:`https://${tenant.name||"www.aisuru.com"}/${lang}/auth?signup=1&redirectTo=${redirectTo}`,children:t("login.signUp")})]})]}),error&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:error})]})})};LoginDrawer.displayName="LoginDrawer";const __WEBPACK_DEFAULT_EXPORT__=LoginDrawer;try{LoginDrawer.displayName="LoginDrawer",LoginDrawer.__docgenInfo={description:"",displayName:"LoginDrawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}},user:{defaultValue:null,description:"",name:"user",required:!1,type:{name:"User"}},loginToken:{defaultValue:null,description:"",name:"loginToken",required:!1,type:{name:"string"}},onLogin:{defaultValue:null,description:"",name:"onLogin",required:!0,type:{name:"(user: User, token: string) => void"}},onLogout:{defaultValue:null,description:"",name:"onLogout",required:!0,type:{name:"() => void"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!0,type:{name:"Tenant"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},__TEST__needMissingData:{defaultValue:{value:"false"},description:"",name:"__TEST__needMissingData",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/LoginDrawer/LoginDrawer.tsx#LoginDrawer"]={docgenInfo:LoginDrawer.__docgenInfo,name:"LoginDrawer",path:"src/components/LoginDrawer/LoginDrawer.tsx#LoginDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,animated=!0,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{static:!0,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:animated?"max-w-0 opacity-0":"opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:animated?"max-w-0 opacity-0":"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},animated:{defaultValue:{value:"true"},description:"",name:"animated",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/error.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{r:()=>getErrori18nKey});const BACKEND_ERRORS=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,TENANT_ALREADY_EXISTS:-6,TENANT_MISSING_DESCRIPTION:-7,TENANT_CANT_SET_COMPLETION_PROVIDER:-8,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_TOO_MANY_ATTEMPTS:-38,USER_MUST_ACCEPT_TNC_AND_PP:-39,USER_BIRTH_DATE_CANT_BE_CHANGED:-40,USER_CANT_SET_COMPLETION_PROVIDER:-41,USER_CANT_ENABLE_DEEP_THOUGHT:-42,USER_CANT_ENABLE_DCM_INTEGRATION:-43,USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS:-44,MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS:-45,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,SESSION_EXPIRED:-103,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS:-215,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,MEMORI_FEATURE_REQUIRES_SUBSCRIPTION:-271,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905,NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD:-1001,PROCESS_INVALID_TYPE:-1401,PROCESS_ALREADY_RUNNING:-1401,PROCESS_NOT_FOUND:-1402,IMPORTCSV_MISSING_ROWS:-1501,IMPORTCSV_MISSING_CSV:-1502,IMPORTCSV_MISSING_SEPARATOR:-1503,IMPORTCSV_INVALID_SEPARATOR:-1504,IMPORTCSV_MISSING_HEADERS:-1505,IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1506,IMPORTCSV_UNDETECTABLE_CHAR_ENCODING:-1521,IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI:-1531,IMPORTTXT_MISSING_ROWS:-1601,IMPORTTXT_INVALID_GRANULARITY:-1602,IMPORTTXT_UNDETECTABLE_CHAR_ENCODING:-1621,IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI:-1631,IMPORTTXT_IMPORT_LIMIT_EXCEEDED:-1632,IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY:-1633,IMPORTTXT_IMPORT_REQUIRES_PAYING:-1634,EXPORTCSV_MISSING_CSV_SPECS:-1801,EXPORTCSV_MISSING_SEPARATOR:-1802,EXPORTCSV_INVALID_SEPARATOR:-1803,EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1804,EXPORTCSV_MISSING_NEW_LINE_CHAR:-1805,EXPORTCSV_INVALID_NEW_LINE_CHAR:-1806,EXPORTCSV_MISSING_PASSWORD:-1811,EXPORTJSONL_MISSING_JSONL_SPECS:-1821,EXPORTJSONL_MISSING_PLATFORM:-1822,EXPORTJSONL_INVALID_PLATFORM:-1823,EXPORTJSONL_MISSING_PASSWORD:-1831,EXPORTJSONL_EXPORT_REQUIRES_PAYING:-1832,ANALYSIS_MISSING_QUERY:-1901,ANALYSIS_CANT_ANALYZE_SECRET_MEMORI:-1902,ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT:-1903,BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS:-2001,BADGE_ASSIGNMENT_MISSING_REF_ID:-2002,BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND:-2003,BADGE_ASSIGNMENT_MISSING_ASSERTION_URL:-2004,BADGE_ASSIGNMENT_MISSING_BADGE_URL:-2005,BADGE_ASSIGNMENT_MISSING_ISSUER_URL:-2006,BADGE_ASSIGNMENT_INVALID_URL:-2007,BADGE_ASSIGNMENT_MISSING_RECIPIENT:-2021,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE:-2022,BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY:-2023,BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE:-2024,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE:-2025,BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY:-2026,BADGE_NOT_FOUND:-2051,OUTCOME_NO_DCM_CONFIGURED:-2071,OUTCOME_USER_BADGES_DISABLED:-2072}).map((([key,value])=>[value,key]))),getErrori18nKey=errorCode=>{if(!errorCode)return"error.generic";if(401===errorCode||403===errorCode)return"error.unauthorized";if(404===errorCode)return"error.notFound";if(422===errorCode)return"error.unprocessableEntity";if(500===errorCode)return"internal server error";let error=BACKEND_ERRORS.get(errorCode);return error?`errors.${error}`:"error.generic"}}}]); \ No newline at end of file diff --git a/components-ExpertsDrawer-ExpertsDrawer-stories.bc10ae50.iframe.bundle.js b/components-ExpertsDrawer-ExpertsDrawer-stories.963b1c2c.iframe.bundle.js similarity index 62% rename from components-ExpertsDrawer-ExpertsDrawer-stories.bc10ae50.iframe.bundle.js rename to components-ExpertsDrawer-ExpertsDrawer-stories.963b1c2c.iframe.bundle.js index be320550..ac007d40 100644 --- a/components-ExpertsDrawer-ExpertsDrawer-stories.bc10ae50.iframe.bundle.js +++ b/components-ExpertsDrawer-ExpertsDrawer-stories.963b1c2c.iframe.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[4771],{"./src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,__namedExportsOrder:()=>__namedExportsOrder,default:()=>ExpertsDrawer_stories});__webpack_require__("./node_modules/react/index.js");var I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),ExpertsDrawer=__webpack_require__("./src/components/ExpertsDrawer/ExpertsDrawer.tsx"),data=__webpack_require__("./src/mocks/data.ts"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),ExpertsDrawer_ExpertsDrawer=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/ExpertsDrawer/ExpertsDrawer.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(ExpertsDrawer_ExpertsDrawer.Z,options);ExpertsDrawer_ExpertsDrawer.Z&&ExpertsDrawer_ExpertsDrawer.Z.locals&&ExpertsDrawer_ExpertsDrawer.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer_stories={title:"Widget/ExpertsDrawer",component:ExpertsDrawer.Z,argTypes:{open:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(ExpertsDrawer.Z,{...args,baseUrl:"https://aisuru.com",apiUrl:"https://backend.memori.ai",tenant:data.cm,experts:[data.A3,{...data.A3,expertID:"2",name:"Lorem ipsum dolor sit amet, consectetur adipiscing elit",description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit."}]})});Template.displayName="Template";const Default=Template.bind({});Default.args={open:!0,onClose:()=>{}},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n return \n \n ;\n}",...Default.parameters?.docs?.source}}};const __namedExportsOrder=["Default"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ExpertsDrawer/ExpertsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer=({open=!1,baseUrl,apiUrl,tenant,experts,onClose})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{open,onClose,className:"memori--experts-drawer",title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h2",{className:"memori--experts-drawer--title",children:t("widget.expertsInTheBoard")}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("ul",{className:"memori--experts-drawer--list",children:experts.map((expert=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("img",{src:`${apiUrl}/api/v1/memoriai/memori/avatar/${expert.expertMemoriID}`,alt:expert.name,onError:e=>{e.currentTarget.src=(0,_helpers_media__WEBPACK_IMPORTED_MODULE_3__.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h3",{className:"memori--experts-drawer--name",children:expert.name}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{className:"memori--experts-drawer--description",children:expert.description})]})]},expert.expertID)))})})};ExpertsDrawer.displayName="ExpertsDrawer";const __WEBPACK_DEFAULT_EXPORT__=ExpertsDrawer;try{ExpertsDrawer.displayName="ExpertsDrawer",ExpertsDrawer.__docgenInfo={description:"",displayName:"ExpertsDrawer",props:{experts:{defaultValue:null,description:"",name:"experts",required:!0,type:{name:"ExpertReference[]"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"]={docgenInfo:ExpertsDrawer.__docgenInfo,name:"ExpertsDrawer",path:"src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/media.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{v:()=>getResourceUrl});const getResourceUrl=({type,resourceURI,sessionID,baseURL="",apiURL=""})=>{let defaultUri="cover"===type?`${baseURL}/images/memoriCover.png`:`${baseURL}/images/memoriAvatar.png?v=20231208`;try{return resourceURI&&0!==resourceURI.length?resourceURI.includes("memoriai/memory")&&!resourceURI.includes("memori-ai-session-id")&&sessionID?`${resourceURI}?memori-ai-session-id=${sessionID}`:(resourceURI.startsWith("https://")||resourceURI.startsWith("http://"))&&(new URL(resourceURI).hostname.includes("memori.ai")||new URL(resourceURI).hostname.includes("aclambda.online"))?`${resourceURI}${resourceURI.endsWith("/")||!sessionID?"":"/"}${sessionID||""}`:resourceURI.startsWith("cloud://")?`${apiURL?.replace(/v2/,"v1")||""}/CloudAsset/${resourceURI.replace("cloud://","")}`:resourceURI.startsWith("guid://")?`${apiURL?.replace(/v2/,"v1")||""}/GuidAsset/${resourceURI.replace("guid://","")}`:resourceURI||defaultUri:defaultUri}catch(e){return resourceURI||defaultUri}}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[4771],{"./src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,__namedExportsOrder:()=>__namedExportsOrder,default:()=>ExpertsDrawer_stories});__webpack_require__("./node_modules/react/index.js");var I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),ExpertsDrawer=__webpack_require__("./src/components/ExpertsDrawer/ExpertsDrawer.tsx"),data=__webpack_require__("./src/mocks/data.ts"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),ExpertsDrawer_ExpertsDrawer=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/ExpertsDrawer/ExpertsDrawer.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(ExpertsDrawer_ExpertsDrawer.Z,options);ExpertsDrawer_ExpertsDrawer.Z&&ExpertsDrawer_ExpertsDrawer.Z.locals&&ExpertsDrawer_ExpertsDrawer.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer_stories={title:"Widget/ExpertsDrawer",component:ExpertsDrawer.Z,argTypes:{open:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(ExpertsDrawer.Z,{...args,baseUrl:"https://aisuru.com",apiUrl:"https://backend.memori.ai",tenant:data.cm,experts:[data.A3,{...data.A3,expertID:"2",name:"Lorem ipsum dolor sit amet, consectetur adipiscing elit",description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit."}]})});Template.displayName="Template";const Default=Template.bind({});Default.args={open:!0,onClose:()=>{}},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n return \n \n ;\n}",...Default.parameters?.docs?.source}}};const __namedExportsOrder=["Default"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ExpertsDrawer/ExpertsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_helpers_media__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/media.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ExpertsDrawer=({open=!1,baseUrl,apiUrl,tenant,experts,onClose})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_2__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{open,onClose,className:"memori--experts-drawer",title:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h2",{className:"memori--experts-drawer--title",children:t("widget.expertsInTheBoard")}),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("ul",{className:"memori--experts-drawer--list",children:experts.map((expert=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("img",{src:`${apiUrl}/api/v1/memoriai/memori/avatar/${expert.expertMemoriID}`,alt:expert.name,onError:e=>{e.currentTarget.src=(0,_helpers_media__WEBPACK_IMPORTED_MODULE_3__.v)({tenantID:tenant?.id,type:"avatar",baseURL:baseUrl}),e.currentTarget.onerror=null}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("h3",{className:"memori--experts-drawer--name",children:expert.name}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("p",{className:"memori--experts-drawer--description",children:expert.description})]})]},expert.expertID)))})})};ExpertsDrawer.displayName="ExpertsDrawer";const __WEBPACK_DEFAULT_EXPORT__=ExpertsDrawer;try{ExpertsDrawer.displayName="ExpertsDrawer",ExpertsDrawer.__docgenInfo={description:"",displayName:"ExpertsDrawer",props:{experts:{defaultValue:null,description:"",name:"experts",required:!0,type:{name:"ExpertReference[]"}},baseUrl:{defaultValue:null,description:"",name:"baseUrl",required:!0,type:{name:"string"}},apiUrl:{defaultValue:null,description:"",name:"apiUrl",required:!0,type:{name:"string"}},tenant:{defaultValue:null,description:"",name:"tenant",required:!1,type:{name:"Tenant"}},open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"]={docgenInfo:ExpertsDrawer.__docgenInfo,name:"ExpertsDrawer",path:"src/components/ExpertsDrawer/ExpertsDrawer.tsx#ExpertsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,animated=!0,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{static:!0,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:animated?"max-w-0 opacity-0":"opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:animated?"max-w-0 opacity-0":"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},animated:{defaultValue:{value:"true"},description:"",name:"animated",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/media.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{v:()=>getResourceUrl});const getResourceUrl=({type,resourceURI,sessionID,baseURL="",apiURL=""})=>{let defaultUri="cover"===type?`${baseURL}/images/memoriCover.png`:`${baseURL}/images/memoriAvatar.png?v=20231208`;try{return resourceURI&&0!==resourceURI.length?resourceURI.includes("memoriai/memory")&&!resourceURI.includes("memori-ai-session-id")&&sessionID?`${resourceURI}?memori-ai-session-id=${sessionID}`:(resourceURI.startsWith("https://")||resourceURI.startsWith("http://"))&&(new URL(resourceURI).hostname.includes("memori.ai")||new URL(resourceURI).hostname.includes("aclambda.online"))?`${resourceURI}${resourceURI.endsWith("/")||!sessionID?"":"/"}${sessionID||""}`:resourceURI.startsWith("cloud://")?`${apiURL?.replace(/v2/,"v1")||""}/CloudAsset/${resourceURI.replace("cloud://","")}`:resourceURI.startsWith("guid://")?`${apiURL?.replace(/v2/,"v1")||""}/GuidAsset/${resourceURI.replace("guid://","")}`:resourceURI||defaultUri:defaultUri}catch(e){return resourceURI||defaultUri}}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file diff --git a/components-KnownFacts-KnownFacts-stories.2f75b2d0.iframe.bundle.js b/components-KnownFacts-KnownFacts-stories.a02ec7ca.iframe.bundle.js similarity index 69% rename from components-KnownFacts-KnownFacts-stories.2f75b2d0.iframe.bundle.js rename to components-KnownFacts-KnownFacts-stories.a02ec7ca.iframe.bundle.js index c3032889..3e3a7695 100644 --- a/components-KnownFacts-KnownFacts-stories.2f75b2d0.iframe.bundle.js +++ b/components-KnownFacts-KnownFacts-stories.a02ec7ca.iframe.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[6191],{"./node_modules/@headlessui/react/dist/components/listbox/listbox.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{R:()=>pt});var r,n,react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-disposables.js"),_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-id.js"),_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js"),_hooks_use_computed_js__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-computed.js"),_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-sync-refs.js"),_utils_render_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/render.js"),_utils_match_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/match.js"),_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/disposables.js"),_keyboard_js__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__("./node_modules/@headlessui/react/dist/components/keyboard.js"),_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/calculate-active-index.js"),_utils_bugs_js__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/bugs.js"),_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/focus-management.js"),_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/@headlessui/react/dist/internal/open-closed.js"),_hooks_use_resolve_button_type_js__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js"),_hooks_use_outside_click_js__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-outside-click.js"),_internal_hidden_js__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./node_modules/@headlessui/react/dist/internal/hidden.js"),_utils_form_js__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/form.js"),_utils_owner_js__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/owner.js"),_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js"),_hooks_use_controllable_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-controllable.js"),ye=((n=ye||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),xe=(n=>(n[n.Single=0]="Single",n[n.Multi=1]="Multi",n))(xe||{}),Oe=(n=>(n[n.Pointer=0]="Pointer",n[n.Other=1]="Other",n))(Oe||{}),me=((r=me||{})[r.OpenListbox=0]="OpenListbox",r[r.CloseListbox=1]="CloseListbox",r[r.SetDisabled=2]="SetDisabled",r[r.SetOrientation=3]="SetOrientation",r[r.GoToOption=4]="GoToOption",r[r.Search=5]="Search",r[r.ClearSearch=6]="ClearSearch",r[r.RegisterOption=7]="RegisterOption",r[r.UnregisterOption=8]="UnregisterOption",r);function j(t,i=(n=>n)){let n=null!==t.activeOptionIndex?t.options[t.activeOptionIndex]:null,e=(0,_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__.z2)(i(t.options.slice()),(u=>u.dataRef.current.domRef.current)),o=n?e.indexOf(n):null;return-1===o&&(o=null),{options:e,activeOptionIndex:o}}let ge={1:t=>t.disabled||1===t.listboxState?t:{...t,activeOptionIndex:null,listboxState:1},0(t){if(t.disabled||0===t.listboxState)return t;let i=t.activeOptionIndex,{value:n,mode:e,compare:o}=t.propsRef.current,u=t.options.findIndex((l=>{let s=l.dataRef.current.value;return(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(e,{1:()=>n.some((r=>o(r,s))),0:()=>o(n,s)})}));return-1!==u&&(i=u),{...t,listboxState:0,activeOptionIndex:i}},2:(t,i)=>t.disabled===i.disabled?t:{...t,disabled:i.disabled},3:(t,i)=>t.orientation===i.orientation?t:{...t,orientation:i.orientation},4(t,i){var o;if(t.disabled||1===t.listboxState)return t;let n=j(t),e=(0,_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.d)(i,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...t,...n,searchQuery:"",activeOptionIndex:e,activationTrigger:null!=(o=i.trigger)?o:1}},5:(t,i)=>{if(t.disabled||1===t.listboxState)return t;let e=""!==t.searchQuery?0:1,o=t.searchQuery+i.value.toLowerCase(),l=(null!==t.activeOptionIndex?t.options.slice(t.activeOptionIndex+e).concat(t.options.slice(0,t.activeOptionIndex+e)):t.options).find((d=>{var r;return!d.dataRef.current.disabled&&(null==(r=d.dataRef.current.textValue)?void 0:r.startsWith(o))})),s=l?t.options.indexOf(l):-1;return-1===s||s===t.activeOptionIndex?{...t,searchQuery:o}:{...t,searchQuery:o,activeOptionIndex:s,activationTrigger:1}},6:t=>t.disabled||1===t.listboxState||""===t.searchQuery?t:{...t,searchQuery:""},7:(t,i)=>{let n={id:i.id,dataRef:i.dataRef},e=j(t,(o=>[...o,n]));if(null===t.activeOptionIndex){let{value:o,mode:u,compare:l}=t.propsRef.current,s=i.dataRef.current.value;(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(u,{1:()=>o.some((r=>l(r,s))),0:()=>l(o,s)})&&(e.activeOptionIndex=e.options.indexOf(n))}return{...t,...e}},8:(t,i)=>{let n=j(t,(e=>{let o=e.findIndex((u=>u.id===i.id));return-1!==o&&e.splice(o,1),e}));return{...t,...n,activationTrigger:1}}},K=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);function w(t){let i=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(K);if(null===i){let n=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,w),n}return i}function Re(t,i){return(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(i.type,ge,t,i)}K.displayName="ListboxContext";let ve=react__WEBPACK_IMPORTED_MODULE_0__.Fragment,Le=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){let{value:e,defaultValue:o,name:u,onChange:l,by:s=((p,T)=>p===T),disabled:d=!1,horizontal:r=!1,multiple:x=!1,...S}=i;const g=r?"horizontal":"vertical";let O=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(n),[m,f]=(0,_hooks_use_controllable_js__WEBPACK_IMPORTED_MODULE_6__.q)(e,l,o),b=(0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(Re,{listboxState:1,propsRef:{current:{value:m,onChange:f,mode:x?1:0,compare:(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)("string"==typeof s?(p,T)=>{let C=s;return(null==p?void 0:p[C])===(null==T?void 0:T[C])}:s)}},labelRef:(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)(),buttonRef:(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)(),optionsRef:(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)(),disabled:d,orientation:g,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1}),[{listboxState:a,propsRef:c,optionsRef:P,buttonRef:D},M]=b;c.current.value=m,c.current.mode=x?1:0,(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{c.current.onChange=p=>(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(c.current.mode,{0:()=>f(p),1(){let T=c.current.value.slice(),{compare:C}=c.current,W=T.findIndex((X=>C(X,p)));return-1===W?T.push(p):T.splice(W,1),f(T)}})}),[f,c]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>M({type:2,disabled:d})),[d]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>M({type:3,orientation:g})),[g]),(0,_hooks_use_outside_click_js__WEBPACK_IMPORTED_MODULE_9__.O)([D,P],((p,T)=>{var C;M({type:1}),(0,_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__.sP)(T,_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__.tJ.Loose)||(p.preventDefault(),null==(C=D.current)||C.focus())}),0===a);let N=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===a,disabled:d,value:m})),[a,d,m]),R={ref:O};return react__WEBPACK_IMPORTED_MODULE_0__.createElement(K.Provider,{value:b},react__WEBPACK_IMPORTED_MODULE_0__.createElement(_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.up,{value:(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(a,{0:_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.ZM.Open,1:_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.ZM.Closed})},null!=u&&null!=m&&(0,_utils_form_js__WEBPACK_IMPORTED_MODULE_11__.t)({[u]:m}).map((([p,T])=>react__WEBPACK_IMPORTED_MODULE_0__.createElement(_internal_hidden_js__WEBPACK_IMPORTED_MODULE_12__._,{features:_internal_hidden_js__WEBPACK_IMPORTED_MODULE_12__.A.Hidden,...(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.oA)({key:p,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:p,value:T})}))),(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:R,theirProps:S,slot:N,defaultTag:ve,name:"Listbox"})))})),Ae=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){var f;let[e,o]=w("Listbox.Button"),u=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(e.buttonRef,n),l=`headlessui-listbox-button-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,s=(0,_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__.G)(),d=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((b=>{switch(b.key){case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Space:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Enter:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowDown:b.preventDefault(),o({type:0}),s.nextFrame((()=>{e.propsRef.current.value||o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.First})}));break;case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowUp:b.preventDefault(),o({type:0}),s.nextFrame((()=>{e.propsRef.current.value||o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Last})}))}})),r=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((b=>{if(b.key===_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Space)b.preventDefault()})),x=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((b=>{if((0,_utils_bugs_js__WEBPACK_IMPORTED_MODULE_16__.P)(b.currentTarget))return b.preventDefault();0===e.listboxState?(o({type:1}),s.nextFrame((()=>{var a;return null==(a=e.buttonRef.current)?void 0:a.focus({preventScroll:!0})}))):(b.preventDefault(),o({type:0}))})),S=(0,_hooks_use_computed_js__WEBPACK_IMPORTED_MODULE_17__.v)((()=>{if(e.labelRef.current)return[e.labelRef.current.id,l].join(" ")}),[e.labelRef.current,l]),g=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===e.listboxState,disabled:e.disabled,value:e.propsRef.current.value})),[e]),O=i,m={ref:u,id:l,type:(0,_hooks_use_resolve_button_type_js__WEBPACK_IMPORTED_MODULE_18__.f)(i,e.buttonRef),"aria-haspopup":!0,"aria-controls":null==(f=e.optionsRef.current)?void 0:f.id,"aria-expanded":e.disabled?void 0:0===e.listboxState,"aria-labelledby":S,disabled:e.disabled,onKeyDown:d,onKeyUp:r,onClick:x};return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:m,theirProps:O,slot:g,defaultTag:"button",name:"Listbox.Button"})})),Pe=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){let[e]=w("Listbox.Label"),o=`headlessui-listbox-label-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,u=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(e.labelRef,n),l=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{var x;return null==(x=e.buttonRef.current)?void 0:x.focus({preventScroll:!0})})),s=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===e.listboxState,disabled:e.disabled})),[e]);return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:{ref:u,id:o,onClick:l},theirProps:i,slot:s,defaultTag:"label",name:"Listbox.Label"})})),De=_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.AN.RenderStrategy|_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.AN.Static,Me=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){var b;let[e,o]=w("Listbox.Options"),u=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(e.optionsRef,n),l=`headlessui-listbox-options-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,s=(0,_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__.G)(),d=(0,_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__.G)(),r=(0,_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.oJ)(),x=null!==r?r===_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.ZM.Open:0===e.listboxState;(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{var c;let a=e.optionsRef.current;!a||0===e.listboxState&&a!==(null==(c=(0,_utils_owner_js__WEBPACK_IMPORTED_MODULE_19__.r)(a))?void 0:c.activeElement)&&a.focus({preventScroll:!0})}),[e.listboxState,e.optionsRef]);let S=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((a=>{switch(d.dispose(),a.key){case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Space:if(""!==e.searchQuery)return a.preventDefault(),a.stopPropagation(),o({type:5,value:a.key});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Enter:if(a.preventDefault(),a.stopPropagation(),null!==e.activeOptionIndex){let{dataRef:c}=e.options[e.activeOptionIndex];e.propsRef.current.onChange(c.current.value)}0===e.propsRef.current.mode&&(o({type:1}),(0,_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__.k)().nextFrame((()=>{var c;return null==(c=e.buttonRef.current)?void 0:c.focus({preventScroll:!0})})));break;case(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(e.orientation,{vertical:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowDown,horizontal:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowRight}):return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Next});case(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(e.orientation,{vertical:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowUp,horizontal:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowLeft}):return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Previous});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Home:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.PageUp:return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.First});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.End:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.PageDown:return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Last});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Escape:return a.preventDefault(),a.stopPropagation(),o({type:1}),s.nextFrame((()=>{var c;return null==(c=e.buttonRef.current)?void 0:c.focus({preventScroll:!0})}));case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Tab:a.preventDefault(),a.stopPropagation();break;default:1===a.key.length&&(o({type:5,value:a.key}),d.setTimeout((()=>o({type:6})),350))}})),g=(0,_hooks_use_computed_js__WEBPACK_IMPORTED_MODULE_17__.v)((()=>{var a,c,P;return null!=(P=null==(a=e.labelRef.current)?void 0:a.id)?P:null==(c=e.buttonRef.current)?void 0:c.id}),[e.labelRef.current,e.buttonRef.current]),O=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===e.listboxState})),[e]),m=i,f={"aria-activedescendant":null===e.activeOptionIndex||null==(b=e.options[e.activeOptionIndex])?void 0:b.id,"aria-multiselectable":1===e.propsRef.current.mode||void 0,"aria-labelledby":g,"aria-orientation":e.orientation,id:l,onKeyDown:S,role:"listbox",tabIndex:0,ref:u};return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:f,theirProps:m,slot:O,defaultTag:"ul",features:De,visible:x,name:"Listbox.Options"})})),Ie=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){let{disabled:e=!1,value:o,...u}=i,[l,s]=w("Listbox.Option"),d=`headlessui-listbox-option-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,r=null!==l.activeOptionIndex&&l.options[l.activeOptionIndex].id===d,{value:x,compare:S}=l.propsRef.current,g=(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(l.propsRef.current.mode,{1:()=>x.some((R=>S(R,o))),0:()=>S(x,o)}),O=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),m=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(n,O);(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{if(0!==l.listboxState||!r||0===l.activationTrigger)return;let R=(0,_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__.k)();return R.requestAnimationFrame((()=>{var p,T;null==(T=null==(p=O.current)?void 0:p.scrollIntoView)||T.call(p,{block:"nearest"})})),R.dispose}),[O,r,l.listboxState,l.activationTrigger,l.activeOptionIndex]);let f=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({disabled:e,value:o,domRef:O});(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{f.current.disabled=e}),[f,e]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{f.current.value=o}),[f,o]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{var R,p;f.current.textValue=null==(p=null==(R=O.current)?void 0:R.textContent)?void 0:p.toLowerCase()}),[f,O]);let b=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>l.propsRef.current.onChange(o)));(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>(s({type:7,id:d,dataRef:f}),()=>s({type:8,id:d}))),[f,d]);let a=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((R=>{if(e)return R.preventDefault();b(),0===l.propsRef.current.mode&&(s({type:1}),(0,_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__.k)().nextFrame((()=>{var p;return null==(p=l.buttonRef.current)?void 0:p.focus({preventScroll:!0})})))})),c=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{if(e)return s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Nothing});s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Specific,id:d})})),P=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{e||r||s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Specific,id:d,trigger:0})})),D=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{e||!r||s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Nothing})})),M=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({active:r,selected:g,disabled:e})),[r,g,e]);return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:{id:d,ref:m,role:"option",tabIndex:!0===e?void 0:-1,"aria-disabled":!0===e||void 0,"aria-selected":g,disabled:void 0,onClick:a,onFocus:c,onPointerMove:P,onMouseMove:P,onPointerLeave:D,onMouseLeave:D},theirProps:u,slot:M,defaultTag:"li",name:"Listbox.Option"})})),pt=Object.assign(Le,{Button:Ae,Label:Pe,Options:Me,Option:Ie})},"./node_modules/@headlessui/react/dist/hooks/use-computed.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{v:()=>i});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js"),_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-latest-value.js");function i(e,o){let[u,t]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(e),r=(0,_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__.E)(e);return(0,_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_2__.e)((()=>t(r.current)),[r,t,...o]),u}},"./node_modules/@headlessui/react/dist/hooks/use-controllable.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{q:()=>T});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_event_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js");function T(l,r,c){let[i,s]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(c),e=void 0!==l,t=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(e),u=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(!1),d=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(!1);return!e||t.current||u.current?!e&&t.current&&!d.current&&(d.current=!0,t.current=e,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(u.current=!0,t.current=e,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[e?l:i,(0,_use_event_js__WEBPACK_IMPORTED_MODULE_1__.z)((n=>(e||s(n),null==r?void 0:r(n))))]}},"./node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{f:()=>s});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js");function i(t){var n;if(t.type)return t.type;let e=null!=(n=t.as)?n:"button";return"string"==typeof e&&"button"===e.toLowerCase()?"button":void 0}function s(t,e){let[n,u]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)((()=>i(t)));return(0,_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_1__.e)((()=>{u(i(t))}),[t.type,t.as]),(0,_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_1__.e)((()=>{n||!e.current||e.current instanceof HTMLButtonElement&&!e.current.hasAttribute("type")&&u("button")}),[n,e]),n}},"./node_modules/@headlessui/react/dist/utils/calculate-active-index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{T:()=>a,d:()=>x});var e,a=((e=a||{})[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e);function x(r,n){let t=n.resolveItems();if(t.length<=0)return null;let l=n.resolveActiveIndex(),s=null!=l?l:-1,d=(()=>{switch(r.focus){case 0:return t.findIndex((e=>!n.resolveDisabled(e)));case 1:{let e=t.slice().reverse().findIndex(((i,c,u)=>!(-1!==s&&u.length-c-1>=s)&&!n.resolveDisabled(i)));return-1===e?e:t.length-1-e}case 2:return t.findIndex(((e,i)=>!(i<=s)&&!n.resolveDisabled(e)));case 3:{let e=t.slice().reverse().findIndex((i=>!n.resolveDisabled(i)));return-1===e?e:t.length-1-e}case 4:return t.findIndex((e=>n.resolveId(e)===r.id));case 5:return null;default:!function f(r){throw new Error("Unexpected object: "+r)}(r)}})();return-1===d?l:d}},"./node_modules/@headlessui/react/dist/utils/form.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function e(n={},r=null,t=[]){for(let[i,o]of Object.entries(n))f(t,s(r,i),o);return t}function s(n,r){return n?n+"["+r+"]":r}function f(n,r,t){if(Array.isArray(t))for(let[i,o]of t.entries())f(n,s(r,i.toString()),o);else t instanceof Date?n.push([r,t.toISOString()]):"boolean"==typeof t?n.push([r,t?"1":"0"]):"string"==typeof t?n.push([r,t]):"number"==typeof t?n.push([r,`${t}`]):null==t?n.push([r,""]):e(t,r,n)}function p(n){var t;let r=null!=(t=null==n?void 0:n.form)?t:n.closest("form");if(r)for(let i of r.elements)if("INPUT"===i.tagName&&"submit"===i.type||"BUTTON"===i.tagName&&"submit"===i.type||"INPUT"===i.nodeName&&"image"===i.type)return void i.click()}__webpack_require__.d(__webpack_exports__,{g:()=>p,t:()=>e})},"./src/components/KnownFacts/KnownFacts.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithData:()=>WithData,WithPaginatedData:()=>WithPaginatedData,WithRealDataLocalhost:()=>WithRealDataLocalhost,__namedExportsOrder:()=>__namedExportsOrder,default:()=>KnownFacts_stories});__webpack_require__("./node_modules/react/index.js");var data=__webpack_require__("./src/mocks/data.ts"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),KnownFacts=__webpack_require__("./src/components/KnownFacts/KnownFacts.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),KnownFacts_KnownFacts=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/KnownFacts/KnownFacts.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(KnownFacts_KnownFacts.Z,options);KnownFacts_KnownFacts.Z&&KnownFacts_KnownFacts.Z.locals&&KnownFacts_KnownFacts.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts_stories={title:"Known Facts",component:KnownFacts.Z,argTypes:{visible:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(KnownFacts.Z,{apiURL:"https://backend.memori.ai",sessionID:data.M9,memori:data.jF,closeDrawer:()=>{},...args})});Template.displayName="Template";const Default=Template.bind({});Default.args={visible:!0};const WithData=Template.bind({});WithData.args={visible:!0,initialKnownFacts:[data.JZ]};const WithPaginatedData=Template.bind({});WithPaginatedData.args={visible:!0,initialKnownFacts:new Array(26).fill(data.JZ).map(((fact,index)=>({...fact,knownFactID:fact.knownFactID+index})))};const WithRealDataLocalhost=Template.bind({});WithRealDataLocalhost.args={visible:!0,sessionID:"5841f5f9-3315-4a5a-9b62-33b13d5a27fd",apiURL:"http://localhost:7778",memori:{memoriName:"test memori",ownerUserName:"nicola",memoriID:"1a9c75e8-57aa-4ce3-8ea5-256185fa79a7",ownerUserID:"04a8cff9-13d6-4367-9cb2-72b9af9ee494",tenantID:"app.memorytwin.com",apiURL:"http://localhost:7778",baseURL:"http://localhost:3000",uiLang:"EN",lang:"IT",layout:"FULLPAGE",showShare:"true",integrationID:"82f017cc-450b-4c47-acf5-47910d336ce9"}},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...Default.parameters?.docs?.source}}},WithData.parameters={...WithData.parameters,docs:{...WithData.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...WithData.parameters?.docs?.source}}},WithPaginatedData.parameters={...WithPaginatedData.parameters,docs:{...WithPaginatedData.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...WithPaginatedData.parameters?.docs?.source}}},WithRealDataLocalhost.parameters={...WithRealDataLocalhost.parameters,docs:{...WithRealDataLocalhost.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...WithRealDataLocalhost.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithData","WithPaginatedData","WithRealDataLocalhost"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/KnownFacts/KnownFacts.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Drawer.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Spin.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_helpers_error__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/helpers/error.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Delete__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/Delete.tsx"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/ui/Select.tsx"),_icons_ChevronLeft__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./src/components/icons/ChevronLeft.tsx"),_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/components/icons/ChevronRight.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts=({apiURL,sessionID,memori,visible=!0,initialKnownFacts=[],closeDrawer})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_14__.$)(),client=(0,_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__.Z)(apiURL),{getKnownFactsPaginated,deleteKnownFact}=client.knownFacts,[knownFacts,setKnownFacts]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts),[numberOfResults,setNumberOfResults]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(25),[pageIndex,setPageIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[knownFactsCount,setKnownFactsCount]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts?.length??0),[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),fetchKnownFacts=async(sessionId,from,howMany)=>{if(sessionID||sessionId){setLoading(!0);try{const{knownFacts,count,...response}=await getKnownFactsPaginated(sessionId??sessionID,from??pageIndex,howMany??numberOfResults);setKnownFacts(knownFacts??[]),setKnownFactsCount(count??0),0!==response.resultCode&&(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode))))}catch(err){console.error("KNOWN_FACTS/FETCH",err),setKnownFacts(initialKnownFacts??[])}setLoading(!1)}};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{fetchKnownFacts()}),[]);const[bulkDeleteModalVisible,setBulkDeleteModalVisible]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[deleteModalVisibleFor,setDeleteModalVisibleFor]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),[selectedRowKeys,setSelectedRowKeys]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,width:"80%",className:"memori-known-facts-drawer",onClose:()=>closeDrawer(),title:t("knownFacts.title"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("p",{children:t("knownFacts.description",{memoriName:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Spin__WEBPACK_IMPORTED_MODULE_4__.Z,{spinning:loading,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:()=>{setBulkDeleteModalVisible(!0)},className:"memori-known-facts-delete-selected",disabled:0===selectedRowKeys?.length,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),loading,children:[t("selected")," (",selectedRowKeys?.length,")"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:bulkDeleteModalVisible,closable:!0,title:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmTitle"):t("knownFacts.deleteConfirmTitle"),description:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmMessage",{number:selectedRowKeys.length}):t("knownFacts.deleteConfirmMessage"),onClose:()=>{setBulkDeleteModalVisible(!1)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setBulkDeleteModalVisible(!1)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const mutations=selectedRowKeys.map((key=>deleteKnownFact(sessionID,key)));Promise.all(mutations).then((responses=>{if(responses.every((r=>0===r.resultCode)))react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setBulkDeleteModalVisible(!1);else{let errored=responses.find((r=>0!==r.resultCode));console.error(errored),void 0!==errored?.resultCode&&react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(errored?.resultCode)))}}))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]}),knownFactsCount>25&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("nav",{className:"memori--table--pagination",children:[knownFactsCount>numberOfResults&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",disabled:0===pageIndex||pageIndex{let from=(pageIndex/numberOfResults-1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(pageIndex/numberOfResults)+1," /"," ",Math.ceil(knownFactsCount/numberOfResults)]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",padded:!1,title:t("next")||"Next",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__.default,{}),disabled:(pageIndex/numberOfResults+1)*numberOfResults>=knownFactsCount,onClick:()=>{let from=(pageIndex/numberOfResults+1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_10__.Z,{options:[{label:`25 / ${t("page")||"page"}`,value:25},{label:`50 / ${t("page")||"page"}`,value:50},{label:`100 / ${t("page")||"page"}`,value:100}],value:numberOfResults,displayValue:`${numberOfResults} / ${t("page")||"page"}`,onChange:value=>{setNumberOfResults(value),setPageIndex(0),fetchKnownFacts(void 0,0,value)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("table",{className:"memori--table",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("thead",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:!!knownFacts?.length&&selectedRowKeys?.length===knownFacts.length,indeterminate:!!knownFacts?.length&&!!selectedRowKeys?.length&&selectedRowKeys?.length!==knownFacts?.length,onChange:e=>{e.target.checked?setSelectedRowKeys(knownFacts.map((kf=>kf.knownFactID))):setSelectedRowKeys([])}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{children:t("knownFacts.text")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"mobile-hidden",children:t("createdAt")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-right",children:t("actions")})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("tbody",{children:knownFacts.map((kf=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:selectedRowKeys?.includes(kf.knownFactID),onChange:e=>{e.target.checked?setSelectedRowKeys((srk=>[...new Set([...srk,kf.knownFactID])])):setSelectedRowKeys((srk=>srk.filter((key=>key!==kf.knownFactID))))}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{children:kf.text}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"mobile-hidden",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("span",{className:"memori--table--date",children:kf.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(kf.creationTimestamp)):"-"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"memori--table--column-right",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--action-column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{danger:!0,ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),disabled:selectedRowKeys?.length>0,title:t("delete")||"Delete",onClick:()=>setDeleteModalVisibleFor(kf.knownFactID)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:deleteModalVisibleFor===kf.knownFactID,closable:!0,title:t("knownFacts.deleteConfirmTitle"),description:t("knownFacts.deleteConfirmMessage"),onClose:()=>{setDeleteModalVisibleFor(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setDeleteModalVisibleFor(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const response=await deleteKnownFact(sessionID,kf.knownFactID);0===response.resultCode?(react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setDeleteModalVisibleFor(void 0)):(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode),{ns:"common"})))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]})})]},kf.knownFactID)))})]})]})]})};KnownFacts.displayName="KnownFacts";const __WEBPACK_DEFAULT_EXPORT__=KnownFacts;try{KnownFacts.displayName="KnownFacts",KnownFacts.__docgenInfo={description:"",displayName:"KnownFacts",props:{apiURL:{defaultValue:null,description:"",name:"apiURL",required:!0,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},initialKnownFacts:{defaultValue:{value:"[]"},description:"",name:"initialKnownFacts",required:!1,type:{name:"KnownFact[]"}},visible:{defaultValue:{value:"true"},description:"",name:"visible",required:!1,type:{name:"boolean"}},closeDrawer:{defaultValue:null,description:"",name:"closeDrawer",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/KnownFacts/KnownFacts.tsx#KnownFacts"]={docgenInfo:KnownFacts.__docgenInfo,name:"KnownFacts",path:"src/components/KnownFacts/KnownFacts.tsx#KnownFacts"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronLeft.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronLeft=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M15 18L9 12 15 6"})});ChevronLeft.displayName="ChevronLeft";const __WEBPACK_DEFAULT_EXPORT__=ChevronLeft;try{ChevronLeft.displayName="ChevronLeft",ChevronLeft.__docgenInfo={description:"",displayName:"ChevronLeft",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronLeft.tsx#ChevronLeft"]={docgenInfo:ChevronLeft.__docgenInfo,name:"ChevronLeft",path:"src/components/icons/ChevronLeft.tsx#ChevronLeft"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronRight.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronRight=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9 18L15 12 9 6"})});ChevronRight.displayName="ChevronRight";const __WEBPACK_DEFAULT_EXPORT__=ChevronRight;try{ChevronRight.displayName="ChevronRight",ChevronRight.__docgenInfo={description:"",displayName:"ChevronRight",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronRight.tsx#ChevronRight"]={docgenInfo:ChevronRight.__docgenInfo,name:"ChevronRight",path:"src/components/icons/ChevronRight.tsx#ChevronRight"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Delete.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Delete=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});Delete.displayName="Delete";const __WEBPACK_DEFAULT_EXPORT__=Delete;try{Delete.displayName="Delete",Delete.__docgenInfo={description:"",displayName:"Delete",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Delete.tsx#Delete"]={docgenInfo:Delete.__docgenInfo,name:"Delete",path:"src/components/icons/Delete.tsx#Delete"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/SelectIcon.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const SelectIcon=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className,fill:"currentColor","aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});SelectIcon.displayName="SelectIcon";const __WEBPACK_DEFAULT_EXPORT__=SelectIcon;try{SelectIcon.displayName="SelectIcon",SelectIcon.__docgenInfo={description:"",displayName:"SelectIcon",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/SelectIcon.tsx#SelectIcon"]={docgenInfo:SelectIcon.__docgenInfo,name:"SelectIcon",path:"src/components/icons/SelectIcon.tsx#SelectIcon"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Checkbox.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Checkbox=({label,className,disabled=!1,indeterminate=!1,checked,children,onChange,name,...props})=>{const inputRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{inputRef.current&&(inputRef.current.indeterminate=indeterminate)}),[inputRef,indeterminate]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("label",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-checkbox",className,{"memori-checkbox--disabled":disabled,"memori-checkbox--indeterminate":indeterminate}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{ref:inputRef,type:"checkbox",...props,name,disabled,checked:checked||indeterminate,className:"memori-checkbox--input",onChange}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--inner"})]}),!!label?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--text",children:label})]})};Checkbox.displayName="Checkbox";const __WEBPACK_DEFAULT_EXPORT__=Checkbox;try{Checkbox.displayName="Checkbox",Checkbox.__docgenInfo={description:"",displayName:"Checkbox",props:{label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},checked:{defaultValue:null,description:"",name:"checked",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},indeterminate:{defaultValue:{value:"false"},description:"",name:"indeterminate",required:!1,type:{name:"boolean"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((event: ChangeEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Checkbox.tsx#Checkbox"]={docgenInfo:Checkbox.__docgenInfo,name:"Checkbox",path:"src/components/ui/Checkbox.tsx#Checkbox"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Modal.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Modal=({open=!1,onClose,className,title,description,children,footer,loading=!1,closable=!0,width="100%",widthMd="100%"})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-modal",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V.Panel,{className:"memori-modal--panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-modal--panel {\n --memori-modal--width: ${width};\n --memori-modal--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,padded:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),title:t("close")||"Close",onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V.Title,{className:"memori-modal--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V.Description,{className:"memori-modal--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--footer",children:footer})]})]})})})})]})})};Modal.displayName="Modal";const __WEBPACK_DEFAULT_EXPORT__=Modal;try{Modal.displayName="Modal",Modal.__docgenInfo={description:"",displayName:"Modal",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"100%"},description:"",name:"widthMd",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Modal.tsx#Modal"]={docgenInfo:Modal.__docgenInfo,name:"Modal",path:"src/components/ui/Modal.tsx#Modal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Select.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Select=({className,value,name,displayValue,options,onChange,disabled=!1,label,placeholder})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select",className),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R,{value,onChange:value=>{onChange(value)},disabled,name,children:[label&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Label,{className:"memori-select--label",children:[label,":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Button,{"aria-label":label,className:"memori-select--button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select--value",{"memori-select--value-placeholder":!value}),children:value?displayValue||value:placeholder}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Options,{className:"memori-select--options",children:options.map((opt=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Option,{value:opt.value,className:"memori-select--option",children:opt.label},opt.value)))})})]})});Select.displayName="Select";const __WEBPACK_DEFAULT_EXPORT__=Select;try{Select.displayName="Select",Select.__docgenInfo={description:"",displayName:"Select",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"any"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},displayValue:{defaultValue:null,description:"",name:"displayValue",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(value: any) => void"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"{ value: any; label: any; }[]"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Select.tsx#Select"]={docgenInfo:Select.__docgenInfo,name:"Select",path:"src/components/ui/Select.tsx#Select"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/error.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{r:()=>getErrori18nKey});const BACKEND_ERRORS=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,TENANT_ALREADY_EXISTS:-6,TENANT_MISSING_DESCRIPTION:-7,TENANT_CANT_SET_COMPLETION_PROVIDER:-8,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_TOO_MANY_ATTEMPTS:-38,USER_MUST_ACCEPT_TNC_AND_PP:-39,USER_BIRTH_DATE_CANT_BE_CHANGED:-40,USER_CANT_SET_COMPLETION_PROVIDER:-41,USER_CANT_ENABLE_DEEP_THOUGHT:-42,USER_CANT_ENABLE_DCM_INTEGRATION:-43,USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS:-44,MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS:-45,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,SESSION_EXPIRED:-103,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS:-215,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,MEMORI_FEATURE_REQUIRES_SUBSCRIPTION:-271,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905,NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD:-1001,PROCESS_INVALID_TYPE:-1401,PROCESS_ALREADY_RUNNING:-1401,PROCESS_NOT_FOUND:-1402,IMPORTCSV_MISSING_ROWS:-1501,IMPORTCSV_MISSING_CSV:-1502,IMPORTCSV_MISSING_SEPARATOR:-1503,IMPORTCSV_INVALID_SEPARATOR:-1504,IMPORTCSV_MISSING_HEADERS:-1505,IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1506,IMPORTCSV_UNDETECTABLE_CHAR_ENCODING:-1521,IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI:-1531,IMPORTTXT_MISSING_ROWS:-1601,IMPORTTXT_INVALID_GRANULARITY:-1602,IMPORTTXT_UNDETECTABLE_CHAR_ENCODING:-1621,IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI:-1631,IMPORTTXT_IMPORT_LIMIT_EXCEEDED:-1632,IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY:-1633,IMPORTTXT_IMPORT_REQUIRES_PAYING:-1634,EXPORTCSV_MISSING_CSV_SPECS:-1801,EXPORTCSV_MISSING_SEPARATOR:-1802,EXPORTCSV_INVALID_SEPARATOR:-1803,EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1804,EXPORTCSV_MISSING_NEW_LINE_CHAR:-1805,EXPORTCSV_INVALID_NEW_LINE_CHAR:-1806,EXPORTCSV_MISSING_PASSWORD:-1811,EXPORTJSONL_MISSING_JSONL_SPECS:-1821,EXPORTJSONL_MISSING_PLATFORM:-1822,EXPORTJSONL_INVALID_PLATFORM:-1823,EXPORTJSONL_MISSING_PASSWORD:-1831,EXPORTJSONL_EXPORT_REQUIRES_PAYING:-1832,ANALYSIS_MISSING_QUERY:-1901,ANALYSIS_CANT_ANALYZE_SECRET_MEMORI:-1902,ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT:-1903,BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS:-2001,BADGE_ASSIGNMENT_MISSING_REF_ID:-2002,BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND:-2003,BADGE_ASSIGNMENT_MISSING_ASSERTION_URL:-2004,BADGE_ASSIGNMENT_MISSING_BADGE_URL:-2005,BADGE_ASSIGNMENT_MISSING_ISSUER_URL:-2006,BADGE_ASSIGNMENT_INVALID_URL:-2007,BADGE_ASSIGNMENT_MISSING_RECIPIENT:-2021,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE:-2022,BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY:-2023,BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE:-2024,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE:-2025,BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY:-2026,BADGE_NOT_FOUND:-2051,OUTCOME_NO_DCM_CONFIGURED:-2071,OUTCOME_USER_BADGES_DISABLED:-2072}).map((([key,value])=>[value,key]))),getErrori18nKey=errorCode=>{if(!errorCode)return"error.generic";if(401===errorCode||403===errorCode)return"error.unauthorized";if(404===errorCode)return"error.notFound";if(422===errorCode)return"error.unprocessableEntity";if(500===errorCode)return"internal server error";let error=BACKEND_ERRORS.get(errorCode);return error?`errors.${error}`:"error.generic"}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[6191],{"./node_modules/@headlessui/react/dist/components/listbox/listbox.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{R:()=>pt});var r,n,react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-disposables.js"),_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-id.js"),_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js"),_hooks_use_computed_js__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-computed.js"),_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-sync-refs.js"),_utils_render_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/render.js"),_utils_match_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/match.js"),_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/disposables.js"),_keyboard_js__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__("./node_modules/@headlessui/react/dist/components/keyboard.js"),_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/calculate-active-index.js"),_utils_bugs_js__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/bugs.js"),_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/focus-management.js"),_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./node_modules/@headlessui/react/dist/internal/open-closed.js"),_hooks_use_resolve_button_type_js__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js"),_hooks_use_outside_click_js__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-outside-click.js"),_internal_hidden_js__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./node_modules/@headlessui/react/dist/internal/hidden.js"),_utils_form_js__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/form.js"),_utils_owner_js__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/owner.js"),_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js"),_hooks_use_controllable_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-controllable.js"),ye=((n=ye||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),xe=(n=>(n[n.Single=0]="Single",n[n.Multi=1]="Multi",n))(xe||{}),Oe=(n=>(n[n.Pointer=0]="Pointer",n[n.Other=1]="Other",n))(Oe||{}),me=((r=me||{})[r.OpenListbox=0]="OpenListbox",r[r.CloseListbox=1]="CloseListbox",r[r.SetDisabled=2]="SetDisabled",r[r.SetOrientation=3]="SetOrientation",r[r.GoToOption=4]="GoToOption",r[r.Search=5]="Search",r[r.ClearSearch=6]="ClearSearch",r[r.RegisterOption=7]="RegisterOption",r[r.UnregisterOption=8]="UnregisterOption",r);function j(t,i=(n=>n)){let n=null!==t.activeOptionIndex?t.options[t.activeOptionIndex]:null,e=(0,_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__.z2)(i(t.options.slice()),(u=>u.dataRef.current.domRef.current)),o=n?e.indexOf(n):null;return-1===o&&(o=null),{options:e,activeOptionIndex:o}}let ge={1:t=>t.disabled||1===t.listboxState?t:{...t,activeOptionIndex:null,listboxState:1},0(t){if(t.disabled||0===t.listboxState)return t;let i=t.activeOptionIndex,{value:n,mode:e,compare:o}=t.propsRef.current,u=t.options.findIndex((l=>{let s=l.dataRef.current.value;return(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(e,{1:()=>n.some((r=>o(r,s))),0:()=>o(n,s)})}));return-1!==u&&(i=u),{...t,listboxState:0,activeOptionIndex:i}},2:(t,i)=>t.disabled===i.disabled?t:{...t,disabled:i.disabled},3:(t,i)=>t.orientation===i.orientation?t:{...t,orientation:i.orientation},4(t,i){var o;if(t.disabled||1===t.listboxState)return t;let n=j(t),e=(0,_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.d)(i,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...t,...n,searchQuery:"",activeOptionIndex:e,activationTrigger:null!=(o=i.trigger)?o:1}},5:(t,i)=>{if(t.disabled||1===t.listboxState)return t;let e=""!==t.searchQuery?0:1,o=t.searchQuery+i.value.toLowerCase(),l=(null!==t.activeOptionIndex?t.options.slice(t.activeOptionIndex+e).concat(t.options.slice(0,t.activeOptionIndex+e)):t.options).find((d=>{var r;return!d.dataRef.current.disabled&&(null==(r=d.dataRef.current.textValue)?void 0:r.startsWith(o))})),s=l?t.options.indexOf(l):-1;return-1===s||s===t.activeOptionIndex?{...t,searchQuery:o}:{...t,searchQuery:o,activeOptionIndex:s,activationTrigger:1}},6:t=>t.disabled||1===t.listboxState||""===t.searchQuery?t:{...t,searchQuery:""},7:(t,i)=>{let n={id:i.id,dataRef:i.dataRef},e=j(t,(o=>[...o,n]));if(null===t.activeOptionIndex){let{value:o,mode:u,compare:l}=t.propsRef.current,s=i.dataRef.current.value;(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(u,{1:()=>o.some((r=>l(r,s))),0:()=>l(o,s)})&&(e.activeOptionIndex=e.options.indexOf(n))}return{...t,...e}},8:(t,i)=>{let n=j(t,(e=>{let o=e.findIndex((u=>u.id===i.id));return-1!==o&&e.splice(o,1),e}));return{...t,...n,activationTrigger:1}}},K=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);function w(t){let i=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(K);if(null===i){let n=new Error(`<${t} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,w),n}return i}function Re(t,i){return(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(i.type,ge,t,i)}K.displayName="ListboxContext";let ve=react__WEBPACK_IMPORTED_MODULE_0__.Fragment,Le=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){let{value:e,defaultValue:o,name:u,onChange:l,by:s=((p,T)=>p===T),disabled:d=!1,horizontal:r=!1,multiple:x=!1,...S}=i;const g=r?"horizontal":"vertical";let O=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(n),[m,f]=(0,_hooks_use_controllable_js__WEBPACK_IMPORTED_MODULE_6__.q)(e,l,o),b=(0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(Re,{listboxState:1,propsRef:{current:{value:m,onChange:f,mode:x?1:0,compare:(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)("string"==typeof s?(p,T)=>{let C=s;return(null==p?void 0:p[C])===(null==T?void 0:T[C])}:s)}},labelRef:(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)(),buttonRef:(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)(),optionsRef:(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)(),disabled:d,orientation:g,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1}),[{listboxState:a,propsRef:c,optionsRef:P,buttonRef:D},M]=b;c.current.value=m,c.current.mode=x?1:0,(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{c.current.onChange=p=>(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(c.current.mode,{0:()=>f(p),1(){let T=c.current.value.slice(),{compare:C}=c.current,W=T.findIndex((X=>C(X,p)));return-1===W?T.push(p):T.splice(W,1),f(T)}})}),[f,c]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>M({type:2,disabled:d})),[d]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>M({type:3,orientation:g})),[g]),(0,_hooks_use_outside_click_js__WEBPACK_IMPORTED_MODULE_9__.O)([D,P],((p,T)=>{var C;M({type:1}),(0,_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__.sP)(T,_utils_focus_management_js__WEBPACK_IMPORTED_MODULE_1__.tJ.Loose)||(p.preventDefault(),null==(C=D.current)||C.focus())}),0===a);let N=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===a,disabled:d,value:m})),[a,d,m]),R={ref:O};return react__WEBPACK_IMPORTED_MODULE_0__.createElement(K.Provider,{value:b},react__WEBPACK_IMPORTED_MODULE_0__.createElement(_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.up,{value:(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(a,{0:_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.ZM.Open,1:_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.ZM.Closed})},null!=u&&null!=m&&(0,_utils_form_js__WEBPACK_IMPORTED_MODULE_11__.t)({[u]:m}).map((([p,T])=>react__WEBPACK_IMPORTED_MODULE_0__.createElement(_internal_hidden_js__WEBPACK_IMPORTED_MODULE_12__._,{features:_internal_hidden_js__WEBPACK_IMPORTED_MODULE_12__.A.Hidden,...(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.oA)({key:p,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:p,value:T})}))),(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:R,theirProps:S,slot:N,defaultTag:ve,name:"Listbox"})))})),Ae=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){var f;let[e,o]=w("Listbox.Button"),u=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(e.buttonRef,n),l=`headlessui-listbox-button-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,s=(0,_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__.G)(),d=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((b=>{switch(b.key){case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Space:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Enter:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowDown:b.preventDefault(),o({type:0}),s.nextFrame((()=>{e.propsRef.current.value||o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.First})}));break;case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowUp:b.preventDefault(),o({type:0}),s.nextFrame((()=>{e.propsRef.current.value||o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Last})}))}})),r=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((b=>{if(b.key===_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Space)b.preventDefault()})),x=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((b=>{if((0,_utils_bugs_js__WEBPACK_IMPORTED_MODULE_16__.P)(b.currentTarget))return b.preventDefault();0===e.listboxState?(o({type:1}),s.nextFrame((()=>{var a;return null==(a=e.buttonRef.current)?void 0:a.focus({preventScroll:!0})}))):(b.preventDefault(),o({type:0}))})),S=(0,_hooks_use_computed_js__WEBPACK_IMPORTED_MODULE_17__.v)((()=>{if(e.labelRef.current)return[e.labelRef.current.id,l].join(" ")}),[e.labelRef.current,l]),g=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===e.listboxState,disabled:e.disabled,value:e.propsRef.current.value})),[e]),O=i,m={ref:u,id:l,type:(0,_hooks_use_resolve_button_type_js__WEBPACK_IMPORTED_MODULE_18__.f)(i,e.buttonRef),"aria-haspopup":!0,"aria-controls":null==(f=e.optionsRef.current)?void 0:f.id,"aria-expanded":e.disabled?void 0:0===e.listboxState,"aria-labelledby":S,disabled:e.disabled,onKeyDown:d,onKeyUp:r,onClick:x};return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:m,theirProps:O,slot:g,defaultTag:"button",name:"Listbox.Button"})})),Pe=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){let[e]=w("Listbox.Label"),o=`headlessui-listbox-label-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,u=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(e.labelRef,n),l=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{var x;return null==(x=e.buttonRef.current)?void 0:x.focus({preventScroll:!0})})),s=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===e.listboxState,disabled:e.disabled})),[e]);return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:{ref:u,id:o,onClick:l},theirProps:i,slot:s,defaultTag:"label",name:"Listbox.Label"})})),De=_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.AN.RenderStrategy|_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.AN.Static,Me=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){var b;let[e,o]=w("Listbox.Options"),u=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(e.optionsRef,n),l=`headlessui-listbox-options-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,s=(0,_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__.G)(),d=(0,_hooks_use_disposables_js__WEBPACK_IMPORTED_MODULE_14__.G)(),r=(0,_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.oJ)(),x=null!==r?r===_internal_open_closed_js__WEBPACK_IMPORTED_MODULE_10__.ZM.Open:0===e.listboxState;(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{var c;let a=e.optionsRef.current;!a||0===e.listboxState&&a!==(null==(c=(0,_utils_owner_js__WEBPACK_IMPORTED_MODULE_19__.r)(a))?void 0:c.activeElement)&&a.focus({preventScroll:!0})}),[e.listboxState,e.optionsRef]);let S=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((a=>{switch(d.dispose(),a.key){case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Space:if(""!==e.searchQuery)return a.preventDefault(),a.stopPropagation(),o({type:5,value:a.key});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Enter:if(a.preventDefault(),a.stopPropagation(),null!==e.activeOptionIndex){let{dataRef:c}=e.options[e.activeOptionIndex];e.propsRef.current.onChange(c.current.value)}0===e.propsRef.current.mode&&(o({type:1}),(0,_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__.k)().nextFrame((()=>{var c;return null==(c=e.buttonRef.current)?void 0:c.focus({preventScroll:!0})})));break;case(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(e.orientation,{vertical:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowDown,horizontal:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowRight}):return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Next});case(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(e.orientation,{vertical:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowUp,horizontal:_keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.ArrowLeft}):return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Previous});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Home:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.PageUp:return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.First});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.End:case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.PageDown:return a.preventDefault(),a.stopPropagation(),o({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Last});case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Escape:return a.preventDefault(),a.stopPropagation(),o({type:1}),s.nextFrame((()=>{var c;return null==(c=e.buttonRef.current)?void 0:c.focus({preventScroll:!0})}));case _keyboard_js__WEBPACK_IMPORTED_MODULE_15__.R.Tab:a.preventDefault(),a.stopPropagation();break;default:1===a.key.length&&(o({type:5,value:a.key}),d.setTimeout((()=>o({type:6})),350))}})),g=(0,_hooks_use_computed_js__WEBPACK_IMPORTED_MODULE_17__.v)((()=>{var a,c,P;return null!=(P=null==(a=e.labelRef.current)?void 0:a.id)?P:null==(c=e.buttonRef.current)?void 0:c.id}),[e.labelRef.current,e.buttonRef.current]),O=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({open:0===e.listboxState})),[e]),m=i,f={"aria-activedescendant":null===e.activeOptionIndex||null==(b=e.options[e.activeOptionIndex])?void 0:b.id,"aria-multiselectable":1===e.propsRef.current.mode||void 0,"aria-labelledby":g,"aria-orientation":e.orientation,id:l,onKeyDown:S,role:"listbox",tabIndex:0,ref:u};return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:f,theirProps:m,slot:O,defaultTag:"ul",features:De,visible:x,name:"Listbox.Options"})})),Ie=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.yV)((function(i,n){let{disabled:e=!1,value:o,...u}=i,[l,s]=w("Listbox.Option"),d=`headlessui-listbox-option-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_13__.M)()}`,r=null!==l.activeOptionIndex&&l.options[l.activeOptionIndex].id===d,{value:x,compare:S}=l.propsRef.current,g=(0,_utils_match_js__WEBPACK_IMPORTED_MODULE_2__.E)(l.propsRef.current.mode,{1:()=>x.some((R=>S(R,o))),0:()=>S(x,o)}),O=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),m=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_5__.T)(n,O);(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{if(0!==l.listboxState||!r||0===l.activationTrigger)return;let R=(0,_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__.k)();return R.requestAnimationFrame((()=>{var p,T;null==(T=null==(p=O.current)?void 0:p.scrollIntoView)||T.call(p,{block:"nearest"})})),R.dispose}),[O,r,l.listboxState,l.activationTrigger,l.activeOptionIndex]);let f=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({disabled:e,value:o,domRef:O});(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{f.current.disabled=e}),[f,e]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{f.current.value=o}),[f,o]),(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>{var R,p;f.current.textValue=null==(p=null==(R=O.current)?void 0:R.textContent)?void 0:p.toLowerCase()}),[f,O]);let b=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>l.propsRef.current.onChange(o)));(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_8__.e)((()=>(s({type:7,id:d,dataRef:f}),()=>s({type:8,id:d}))),[f,d]);let a=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((R=>{if(e)return R.preventDefault();b(),0===l.propsRef.current.mode&&(s({type:1}),(0,_utils_disposables_js__WEBPACK_IMPORTED_MODULE_20__.k)().nextFrame((()=>{var p;return null==(p=l.buttonRef.current)?void 0:p.focus({preventScroll:!0})})))})),c=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{if(e)return s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Nothing});s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Specific,id:d})})),P=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{e||r||s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Specific,id:d,trigger:0})})),D=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_7__.z)((()=>{e||!r||s({type:4,focus:_utils_calculate_active_index_js__WEBPACK_IMPORTED_MODULE_3__.T.Nothing})})),M=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({active:r,selected:g,disabled:e})),[r,g,e]);return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_4__.sY)({ourProps:{id:d,ref:m,role:"option",tabIndex:!0===e?void 0:-1,"aria-disabled":!0===e||void 0,"aria-selected":g,disabled:void 0,onClick:a,onFocus:c,onPointerMove:P,onMouseMove:P,onPointerLeave:D,onMouseLeave:D},theirProps:u,slot:M,defaultTag:"li",name:"Listbox.Option"})})),pt=Object.assign(Le,{Button:Ae,Label:Pe,Options:Me,Option:Ie})},"./node_modules/@headlessui/react/dist/hooks/use-computed.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{v:()=>i});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js"),_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-latest-value.js");function i(e,o){let[u,t]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(e),r=(0,_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__.E)(e);return(0,_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_2__.e)((()=>t(r.current)),[r,t,...o]),u}},"./node_modules/@headlessui/react/dist/hooks/use-controllable.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{q:()=>T});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_event_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js");function T(l,r,c){let[i,s]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(c),e=void 0!==l,t=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(e),u=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(!1),d=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(!1);return!e||t.current||u.current?!e&&t.current&&!d.current&&(d.current=!0,t.current=e,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(u.current=!0,t.current=e,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[e?l:i,(0,_use_event_js__WEBPACK_IMPORTED_MODULE_1__.z)((n=>(e||s(n),null==r?void 0:r(n))))]}},"./node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{f:()=>s});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js");function i(t){var n;if(t.type)return t.type;let e=null!=(n=t.as)?n:"button";return"string"==typeof e&&"button"===e.toLowerCase()?"button":void 0}function s(t,e){let[n,u]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)((()=>i(t)));return(0,_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_1__.e)((()=>{u(i(t))}),[t.type,t.as]),(0,_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_1__.e)((()=>{n||!e.current||e.current instanceof HTMLButtonElement&&!e.current.hasAttribute("type")&&u("button")}),[n,e]),n}},"./node_modules/@headlessui/react/dist/utils/calculate-active-index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{T:()=>a,d:()=>x});var e,a=((e=a||{})[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e);function x(r,n){let t=n.resolveItems();if(t.length<=0)return null;let l=n.resolveActiveIndex(),s=null!=l?l:-1,d=(()=>{switch(r.focus){case 0:return t.findIndex((e=>!n.resolveDisabled(e)));case 1:{let e=t.slice().reverse().findIndex(((i,c,u)=>!(-1!==s&&u.length-c-1>=s)&&!n.resolveDisabled(i)));return-1===e?e:t.length-1-e}case 2:return t.findIndex(((e,i)=>!(i<=s)&&!n.resolveDisabled(e)));case 3:{let e=t.slice().reverse().findIndex((i=>!n.resolveDisabled(i)));return-1===e?e:t.length-1-e}case 4:return t.findIndex((e=>n.resolveId(e)===r.id));case 5:return null;default:!function f(r){throw new Error("Unexpected object: "+r)}(r)}})();return-1===d?l:d}},"./node_modules/@headlessui/react/dist/utils/form.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function e(n={},r=null,t=[]){for(let[i,o]of Object.entries(n))f(t,s(r,i),o);return t}function s(n,r){return n?n+"["+r+"]":r}function f(n,r,t){if(Array.isArray(t))for(let[i,o]of t.entries())f(n,s(r,i.toString()),o);else t instanceof Date?n.push([r,t.toISOString()]):"boolean"==typeof t?n.push([r,t?"1":"0"]):"string"==typeof t?n.push([r,t]):"number"==typeof t?n.push([r,`${t}`]):null==t?n.push([r,""]):e(t,r,n)}function p(n){var t;let r=null!=(t=null==n?void 0:n.form)?t:n.closest("form");if(r)for(let i of r.elements)if("INPUT"===i.tagName&&"submit"===i.type||"BUTTON"===i.tagName&&"submit"===i.type||"INPUT"===i.nodeName&&"image"===i.type)return void i.click()}__webpack_require__.d(__webpack_exports__,{g:()=>p,t:()=>e})},"./src/components/KnownFacts/KnownFacts.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithData:()=>WithData,WithPaginatedData:()=>WithPaginatedData,WithRealDataLocalhost:()=>WithRealDataLocalhost,__namedExportsOrder:()=>__namedExportsOrder,default:()=>KnownFacts_stories});__webpack_require__("./node_modules/react/index.js");var data=__webpack_require__("./src/mocks/data.ts"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),KnownFacts=__webpack_require__("./src/components/KnownFacts/KnownFacts.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),KnownFacts_KnownFacts=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/KnownFacts/KnownFacts.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(KnownFacts_KnownFacts.Z,options);KnownFacts_KnownFacts.Z&&KnownFacts_KnownFacts.Z.locals&&KnownFacts_KnownFacts.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts_stories={title:"Known Facts",component:KnownFacts.Z,argTypes:{visible:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(KnownFacts.Z,{apiURL:"https://backend.memori.ai",sessionID:data.M9,memori:data.jF,closeDrawer:()=>{},...args})});Template.displayName="Template";const Default=Template.bind({});Default.args={visible:!0};const WithData=Template.bind({});WithData.args={visible:!0,initialKnownFacts:[data.JZ]};const WithPaginatedData=Template.bind({});WithPaginatedData.args={visible:!0,initialKnownFacts:new Array(26).fill(data.JZ).map(((fact,index)=>({...fact,knownFactID:fact.knownFactID+index})))};const WithRealDataLocalhost=Template.bind({});WithRealDataLocalhost.args={visible:!0,sessionID:"5841f5f9-3315-4a5a-9b62-33b13d5a27fd",apiURL:"http://localhost:7778",memori:{memoriName:"test memori",ownerUserName:"nicola",memoriID:"1a9c75e8-57aa-4ce3-8ea5-256185fa79a7",ownerUserID:"04a8cff9-13d6-4367-9cb2-72b9af9ee494",tenantID:"app.memorytwin.com",apiURL:"http://localhost:7778",baseURL:"http://localhost:3000",uiLang:"EN",lang:"IT",layout:"FULLPAGE",showShare:"true",integrationID:"82f017cc-450b-4c47-acf5-47910d336ce9"}},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...Default.parameters?.docs?.source}}},WithData.parameters={...WithData.parameters,docs:{...WithData.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...WithData.parameters?.docs?.source}}},WithPaginatedData.parameters={...WithPaginatedData.parameters,docs:{...WithPaginatedData.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...WithPaginatedData.parameters?.docs?.source}}},WithRealDataLocalhost.parameters={...WithRealDataLocalhost.parameters,docs:{...WithRealDataLocalhost.parameters?.docs,source:{originalSource:'args => \n {}} {...args} />\n ',...WithRealDataLocalhost.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithData","WithPaginatedData","WithRealDataLocalhost"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/KnownFacts/KnownFacts.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@memori.ai/memori-api-client/esm/index.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/ui/Drawer.tsx"),_ui_Spin__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Spin.tsx"),_ui_Modal__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./src/components/ui/Modal.tsx"),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),_helpers_error__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./src/helpers/error.ts"),react_i18next__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_icons_Delete__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./src/components/icons/Delete.tsx"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./src/components/ui/Select.tsx"),_icons_ChevronLeft__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./src/components/icons/ChevronLeft.tsx"),_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./src/components/icons/ChevronRight.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/react/jsx-runtime.js");const KnownFacts=({apiURL,sessionID,memori,visible=!0,initialKnownFacts=[],closeDrawer})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_14__.$)(),client=(0,_memori_ai_memori_api_client__WEBPACK_IMPORTED_MODULE_1__.Z)(apiURL),{getKnownFactsPaginated,deleteKnownFact}=client.knownFacts,[knownFacts,setKnownFacts]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts),[numberOfResults,setNumberOfResults]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(25),[pageIndex,setPageIndex]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),[knownFactsCount,setKnownFactsCount]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialKnownFacts?.length??0),[loading,setLoading]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),fetchKnownFacts=async(sessionId,from,howMany)=>{if(sessionID||sessionId){setLoading(!0);try{const{knownFacts,count,...response}=await getKnownFactsPaginated(sessionId??sessionID,from??pageIndex,howMany??numberOfResults);setKnownFacts(knownFacts??[]),setKnownFactsCount(count??0),0!==response.resultCode&&(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode))))}catch(err){console.error("KNOWN_FACTS/FETCH",err),setKnownFacts(initialKnownFacts??[])}setLoading(!1)}};(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{fetchKnownFacts()}),[]);const[bulkDeleteModalVisible,setBulkDeleteModalVisible]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(!1),[deleteModalVisibleFor,setDeleteModalVisibleFor]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),[selectedRowKeys,setSelectedRowKeys]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_3__.Z,{open:visible,width:"80%",className:"memori-known-facts-drawer",onClose:()=>closeDrawer(),title:t("knownFacts.title"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("p",{children:t("knownFacts.description",{memoriName:memori.name})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Spin__WEBPACK_IMPORTED_MODULE_4__.Z,{spinning:loading,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:()=>{setBulkDeleteModalVisible(!0)},className:"memori-known-facts-delete-selected",disabled:0===selectedRowKeys?.length,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),loading,children:[t("selected")," (",selectedRowKeys?.length,")"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:bulkDeleteModalVisible,closable:!0,title:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmTitle"):t("knownFacts.deleteConfirmTitle"),description:selectedRowKeys.length>1?t("knownFacts.deleteSelectedConfirmMessage",{number:selectedRowKeys.length}):t("knownFacts.deleteConfirmMessage"),onClose:()=>{setBulkDeleteModalVisible(!1)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setBulkDeleteModalVisible(!1)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const mutations=selectedRowKeys.map((key=>deleteKnownFact(sessionID,key)));Promise.all(mutations).then((responses=>{if(responses.every((r=>0===r.resultCode)))react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setBulkDeleteModalVisible(!1);else{let errored=responses.find((r=>0!==r.resultCode));console.error(errored),void 0!==errored?.resultCode&&react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(errored?.resultCode)))}}))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]}),knownFactsCount>25&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("nav",{className:"memori--table--pagination",children:[knownFactsCount>numberOfResults&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",disabled:0===pageIndex||pageIndex{let from=(pageIndex/numberOfResults-1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(pageIndex/numberOfResults)+1," /"," ",Math.ceil(knownFactsCount/numberOfResults)]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",padded:!1,title:t("next")||"Next",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_ChevronRight__WEBPACK_IMPORTED_MODULE_12__.default,{}),disabled:(pageIndex/numberOfResults+1)*numberOfResults>=knownFactsCount,onClick:()=>{let from=(pageIndex/numberOfResults+1)*numberOfResults;setPageIndex(from),fetchKnownFacts(void 0,from,numberOfResults)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_10__.Z,{options:[{label:`25 / ${t("page")||"page"}`,value:25},{label:`50 / ${t("page")||"page"}`,value:50},{label:`100 / ${t("page")||"page"}`,value:100}],value:numberOfResults,displayValue:`${numberOfResults} / ${t("page")||"page"}`,onChange:value=>{setNumberOfResults(value),setPageIndex(0),fetchKnownFacts(void 0,0,value)}})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("table",{className:"memori--table",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("thead",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:!!knownFacts?.length&&selectedRowKeys?.length===knownFacts.length,indeterminate:!!knownFacts?.length&&!!selectedRowKeys?.length&&selectedRowKeys?.length!==knownFacts?.length,onChange:e=>{e.target.checked?setSelectedRowKeys(knownFacts.map((kf=>kf.knownFactID))):setSelectedRowKeys([])}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{children:t("knownFacts.text")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"mobile-hidden",children:t("createdAt")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-right",children:t("actions")})]})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("tbody",{children:knownFacts.map((kf=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("th",{className:"memori--table--column-centered",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_9__.Z,{checked:selectedRowKeys?.includes(kf.knownFactID),onChange:e=>{e.target.checked?setSelectedRowKeys((srk=>[...new Set([...srk,kf.knownFactID])])):setSelectedRowKeys((srk=>srk.filter((key=>key!==kf.knownFactID))))}})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{children:kf.text}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"mobile-hidden",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("span",{className:"memori--table--date",children:kf.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(kf.creationTimestamp)):"-"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)("td",{className:"memori--table--column-right",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)("div",{className:"memori--table--action-column",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{danger:!0,ghost:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_icons_Delete__WEBPACK_IMPORTED_MODULE_8__.default,{}),disabled:selectedRowKeys?.length>0,title:t("delete")||"Delete",onClick:()=>setDeleteModalVisibleFor(kf.knownFactID)}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Modal__WEBPACK_IMPORTED_MODULE_5__.Z,{className:"memori-known-facts-modal",open:deleteModalVisibleFor===kf.knownFactID,closable:!0,title:t("knownFacts.deleteConfirmTitle"),description:t("knownFacts.deleteConfirmMessage"),onClose:()=>{setDeleteModalVisibleFor(void 0)},footer:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,onClick:()=>{setDeleteModalVisibleFor(void 0)},children:t("cancel")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_13__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{primary:!0,danger:!0,onClick:async()=>{try{const response=await deleteKnownFact(sessionID,kf.knownFactID);0===response.resultCode?(react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.success(t("knownFacts.deleteSuccess")),setSelectedRowKeys([]),fetchKnownFacts(),setDeleteModalVisibleFor(void 0)):(console.error(response),react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t((0,_helpers_error__WEBPACK_IMPORTED_MODULE_7__.r)(response.resultCode),{ns:"common"})))}catch(_e){let error=_e;react_hot_toast__WEBPACK_IMPORTED_MODULE_6__.ZP.error(t("Error")+error.message)}},children:t("confirm")})]})})]})})]},kf.knownFactID)))})]})]})]})};KnownFacts.displayName="KnownFacts";const __WEBPACK_DEFAULT_EXPORT__=KnownFacts;try{KnownFacts.displayName="KnownFacts",KnownFacts.__docgenInfo={description:"",displayName:"KnownFacts",props:{apiURL:{defaultValue:null,description:"",name:"apiURL",required:!0,type:{name:"string"}},sessionID:{defaultValue:null,description:"",name:"sessionID",required:!0,type:{name:"string"}},memori:{defaultValue:null,description:"",name:"memori",required:!0,type:{name:"Memori"}},initialKnownFacts:{defaultValue:{value:"[]"},description:"",name:"initialKnownFacts",required:!1,type:{name:"KnownFact[]"}},visible:{defaultValue:{value:"true"},description:"",name:"visible",required:!1,type:{name:"boolean"}},closeDrawer:{defaultValue:null,description:"",name:"closeDrawer",required:!0,type:{name:"() => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/KnownFacts/KnownFacts.tsx#KnownFacts"]={docgenInfo:KnownFacts.__docgenInfo,name:"KnownFacts",path:"src/components/KnownFacts/KnownFacts.tsx#KnownFacts"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronLeft.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronLeft=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M15 18L9 12 15 6"})});ChevronLeft.displayName="ChevronLeft";const __WEBPACK_DEFAULT_EXPORT__=ChevronLeft;try{ChevronLeft.displayName="ChevronLeft",ChevronLeft.__docgenInfo={description:"",displayName:"ChevronLeft",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronLeft.tsx#ChevronLeft"]={docgenInfo:ChevronLeft.__docgenInfo,name:"ChevronLeft",path:"src/components/icons/ChevronLeft.tsx#ChevronLeft"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/ChevronRight.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const ChevronRight=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M9 18L15 12 9 6"})});ChevronRight.displayName="ChevronRight";const __WEBPACK_DEFAULT_EXPORT__=ChevronRight;try{ChevronRight.displayName="ChevronRight",ChevronRight.__docgenInfo={description:"",displayName:"ChevronRight",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/ChevronRight.tsx#ChevronRight"]={docgenInfo:ChevronRight.__docgenInfo,name:"ChevronRight",path:"src/components/icons/ChevronRight.tsx#ChevronRight"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Delete.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Delete=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});Delete.displayName="Delete";const __WEBPACK_DEFAULT_EXPORT__=Delete;try{Delete.displayName="Delete",Delete.__docgenInfo={description:"",displayName:"Delete",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Delete.tsx#Delete"]={docgenInfo:Delete.__docgenInfo,name:"Delete",path:"src/components/icons/Delete.tsx#Delete"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/SelectIcon.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const SelectIcon=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className,fill:"currentColor","aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});SelectIcon.displayName="SelectIcon";const __WEBPACK_DEFAULT_EXPORT__=SelectIcon;try{SelectIcon.displayName="SelectIcon",SelectIcon.__docgenInfo={description:"",displayName:"SelectIcon",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/SelectIcon.tsx#SelectIcon"]={docgenInfo:SelectIcon.__docgenInfo,name:"SelectIcon",path:"src/components/icons/SelectIcon.tsx#SelectIcon"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Checkbox.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Checkbox=({label,className,disabled=!1,indeterminate=!1,checked,children,onChange,name,...props})=>{const inputRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{inputRef.current&&(inputRef.current.indeterminate=indeterminate)}),[inputRef,indeterminate]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("label",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-checkbox",className,{"memori-checkbox--disabled":disabled,"memori-checkbox--indeterminate":indeterminate}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{ref:inputRef,type:"checkbox",...props,name,disabled,checked:checked||indeterminate,className:"memori-checkbox--input",onChange}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--inner"})]}),!!label?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--text",children:label})]})};Checkbox.displayName="Checkbox";const __WEBPACK_DEFAULT_EXPORT__=Checkbox;try{Checkbox.displayName="Checkbox",Checkbox.__docgenInfo={description:"",displayName:"Checkbox",props:{label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},checked:{defaultValue:null,description:"",name:"checked",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},indeterminate:{defaultValue:{value:"false"},description:"",name:"indeterminate",required:!1,type:{name:"boolean"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((event: ChangeEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Checkbox.tsx#Checkbox"]={docgenInfo:Checkbox.__docgenInfo,name:"Checkbox",path:"src/components/ui/Checkbox.tsx#Checkbox"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,animated=!0,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{static:!0,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:animated?"max-w-0 opacity-0":"opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:animated?"max-w-0 opacity-0":"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},animated:{defaultValue:{value:"true"},description:"",name:"animated",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Modal.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Modal=({open=!1,onClose,className,title,description,children,footer,loading=!1,closable=!0,width="100%",widthMd="100%"})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-modal",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V.Panel,{className:"memori-modal--panel",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-modal--panel {\n --memori-modal--width: ${width};\n --memori-modal--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{ghost:!0,padded:!0,shape:"circle",icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),title:t("close")||"Close",onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V.Title,{className:"memori-modal--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_8__.V.Description,{className:"memori-modal--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-modal--footer",children:footer})]})]})})})})]})})};Modal.displayName="Modal";const __WEBPACK_DEFAULT_EXPORT__=Modal;try{Modal.displayName="Modal",Modal.__docgenInfo={description:"",displayName:"Modal",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"100%"},description:"",name:"widthMd",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Modal.tsx#Modal"]={docgenInfo:Modal.__docgenInfo,name:"Modal",path:"src/components/ui/Modal.tsx#Modal"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Select.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Select=({className,value,name,displayValue,options,onChange,disabled=!1,label,placeholder})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select",className),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R,{value,onChange:value=>{onChange(value)},disabled,name,children:[label&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Label,{className:"memori-select--label",children:[label,":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Button,{"aria-label":label,className:"memori-select--button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select--value",{"memori-select--value-placeholder":!value}),children:value?displayValue||value:placeholder}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Options,{className:"memori-select--options",children:options.map((opt=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Option,{value:opt.value,className:"memori-select--option",children:opt.label},opt.value)))})})]})});Select.displayName="Select";const __WEBPACK_DEFAULT_EXPORT__=Select;try{Select.displayName="Select",Select.__docgenInfo={description:"",displayName:"Select",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"any"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},displayValue:{defaultValue:null,description:"",name:"displayValue",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(value: any) => void"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"{ value: any; label: any; }[]"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Select.tsx#Select"]={docgenInfo:Select.__docgenInfo,name:"Select",path:"src/components/ui/Select.tsx#Select"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/error.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{r:()=>getErrori18nKey});const BACKEND_ERRORS=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,TENANT_ALREADY_EXISTS:-6,TENANT_MISSING_DESCRIPTION:-7,TENANT_CANT_SET_COMPLETION_PROVIDER:-8,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_TOO_MANY_ATTEMPTS:-38,USER_MUST_ACCEPT_TNC_AND_PP:-39,USER_BIRTH_DATE_CANT_BE_CHANGED:-40,USER_CANT_SET_COMPLETION_PROVIDER:-41,USER_CANT_ENABLE_DEEP_THOUGHT:-42,USER_CANT_ENABLE_DCM_INTEGRATION:-43,USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS:-44,MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS:-45,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,SESSION_EXPIRED:-103,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS:-215,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,MEMORI_FEATURE_REQUIRES_SUBSCRIPTION:-271,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905,NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD:-1001,PROCESS_INVALID_TYPE:-1401,PROCESS_ALREADY_RUNNING:-1401,PROCESS_NOT_FOUND:-1402,IMPORTCSV_MISSING_ROWS:-1501,IMPORTCSV_MISSING_CSV:-1502,IMPORTCSV_MISSING_SEPARATOR:-1503,IMPORTCSV_INVALID_SEPARATOR:-1504,IMPORTCSV_MISSING_HEADERS:-1505,IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1506,IMPORTCSV_UNDETECTABLE_CHAR_ENCODING:-1521,IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI:-1531,IMPORTTXT_MISSING_ROWS:-1601,IMPORTTXT_INVALID_GRANULARITY:-1602,IMPORTTXT_UNDETECTABLE_CHAR_ENCODING:-1621,IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI:-1631,IMPORTTXT_IMPORT_LIMIT_EXCEEDED:-1632,IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY:-1633,IMPORTTXT_IMPORT_REQUIRES_PAYING:-1634,EXPORTCSV_MISSING_CSV_SPECS:-1801,EXPORTCSV_MISSING_SEPARATOR:-1802,EXPORTCSV_INVALID_SEPARATOR:-1803,EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1804,EXPORTCSV_MISSING_NEW_LINE_CHAR:-1805,EXPORTCSV_INVALID_NEW_LINE_CHAR:-1806,EXPORTCSV_MISSING_PASSWORD:-1811,EXPORTJSONL_MISSING_JSONL_SPECS:-1821,EXPORTJSONL_MISSING_PLATFORM:-1822,EXPORTJSONL_INVALID_PLATFORM:-1823,EXPORTJSONL_MISSING_PASSWORD:-1831,EXPORTJSONL_EXPORT_REQUIRES_PAYING:-1832,ANALYSIS_MISSING_QUERY:-1901,ANALYSIS_CANT_ANALYZE_SECRET_MEMORI:-1902,ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT:-1903,BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS:-2001,BADGE_ASSIGNMENT_MISSING_REF_ID:-2002,BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND:-2003,BADGE_ASSIGNMENT_MISSING_ASSERTION_URL:-2004,BADGE_ASSIGNMENT_MISSING_BADGE_URL:-2005,BADGE_ASSIGNMENT_MISSING_ISSUER_URL:-2006,BADGE_ASSIGNMENT_INVALID_URL:-2007,BADGE_ASSIGNMENT_MISSING_RECIPIENT:-2021,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE:-2022,BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY:-2023,BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE:-2024,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE:-2025,BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY:-2026,BADGE_NOT_FOUND:-2051,OUTCOME_NO_DCM_CONFIGURED:-2071,OUTCOME_USER_BADGES_DISABLED:-2072}).map((([key,value])=>[value,key]))),getErrori18nKey=errorCode=>{if(!errorCode)return"error.generic";if(401===errorCode||403===errorCode)return"error.unauthorized";if(404===errorCode)return"error.notFound";if(422===errorCode)return"error.unprocessableEntity";if(500===errorCode)return"internal server error";let error=BACKEND_ERRORS.get(errorCode);return error?`errors.${error}`:"error.generic"}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file diff --git a/components-PositionDrawer-PositionDrawer-stories.b843a277.iframe.bundle.js b/components-PositionDrawer-PositionDrawer-stories.b843a277.iframe.bundle.js new file mode 100644 index 00000000..ef224c3d --- /dev/null +++ b/components-PositionDrawer-PositionDrawer-stories.b843a277.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2523],{"./src/components/PositionDrawer/PositionDrawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithVenue:()=>WithVenue,__namedExportsOrder:()=>__namedExportsOrder,default:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_I18nWrapper__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/I18nWrapper.tsx"),_PositionDrawer__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/PositionDrawer/PositionDrawer.tsx"),_mocks_data__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/mocks/data.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__={title:"Widget/PositionDrawer",component:_PositionDrawer__WEBPACK_IMPORTED_MODULE_2__.Z,argTypes:{open:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>{const[venue,setVenue]=react__WEBPACK_IMPORTED_MODULE_0__.useState(args.venue);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_I18nWrapper__WEBPACK_IMPORTED_MODULE_1__.Z,{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_PositionDrawer__WEBPACK_IMPORTED_MODULE_2__.Z,{...args,venue,setVenue})})};Template.displayName="Template";const Default=Template.bind({});Default.args={open:!0};const WithVenue=Template.bind({});WithVenue.args={open:!0,venue:_mocks_data__WEBPACK_IMPORTED_MODULE_3__.Fr},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...Default.parameters?.docs?.source}}},WithVenue.parameters={...WithVenue.parameters,docs:{...WithVenue.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenue.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithVenue"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PositionDrawer/PositionDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Drawer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PositionDrawer=({open,onClose,venue,setVenue})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori-position-drawer",open,onClose:()=>onClose(venue),title:t("widget.position")||"Position",animated:!1,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__.Z,{venue,setVenue,showUncertainty:!1})})};PositionDrawer.displayName="PositionDrawer";const __WEBPACK_DEFAULT_EXPORT__=PositionDrawer;try{PositionDrawer.displayName="PositionDrawer",PositionDrawer.__docgenInfo={description:"",displayName:"PositionDrawer",props:{open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"]={docgenInfo:PositionDrawer.__docgenInfo,name:"PositionDrawer",path:"src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?.latitude&&venue?.longitude?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>i?getPlaceName(i):"",placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",outlined:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3})}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3})}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'ยฉ OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,animated=!0,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{static:!0,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:animated?"max-w-0 opacity-0":"opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:animated?"max-w-0 opacity-0":"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},animated:{defaultValue:{value:"true"},description:"",name:"animated",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{DI:()=>useDebounceFn,Dt:()=>isAndroid,Tt:()=>isiOS,bw:()=>cleanUrl,h:()=>stripEmojis,vw:()=>stripDuplicates,xZ:()=>hasTouchscreen});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js");const hasTouchscreen=()=>{let hasTouchScreen=!1;if("maxTouchPoints"in navigator)hasTouchScreen=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)hasTouchScreen=navigator.msMaxTouchPoints>0;else{const mQ=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(mQ&&"(pointer:coarse)"===mQ.media)hasTouchScreen=!!mQ.matches;else if("orientation"in window)hasTouchScreen=!0;else{var UA=navigator?.userAgent;hasTouchScreen=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)}}return hasTouchScreen},isiOS=()=>{let platform=navigator?.userAgentData?.platform||navigator?.platform||"unknown",userAgent=navigator?.userAgent||"unknown";return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(platform)||userAgent.includes("Mac")&&"ontouchend"in document},isAndroid=()=>"android"===(navigator?.userAgentData?.platform||navigator?.platform||"unknown").toLowerCase()||navigator.userAgent.includes("Android");function useDebounceFn(fn,delay){const timeoutId=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),originalFn=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>(originalFn.current=fn,()=>{originalFn.current=null})),[fn]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>()=>{clearTimeout(timeoutId.current)}),[]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>(...args)=>{clearTimeout(timeoutId.current),timeoutId.current=window.setTimeout((()=>{originalFn.current&&originalFn.current(...args)}),delay)}),[delay])}const stripDuplicates=text=>text.slice(0,text.length/2).trim().toLowerCase()===text.slice(text.length/2+1).trim().toLowerCase()?text.slice(0,text.length/2):text,stripEmojis=text=>text.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu,"").trim();function cleanUrl(href){try{href=encodeURI(href).replace(/%25/g,"%")}catch(e){return null}return href}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file diff --git a/components-PositionDrawer-PositionDrawer-stories.da6478b5.iframe.bundle.js b/components-PositionDrawer-PositionDrawer-stories.da6478b5.iframe.bundle.js deleted file mode 100644 index 8dbe9537..00000000 --- a/components-PositionDrawer-PositionDrawer-stories.da6478b5.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[2523],{"./src/components/PositionDrawer/PositionDrawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithVenue:()=>WithVenue,__namedExportsOrder:()=>__namedExportsOrder,default:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_I18nWrapper__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/I18nWrapper.tsx"),_PositionDrawer__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/PositionDrawer/PositionDrawer.tsx"),_mocks_data__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/mocks/data.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__={title:"Widget/PositionDrawer",component:_PositionDrawer__WEBPACK_IMPORTED_MODULE_2__.Z,argTypes:{open:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>{const[venue,setVenue]=react__WEBPACK_IMPORTED_MODULE_0__.useState(args.venue);return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_I18nWrapper__WEBPACK_IMPORTED_MODULE_1__.Z,{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(_PositionDrawer__WEBPACK_IMPORTED_MODULE_2__.Z,{...args,venue,setVenue})})};Template.displayName="Template";const Default=Template.bind({});Default.args={open:!0};const WithVenue=Template.bind({});WithVenue.args={open:!0,venue:_mocks_data__WEBPACK_IMPORTED_MODULE_3__.Fr},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...Default.parameters?.docs?.source}}},WithVenue.parameters={...WithVenue.parameters,docs:{...WithVenue.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenue.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithVenue"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/PositionDrawer/PositionDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var _ui_Drawer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const PositionDrawer=({open,onClose,venue,setVenue})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_4__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_1__.Z,{className:"memori-position-drawer",open,onClose:()=>onClose(venue),title:t("widget.position")||"Position",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_VenueWidget_VenueWidget__WEBPACK_IMPORTED_MODULE_2__.Z,{venue,setVenue,showUncertainty:!1})})};PositionDrawer.displayName="PositionDrawer";const __WEBPACK_DEFAULT_EXPORT__=PositionDrawer;try{PositionDrawer.displayName="PositionDrawer",PositionDrawer.__docgenInfo={description:"",displayName:"PositionDrawer",props:{open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"]={docgenInfo:PositionDrawer.__docgenInfo,name:"PositionDrawer",path:"src/components/PositionDrawer/PositionDrawer.tsx#PositionDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>getPlaceName(i),placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",outlined:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3})}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3})}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'ยฉ OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{DI:()=>useDebounceFn,Dt:()=>isAndroid,Tt:()=>isiOS,bw:()=>cleanUrl,h:()=>stripEmojis,vw:()=>stripDuplicates,xZ:()=>hasTouchscreen});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js");const hasTouchscreen=()=>{let hasTouchScreen=!1;if("maxTouchPoints"in navigator)hasTouchScreen=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)hasTouchScreen=navigator.msMaxTouchPoints>0;else{const mQ=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(mQ&&"(pointer:coarse)"===mQ.media)hasTouchScreen=!!mQ.matches;else if("orientation"in window)hasTouchScreen=!0;else{var UA=navigator?.userAgent;hasTouchScreen=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)}}return hasTouchScreen},isiOS=()=>{let platform=navigator?.userAgentData?.platform||navigator?.platform||"unknown",userAgent=navigator?.userAgent||"unknown";return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(platform)||userAgent.includes("Mac")&&"ontouchend"in document},isAndroid=()=>"android"===(navigator?.userAgentData?.platform||navigator?.platform||"unknown").toLowerCase()||navigator.userAgent.includes("Android");function useDebounceFn(fn,delay){const timeoutId=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),originalFn=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>(originalFn.current=fn,()=>{originalFn.current=null})),[fn]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>()=>{clearTimeout(timeoutId.current)}),[]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>(...args)=>{clearTimeout(timeoutId.current),timeoutId.current=window.setTimeout((()=>{originalFn.current&&originalFn.current(...args)}),delay)}),[delay])}const stripDuplicates=text=>text.slice(0,text.length/2).trim().toLowerCase()===text.slice(text.length/2+1).trim().toLowerCase()?text.slice(0,text.length/2):text,stripEmojis=text=>text.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu,"").trim();function cleanUrl(href){try{href=encodeURI(href).replace(/%25/g,"%")}catch(e){return null}return href}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file diff --git a/components-SettingsDrawer-SettingsDrawer-stories.ab980215.iframe.bundle.js b/components-SettingsDrawer-SettingsDrawer-stories.d7c81786.iframe.bundle.js similarity index 77% rename from components-SettingsDrawer-SettingsDrawer-stories.ab980215.iframe.bundle.js rename to components-SettingsDrawer-SettingsDrawer-stories.d7c81786.iframe.bundle.js index 609f89f1..2f0d2fad 100644 --- a/components-SettingsDrawer-SettingsDrawer-stories.ab980215.iframe.bundle.js +++ b/components-SettingsDrawer-SettingsDrawer-stories.d7c81786.iframe.bundle.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[834],{"./src/components/SettingsDrawer/SettingsDrawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithAdditionalSettings:()=>WithAdditionalSettings,WithinTotemLayout:()=>WithinTotemLayout,__namedExportsOrder:()=>__namedExportsOrder,default:()=>SettingsDrawer_stories});var react=__webpack_require__("./node_modules/react/index.js"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),SettingsDrawer_SettingsDrawer=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/SettingsDrawer/SettingsDrawer.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(SettingsDrawer_SettingsDrawer.Z,options);SettingsDrawer_SettingsDrawer.Z&&SettingsDrawer_SettingsDrawer.Z.locals&&SettingsDrawer_SettingsDrawer.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const SettingsDrawer_stories={title:"Widget/SettingsDrawer",component:SettingsDrawer.Z,argTypes:{open:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>{const[microphoneMode,setMicrophoneMode]=react.useState("HOLD_TO_TALK"),[controlsPosition,setControlsPosition]=react.useState("bottom");return(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(SettingsDrawer.Z,{...args,microphoneMode,setMicrophoneMode,controlsPosition,setControlsPosition})})};Template.displayName="Template";const Default=Template.bind({});Default.args={open:!0,onClose:()=>{},continuousSpeech:!1,continuousSpeechTimeout:2,setContinuousSpeech:()=>{},setContinuousSpeechTimeout:()=>{}};const WithinTotemLayout=Template.bind({});WithinTotemLayout.args={layout:"TOTEM",open:!0,onClose:()=>{},continuousSpeech:!1,continuousSpeechTimeout:2,setContinuousSpeech:()=>{},setContinuousSpeechTimeout:()=>{}};const AdditionalSettings=()=>{const[hideEmissions,setHideEmissions]=react.useState(!1);return(0,jsx_runtime.jsxs)("div",{children:[(0,jsx_runtime.jsx)("label",{htmlFor:"#hideEmissions",children:"Hide emissions:"}),(0,jsx_runtime.jsx)("input",{id:"hideEmissions",name:"hideEmissions",type:"checkbox",checked:hideEmissions,onChange:e=>setHideEmissions(e.target.checked)})]})};AdditionalSettings.displayName="AdditionalSettings";const WithAdditionalSettings=Template.bind({});WithAdditionalSettings.args={open:!0,onClose:()=>{},continuousSpeech:!1,continuousSpeechTimeout:2,setContinuousSpeech:()=>{},setContinuousSpeechTimeout:()=>{},additionalSettings:(0,jsx_runtime.jsx)(AdditionalSettings,{})},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [microphoneMode, setMicrophoneMode] = React.useState<'HOLD_TO_TALK' | 'CONTINUOUS'>('HOLD_TO_TALK');\n const [controlsPosition, setControlsPosition] = React.useState<'bottom' | 'center'>('bottom');\n return \n \n ;\n}",...Default.parameters?.docs?.source}}},WithinTotemLayout.parameters={...WithinTotemLayout.parameters,docs:{...WithinTotemLayout.parameters?.docs,source:{originalSource:"args => {\n const [microphoneMode, setMicrophoneMode] = React.useState<'HOLD_TO_TALK' | 'CONTINUOUS'>('HOLD_TO_TALK');\n const [controlsPosition, setControlsPosition] = React.useState<'bottom' | 'center'>('bottom');\n return \n \n ;\n}",...WithinTotemLayout.parameters?.docs?.source}}},WithAdditionalSettings.parameters={...WithAdditionalSettings.parameters,docs:{...WithAdditionalSettings.parameters?.docs,source:{originalSource:"args => {\n const [microphoneMode, setMicrophoneMode] = React.useState<'HOLD_TO_TALK' | 'CONTINUOUS'>('HOLD_TO_TALK');\n const [controlsPosition, setControlsPosition] = React.useState<'bottom' | 'center'>('bottom');\n return \n \n ;\n}",...WithAdditionalSettings.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithinTotemLayout","WithAdditionalSettings"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/SettingsDrawer/SettingsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Select.tsx"),_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/configuration.ts"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/radio-group/radio-group.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Button.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const silenceSeconds=[2,3,5,10,15,20,30,60],SettingsDrawer=({open,layout="DEFAULT",onClose,microphoneMode="HOLD_TO_TALK",continuousSpeechTimeout,setMicrophoneMode,setContinuousSpeechTimeout,controlsPosition,setControlsPosition,hideEmissions,setHideEmissions,additionalSettings})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{className:"memori-settings-drawer",open,onClose,title:t("widget.settings")||"Settings",description:t("write_and_speak.settingsHeaderLabel"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("label",{htmlFor:"#microphoneMode",children:[t("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E,{id:"microphoneMode",name:"microphoneMode",value:microphoneMode,defaultValue:microphoneMode,className:"memori-settings-drawer--microphoneMode-radio",onChange:value=>{let micMode="CONTINUOUS"===value?"CONTINUOUS":"HOLD_TO_TALK";setMicrophoneMode(micMode),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("microphoneMode",micMode)},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})]})]}),"CONTINUOUS"===microphoneMode&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-settings-drawer--field",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_2__.Z,{label:t("write_and_speak.secondsLabel")||"Seconds",placeholder:t("write_and_speak.secondsLabel")||"Seconds",options:silenceSeconds.map((s=>({value:s,label:s}))),value:continuousSpeechTimeout,onChange:value=>{setContinuousSpeechTimeout(value),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("continuousSpeechTimeout",value)}})}),"TOTEM"===layout&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("label",{htmlFor:"#controlsPosition",children:[t("write_and_speak.controlsPosition")||"Controls",":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E,{id:"controlsPosition",name:"controlsPosition",value:controlsPosition,defaultValue:controlsPosition,className:"memori-settings-drawer--controlsposition-radio",onChange:value=>{setControlsPosition(value),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("controlsPosition",value)},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("center")||"Center"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("bottom")||"Bottom"})})]})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-settings-drawer--field",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_1__.Z,{label:t("write_and_speak.hideEmissionsLabel")||"Hide emissions",name:"hideControls",checked:hideEmissions,onChange:e=>{setHideEmissions(e.target.checked),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("hideEmissions",e.target.checked)}})})]}),additionalSettings&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-settings-drawer--field controls",children:additionalSettings})]})};SettingsDrawer.displayName="SettingsDrawer";const __WEBPACK_DEFAULT_EXPORT__=SettingsDrawer;try{SettingsDrawer.displayName="SettingsDrawer",SettingsDrawer.__docgenInfo={description:"",displayName:"SettingsDrawer",props:{open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},layout:{defaultValue:{value:"DEFAULT"},description:"",name:"layout",required:!1,type:{name:"enum",value:[{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'}]}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}},microphoneMode:{defaultValue:{value:"HOLD_TO_TALK"},description:"",name:"microphoneMode",required:!1,type:{name:"enum",value:[{value:'"HOLD_TO_TALK"'},{value:'"CONTINUOUS"'}]}},continuousSpeechTimeout:{defaultValue:null,description:"",name:"continuousSpeechTimeout",required:!1,type:{name:"number"}},setMicrophoneMode:{defaultValue:null,description:"",name:"setMicrophoneMode",required:!0,type:{name:'(value: "HOLD_TO_TALK" | "CONTINUOUS") => void'}},setContinuousSpeechTimeout:{defaultValue:null,description:"",name:"setContinuousSpeechTimeout",required:!0,type:{name:"(value: number) => void"}},controlsPosition:{defaultValue:null,description:"",name:"controlsPosition",required:!1,type:{name:"enum",value:[{value:'"center"'},{value:'"bottom"'}]}},setControlsPosition:{defaultValue:null,description:"",name:"setControlsPosition",required:!0,type:{name:'(value: "center" | "bottom") => void'}},hideEmissions:{defaultValue:null,description:"",name:"hideEmissions",required:!1,type:{name:"boolean"}},setHideEmissions:{defaultValue:null,description:"",name:"setHideEmissions",required:!0,type:{name:"(value: boolean) => void"}},additionalSettings:{defaultValue:null,description:"",name:"additionalSettings",required:!1,type:{name:"Element | null"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/SettingsDrawer/SettingsDrawer.tsx#SettingsDrawer"]={docgenInfo:SettingsDrawer.__docgenInfo,name:"SettingsDrawer",path:"src/components/SettingsDrawer/SettingsDrawer.tsx#SettingsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/SelectIcon.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const SelectIcon=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className,fill:"currentColor","aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});SelectIcon.displayName="SelectIcon";const __WEBPACK_DEFAULT_EXPORT__=SelectIcon;try{SelectIcon.displayName="SelectIcon",SelectIcon.__docgenInfo={description:"",displayName:"SelectIcon",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/SelectIcon.tsx#SelectIcon"]={docgenInfo:SelectIcon.__docgenInfo,name:"SelectIcon",path:"src/components/icons/SelectIcon.tsx#SelectIcon"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Checkbox.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Checkbox=({label,className,disabled=!1,indeterminate=!1,checked,children,onChange,name,...props})=>{const inputRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{inputRef.current&&(inputRef.current.indeterminate=indeterminate)}),[inputRef,indeterminate]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("label",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-checkbox",className,{"memori-checkbox--disabled":disabled,"memori-checkbox--indeterminate":indeterminate}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{ref:inputRef,type:"checkbox",...props,name,disabled,checked:checked||indeterminate,className:"memori-checkbox--input",onChange}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--inner"})]}),!!label?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--text",children:label})]})};Checkbox.displayName="Checkbox";const __WEBPACK_DEFAULT_EXPORT__=Checkbox;try{Checkbox.displayName="Checkbox",Checkbox.__docgenInfo={description:"",displayName:"Checkbox",props:{label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},checked:{defaultValue:null,description:"",name:"checked",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},indeterminate:{defaultValue:{value:"false"},description:"",name:"indeterminate",required:!1,type:{name:"boolean"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((event: ChangeEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Checkbox.tsx#Checkbox"]={docgenInfo:Checkbox.__docgenInfo,name:"Checkbox",path:"src/components/ui/Checkbox.tsx#Checkbox"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Select.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Select=({className,value,name,displayValue,options,onChange,disabled=!1,label,placeholder})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select",className),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R,{value,onChange:value=>{onChange(value)},disabled,name,children:[label&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Label,{className:"memori-select--label",children:[label,":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Button,{"aria-label":label,className:"memori-select--button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select--value",{"memori-select--value-placeholder":!value}),children:value?displayValue||value:placeholder}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Options,{className:"memori-select--options",children:options.map((opt=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Option,{value:opt.value,className:"memori-select--option",children:opt.label},opt.value)))})})]})});Select.displayName="Select";const __WEBPACK_DEFAULT_EXPORT__=Select;try{Select.displayName="Select",Select.__docgenInfo={description:"",displayName:"Select",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"any"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},displayValue:{defaultValue:null,description:"",name:"displayValue",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(value: any) => void"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"{ value: any; label: any; }[]"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Select.tsx#Select"]={docgenInfo:Select.__docgenInfo,name:"Select",path:"src/components/ui/Select.tsx#Select"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/configuration.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A2:()=>setLocalConfig,gj:()=>removeLocalConfig,wm:()=>getLocalConfig});const keys={muteSpeaker:"@memori:muteSpeaker",microphoneMode:"@memori:microphoneMode",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter",birthDate:"@memori:birthDate",controlsPosition:"@memori:controlsPosition",hideEmissions:"@memori:hideEmissions",loginToken:"@memori:loginToken"},getLocalConfig=(key,defaultValue)=>{try{const value=window.localStorage.getItem(keys[key]??key);if(!value)return defaultValue;try{return JSON.parse(value)}catch{return value}}catch(error){return console.error("error",error),defaultValue}},setLocalConfig=(key,value)=>{try{window.localStorage.setItem(keys[key]??key,value.toString())}catch(error){console.error("error",error)}},removeLocalConfig=key=>{try{window.localStorage.removeItem(keys[key]??key)}catch(error){console.error("error",error)}}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[834],{"./src/components/SettingsDrawer/SettingsDrawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithAdditionalSettings:()=>WithAdditionalSettings,WithinTotemLayout:()=>WithinTotemLayout,__namedExportsOrder:()=>__namedExportsOrder,default:()=>SettingsDrawer_stories});var react=__webpack_require__("./node_modules/react/index.js"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),SettingsDrawer=__webpack_require__("./src/components/SettingsDrawer/SettingsDrawer.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),SettingsDrawer_SettingsDrawer=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/SettingsDrawer/SettingsDrawer.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(SettingsDrawer_SettingsDrawer.Z,options);SettingsDrawer_SettingsDrawer.Z&&SettingsDrawer_SettingsDrawer.Z.locals&&SettingsDrawer_SettingsDrawer.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const SettingsDrawer_stories={title:"Widget/SettingsDrawer",component:SettingsDrawer.Z,argTypes:{open:{control:{type:"boolean"}}},parameters:{controls:{expanded:!0}}},Template=args=>{const[microphoneMode,setMicrophoneMode]=react.useState("HOLD_TO_TALK"),[controlsPosition,setControlsPosition]=react.useState("bottom");return(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(SettingsDrawer.Z,{...args,microphoneMode,setMicrophoneMode,controlsPosition,setControlsPosition})})};Template.displayName="Template";const Default=Template.bind({});Default.args={open:!0,onClose:()=>{},continuousSpeech:!1,continuousSpeechTimeout:2,setContinuousSpeech:()=>{},setContinuousSpeechTimeout:()=>{}};const WithinTotemLayout=Template.bind({});WithinTotemLayout.args={layout:"TOTEM",open:!0,onClose:()=>{},continuousSpeech:!1,continuousSpeechTimeout:2,setContinuousSpeech:()=>{},setContinuousSpeechTimeout:()=>{}};const AdditionalSettings=()=>{const[hideEmissions,setHideEmissions]=react.useState(!1);return(0,jsx_runtime.jsxs)("div",{children:[(0,jsx_runtime.jsx)("label",{htmlFor:"#hideEmissions",children:"Hide emissions:"}),(0,jsx_runtime.jsx)("input",{id:"hideEmissions",name:"hideEmissions",type:"checkbox",checked:hideEmissions,onChange:e=>setHideEmissions(e.target.checked)})]})};AdditionalSettings.displayName="AdditionalSettings";const WithAdditionalSettings=Template.bind({});WithAdditionalSettings.args={open:!0,onClose:()=>{},continuousSpeech:!1,continuousSpeechTimeout:2,setContinuousSpeech:()=>{},setContinuousSpeechTimeout:()=>{},additionalSettings:(0,jsx_runtime.jsx)(AdditionalSettings,{})},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [microphoneMode, setMicrophoneMode] = React.useState<'HOLD_TO_TALK' | 'CONTINUOUS'>('HOLD_TO_TALK');\n const [controlsPosition, setControlsPosition] = React.useState<'bottom' | 'center'>('bottom');\n return \n \n ;\n}",...Default.parameters?.docs?.source}}},WithinTotemLayout.parameters={...WithinTotemLayout.parameters,docs:{...WithinTotemLayout.parameters?.docs,source:{originalSource:"args => {\n const [microphoneMode, setMicrophoneMode] = React.useState<'HOLD_TO_TALK' | 'CONTINUOUS'>('HOLD_TO_TALK');\n const [controlsPosition, setControlsPosition] = React.useState<'bottom' | 'center'>('bottom');\n return \n \n ;\n}",...WithinTotemLayout.parameters?.docs?.source}}},WithAdditionalSettings.parameters={...WithAdditionalSettings.parameters,docs:{...WithAdditionalSettings.parameters?.docs,source:{originalSource:"args => {\n const [microphoneMode, setMicrophoneMode] = React.useState<'HOLD_TO_TALK' | 'CONTINUOUS'>('HOLD_TO_TALK');\n const [controlsPosition, setControlsPosition] = React.useState<'bottom' | 'center'>('bottom');\n return \n \n ;\n}",...WithAdditionalSettings.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithinTotemLayout","WithAdditionalSettings"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/SettingsDrawer/SettingsDrawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var _ui_Drawer__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./src/components/ui/Drawer.tsx"),react_i18next__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js"),_ui_Checkbox__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Checkbox.tsx"),_ui_Select__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Select.tsx"),_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/helpers/configuration.ts"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/radio-group/radio-group.js"),_ui_Button__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./src/components/ui/Button.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const silenceSeconds=[2,3,5,10,15,20,30,60],SettingsDrawer=({open,layout="DEFAULT",onClose,microphoneMode="HOLD_TO_TALK",continuousSpeechTimeout,setMicrophoneMode,setContinuousSpeechTimeout,controlsPosition,setControlsPosition,hideEmissions,setHideEmissions,additionalSettings})=>{const{t}=(0,react_i18next__WEBPACK_IMPORTED_MODULE_6__.$)();return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_ui_Drawer__WEBPACK_IMPORTED_MODULE_0__.Z,{className:"memori-settings-drawer",open,onClose,title:t("widget.settings")||"Settings",description:t("write_and_speak.settingsHeaderLabel"),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("label",{htmlFor:"#microphoneMode",children:[t("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E,{id:"microphoneMode",name:"microphoneMode",value:microphoneMode,defaultValue:microphoneMode,className:"memori-settings-drawer--microphoneMode-radio",onChange:value=>{let micMode="CONTINUOUS"===value?"CONTINUOUS":"HOLD_TO_TALK";setMicrophoneMode(micMode),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("microphoneMode",micMode)},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})]})]}),"CONTINUOUS"===microphoneMode&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-settings-drawer--field",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Select__WEBPACK_IMPORTED_MODULE_2__.Z,{label:t("write_and_speak.secondsLabel")||"Seconds",placeholder:t("write_and_speak.secondsLabel")||"Seconds",options:silenceSeconds.map((s=>({value:s,label:s}))),value:continuousSpeechTimeout,onChange:value=>{setContinuousSpeechTimeout(value),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("continuousSpeechTimeout",value)}})}),"TOTEM"===layout&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("label",{htmlFor:"#controlsPosition",children:[t("write_and_speak.controlsPosition")||"Controls",":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E,{id:"controlsPosition",name:"controlsPosition",value:controlsPosition,defaultValue:controlsPosition,className:"memori-settings-drawer--controlsposition-radio",onChange:value=>{setControlsPosition(value),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("controlsPosition",value)},children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("center")||"Center"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.E.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Button__WEBPACK_IMPORTED_MODULE_4__.Z,{primary:checked,outlined:!checked,children:t("bottom")||"Bottom"})})]})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-settings-drawer--field",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_ui_Checkbox__WEBPACK_IMPORTED_MODULE_1__.Z,{label:t("write_and_speak.hideEmissionsLabel")||"Hide emissions",name:"hideControls",checked:hideEmissions,onChange:e=>{setHideEmissions(e.target.checked),(0,_helpers_configuration__WEBPACK_IMPORTED_MODULE_3__.A2)("hideEmissions",e.target.checked)}})})]}),additionalSettings&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-settings-drawer--field controls",children:additionalSettings})]})};SettingsDrawer.displayName="SettingsDrawer";const __WEBPACK_DEFAULT_EXPORT__=SettingsDrawer;try{SettingsDrawer.displayName="SettingsDrawer",SettingsDrawer.__docgenInfo={description:"",displayName:"SettingsDrawer",props:{open:{defaultValue:null,description:"",name:"open",required:!0,type:{name:"boolean"}},layout:{defaultValue:{value:"DEFAULT"},description:"",name:"layout",required:!1,type:{name:"enum",value:[{value:'"DEFAULT"'},{value:'"FULLPAGE"'},{value:'"TOTEM"'},{value:'"CHAT"'},{value:'"WEBSITE_ASSISTANT"'}]}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"() => void"}},microphoneMode:{defaultValue:{value:"HOLD_TO_TALK"},description:"",name:"microphoneMode",required:!1,type:{name:"enum",value:[{value:'"HOLD_TO_TALK"'},{value:'"CONTINUOUS"'}]}},continuousSpeechTimeout:{defaultValue:null,description:"",name:"continuousSpeechTimeout",required:!1,type:{name:"number"}},setMicrophoneMode:{defaultValue:null,description:"",name:"setMicrophoneMode",required:!0,type:{name:'(value: "HOLD_TO_TALK" | "CONTINUOUS") => void'}},setContinuousSpeechTimeout:{defaultValue:null,description:"",name:"setContinuousSpeechTimeout",required:!0,type:{name:"(value: number) => void"}},controlsPosition:{defaultValue:null,description:"",name:"controlsPosition",required:!1,type:{name:"enum",value:[{value:'"center"'},{value:'"bottom"'}]}},setControlsPosition:{defaultValue:null,description:"",name:"setControlsPosition",required:!0,type:{name:'(value: "center" | "bottom") => void'}},hideEmissions:{defaultValue:null,description:"",name:"hideEmissions",required:!1,type:{name:"boolean"}},setHideEmissions:{defaultValue:null,description:"",name:"setHideEmissions",required:!0,type:{name:"(value: boolean) => void"}},additionalSettings:{defaultValue:null,description:"",name:"additionalSettings",required:!1,type:{name:"Element | null"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/SettingsDrawer/SettingsDrawer.tsx#SettingsDrawer"]={docgenInfo:SettingsDrawer.__docgenInfo,name:"SettingsDrawer",path:"src/components/SettingsDrawer/SettingsDrawer.tsx#SettingsDrawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/SelectIcon.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const SelectIcon=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className,fill:"currentColor","aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});SelectIcon.displayName="SelectIcon";const __WEBPACK_DEFAULT_EXPORT__=SelectIcon;try{SelectIcon.displayName="SelectIcon",SelectIcon.__docgenInfo={description:"",displayName:"SelectIcon",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/SelectIcon.tsx#SelectIcon"]={docgenInfo:SelectIcon.__docgenInfo,name:"SelectIcon",path:"src/components/icons/SelectIcon.tsx#SelectIcon"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Checkbox.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Checkbox=({label,className,disabled=!1,indeterminate=!1,checked,children,onChange,name,...props})=>{const inputRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{inputRef.current&&(inputRef.current.indeterminate=indeterminate)}),[inputRef,indeterminate]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("label",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-checkbox",className,{"memori-checkbox--disabled":disabled,"memori-checkbox--indeterminate":indeterminate}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{ref:inputRef,type:"checkbox",...props,name,disabled,checked:checked||indeterminate,className:"memori-checkbox--input",onChange}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--inner"})]}),!!label?.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{className:"memori-checkbox--text",children:label})]})};Checkbox.displayName="Checkbox";const __WEBPACK_DEFAULT_EXPORT__=Checkbox;try{Checkbox.displayName="Checkbox",Checkbox.__docgenInfo={description:"",displayName:"Checkbox",props:{label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},checked:{defaultValue:null,description:"",name:"checked",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},indeterminate:{defaultValue:{value:"false"},description:"",name:"indeterminate",required:!1,type:{name:"boolean"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((event: ChangeEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Checkbox.tsx#Checkbox"]={docgenInfo:Checkbox.__docgenInfo,name:"Checkbox",path:"src/components/ui/Checkbox.tsx#Checkbox"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,animated=!0,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{static:!0,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:animated?"max-w-0 opacity-0":"opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:animated?"max-w-0 opacity-0":"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},animated:{defaultValue:{value:"true"},description:"",name:"animated",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Select.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_headlessui_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/components/listbox/listbox.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/SelectIcon.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Select=({className,value,name,displayValue,options,onChange,disabled=!1,label,placeholder})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select",className),children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R,{value,onChange:value=>{onChange(value)},disabled,name,children:[label&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Label,{className:"memori-select--label",children:[label,":"]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Button,{"aria-label":label,className:"memori-select--button",children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-select--value",{"memori-select--value-placeholder":!value}),children:value?displayValue||value:placeholder}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-select--icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_SelectIcon__WEBPACK_IMPORTED_MODULE_2__.default,{})})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_5__.u,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Options,{className:"memori-select--options",children:options.map((opt=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_4__.R.Option,{value:opt.value,className:"memori-select--option",children:opt.label},opt.value)))})})]})});Select.displayName="Select";const __WEBPACK_DEFAULT_EXPORT__=Select;try{Select.displayName="Select",Select.__docgenInfo={description:"",displayName:"Select",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"any"}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},displayValue:{defaultValue:null,description:"",name:"displayValue",required:!1,type:{name:"string"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(value: any) => void"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"{ value: any; label: any; }[]"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Select.tsx#Select"]={docgenInfo:Select.__docgenInfo,name:"Select",path:"src/components/ui/Select.tsx#Select"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/configuration.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A2:()=>setLocalConfig,gj:()=>removeLocalConfig,wm:()=>getLocalConfig});const keys={muteSpeaker:"@memori:muteSpeaker",microphoneMode:"@memori:microphoneMode",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter",birthDate:"@memori:birthDate",controlsPosition:"@memori:controlsPosition",hideEmissions:"@memori:hideEmissions",loginToken:"@memori:loginToken"},getLocalConfig=(key,defaultValue)=>{try{const value=window.localStorage.getItem(keys[key]??key);if(!value)return defaultValue;try{return JSON.parse(value)}catch{return value}}catch(error){return console.error("error",error),defaultValue}},setLocalConfig=(key,value)=>{try{window.localStorage.setItem(keys[key]??key,value.toString())}catch(error){console.error("error",error)}},removeLocalConfig=key=>{try{window.localStorage.removeItem(keys[key]??key)}catch(error){console.error("error",error)}}}}]); \ No newline at end of file diff --git a/components-VenueWidget-VenueWidget-stories.012710fa.iframe.bundle.js b/components-VenueWidget-VenueWidget-stories.012710fa.iframe.bundle.js deleted file mode 100644 index f3fb601b..00000000 --- a/components-VenueWidget-VenueWidget-stories.012710fa.iframe.bundle.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[1233],{"./src/components/VenueWidget/VenueWidget.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithUncertaintyUI:()=>WithUncertaintyUI,WithVenueExactLocartion:()=>WithVenueExactLocartion,WithVenueLargeUncertainty:()=>WithVenueLargeUncertainty,WithVenueUncertainty:()=>WithVenueUncertainty,WithoutGpsButton:()=>WithoutGpsButton,__namedExportsOrder:()=>__namedExportsOrder,default:()=>VenueWidget_stories});var react=__webpack_require__("./node_modules/react/index.js"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),VenueWidget=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),data=__webpack_require__("./src/mocks/data.ts"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),VenueWidget_VenueWidget=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/VenueWidget/VenueWidget.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(VenueWidget_VenueWidget.Z,options);VenueWidget_VenueWidget.Z&&VenueWidget_VenueWidget.Z.locals&&VenueWidget_VenueWidget.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const VenueWidget_stories={title:"Widget/VenueWidget",component:VenueWidget.Z,parameters:{controls:{expanded:!0}}},Template=args=>{const[venue,setVenue]=react.useState(args.venue);return(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(VenueWidget.Z,{...args,venue,setVenue})})};Template.displayName="Template";const Default=Template.bind({});Default.args={};const WithVenueExactLocartion=Template.bind({});WithVenueExactLocartion.args={venue:{...data.Fr,uncertainty:0}};const WithVenueUncertainty=Template.bind({});WithVenueUncertainty.args={venue:{...data.Fr,uncertainty:2}};const WithVenueLargeUncertainty=Template.bind({});WithVenueLargeUncertainty.args={venue:{...data.Fr,uncertainty:20}};const WithUncertaintyUI=Template.bind({});WithUncertaintyUI.args={venue:data.Fr,showUncertainty:!0};const WithoutGpsButton=Template.bind({});WithoutGpsButton.args={venue:data.Fr,showGpsButton:!1},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...Default.parameters?.docs?.source}}},WithVenueExactLocartion.parameters={...WithVenueExactLocartion.parameters,docs:{...WithVenueExactLocartion.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenueExactLocartion.parameters?.docs?.source}}},WithVenueUncertainty.parameters={...WithVenueUncertainty.parameters,docs:{...WithVenueUncertainty.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenueUncertainty.parameters?.docs?.source}}},WithVenueLargeUncertainty.parameters={...WithVenueLargeUncertainty.parameters,docs:{...WithVenueLargeUncertainty.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenueLargeUncertainty.parameters?.docs?.source}}},WithUncertaintyUI.parameters={...WithUncertaintyUI.parameters,docs:{...WithUncertaintyUI.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithUncertaintyUI.parameters?.docs?.source}}},WithoutGpsButton.parameters={...WithoutGpsButton.parameters,docs:{...WithoutGpsButton.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithoutGpsButton.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithVenueExactLocartion","WithVenueUncertainty","WithVenueLargeUncertainty","WithUncertaintyUI","WithoutGpsButton"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>getPlaceName(i),placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",outlined:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3})}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3})}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'ยฉ OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{DI:()=>useDebounceFn,Dt:()=>isAndroid,Tt:()=>isiOS,bw:()=>cleanUrl,h:()=>stripEmojis,vw:()=>stripDuplicates,xZ:()=>hasTouchscreen});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js");const hasTouchscreen=()=>{let hasTouchScreen=!1;if("maxTouchPoints"in navigator)hasTouchScreen=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)hasTouchScreen=navigator.msMaxTouchPoints>0;else{const mQ=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(mQ&&"(pointer:coarse)"===mQ.media)hasTouchScreen=!!mQ.matches;else if("orientation"in window)hasTouchScreen=!0;else{var UA=navigator?.userAgent;hasTouchScreen=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)}}return hasTouchScreen},isiOS=()=>{let platform=navigator?.userAgentData?.platform||navigator?.platform||"unknown",userAgent=navigator?.userAgent||"unknown";return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(platform)||userAgent.includes("Mac")&&"ontouchend"in document},isAndroid=()=>"android"===(navigator?.userAgentData?.platform||navigator?.platform||"unknown").toLowerCase()||navigator.userAgent.includes("Android");function useDebounceFn(fn,delay){const timeoutId=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),originalFn=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>(originalFn.current=fn,()=>{originalFn.current=null})),[fn]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>()=>{clearTimeout(timeoutId.current)}),[]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>(...args)=>{clearTimeout(timeoutId.current),timeoutId.current=window.setTimeout((()=>{originalFn.current&&originalFn.current(...args)}),delay)}),[delay])}const stripDuplicates=text=>text.slice(0,text.length/2).trim().toLowerCase()===text.slice(text.length/2+1).trim().toLowerCase()?text.slice(0,text.length/2):text,stripEmojis=text=>text.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu,"").trim();function cleanUrl(href){try{href=encodeURI(href).replace(/%25/g,"%")}catch(e){return null}return href}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file diff --git a/components-VenueWidget-VenueWidget-stories.4104c9fb.iframe.bundle.js b/components-VenueWidget-VenueWidget-stories.4104c9fb.iframe.bundle.js new file mode 100644 index 00000000..69fa71be --- /dev/null +++ b/components-VenueWidget-VenueWidget-stories.4104c9fb.iframe.bundle.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[1233],{"./src/components/VenueWidget/VenueWidget.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,WithUncertaintyUI:()=>WithUncertaintyUI,WithVenueExactLocartion:()=>WithVenueExactLocartion,WithVenueLargeUncertainty:()=>WithVenueLargeUncertainty,WithVenueUncertainty:()=>WithVenueUncertainty,WithoutGpsButton:()=>WithoutGpsButton,__namedExportsOrder:()=>__namedExportsOrder,default:()=>VenueWidget_stories});var react=__webpack_require__("./node_modules/react/index.js"),I18nWrapper=__webpack_require__("./src/I18nWrapper.tsx"),VenueWidget=__webpack_require__("./src/components/VenueWidget/VenueWidget.tsx"),data=__webpack_require__("./src/mocks/data.ts"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),VenueWidget_VenueWidget=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/VenueWidget/VenueWidget.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(VenueWidget_VenueWidget.Z,options);VenueWidget_VenueWidget.Z&&VenueWidget_VenueWidget.Z.locals&&VenueWidget_VenueWidget.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const VenueWidget_stories={title:"Widget/VenueWidget",component:VenueWidget.Z,parameters:{controls:{expanded:!0}}},Template=args=>{const[venue,setVenue]=react.useState(args.venue);return(0,jsx_runtime.jsx)(I18nWrapper.Z,{children:(0,jsx_runtime.jsx)(VenueWidget.Z,{...args,venue,setVenue})})};Template.displayName="Template";const Default=Template.bind({});Default.args={};const WithVenueExactLocartion=Template.bind({});WithVenueExactLocartion.args={venue:{...data.Fr,uncertainty:0}};const WithVenueUncertainty=Template.bind({});WithVenueUncertainty.args={venue:{...data.Fr,uncertainty:2}};const WithVenueLargeUncertainty=Template.bind({});WithVenueLargeUncertainty.args={venue:{...data.Fr,uncertainty:20}};const WithUncertaintyUI=Template.bind({});WithUncertaintyUI.args={venue:data.Fr,showUncertainty:!0};const WithoutGpsButton=Template.bind({});WithoutGpsButton.args={venue:data.Fr,showGpsButton:!1},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...Default.parameters?.docs?.source}}},WithVenueExactLocartion.parameters={...WithVenueExactLocartion.parameters,docs:{...WithVenueExactLocartion.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenueExactLocartion.parameters?.docs?.source}}},WithVenueUncertainty.parameters={...WithVenueUncertainty.parameters,docs:{...WithVenueUncertainty.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenueUncertainty.parameters?.docs?.source}}},WithVenueLargeUncertainty.parameters={...WithVenueLargeUncertainty.parameters,docs:{...WithVenueLargeUncertainty.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithVenueLargeUncertainty.parameters?.docs?.source}}},WithUncertaintyUI.parameters={...WithUncertaintyUI.parameters,docs:{...WithUncertaintyUI.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithUncertaintyUI.parameters?.docs?.source}}},WithoutGpsButton.parameters={...WithoutGpsButton.parameters,docs:{...WithoutGpsButton.parameters?.docs,source:{originalSource:"args => {\n const [venue, setVenue] = React.useState(args.venue);\n return \n \n ;\n}",...WithoutGpsButton.parameters?.docs?.source}}};const __namedExportsOrder=["Default","WithVenueExactLocartion","WithVenueUncertainty","WithVenueLargeUncertainty","WithUncertaintyUI","WithoutGpsButton"]},"./src/I18nWrapper.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_i18next__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react-i18next/dist/es/I18nextProvider.js"),_i18n__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/i18n.ts"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const I18nWrapper=({children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(react_i18next__WEBPACK_IMPORTED_MODULE_3__.a,{i18n:_i18n__WEBPACK_IMPORTED_MODULE_1__.Z,children});I18nWrapper.displayName="I18nWrapper";const __WEBPACK_DEFAULT_EXPORT__=I18nWrapper;try{I18nWrapper.displayName="I18nWrapper",I18nWrapper.__docgenInfo={description:"",displayName:"I18nWrapper",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/I18nWrapper.tsx#I18nWrapper"]={docgenInfo:I18nWrapper.__docgenInfo,name:"I18nWrapper",path:"src/I18nWrapper.tsx#I18nWrapper"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/VenueWidget/VenueWidget.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>VenueWidget_VenueWidget});var react=__webpack_require__("./node_modules/react/index.js"),useTranslation=__webpack_require__("./node_modules/react-i18next/dist/es/useTranslation.js");const DEGREES_TO_RADIANS=Math.PI/180,getUncertaintyByViewport=bouningBox=>{const[minLat,maxLat,minLng,maxLng]="string"==typeof bouningBox[0]?bouningBox.map(parseFloat):bouningBox,phi1=minLat*DEGREES_TO_RADIANS,lambda1=minLng*DEGREES_TO_RADIANS,phi2=maxLat*DEGREES_TO_RADIANS,lambda2=maxLng*DEGREES_TO_RADIANS;return 6367.5*(2*Math.asin(Math.sqrt(Math.sin((phi2-phi1)/2)*Math.sin((phi2-phi1)/2)+Math.cos(phi1)*Math.cos(phi2)*Math.sin((lambda2-lambda1)/2)*Math.sin((lambda2-lambda1)/2))))};var hooks=__webpack_require__("./node_modules/react-leaflet/lib/hooks.js"),MapContainer=__webpack_require__("./node_modules/react-leaflet/lib/MapContainer.js"),TileLayer=__webpack_require__("./node_modules/react-leaflet/lib/TileLayer.js"),Marker=__webpack_require__("./node_modules/react-leaflet/lib/Marker.js"),Popup=__webpack_require__("./node_modules/react-leaflet/lib/Popup.js"),lib_context=__webpack_require__("./node_modules/@react-leaflet/core/lib/context.js"),leaflet_src=__webpack_require__("./node_modules/leaflet/dist/leaflet-src.js"),leaflet_src_default=__webpack_require__.n(leaflet_src),dist=__webpack_require__("./node_modules/react-hot-toast/dist/index.mjs"),Button=__webpack_require__("./src/components/ui/Button.tsx"),utils=__webpack_require__("./src/helpers/utils.ts"),combobox=__webpack_require__("./node_modules/@headlessui/react/dist/components/combobox/combobox.js"),transition=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),classnames=__webpack_require__("./node_modules/classnames/index.js"),classnames_default=__webpack_require__.n(classnames),Spin=__webpack_require__("./src/components/ui/Spin.tsx"),jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Circle=({center,size})=>{const context=(0,lib_context.mE)();return(0,react.useEffect)((()=>{const square=new(leaflet_src_default().Circle)(center,size),container=context.layerContainer||context.map;return container.addLayer(square),()=>{container.removeLayer(square)}})),null},CenterAndZoomUpdater=({center,uncertainty})=>{const[init,setInit]=(0,react.useState)(!1),map=(0,hooks.Sx)(),updateView=(0,react.useCallback)((()=>{let zoom=void 0!==uncertainty?Math.round(Math.log2(1e7/uncertainty)):map.getZoom();map.setView(center,zoom)}),[center,uncertainty,map]);return(0,react.useEffect)((()=>{init||(updateView(),setInit(!0))}),[]),(0,react.useEffect)((()=>{updateView()}),[center,uncertainty,updateView]),null};let DefaultIcon=leaflet_src_default().icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});leaflet_src_default().Marker.prototype.options.icon=DefaultIcon;const getPlaceName=venue=>{let placeName="Position";return venue?.address?placeName=[venue.address.village||venue.address.suburb,venue.address.town||venue.address.city||venue.address.county||venue.address.state,venue.address.country].filter(Boolean).join(", "):venue?.display_name&&(placeName=venue.display_name),placeName},VenueWidget=({venue,setVenue,showUncertainty=!1,showGpsButton=!0})=>{const{t}=(0,useTranslation.$)(),[isClient,setIsClient]=(0,react.useState)(!1),[updatingPosition,setUpdatingPosition]=(0,react.useState)(!1),[fetching,setFetching]=(0,react.useState)(!1),[query,setQuery]=(0,react.useState)(""),[suggestions,setSuggestions]=(0,react.useState)([]),handleSearch=(0,utils.DI)((async value=>{setFetching(!0);try{let response=await fetch(`https://nominatim.openstreetmap.org/search?q=${value}&format=jsonv2&limit=5&addressdetails=1`),data=await response.json();setSuggestions(data)}catch(error){console.error(error)}finally{setFetching(!1)}}),1e3);return(0,react.useEffect)((()=>{setIsClient(!0)}),[]),(0,react.useEffect)((()=>{const leafletCSS=document.createElement("link");return leafletCSS.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",leafletCSS.rel="stylesheet",leafletCSS.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",leafletCSS.crossOrigin="",document.head.appendChild(leafletCSS),()=>{document.head.removeChild(leafletCSS)}}),[]),(0,jsx_runtime.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,jsx_runtime.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__geosuggest",children:updatingPosition?(0,jsx_runtime.jsx)("p",{children:t("write_and_speak.updatingPosition")}):(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget-search",children:(0,jsx_runtime.jsxs)(combobox.h,{value:venue?.latitude&&venue?.longitude?{place_id:0,lat:venue?.latitude,lon:venue?.longitude,display_name:venue?.placeName}:void 0,onChange:value=>{console.log(value);const placeName=getPlaceName(value);setVenue({latitude:value.lat,longitude:value.lon,placeName,uncertainty:value?.boundingbox?getUncertaintyByViewport(value.boundingbox):2})},children:[(0,jsx_runtime.jsx)(combobox.h.Input,{className:"memori--venue-widget-search--input",displayValue:i=>i?getPlaceName(i):"",placeholder:t("searchVenue"),onChange:e=>{return value=e.target.value,setQuery(value),void handleSearch(value);var value}}),(fetching||suggestions.length>0||0===suggestions.length&&""!==query)&&(0,jsx_runtime.jsx)(transition.u,{as:react.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,jsx_runtime.jsx)(combobox.h.Options,{className:"memori--venue-widget-search--options",children:fetching?(0,jsx_runtime.jsx)(Spin.Z,{spinning:!0,children:(0,jsx_runtime.jsxs)("center",{className:"memori--venue-widget-search--option",children:[t("loading"),"..."]})}):0===suggestions.length&&""!==query?(0,jsx_runtime.jsx)("center",{className:"memori--venue-widget-search--option",children:t("nothingFound")}):suggestions?.map((s=>(0,jsx_runtime.jsx)(combobox.h.Option,{as:react.Fragment,value:s,children:({active,selected})=>(0,jsx_runtime.jsx)("li",{className:classnames_default()("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":active,"memori--venue-widget-search--option-selected":selected}),children:s.display_name})},s.place_id)))})})]})}),showGpsButton&&(0,jsx_runtime.jsx)(Button.Z,{className:"memori--venue-widget__gps-button",outlined:!0,loading:updatingPosition,onClick:()=>{setUpdatingPosition(!0),(async()=>{setUpdatingPosition(!0),navigator.geolocation.getCurrentPosition((async coords=>{try{const result=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${coords.coords.latitude}&lon=${coords.coords.longitude}&format=jsonv2&addressdetails=1`),response=await result.json(),placeName=getPlaceName(response);setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName,uncertainty:coords.coords.accuracy/1e3})}catch(e){let err=e;console.error("[POSITION ERROR]",err),err?.message&&dist.ZP.error(err.message),setVenue({latitude:coords.coords.latitude,longitude:coords.coords.longitude,placeName:"Position",uncertainty:coords.coords.accuracy/1e3})}setUpdatingPosition(!1)}),(err=>{console.error("[POSITION ERROR]",err),dist.ZP.error(err.message),setUpdatingPosition(!1)}))})()},children:t("write_and_speak.useMyPosition")})]})}),showUncertainty&&(0,jsx_runtime.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,jsx_runtime.jsxs)("span",{children:[t("uncertain"),": "]}),(0,jsx_runtime.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((venue?.uncertainty??0).toFixed(2)),disabled:!(venue&&venue.placeName&&venue.latitude&&venue.longitude),onChange:e=>{setVenue({...venue,uncertainty:parseFloat(e.target.value)})},children:[venue?.uncertainty&&![0,1,2,5,10,20,50,100].includes(venue.uncertainty)&&(0,jsx_runtime.jsxs)("option",{value:venue.uncertainty,children:[venue.uncertainty," Km"]}),(0,jsx_runtime.jsx)("option",{value:0,children:t("exactPosition")}),(0,jsx_runtime.jsx)("option",{value:1,children:"1 km"}),(0,jsx_runtime.jsx)("option",{value:2,children:"2 km"}),(0,jsx_runtime.jsx)("option",{value:5,children:"5 km"}),(0,jsx_runtime.jsx)("option",{value:10,children:"10 km"}),(0,jsx_runtime.jsx)("option",{value:20,children:"20 km"}),(0,jsx_runtime.jsx)("option",{value:50,children:"50 km"}),(0,jsx_runtime.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,jsx_runtime.jsxs)("div",{className:"memori--venue-widget__form-item",children:[venue?.placeName&&(0,jsx_runtime.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,jsx_runtime.jsx)("strong",{children:t("venue")}),": ",venue.placeName]}),(0,jsx_runtime.jsx)("div",{className:"memori--venue-widget__map",children:isClient&&(0,jsx_runtime.jsxs)(MapContainer.h,{className:"memori--venue-widget__map",center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,jsx_runtime.jsx)(TileLayer.I,{attribution:'ยฉ OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,jsx_runtime.jsx)(CenterAndZoomUpdater,{center:venue?.latitude&&venue?.longitude?[venue.latitude,venue.longitude]:[44.66579,11.48823],uncertainty:1e3*(venue?.uncertainty??0)}),venue?.latitude&&venue?.longitude&&(0,jsx_runtime.jsx)(Marker.J,{position:[venue.latitude,venue.longitude],icon:DefaultIcon,children:(0,jsx_runtime.jsx)(Popup.G,{children:venue.placeName??""})}),venue?.latitude&&venue?.longitude&&void 0!==venue?.uncertainty&&(0,jsx_runtime.jsx)(Circle,{center:[venue.latitude,venue.longitude],size:1e3*venue.uncertainty})]})})]})]})};VenueWidget.displayName="VenueWidget";const VenueWidget_VenueWidget=VenueWidget;try{VenueWidget.displayName="VenueWidget",VenueWidget.__docgenInfo={description:"",displayName:"VenueWidget",props:{venue:{defaultValue:null,description:"",name:"venue",required:!1,type:{name:"Venue"}},setVenue:{defaultValue:null,description:"",name:"setVenue",required:!0,type:{name:"(venue?: Venue | undefined) => void"}},showUncertainty:{defaultValue:{value:"false"},description:"",name:"showUncertainty",required:!1,type:{name:"boolean"}},showGpsButton:{defaultValue:{value:"true"},description:"",name:"showGpsButton",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/VenueWidget/VenueWidget.tsx#VenueWidget"]={docgenInfo:VenueWidget.__docgenInfo,name:"VenueWidget",path:"src/components/VenueWidget/VenueWidget.tsx#VenueWidget"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./src/helpers/utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{DI:()=>useDebounceFn,Dt:()=>isAndroid,Tt:()=>isiOS,bw:()=>cleanUrl,h:()=>stripEmojis,vw:()=>stripDuplicates,xZ:()=>hasTouchscreen});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js");const hasTouchscreen=()=>{let hasTouchScreen=!1;if("maxTouchPoints"in navigator)hasTouchScreen=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)hasTouchScreen=navigator.msMaxTouchPoints>0;else{const mQ=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(mQ&&"(pointer:coarse)"===mQ.media)hasTouchScreen=!!mQ.matches;else if("orientation"in window)hasTouchScreen=!0;else{var UA=navigator?.userAgent;hasTouchScreen=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)}}return hasTouchScreen},isiOS=()=>{let platform=navigator?.userAgentData?.platform||navigator?.platform||"unknown",userAgent=navigator?.userAgent||"unknown";return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(platform)||userAgent.includes("Mac")&&"ontouchend"in document},isAndroid=()=>"android"===(navigator?.userAgentData?.platform||navigator?.platform||"unknown").toLowerCase()||navigator.userAgent.includes("Android");function useDebounceFn(fn,delay){const timeoutId=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(),originalFn=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>(originalFn.current=fn,()=>{originalFn.current=null})),[fn]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>()=>{clearTimeout(timeoutId.current)}),[]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>(...args)=>{clearTimeout(timeoutId.current),timeoutId.current=window.setTimeout((()=>{originalFn.current&&originalFn.current(...args)}),delay)}),[delay])}const stripDuplicates=text=>text.slice(0,text.length/2).trim().toLowerCase()===text.slice(text.length/2+1).trim().toLowerCase()?text.slice(0,text.length/2):text,stripEmojis=text=>text.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu,"").trim();function cleanUrl(href){try{href=encodeURI(href).replace(/%25/g,"%")}catch(e){return null}return href}},"./src/mocks/data.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A3:()=>expertReference,EA:()=>user,Eu:()=>historyWithMedia,Fr:()=>venue,Gs:()=>dialogState,I_:()=>historyWithAIGeneratedMessages,JZ:()=>knownFact,M9:()=>sessionID,WM:()=>integration,cm:()=>tenant,jF:()=>memori,m8:()=>history});const sessionID="131165be-9d1a-42fb-a3ce-e8f86d40c88f",tenant={adminCount:3,config:{name:"AIsuru",requirePosition:!1,showNewUser:!0},creationTimestamp:"2023-05-31T14:32:48.885287Z",description:"AIsuru",disableRegistration:!1,id:"www.aisuru.com",lastChangeTimestamp:"2023-05-31T14:32:48.885287Z",logoURL:"https://aisuru.com/images/twincreator/logo.png",maxAdmins:0,maxCompletions:0,maxCompletionsPerUser:0,maxFreeSessions:400,maxFreeSessionsPerUser:100,maxMemoriPerAdmin:0,maxMemoriPerUser:3,maxTotalMemori:0,maxUsers:0,memoriCount:0,name:"www.aisuru.com",nonFreeSessionCost:.02,paying:!0,tenantID:"96caa4b4-31a4-48e5-8163-dec61869a2a7",theme:"aisuru",userCount:0},user={tenant:"localhost:3000",userID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",userName:"nzambello",eMail:"nicola@nzambello.dev",admin:!1,maxMemori:0,enableMemoriCreation:!0,enableBoardOfExperts:!0,maxFreeSessions:0,tnCAndPPAccepted:!0,tnCAndPPAcceptanceDate:"2021-03-01T00:00:00.000Z",pAndCUAccepted:!0,pAndCUAcceptanceDate:"2021-03-01T00:00:00.000Z",birthDate:"1900-03-01T00:00:00.000Z",age:28},memori={memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",engineMemoriID:"66b4e161-2431-4b21-9b70-d8c27de730ca",name:"Memori",memoriConfigurationID:"MemoriCloud-it_IT",description:"Lorem ipsum.",voiceType:"male",isGiver:!0,isReceiver:!1,privacyType:"PUBLIC",needsPosition:!1,culture:"it-IT",categories:[],publishedInTheMetaverse:!0,exposed:!0,enableCompletions:!0,nsfw:!1,ageRestriction:14,contentQualityIndex:66.6,contentQualityIndexTimestamp:"2021-03-01T12:00:00.000Z",ownerUserName:"username",ownerTenantName:"aisuru.com",ownerUserID:"97c42d18-ffe4-47e1-a3c7-e42729f1e6a3",metaverseEnvironment:"synthwave",secretToken:"awanagana",giverPIN:"1234",giverTag:"๐Ÿง‘โ€๐Ÿ’ป",avatarURL:"https://aisuru.com/images/twincreator/square_logo.png",coverURL:"https://aisuru.com/images/twincreator/og-image.png"},history=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],historyWithMedia=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Mi dispiace, le mie risposte sono limitate. Devi farmi le domande giuste. C'รจ altro che vuoi sapere?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui delle cose per te.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai/en",mimeType:"text/html",title:"Link Memori Srl"},{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efce",url:"https://rawmaterial.it/en",mimeType:"text/html",title:"Link RawMaterial"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5971",mimeType:"text/html",title:"Introducing Plone Remix | Vimeo",url:"https://vimeo.com/766468314"},{mediumID:"95226d7e-7bae-465e-8b80-995587bb5969",mimeType:"text/html",title:"A sustainable web: is it possible? - Nicola Zambello | YouTube",url:"https://www.youtube.com/watch?v=feH26j3rBz8"},...Array.from({length:3},((_,i)=>({mediumID:`95226d7e-7bae-465e-8b80-995587bb597${i}`,mimeType:"image/png",title:`Image ${i}`,url:`https://picsum.photos/${i%2?"200":"300"}/${i%3?"300":"200"}?random=${i}`})))],timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z"}],historyWithAIGeneratedMessages=[{text:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Prova",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Sa. Sa. Prova",timestamp:"2021-03-01T12:00:00.000Z"},{text:"Come faccio a fare delle cose con questa cosa?",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Ecco qui come.",media:[{mediumID:"c6851968-5d4d-409a-ae75-f22ec077efcd",url:"https://memori.ai",mimeType:"text/html",title:"Link"}],timestamp:"2021-03-01T12:00:00.000Z",generatedByAI:!0,contextVars:{TEST:"test"}},{text:"Ah, grazie! Ciao!",fromUser:!0,timestamp:"2021-03-01T12:00:00.000Z"},{text:"Arrivederci.",timestamp:"2021-03-01T12:00:00.000Z",contextVars:{TEST:"test"}}],dialogState={state:"R1",previousState:"I0",stateName:"WaitingForReceiverQuestion",confidence:1,knownTags:{"โ˜ ๏ธ":"test","๐Ÿ˜Ž":"Ciccio"},emission:"Ciao, io sono test, c'รจ qualcosa che vorresti chiedermi?",hints:["Va bene","No grazie"],media:[],acceptsTimeout:!0,acceptsAbort:!1,acceptsMedia:!1,acceptsDate:!1,acceptsPlace:!1,acceptsTag:!1,giverID:"c832e2dc-403c-4baf-a3b7-2374e100dbcf",contextVars:{}},integration={integrationID:"cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1",memoriID:"25ced51c-3520-41af-8bbe-222d861b8e32",type:"LANDING_EXPERIENCE",state:"NEW",deviceEmails:[],customData:'{"textColor":"#2a2a2a","buttonBgColor":"#823ce1","buttonTextColor":"#ffffff","name":"Web","globalBackground":"https://assets.memori.ai/api/v2/asset/364e498c-11da-42d5-9e32-19e5d137d4b8.jpeg","blurBackground":true,"innerBgColor":"light","innerBgAlpha":0.8,"multilanguage":true,"avatar":"readyplayerme","avatarURL":"https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb#1669663599444"}',resources:[],publish:!0,creationTimestamp:"2022-06-11T14:13:45.685038Z",lastChangeTimestamp:"2022-06-11T14:13:45.685038Z"},knownFact={knownFactID:"b0b0b0b0-b0b0-b0b0-b0b0-b0b0b0b0b0b3",knownFactType:"ShortTerm",text:"I am a known fact. Quisque in ultrices lectus. Nulla at urna diam. Proin sodales lobortis libero eu facilisis.",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},expertReference={expertID:"f016f204-c307-483b-8891-680a3c974c53",name:"TEST MEMORI",description:"lui รจ competente",default:!0,expertMemoriID:"dfc44f1c-1ba7-4e1e-a234-28aa8b6b3d32",expertBaseURL:"http://localhost:7778",creationTimestamp:"2023-12-01T13:40:25.235896Z",creationSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f",lastChangeTimestamp:"2023-12-01T13:44:04.832072Z",lastChangeSessionID:"0ce713c0-c8f1-4aed-a2a6-40f81c06854f"},venue={latitude:44.66579,longitude:11.48823,placeName:"Altedo, Bologna, Italy",uncertainty:2}}}]); \ No newline at end of file diff --git a/components-ui-Drawer-stories.0d7b5edb.iframe.bundle.js b/components-ui-Drawer-stories.27a50333.iframe.bundle.js similarity index 88% rename from components-ui-Drawer-stories.0d7b5edb.iframe.bundle.js rename to components-ui-Drawer-stories.27a50333.iframe.bundle.js index a36db670..c0034156 100644 --- a/components-ui-Drawer-stories.0d7b5edb.iframe.bundle.js +++ b/components-ui-Drawer-stories.27a50333.iframe.bundle.js @@ -1,2 +1,2 @@ -/*! For license information please see components-ui-Drawer-stories.0d7b5edb.iframe.bundle.js.LICENSE.txt */ -"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[200],{"./node_modules/@headlessui/react/dist/components/description/description.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{d:()=>F,f:()=>k});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-id.js"),_utils_render_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/render.js"),_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js"),_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-sync-refs.js"),_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js");let d=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);function u(){let r=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(d);if(null===r){let t=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,u),t}return r}function k(){let[r,t]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return[r.length>0?r.join(" "):void 0,(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>function(e){let i=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_1__.z)((n=>(t((o=>[...o,n])),()=>t((o=>{let c=o.slice(),p=c.indexOf(n);return-1!==p&&c.splice(p,1),c}))))),s=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({register:i,slot:e.slot,name:e.name,props:e.props})),[i,e.slot,e.name,e.props]);return react__WEBPACK_IMPORTED_MODULE_0__.createElement(d.Provider,{value:s},e.children)}),[t])]}let F=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_2__.yV)((function(t,a){let e=u(),i=`headlessui-description-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_3__.M)()}`,s=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_4__.T)(a);(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_5__.e)((()=>e.register(i)),[i,e.register]);let n=t,o={ref:s,...e.props,id:i};return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_2__.sY)({ourProps:o,theirProps:n,slot:e.slot||{},defaultTag:"p",name:e.name||"Description"})}))},"./node_modules/@headlessui/react/dist/components/dialog/dialog.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{V:()=>gt});var react=__webpack_require__("./node_modules/react/index.js"),match=__webpack_require__("./node_modules/@headlessui/react/dist/utils/match.js"),render=__webpack_require__("./node_modules/@headlessui/react/dist/utils/render.js"),use_sync_refs=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-sync-refs.js"),keyboard=__webpack_require__("./node_modules/@headlessui/react/dist/components/keyboard.js"),bugs=__webpack_require__("./node_modules/@headlessui/react/dist/utils/bugs.js"),use_id=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-id.js"),use_server_handoff_complete=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-server-handoff-complete.js"),internal_hidden=__webpack_require__("./node_modules/@headlessui/react/dist/internal/hidden.js"),focus_management=__webpack_require__("./node_modules/@headlessui/react/dist/utils/focus-management.js"),use_event=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js"),use_tab_direction=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-tab-direction.js"),use_is_mounted=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-is-mounted.js"),use_owner=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-owner.js"),use_event_listener=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event-listener.js"),micro_task=__webpack_require__("./node_modules/@headlessui/react/dist/utils/micro-task.js"),use_watch=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-watch.js");var v=(r=>(r[r.None=1]="None",r[r.InitialFocus=2]="InitialFocus",r[r.TabLock=4]="TabLock",r[r.FocusLock=8]="FocusLock",r[r.RestoreFocus=16]="RestoreFocus",r[r.All=30]="All",r))(v||{});let fe=Object.assign((0,render.yV)((function(u,e){let l=(0,react.useRef)(null),o=(0,use_sync_refs.T)(l,e),{initialFocus:a,containers:r,features:n=30,...c}=u;(0,use_server_handoff_complete.H)()||(n=1);let s=(0,use_owner.i)(l);!function V({ownerDocument:t},u){let e=(0,react.useRef)(null);(0,use_event_listener.O)(null==t?void 0:t.defaultView,"focusout",(o=>{!u||e.current||(e.current=o.target)}),!0),(0,use_watch.q)((()=>{u||((null==t?void 0:t.activeElement)===(null==t?void 0:t.body)&&(0,focus_management.C5)(e.current),e.current=null)}),[u]);let l=(0,react.useRef)(!1);(0,react.useEffect)((()=>(l.current=!1,()=>{l.current=!0,(0,micro_task.Y)((()=>{!l.current||((0,focus_management.C5)(e.current),e.current=null)}))})),[])}({ownerDocument:s},Boolean(16&n));let j=function x({ownerDocument:t,container:u,initialFocus:e},l){let o=(0,react.useRef)(null),a=(0,use_is_mounted.t)();return(0,use_watch.q)((()=>{if(!l)return;let r=u.current;!r||(0,micro_task.Y)((()=>{if(!a.current)return;let n=null==t?void 0:t.activeElement;if(null!=e&&e.current){if((null==e?void 0:e.current)===n)return void(o.current=n)}else if(r.contains(n))return void(o.current=n);null!=e&&e.current?(0,focus_management.C5)(e.current):(0,focus_management.jA)(r,focus_management.TO.First)===focus_management.fE.Error&&console.warn("There are no focusable elements inside the "),o.current=null==t?void 0:t.activeElement}))}),[l]),o}({ownerDocument:s,container:l,initialFocus:a},Boolean(2&n));!function G({ownerDocument:t,container:u,containers:e,previousActiveElement:l},o){let a=(0,use_is_mounted.t)();(0,use_event_listener.O)(null==t?void 0:t.defaultView,"focus",(r=>{if(!o||!a.current)return;let n=new Set(null==e?void 0:e.current);n.add(u);let c=l.current;if(!c)return;let s=r.target;s&&s instanceof HTMLElement?function W(t,u){var e;for(let l of t)if(null!=(e=l.current)&&e.contains(u))return!0;return!1}(n,s)?(l.current=s,(0,focus_management.C5)(s)):(r.preventDefault(),r.stopPropagation(),(0,focus_management.C5)(c)):(0,focus_management.C5)(l.current)}),!0)}({ownerDocument:s,container:l,containers:r,previousActiveElement:j},Boolean(8&n));let k=(0,use_tab_direction.l)(),p=(0,use_event.z)((()=>{let T=l.current;!T||(0,match.E)(k.current,{[use_tab_direction.N.Forwards]:()=>(0,focus_management.jA)(T,focus_management.TO.First),[use_tab_direction.N.Backwards]:()=>(0,focus_management.jA)(T,focus_management.TO.Last)})})),A={ref:o};return react.createElement(react.Fragment,null,Boolean(4&n)&&react.createElement(internal_hidden._,{as:"button",type:"button",onFocus:p,features:internal_hidden.A.Focusable}),(0,render.sY)({ourProps:A,theirProps:c,defaultTag:"div",name:"FocusTrap"}),Boolean(4&n)&&react.createElement(internal_hidden._,{as:"button",type:"button",onFocus:p,features:internal_hidden.A.Focusable}))})),{features:v});var owner=__webpack_require__("./node_modules/@headlessui/react/dist/utils/owner.js"),use_iso_morphic_effect=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js");let i=new Set,r=new Map;function u(t){t.setAttribute("aria-hidden","true"),t.inert=!0}function l(t){let n=r.get(t);!n||(null===n["aria-hidden"]?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",n["aria-hidden"]),t.inert=n.inert)}function M(t,n=!0){(0,use_iso_morphic_effect.e)((()=>{if(!n||!t.current)return;let o=t.current,a=(0,owner.r)(o);if(a){i.add(o);for(let e of r.keys())e.contains(o)&&(l(e),r.delete(e));return a.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement){for(let f of i)if(e.contains(f))return;1===i.size&&(r.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),u(e))}})),()=>{if(i.delete(o),i.size>0)a.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement&&!r.has(e)){for(let f of i)if(e.contains(f))return;r.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),u(e)}}));else for(let e of r.keys())l(e),r.delete(e)}}}),[n])}var react_dom=__webpack_require__("./node_modules/react-dom/index.js");let e=(0,react.createContext)(!1);function portal_force_root_l(){return(0,react.useContext)(e)}function portal_force_root_P(o){return react.createElement(e.Provider,{value:o.force},o.children)}var ssr=__webpack_require__("./node_modules/@headlessui/react/dist/utils/ssr.js");let _=react.Fragment,U=(0,render.yV)((function(u,o){let e=u,r=(0,react.useRef)(null),f=(0,use_sync_refs.T)((0,use_sync_refs.h)((a=>{r.current=a})),o),n=(0,use_owner.i)(r),t=function portal_x(i){let u=portal_force_root_l(),o=(0,react.useContext)(A),e=(0,use_owner.i)(i),[r,f]=(0,react.useState)((()=>{if(!u&&null!==o||ssr.s)return null;let n=null==e?void 0:e.getElementById("headlessui-portal-root");if(n)return n;if(null===e)return null;let t=e.createElement("div");return t.setAttribute("id","headlessui-portal-root"),e.body.appendChild(t)}));return(0,react.useEffect)((()=>{null!==r&&(null!=e&&e.body.contains(r)||null==e||e.body.appendChild(r))}),[r,e]),(0,react.useEffect)((()=>{u||null!==o&&f(o.current)}),[o,f,u]),r}(r),[l]=(0,react.useState)((()=>{var a;return ssr.s?null:null!=(a=null==n?void 0:n.createElement("div"))?a:null})),b=(0,use_server_handoff_complete.H)(),p=(0,react.useRef)(!1);return(0,use_iso_morphic_effect.e)((()=>{if(p.current=!1,t&&l)return t.contains(l)||(l.setAttribute("data-headlessui-portal",""),t.appendChild(l)),()=>{p.current=!0,(0,micro_task.Y)((()=>{var a;!p.current||!t||!l||(t.removeChild(l),t.childNodes.length<=0&&(null==(a=t.parentElement)||a.removeChild(t)))}))}}),[t,l]),b&&t&&l?(0,react_dom.createPortal)((0,render.sY)({ourProps:{ref:f},theirProps:e,defaultTag:_,name:"Portal"}),l):null})),j=react.Fragment,A=(0,react.createContext)(null),F=(0,render.yV)((function(u,o){let{target:e,...r}=u,n={ref:(0,use_sync_refs.T)(o)};return react.createElement(A.Provider,{value:e},(0,render.sY)({ourProps:n,theirProps:r,defaultTag:j,name:"Popover.Group"}))})),portal_$=Object.assign(U,{Group:F});var description=__webpack_require__("./node_modules/@headlessui/react/dist/components/description/description.js"),open_closed=__webpack_require__("./node_modules/@headlessui/react/dist/internal/open-closed.js");let a=(0,react.createContext)((()=>{}));a.displayName="StackContext";var stack_context_s=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(stack_context_s||{});function stack_context_M({children:i,onUpdate:r,type:e,element:n,enabled:u}){let l=function stack_context_x(){return(0,react.useContext)(a)}(),o=(0,use_event.z)(((...t)=>{null==r||r(...t),l(...t)}));return(0,use_iso_morphic_effect.e)((()=>{let t=void 0===u||!0===u;return t&&o(0,e,n),()=>{t&&o(1,e,n)}}),[o,e,n,u]),react.createElement(a.Provider,{value:o},i)}var use_outside_click=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-outside-click.js"),disposables=__webpack_require__("./node_modules/@headlessui/react/dist/utils/disposables.js");var Re=(r=>(r[r.Open=0]="Open",r[r.Closed=1]="Closed",r))(Re||{}),be=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(be||{});let Ae={0:(l,e)=>l.titleId===e.id?l:{...l,titleId:e.id}},dialog_M=(0,react.createContext)(null);function L(l){let e=(0,react.useContext)(dialog_M);if(null===e){let r=new Error(`<${l} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,L),r}return e}function Ee(l,e){(0,react.useEffect)((()=>{var p;if(!e||!l)return;let r=(0,disposables.k)();function t(n,d,m){let i=n.style.getPropertyValue(d);return Object.assign(n.style,{[d]:m}),r.add((()=>{Object.assign(n.style,{[d]:i})}))}let o=l.documentElement,s=(null!=(p=l.defaultView)?p:window).innerWidth-o.clientWidth;if(t(o,"overflow","hidden"),s>0){t(o,"paddingRight",`${s-(o.clientWidth-o.offsetWidth)}px`)}if(function platform_o(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}()){let n=window.pageYOffset;t(o,"position","fixed"),t(o,"marginTop",`-${n}px`),t(o,"width","100%"),r.add((()=>window.scrollTo(0,n)))}return r.dispose}),[l,e])}function ve(l,e){return(0,match.E)(e.type,Ae,l,e)}dialog_M.displayName="DialogContext";let Ce=render.AN.RenderStrategy|render.AN.Static,Se=(0,render.yV)((function(e,r){let{open:t,onClose:o,initialFocus:a,__demoMode:s=!1,...p}=e,[n,d]=(0,react.useState)(0),m=(0,open_closed.oJ)();void 0===t&&null!==m&&(t=(0,match.E)(m,{[open_closed.ZM.Open]:!0,[open_closed.ZM.Closed]:!1}));let i=(0,react.useRef)(new Set),T=(0,react.useRef)(null),K=(0,use_sync_refs.T)(T,r),W=(0,react.useRef)(null),P=(0,use_owner.i)(T),B=e.hasOwnProperty("open")||null!==m,G=e.hasOwnProperty("onClose");if(!B&&!G)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!B)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!G)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof t)throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${t}`);if("function"!=typeof o)throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o}`);let u=t?0:1,[y,q]=(0,react.useReducer)(ve,{titleId:null,descriptionId:null,panelRef:(0,react.createRef)()}),h=(0,use_event.z)((()=>o(!1))),U=(0,use_event.z)((f=>q({type:0,id:f}))),_=!!(0,use_server_handoff_complete.H)()&&(!s&&0===u),w=n>1,z=null!==(0,react.useContext)(dialog_M),J=w?"parent":"leaf";M(T,!!w&&_),(0,use_outside_click.O)((()=>{var R,g;return[...Array.from(null!=(R=null==P?void 0:P.querySelectorAll("body > *, [data-headlessui-portal]"))?R:[]).filter((D=>!(!(D instanceof HTMLElement)||D.contains(W.current)||y.panelRef.current&&D.contains(y.panelRef.current)))),null!=(g=y.panelRef.current)?g:T.current]}),h,_&&!w),(0,use_event_listener.O)(null==P?void 0:P.defaultView,"keydown",(f=>{f.defaultPrevented||f.key===keyboard.R.Escape&&0===u&&(w||(f.preventDefault(),f.stopPropagation(),h()))})),Ee(P,0===u&&!z),(0,react.useEffect)((()=>{if(0!==u||!T.current)return;let f=new IntersectionObserver((R=>{for(let g of R)0===g.boundingClientRect.x&&0===g.boundingClientRect.y&&0===g.boundingClientRect.width&&0===g.boundingClientRect.height&&h()}));return f.observe(T.current),()=>f.disconnect()}),[u,T,h]);let[Q,X]=(0,description.f)(),Z=`headlessui-dialog-${(0,use_id.M)()}`,ee=(0,react.useMemo)((()=>[{dialogState:u,close:h,setTitleId:U},y]),[u,y,h,U]),$=(0,react.useMemo)((()=>({open:0===u})),[u]),te={ref:K,id:Z,role:"dialog","aria-modal":0===u||void 0,"aria-labelledby":y.titleId,"aria-describedby":Q};return react.createElement(stack_context_M,{type:"Dialog",enabled:0===u,element:T,onUpdate:(0,use_event.z)(((f,R,g)=>{"Dialog"===R&&(0,match.E)(f,{[stack_context_s.Add](){i.current.add(g),d((D=>D+1))},[stack_context_s.Remove](){i.current.add(g),d((D=>D-1))}})}))},react.createElement(portal_force_root_P,{force:!0},react.createElement(portal_$,null,react.createElement(dialog_M.Provider,{value:ee},react.createElement(portal_$.Group,{target:T},react.createElement(portal_force_root_P,{force:!1},react.createElement(X,{slot:$,name:"Dialog.Description"},react.createElement(fe,{initialFocus:a,containers:i,features:_?(0,match.E)(J,{parent:fe.features.RestoreFocus,leaf:fe.features.All&~fe.features.FocusLock}):fe.features.None},(0,render.sY)({ourProps:te,theirProps:p,slot:$,defaultTag:"div",features:Ce,visible:0===u,name:"Dialog"})))))))),react.createElement(internal_hidden._,{features:internal_hidden.A.Hidden,ref:W}))})),we=(0,render.yV)((function(e,r){let[{dialogState:t,close:o}]=L("Dialog.Overlay"),a=(0,use_sync_refs.T)(r),s=`headlessui-dialog-overlay-${(0,use_id.M)()}`,p=(0,use_event.z)((i=>{if(i.target===i.currentTarget){if((0,bugs.P)(i.currentTarget))return i.preventDefault();i.preventDefault(),i.stopPropagation(),o()}})),n=(0,react.useMemo)((()=>({open:0===t})),[t]);return(0,render.sY)({ourProps:{ref:a,id:s,"aria-hidden":!0,onClick:p},theirProps:e,slot:n,defaultTag:"div",name:"Dialog.Overlay"})})),ke=(0,render.yV)((function(e,r){let[{dialogState:t},o]=L("Dialog.Backdrop"),a=(0,use_sync_refs.T)(r),s=`headlessui-dialog-backdrop-${(0,use_id.M)()}`;(0,react.useEffect)((()=>{if(null===o.panelRef.current)throw new Error("A component is being used, but a component is missing.")}),[o.panelRef]);let p=(0,react.useMemo)((()=>({open:0===t})),[t]);return react.createElement(portal_force_root_P,{force:!0},react.createElement(portal_$,null,(0,render.sY)({ourProps:{ref:a,id:s,"aria-hidden":!0},theirProps:e,slot:p,defaultTag:"div",name:"Dialog.Backdrop"})))})),_e=(0,render.yV)((function(e,r){let[{dialogState:t},o]=L("Dialog.Panel"),a=(0,use_sync_refs.T)(r,o.panelRef),s=`headlessui-dialog-panel-${(0,use_id.M)()}`,p=(0,react.useMemo)((()=>({open:0===t})),[t]),n=(0,use_event.z)((i=>{i.stopPropagation()}));return(0,render.sY)({ourProps:{ref:a,id:s,onClick:n},theirProps:e,slot:p,defaultTag:"div",name:"Dialog.Panel"})})),Ie=(0,render.yV)((function(e,r){let[{dialogState:t,setTitleId:o}]=L("Dialog.Title"),a=`headlessui-dialog-title-${(0,use_id.M)()}`,s=(0,use_sync_refs.T)(r);(0,react.useEffect)((()=>(o(a),()=>o(null))),[a,o]);let p=(0,react.useMemo)((()=>({open:0===t})),[t]);return(0,render.sY)({ourProps:{ref:s,id:a},theirProps:e,slot:p,defaultTag:"h2",name:"Dialog.Title"})})),gt=Object.assign(Se,{Backdrop:ke,Panel:_e,Overlay:we,Title:Ie,Description:description.d})},"./node_modules/@headlessui/react/dist/hooks/use-event-listener.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{O:()=>E});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-latest-value.js");function E(n,e,a,t){let i=(0,_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__.E)(a);(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{function r(o){i.current(o)}return(n=null!=n?n:window).addEventListener(e,r,t),()=>n.removeEventListener(e,r,t)}),[n,e,t])}},"./node_modules/@headlessui/react/dist/hooks/use-owner.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{i:()=>n});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_utils_owner_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/owner.js");function n(...e){return(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>(0,_utils_owner_js__WEBPACK_IMPORTED_MODULE_1__.r)(...e)),[...e])}},"./node_modules/@headlessui/react/dist/hooks/use-tab-direction.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{N:()=>use_tab_direction_s,l:()=>n});var react=__webpack_require__("./node_modules/react/index.js"),use_latest_value=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-latest-value.js");var r,use_tab_direction_s=((r=use_tab_direction_s||{})[r.Forwards=0]="Forwards",r[r.Backwards=1]="Backwards",r);function n(){let e=(0,react.useRef)(0);return function s(e,r,n){let o=(0,use_latest_value.E)(r);(0,react.useEffect)((()=>{function t(i){o.current(i)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)}),[e,n])}("keydown",(o=>{"Tab"===o.key&&(e.current=o.shiftKey?1:0)}),!0),e}},"./src/components/ui/Drawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,Loading:()=>Loading,Open:()=>Open,SideLeft:()=>SideLeft,WithALotOfContent:()=>WithALotOfContent,WithFooter:()=>WithFooter,WithTitle:()=>WithTitle,WithTitleAndDescription:()=>WithTitleAndDescription,__namedExportsOrder:()=>__namedExportsOrder,default:()=>Drawer_stories});var react=__webpack_require__("./node_modules/react/index.js"),Drawer=__webpack_require__("./src/components/ui/Drawer.tsx"),Button=__webpack_require__("./src/components/ui/Button.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),ui_Drawer=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/ui/Drawer.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(ui_Drawer.Z,options);ui_Drawer.Z&&ui_Drawer.Z.locals&&ui_Drawer.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer_stories={title:"UI/Drawer",component:Drawer.Z,argTypes:{title:{control:{type:"text"}},description:{control:{type:"text"}},loading:{control:{type:"boolean"}},open:{control:{type:"boolean"}},className:{control:{type:"text"}},side:{control:{type:"select",options:["left","right"]}}},parameters:{controls:{expanded:!0}}},content=(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("p",{children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit."}),(0,jsx_runtime.jsx)("h3",{children:"Suspendisse a sodales nulla, sed semper nisi."}),(0,jsx_runtime.jsx)("p",{children:"Proin tincidunt enim in felis aliquet, a ultricies purus bibendum."}),(0,jsx_runtime.jsxs)("ul",{children:[(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."})]}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."}),(0,jsx_runtime.jsx)("h3",{children:"Suspendisse a sodales nulla, sed semper nisi."}),(0,jsx_runtime.jsx)("p",{children:"Proin tincidunt enim in felis aliquet, a ultricies purus bibendum."}),(0,jsx_runtime.jsxs)("ul",{children:[(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."})]}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."}),(0,jsx_runtime.jsx)("h3",{children:"Suspendisse a sodales nulla, sed semper nisi."}),(0,jsx_runtime.jsx)("p",{children:"Proin tincidunt enim in felis aliquet, a ultricies purus bibendum."}),(0,jsx_runtime.jsxs)("ul",{children:[(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."})]}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."})]}),footer=(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)(Button.Z,{primary:!0,children:"OK"}),(0,jsx_runtime.jsx)(Button.Z,{children:"Cancel"})]}),Template=args=>{const[isOpen,setIsOpen]=react.useState(!!args.open||!1);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)(Button.Z,{onClick:()=>setIsOpen(!0),children:"Click me"}),(0,jsx_runtime.jsx)(Drawer.Z,{...args,open:isOpen,onClose:()=>setIsOpen(!1),footer:args.footer,children:content})]})},Default=Template.bind({});Default.args={open:!1};const Open=Template.bind({});Open.args={open:!0};const WithTitle=Template.bind({});WithTitle.args={open:!0,title:"Drawer Title"};const WithTitleAndDescription=Template.bind({});WithTitleAndDescription.args={open:!0,title:"Drawer Title",description:"Drawer Description"};const Loading=Template.bind({});Loading.args={open:!0,title:"Drawer Title",description:"Drawer Description",loading:!0};const WithFooter=Template.bind({});WithFooter.args={open:!0,title:"Drawer Title",description:"Drawer Description",footer};const SideLeft=Template.bind({});SideLeft.args={open:!0,side:"left"};const WithALotOfContent=(args=>{const[isOpen,setIsOpen]=react.useState(!!args.open||!1);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)(Button.Z,{onClick:()=>setIsOpen(!0),children:"Click me"}),(0,jsx_runtime.jsxs)(Drawer.Z,{...args,open:isOpen,onClose:()=>setIsOpen(!1),footer:args.footer,children:[content,content,content,content,content]})]})}).bind({});WithALotOfContent.args={open:!0,title:"Drawer Title",description:"Drawer Description",footer},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...Default.parameters?.docs?.source}}},Open.parameters={...Open.parameters,docs:{...Open.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...Open.parameters?.docs?.source}}},WithTitle.parameters={...WithTitle.parameters,docs:{...WithTitle.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...WithTitle.parameters?.docs?.source}}},WithTitleAndDescription.parameters={...WithTitleAndDescription.parameters,docs:{...WithTitleAndDescription.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...WithTitleAndDescription.parameters?.docs?.source}}},Loading.parameters={...Loading.parameters,docs:{...Loading.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...Loading.parameters?.docs?.source}}},WithFooter.parameters={...WithFooter.parameters,docs:{...WithFooter.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...WithFooter.parameters?.docs?.source}}},SideLeft.parameters={...SideLeft.parameters,docs:{...SideLeft.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...SideLeft.parameters?.docs?.source}}},WithALotOfContent.parameters={...WithALotOfContent.parameters,docs:{...WithALotOfContent.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n {content}\n {content}\n {content}\n {content}\n \n ;\n}",...WithALotOfContent.parameters?.docs?.source}}};const __namedExportsOrder=["Default","Open","WithTitle","WithTitleAndDescription","Loading","WithFooter","SideLeft","WithALotOfContent"]},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./node_modules/react/cjs/react-jsx-runtime.production.min.js":(__unused_webpack_module,exports,__webpack_require__)=>{var f=__webpack_require__("./node_modules/react/index.js"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;for(b in void 0!==g&&(e=""+g),void 0!==a.key&&(e=""+a.key),void 0!==a.ref&&(h=a.ref),a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l,exports.jsx=q,exports.jsxs=q},"./node_modules/react/jsx-runtime.js":(module,__unused_webpack_exports,__webpack_require__)=>{module.exports=__webpack_require__("./node_modules/react/cjs/react-jsx-runtime.production.min.js")}}]); \ No newline at end of file +/*! For license information please see components-ui-Drawer-stories.27a50333.iframe.bundle.js.LICENSE.txt */ +"use strict";(self.webpackChunk_memori_ai_memori_react=self.webpackChunk_memori_ai_memori_react||[]).push([[200],{"./node_modules/@headlessui/react/dist/components/description/description.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{d:()=>F,f:()=>k});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-id.js"),_utils_render_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/render.js"),_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js"),_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-sync-refs.js"),_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js");let d=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);function u(){let r=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(d);if(null===r){let t=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,u),t}return r}function k(){let[r,t]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]);return[r.length>0?r.join(" "):void 0,(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>function(e){let i=(0,_hooks_use_event_js__WEBPACK_IMPORTED_MODULE_1__.z)((n=>(t((o=>[...o,n])),()=>t((o=>{let c=o.slice(),p=c.indexOf(n);return-1!==p&&c.splice(p,1),c}))))),s=(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>({register:i,slot:e.slot,name:e.name,props:e.props})),[i,e.slot,e.name,e.props]);return react__WEBPACK_IMPORTED_MODULE_0__.createElement(d.Provider,{value:s},e.children)}),[t])]}let F=(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_2__.yV)((function(t,a){let e=u(),i=`headlessui-description-${(0,_hooks_use_id_js__WEBPACK_IMPORTED_MODULE_3__.M)()}`,s=(0,_hooks_use_sync_refs_js__WEBPACK_IMPORTED_MODULE_4__.T)(a);(0,_hooks_use_iso_morphic_effect_js__WEBPACK_IMPORTED_MODULE_5__.e)((()=>e.register(i)),[i,e.register]);let n=t,o={ref:s,...e.props,id:i};return(0,_utils_render_js__WEBPACK_IMPORTED_MODULE_2__.sY)({ourProps:o,theirProps:n,slot:e.slot||{},defaultTag:"p",name:e.name||"Description"})}))},"./node_modules/@headlessui/react/dist/components/dialog/dialog.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{V:()=>gt});var react=__webpack_require__("./node_modules/react/index.js"),match=__webpack_require__("./node_modules/@headlessui/react/dist/utils/match.js"),render=__webpack_require__("./node_modules/@headlessui/react/dist/utils/render.js"),use_sync_refs=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-sync-refs.js"),keyboard=__webpack_require__("./node_modules/@headlessui/react/dist/components/keyboard.js"),bugs=__webpack_require__("./node_modules/@headlessui/react/dist/utils/bugs.js"),use_id=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-id.js"),use_server_handoff_complete=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-server-handoff-complete.js"),internal_hidden=__webpack_require__("./node_modules/@headlessui/react/dist/internal/hidden.js"),focus_management=__webpack_require__("./node_modules/@headlessui/react/dist/utils/focus-management.js"),use_event=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event.js"),use_tab_direction=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-tab-direction.js"),use_is_mounted=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-is-mounted.js"),use_owner=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-owner.js"),use_event_listener=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-event-listener.js"),micro_task=__webpack_require__("./node_modules/@headlessui/react/dist/utils/micro-task.js"),use_watch=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-watch.js");var v=(r=>(r[r.None=1]="None",r[r.InitialFocus=2]="InitialFocus",r[r.TabLock=4]="TabLock",r[r.FocusLock=8]="FocusLock",r[r.RestoreFocus=16]="RestoreFocus",r[r.All=30]="All",r))(v||{});let fe=Object.assign((0,render.yV)((function(u,e){let l=(0,react.useRef)(null),o=(0,use_sync_refs.T)(l,e),{initialFocus:a,containers:r,features:n=30,...c}=u;(0,use_server_handoff_complete.H)()||(n=1);let s=(0,use_owner.i)(l);!function V({ownerDocument:t},u){let e=(0,react.useRef)(null);(0,use_event_listener.O)(null==t?void 0:t.defaultView,"focusout",(o=>{!u||e.current||(e.current=o.target)}),!0),(0,use_watch.q)((()=>{u||((null==t?void 0:t.activeElement)===(null==t?void 0:t.body)&&(0,focus_management.C5)(e.current),e.current=null)}),[u]);let l=(0,react.useRef)(!1);(0,react.useEffect)((()=>(l.current=!1,()=>{l.current=!0,(0,micro_task.Y)((()=>{!l.current||((0,focus_management.C5)(e.current),e.current=null)}))})),[])}({ownerDocument:s},Boolean(16&n));let j=function x({ownerDocument:t,container:u,initialFocus:e},l){let o=(0,react.useRef)(null),a=(0,use_is_mounted.t)();return(0,use_watch.q)((()=>{if(!l)return;let r=u.current;!r||(0,micro_task.Y)((()=>{if(!a.current)return;let n=null==t?void 0:t.activeElement;if(null!=e&&e.current){if((null==e?void 0:e.current)===n)return void(o.current=n)}else if(r.contains(n))return void(o.current=n);null!=e&&e.current?(0,focus_management.C5)(e.current):(0,focus_management.jA)(r,focus_management.TO.First)===focus_management.fE.Error&&console.warn("There are no focusable elements inside the "),o.current=null==t?void 0:t.activeElement}))}),[l]),o}({ownerDocument:s,container:l,initialFocus:a},Boolean(2&n));!function G({ownerDocument:t,container:u,containers:e,previousActiveElement:l},o){let a=(0,use_is_mounted.t)();(0,use_event_listener.O)(null==t?void 0:t.defaultView,"focus",(r=>{if(!o||!a.current)return;let n=new Set(null==e?void 0:e.current);n.add(u);let c=l.current;if(!c)return;let s=r.target;s&&s instanceof HTMLElement?function W(t,u){var e;for(let l of t)if(null!=(e=l.current)&&e.contains(u))return!0;return!1}(n,s)?(l.current=s,(0,focus_management.C5)(s)):(r.preventDefault(),r.stopPropagation(),(0,focus_management.C5)(c)):(0,focus_management.C5)(l.current)}),!0)}({ownerDocument:s,container:l,containers:r,previousActiveElement:j},Boolean(8&n));let k=(0,use_tab_direction.l)(),p=(0,use_event.z)((()=>{let T=l.current;!T||(0,match.E)(k.current,{[use_tab_direction.N.Forwards]:()=>(0,focus_management.jA)(T,focus_management.TO.First),[use_tab_direction.N.Backwards]:()=>(0,focus_management.jA)(T,focus_management.TO.Last)})})),A={ref:o};return react.createElement(react.Fragment,null,Boolean(4&n)&&react.createElement(internal_hidden._,{as:"button",type:"button",onFocus:p,features:internal_hidden.A.Focusable}),(0,render.sY)({ourProps:A,theirProps:c,defaultTag:"div",name:"FocusTrap"}),Boolean(4&n)&&react.createElement(internal_hidden._,{as:"button",type:"button",onFocus:p,features:internal_hidden.A.Focusable}))})),{features:v});var owner=__webpack_require__("./node_modules/@headlessui/react/dist/utils/owner.js"),use_iso_morphic_effect=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-iso-morphic-effect.js");let i=new Set,r=new Map;function u(t){t.setAttribute("aria-hidden","true"),t.inert=!0}function l(t){let n=r.get(t);!n||(null===n["aria-hidden"]?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",n["aria-hidden"]),t.inert=n.inert)}function M(t,n=!0){(0,use_iso_morphic_effect.e)((()=>{if(!n||!t.current)return;let o=t.current,a=(0,owner.r)(o);if(a){i.add(o);for(let e of r.keys())e.contains(o)&&(l(e),r.delete(e));return a.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement){for(let f of i)if(e.contains(f))return;1===i.size&&(r.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),u(e))}})),()=>{if(i.delete(o),i.size>0)a.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement&&!r.has(e)){for(let f of i)if(e.contains(f))return;r.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),u(e)}}));else for(let e of r.keys())l(e),r.delete(e)}}}),[n])}var react_dom=__webpack_require__("./node_modules/react-dom/index.js");let e=(0,react.createContext)(!1);function portal_force_root_l(){return(0,react.useContext)(e)}function portal_force_root_P(o){return react.createElement(e.Provider,{value:o.force},o.children)}var ssr=__webpack_require__("./node_modules/@headlessui/react/dist/utils/ssr.js");let _=react.Fragment,U=(0,render.yV)((function(u,o){let e=u,r=(0,react.useRef)(null),f=(0,use_sync_refs.T)((0,use_sync_refs.h)((a=>{r.current=a})),o),n=(0,use_owner.i)(r),t=function portal_x(i){let u=portal_force_root_l(),o=(0,react.useContext)(A),e=(0,use_owner.i)(i),[r,f]=(0,react.useState)((()=>{if(!u&&null!==o||ssr.s)return null;let n=null==e?void 0:e.getElementById("headlessui-portal-root");if(n)return n;if(null===e)return null;let t=e.createElement("div");return t.setAttribute("id","headlessui-portal-root"),e.body.appendChild(t)}));return(0,react.useEffect)((()=>{null!==r&&(null!=e&&e.body.contains(r)||null==e||e.body.appendChild(r))}),[r,e]),(0,react.useEffect)((()=>{u||null!==o&&f(o.current)}),[o,f,u]),r}(r),[l]=(0,react.useState)((()=>{var a;return ssr.s?null:null!=(a=null==n?void 0:n.createElement("div"))?a:null})),b=(0,use_server_handoff_complete.H)(),p=(0,react.useRef)(!1);return(0,use_iso_morphic_effect.e)((()=>{if(p.current=!1,t&&l)return t.contains(l)||(l.setAttribute("data-headlessui-portal",""),t.appendChild(l)),()=>{p.current=!0,(0,micro_task.Y)((()=>{var a;!p.current||!t||!l||(t.removeChild(l),t.childNodes.length<=0&&(null==(a=t.parentElement)||a.removeChild(t)))}))}}),[t,l]),b&&t&&l?(0,react_dom.createPortal)((0,render.sY)({ourProps:{ref:f},theirProps:e,defaultTag:_,name:"Portal"}),l):null})),j=react.Fragment,A=(0,react.createContext)(null),F=(0,render.yV)((function(u,o){let{target:e,...r}=u,n={ref:(0,use_sync_refs.T)(o)};return react.createElement(A.Provider,{value:e},(0,render.sY)({ourProps:n,theirProps:r,defaultTag:j,name:"Popover.Group"}))})),portal_$=Object.assign(U,{Group:F});var description=__webpack_require__("./node_modules/@headlessui/react/dist/components/description/description.js"),open_closed=__webpack_require__("./node_modules/@headlessui/react/dist/internal/open-closed.js");let a=(0,react.createContext)((()=>{}));a.displayName="StackContext";var stack_context_s=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(stack_context_s||{});function stack_context_M({children:i,onUpdate:r,type:e,element:n,enabled:u}){let l=function stack_context_x(){return(0,react.useContext)(a)}(),o=(0,use_event.z)(((...t)=>{null==r||r(...t),l(...t)}));return(0,use_iso_morphic_effect.e)((()=>{let t=void 0===u||!0===u;return t&&o(0,e,n),()=>{t&&o(1,e,n)}}),[o,e,n,u]),react.createElement(a.Provider,{value:o},i)}var use_outside_click=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-outside-click.js"),disposables=__webpack_require__("./node_modules/@headlessui/react/dist/utils/disposables.js");var Re=(r=>(r[r.Open=0]="Open",r[r.Closed=1]="Closed",r))(Re||{}),be=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(be||{});let Ae={0:(l,e)=>l.titleId===e.id?l:{...l,titleId:e.id}},dialog_M=(0,react.createContext)(null);function L(l){let e=(0,react.useContext)(dialog_M);if(null===e){let r=new Error(`<${l} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,L),r}return e}function Ee(l,e){(0,react.useEffect)((()=>{var p;if(!e||!l)return;let r=(0,disposables.k)();function t(n,d,m){let i=n.style.getPropertyValue(d);return Object.assign(n.style,{[d]:m}),r.add((()=>{Object.assign(n.style,{[d]:i})}))}let o=l.documentElement,s=(null!=(p=l.defaultView)?p:window).innerWidth-o.clientWidth;if(t(o,"overflow","hidden"),s>0){t(o,"paddingRight",`${s-(o.clientWidth-o.offsetWidth)}px`)}if(function platform_o(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}()){let n=window.pageYOffset;t(o,"position","fixed"),t(o,"marginTop",`-${n}px`),t(o,"width","100%"),r.add((()=>window.scrollTo(0,n)))}return r.dispose}),[l,e])}function ve(l,e){return(0,match.E)(e.type,Ae,l,e)}dialog_M.displayName="DialogContext";let Ce=render.AN.RenderStrategy|render.AN.Static,Se=(0,render.yV)((function(e,r){let{open:t,onClose:o,initialFocus:a,__demoMode:s=!1,...p}=e,[n,d]=(0,react.useState)(0),m=(0,open_closed.oJ)();void 0===t&&null!==m&&(t=(0,match.E)(m,{[open_closed.ZM.Open]:!0,[open_closed.ZM.Closed]:!1}));let i=(0,react.useRef)(new Set),T=(0,react.useRef)(null),K=(0,use_sync_refs.T)(T,r),W=(0,react.useRef)(null),P=(0,use_owner.i)(T),B=e.hasOwnProperty("open")||null!==m,G=e.hasOwnProperty("onClose");if(!B&&!G)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!B)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!G)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof t)throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${t}`);if("function"!=typeof o)throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o}`);let u=t?0:1,[y,q]=(0,react.useReducer)(ve,{titleId:null,descriptionId:null,panelRef:(0,react.createRef)()}),h=(0,use_event.z)((()=>o(!1))),U=(0,use_event.z)((f=>q({type:0,id:f}))),_=!!(0,use_server_handoff_complete.H)()&&(!s&&0===u),w=n>1,z=null!==(0,react.useContext)(dialog_M),J=w?"parent":"leaf";M(T,!!w&&_),(0,use_outside_click.O)((()=>{var R,g;return[...Array.from(null!=(R=null==P?void 0:P.querySelectorAll("body > *, [data-headlessui-portal]"))?R:[]).filter((D=>!(!(D instanceof HTMLElement)||D.contains(W.current)||y.panelRef.current&&D.contains(y.panelRef.current)))),null!=(g=y.panelRef.current)?g:T.current]}),h,_&&!w),(0,use_event_listener.O)(null==P?void 0:P.defaultView,"keydown",(f=>{f.defaultPrevented||f.key===keyboard.R.Escape&&0===u&&(w||(f.preventDefault(),f.stopPropagation(),h()))})),Ee(P,0===u&&!z),(0,react.useEffect)((()=>{if(0!==u||!T.current)return;let f=new IntersectionObserver((R=>{for(let g of R)0===g.boundingClientRect.x&&0===g.boundingClientRect.y&&0===g.boundingClientRect.width&&0===g.boundingClientRect.height&&h()}));return f.observe(T.current),()=>f.disconnect()}),[u,T,h]);let[Q,X]=(0,description.f)(),Z=`headlessui-dialog-${(0,use_id.M)()}`,ee=(0,react.useMemo)((()=>[{dialogState:u,close:h,setTitleId:U},y]),[u,y,h,U]),$=(0,react.useMemo)((()=>({open:0===u})),[u]),te={ref:K,id:Z,role:"dialog","aria-modal":0===u||void 0,"aria-labelledby":y.titleId,"aria-describedby":Q};return react.createElement(stack_context_M,{type:"Dialog",enabled:0===u,element:T,onUpdate:(0,use_event.z)(((f,R,g)=>{"Dialog"===R&&(0,match.E)(f,{[stack_context_s.Add](){i.current.add(g),d((D=>D+1))},[stack_context_s.Remove](){i.current.add(g),d((D=>D-1))}})}))},react.createElement(portal_force_root_P,{force:!0},react.createElement(portal_$,null,react.createElement(dialog_M.Provider,{value:ee},react.createElement(portal_$.Group,{target:T},react.createElement(portal_force_root_P,{force:!1},react.createElement(X,{slot:$,name:"Dialog.Description"},react.createElement(fe,{initialFocus:a,containers:i,features:_?(0,match.E)(J,{parent:fe.features.RestoreFocus,leaf:fe.features.All&~fe.features.FocusLock}):fe.features.None},(0,render.sY)({ourProps:te,theirProps:p,slot:$,defaultTag:"div",features:Ce,visible:0===u,name:"Dialog"})))))))),react.createElement(internal_hidden._,{features:internal_hidden.A.Hidden,ref:W}))})),we=(0,render.yV)((function(e,r){let[{dialogState:t,close:o}]=L("Dialog.Overlay"),a=(0,use_sync_refs.T)(r),s=`headlessui-dialog-overlay-${(0,use_id.M)()}`,p=(0,use_event.z)((i=>{if(i.target===i.currentTarget){if((0,bugs.P)(i.currentTarget))return i.preventDefault();i.preventDefault(),i.stopPropagation(),o()}})),n=(0,react.useMemo)((()=>({open:0===t})),[t]);return(0,render.sY)({ourProps:{ref:a,id:s,"aria-hidden":!0,onClick:p},theirProps:e,slot:n,defaultTag:"div",name:"Dialog.Overlay"})})),ke=(0,render.yV)((function(e,r){let[{dialogState:t},o]=L("Dialog.Backdrop"),a=(0,use_sync_refs.T)(r),s=`headlessui-dialog-backdrop-${(0,use_id.M)()}`;(0,react.useEffect)((()=>{if(null===o.panelRef.current)throw new Error("A component is being used, but a component is missing.")}),[o.panelRef]);let p=(0,react.useMemo)((()=>({open:0===t})),[t]);return react.createElement(portal_force_root_P,{force:!0},react.createElement(portal_$,null,(0,render.sY)({ourProps:{ref:a,id:s,"aria-hidden":!0},theirProps:e,slot:p,defaultTag:"div",name:"Dialog.Backdrop"})))})),_e=(0,render.yV)((function(e,r){let[{dialogState:t},o]=L("Dialog.Panel"),a=(0,use_sync_refs.T)(r,o.panelRef),s=`headlessui-dialog-panel-${(0,use_id.M)()}`,p=(0,react.useMemo)((()=>({open:0===t})),[t]),n=(0,use_event.z)((i=>{i.stopPropagation()}));return(0,render.sY)({ourProps:{ref:a,id:s,onClick:n},theirProps:e,slot:p,defaultTag:"div",name:"Dialog.Panel"})})),Ie=(0,render.yV)((function(e,r){let[{dialogState:t,setTitleId:o}]=L("Dialog.Title"),a=`headlessui-dialog-title-${(0,use_id.M)()}`,s=(0,use_sync_refs.T)(r);(0,react.useEffect)((()=>(o(a),()=>o(null))),[a,o]);let p=(0,react.useMemo)((()=>({open:0===t})),[t]);return(0,render.sY)({ourProps:{ref:s,id:a},theirProps:e,slot:p,defaultTag:"h2",name:"Dialog.Title"})})),gt=Object.assign(Se,{Backdrop:ke,Panel:_e,Overlay:we,Title:Ie,Description:description.d})},"./node_modules/@headlessui/react/dist/hooks/use-event-listener.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{O:()=>E});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-latest-value.js");function E(n,e,a,t){let i=(0,_use_latest_value_js__WEBPACK_IMPORTED_MODULE_1__.E)(a);(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{function r(o){i.current(o)}return(n=null!=n?n:window).addEventListener(e,r,t),()=>n.removeEventListener(e,r,t)}),[n,e,t])}},"./node_modules/@headlessui/react/dist/hooks/use-owner.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{i:()=>n});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_utils_owner_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@headlessui/react/dist/utils/owner.js");function n(...e){return(0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)((()=>(0,_utils_owner_js__WEBPACK_IMPORTED_MODULE_1__.r)(...e)),[...e])}},"./node_modules/@headlessui/react/dist/hooks/use-tab-direction.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{N:()=>use_tab_direction_s,l:()=>n});var react=__webpack_require__("./node_modules/react/index.js"),use_latest_value=__webpack_require__("./node_modules/@headlessui/react/dist/hooks/use-latest-value.js");var r,use_tab_direction_s=((r=use_tab_direction_s||{})[r.Forwards=0]="Forwards",r[r.Backwards=1]="Backwards",r);function n(){let e=(0,react.useRef)(0);return function s(e,r,n){let o=(0,use_latest_value.E)(r);(0,react.useEffect)((()=>{function t(i){o.current(i)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)}),[e,n])}("keydown",(o=>{"Tab"===o.key&&(e.current=o.shiftKey?1:0)}),!0),e}},"./src/components/ui/Drawer.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,Loading:()=>Loading,Open:()=>Open,SideLeft:()=>SideLeft,WithALotOfContent:()=>WithALotOfContent,WithFooter:()=>WithFooter,WithTitle:()=>WithTitle,WithTitleAndDescription:()=>WithTitleAndDescription,__namedExportsOrder:()=>__namedExportsOrder,default:()=>Drawer_stories});var react=__webpack_require__("./node_modules/react/index.js"),Drawer=__webpack_require__("./src/components/ui/Drawer.tsx"),Button=__webpack_require__("./src/components/ui/Button.tsx"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),styleDomAPI=__webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js"),styleDomAPI_default=__webpack_require__.n(styleDomAPI),insertBySelector=__webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),setAttributesWithoutAttributes=__webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"),setAttributesWithoutAttributes_default=__webpack_require__.n(setAttributesWithoutAttributes),insertStyleElement=__webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js"),insertStyleElement_default=__webpack_require__.n(insertStyleElement),styleTagTransform=__webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js"),styleTagTransform_default=__webpack_require__.n(styleTagTransform),ui_Drawer=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].use[1]!./src/components/ui/Drawer.css"),options={};options.styleTagTransform=styleTagTransform_default(),options.setAttributes=setAttributesWithoutAttributes_default(),options.insert=insertBySelector_default().bind(null,"head"),options.domAPI=styleDomAPI_default(),options.insertStyleElement=insertStyleElement_default();injectStylesIntoStyleTag_default()(ui_Drawer.Z,options);ui_Drawer.Z&&ui_Drawer.Z.locals&&ui_Drawer.Z.locals;var jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer_stories={title:"UI/Drawer",component:Drawer.Z,argTypes:{title:{control:{type:"text"}},description:{control:{type:"text"}},loading:{control:{type:"boolean"}},open:{control:{type:"boolean"}},className:{control:{type:"text"}},side:{control:{type:"select",options:["left","right"]}}},parameters:{controls:{expanded:!0}}},content=(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)("p",{children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit."}),(0,jsx_runtime.jsx)("h3",{children:"Suspendisse a sodales nulla, sed semper nisi."}),(0,jsx_runtime.jsx)("p",{children:"Proin tincidunt enim in felis aliquet, a ultricies purus bibendum."}),(0,jsx_runtime.jsxs)("ul",{children:[(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."})]}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."}),(0,jsx_runtime.jsx)("h3",{children:"Suspendisse a sodales nulla, sed semper nisi."}),(0,jsx_runtime.jsx)("p",{children:"Proin tincidunt enim in felis aliquet, a ultricies purus bibendum."}),(0,jsx_runtime.jsxs)("ul",{children:[(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."})]}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."}),(0,jsx_runtime.jsx)("h3",{children:"Suspendisse a sodales nulla, sed semper nisi."}),(0,jsx_runtime.jsx)("p",{children:"Proin tincidunt enim in felis aliquet, a ultricies purus bibendum."}),(0,jsx_runtime.jsxs)("ul",{children:[(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."}),(0,jsx_runtime.jsx)("li",{children:"Quisque in ultrices lectus."})]}),(0,jsx_runtime.jsx)("p",{children:"Nulla at urna diam."})]}),footer=(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)(Button.Z,{primary:!0,children:"OK"}),(0,jsx_runtime.jsx)(Button.Z,{children:"Cancel"})]}),Template=args=>{const[isOpen,setIsOpen]=react.useState(!!args.open||!1);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)(Button.Z,{onClick:()=>setIsOpen(!0),children:"Click me"}),(0,jsx_runtime.jsx)(Drawer.Z,{...args,open:isOpen,onClose:()=>setIsOpen(!1),footer:args.footer,children:content})]})},Default=Template.bind({});Default.args={open:!1};const Open=Template.bind({});Open.args={open:!0};const WithTitle=Template.bind({});WithTitle.args={open:!0,title:"Drawer Title"};const WithTitleAndDescription=Template.bind({});WithTitleAndDescription.args={open:!0,title:"Drawer Title",description:"Drawer Description"};const Loading=Template.bind({});Loading.args={open:!0,title:"Drawer Title",description:"Drawer Description",loading:!0};const WithFooter=Template.bind({});WithFooter.args={open:!0,title:"Drawer Title",description:"Drawer Description",footer};const SideLeft=Template.bind({});SideLeft.args={open:!0,side:"left"};const WithALotOfContent=(args=>{const[isOpen,setIsOpen]=react.useState(!!args.open||!1);return(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[(0,jsx_runtime.jsx)(Button.Z,{onClick:()=>setIsOpen(!0),children:"Click me"}),(0,jsx_runtime.jsxs)(Drawer.Z,{...args,open:isOpen,onClose:()=>setIsOpen(!1),footer:args.footer,children:[content,content,content,content,content]})]})}).bind({});WithALotOfContent.args={open:!0,title:"Drawer Title",description:"Drawer Description",footer},Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...Default.parameters?.docs?.source}}},Open.parameters={...Open.parameters,docs:{...Open.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...Open.parameters?.docs?.source}}},WithTitle.parameters={...WithTitle.parameters,docs:{...WithTitle.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...WithTitle.parameters?.docs?.source}}},WithTitleAndDescription.parameters={...WithTitleAndDescription.parameters,docs:{...WithTitleAndDescription.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...WithTitleAndDescription.parameters?.docs?.source}}},Loading.parameters={...Loading.parameters,docs:{...Loading.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...Loading.parameters?.docs?.source}}},WithFooter.parameters={...WithFooter.parameters,docs:{...WithFooter.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...WithFooter.parameters?.docs?.source}}},SideLeft.parameters={...SideLeft.parameters,docs:{...SideLeft.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n \n ;\n}",...SideLeft.parameters?.docs?.source}}},WithALotOfContent.parameters={...WithALotOfContent.parameters,docs:{...WithALotOfContent.parameters?.docs,source:{originalSource:"args => {\n const [isOpen, setIsOpen] = React.useState(!!args.open || false);\n return <>\n \n setIsOpen(false)} footer={args.footer}>\n {content}\n {content}\n {content}\n {content}\n {content}\n \n ;\n}",...WithALotOfContent.parameters?.docs?.source}}};const __namedExportsOrder=["Default","Open","WithTitle","WithTitleAndDescription","Loading","WithFooter","SideLeft","WithALotOfContent"]},"./src/components/icons/Close.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Close=({className,title})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className,"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)("path",{d:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Close.displayName="Close";const __WEBPACK_DEFAULT_EXPORT__=Close;try{Close.displayName="Close",Close.__docgenInfo={description:"",displayName:"Close",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Close.tsx#Close"]={docgenInfo:Close.__docgenInfo,name:"Close",path:"src/components/icons/Close.tsx#Close"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/icons/Loading.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Loading=({className,title,loading=!0})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("svg",{...title?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:classnames__WEBPACK_IMPORTED_MODULE_1___default()(className,{"memori-loading-icon":loading}),"aria-label":title,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});Loading.displayName="Loading";const __WEBPACK_DEFAULT_EXPORT__=Loading;try{Loading.displayName="Loading",Loading.__docgenInfo={description:"",displayName:"Loading",props:{className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},loading:{defaultValue:{value:"true"},description:"",name:"loading",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/icons/Loading.tsx#Loading"]={docgenInfo:Loading.__docgenInfo,name:"Loading",path:"src/components/icons/Loading.tsx#Loading"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Button.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Button=({primary=!1,outlined=!1,ghost=!1,padded=!0,shape="rounded",danger=!1,loading=!1,disabled=!1,block=!1,icon,className,title,id,htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button",{id,type:htmlType,onClick,onMouseDown,onMouseUp,onMouseLeave,onTouchStart,onTouchEnd,title,disabled:loading||disabled,className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-button",{"memori-button--primary":primary,"memori-button--outlined":outlined,"memori-button--ghost":ghost,"memori-button--square":"square"===shape,"memori-button--rounded":"rounded"===shape,"memori-button--circle":"circle"===shape,"memori-button--padded":padded,"memori-button--block":block,"memori-button--with-icon":(icon||loading)&&children,"memori-button--icon-only":(icon||loading)&&!children,"memori-button--danger":danger,"memori-button--loading":loading},className),children:[icon&&!loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon",children:icon}),loading&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})}),children]});Button.displayName="Button";const __WEBPACK_DEFAULT_EXPORT__=Button;try{Button.displayName="Button",Button.__docgenInfo={description:"",displayName:"Button",props:{primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}},outlined:{defaultValue:{value:"false"},description:"",name:"outlined",required:!1,type:{name:"boolean"}},ghost:{defaultValue:{value:"false"},description:"",name:"ghost",required:!1,type:{name:"boolean"}},padded:{defaultValue:{value:"true"},description:"",name:"padded",required:!1,type:{name:"boolean"}},block:{defaultValue:{value:"false"},description:"",name:"block",required:!1,type:{name:"boolean"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},shape:{defaultValue:{value:"rounded"},description:"",name:"shape",required:!1,type:{name:"enum",value:[{value:'"square"'},{value:'"rounded"'},{value:'"circle"'}]}},danger:{defaultValue:{value:"false"},description:"",name:"danger",required:!1,type:{name:"boolean"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"string"}},id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"string"}},htmlType:{defaultValue:null,description:"",name:"htmlType",required:!1,type:{name:"enum",value:[{value:'"button"'},{value:'"submit"'},{value:'"reset"'}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseDown:{defaultValue:null,description:"",name:"onMouseDown",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseUp:{defaultValue:null,description:"",name:"onMouseUp",required:!1,type:{name:"((event: MouseEvent) => void)"}},onMouseLeave:{defaultValue:null,description:"",name:"onMouseLeave",required:!1,type:{name:"((event: MouseEvent) => void)"}},onTouchStart:{defaultValue:null,description:"",name:"onTouchStart",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}},onTouchEnd:{defaultValue:null,description:"",name:"onTouchEnd",required:!1,type:{name:"((event: TouchEvent | MouseEvent) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Button.tsx#Button"]={docgenInfo:Button.__docgenInfo,name:"Button",path:"src/components/ui/Button.tsx#Button"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Drawer.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./node_modules/@headlessui/react/dist/components/transitions/transition.js"),_headlessui_react__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./node_modules/@headlessui/react/dist/components/dialog/dialog.js"),_Spin__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./src/components/ui/Spin.tsx"),_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/ui/Button.tsx"),_icons_Close__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./src/components/icons/Close.tsx"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Drawer=({open=!1,onClose,className,title,description,children,footer,loading=!1,animated=!0,side="right",closable=!0,width="100%",widthMd="80%",widthLg="60%"})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u,{appear:!0,show:open,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V,{open,onClose,className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer",className),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_6__.u.Child,{static:!0,as:react__WEBPACK_IMPORTED_MODULE_0__.Fragment,enter:"ease-out duration-300",enterFrom:animated?"max-w-0 opacity-0":"opacity-0",enterTo:"max-w-80 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-80 opacity-100",leaveTo:animated?"max-w-0 opacity-0":"opacity-0",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Panel,{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("memori-drawer--panel",{"memori-drawer--panel-left":"left"===side,"memori-drawer--with-footer":!!footer}),children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${width};\n --memori-drawer--width-lg: ${widthLg};\n --memori-drawer--width-md: ${widthMd};\n }\n `}}),closable&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--close",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Button__WEBPACK_IMPORTED_MODULE_2__.Z,{shape:"circle",outlined:!0,icon:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_icons_Close__WEBPACK_IMPORTED_MODULE_3__.default,{}),onClick:()=>onClose(!1)})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Spin__WEBPACK_IMPORTED_MODULE_1__.Z,{spinning:loading,children:[title&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Title,{className:"memori-drawer--title",children:title}),description&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_headlessui_react__WEBPACK_IMPORTED_MODULE_7__.V.Description,{className:"memori-drawer--description",children:description}),children,footer&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div",{className:"memori-drawer--footer",children:footer})]})]})})})})]})});Drawer.displayName="Drawer";const __WEBPACK_DEFAULT_EXPORT__=Drawer;try{Drawer.displayName="Drawer",Drawer.__docgenInfo={description:"",displayName:"Drawer",props:{open:{defaultValue:{value:"false"},description:"",name:"open",required:!1,type:{name:"boolean"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!0,type:{name:"(value: boolean) => void"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},title:{defaultValue:null,description:"",name:"title",required:!1,type:{name:"Element | ReactNode"}},description:{defaultValue:null,description:"",name:"description",required:!1,type:{name:"Element | ReactNode"}},footer:{defaultValue:null,description:"",name:"footer",required:!1,type:{name:"Element | ReactNode"}},loading:{defaultValue:{value:"false"},description:"",name:"loading",required:!1,type:{name:"boolean"}},animated:{defaultValue:{value:"true"},description:"",name:"animated",required:!1,type:{name:"boolean"}},closable:{defaultValue:{value:"true"},description:"",name:"closable",required:!1,type:{name:"boolean"}},side:{defaultValue:{value:"right"},description:"",name:"side",required:!1,type:{name:"enum",value:[{value:'"left"'},{value:'"right"'}]}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string"}},widthMd:{defaultValue:{value:"80%"},description:"",name:"widthMd",required:!1,type:{name:"string"}},widthLg:{defaultValue:{value:"60%"},description:"",name:"widthLg",required:!1,type:{name:"string"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Drawer.tsx#Drawer"]={docgenInfo:Drawer.__docgenInfo,name:"Drawer",path:"src/components/ui/Drawer.tsx#Drawer"})}catch(__react_docgen_typescript_loader_error){}},"./src/components/ui/Spin.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/react/index.js");var classnames__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__),_icons_Loading__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./src/components/icons/Loading.tsx"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/react/jsx-runtime.js");const Spin=({spinning=!1,primary=!1,className,children})=>(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_1___default()("memori-spin",className,{"memori-spin--spinning":spinning,"memori-spin--primary":primary}),children:[children,(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div",{className:"memori-spin--spinner",children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_icons_Loading__WEBPACK_IMPORTED_MODULE_2__.default,{loading:!0})})]});Spin.displayName="Spin";const __WEBPACK_DEFAULT_EXPORT__=Spin;try{Spin.displayName="Spin",Spin.__docgenInfo={description:"",displayName:"Spin",props:{spinning:{defaultValue:{value:"false"},description:"",name:"spinning",required:!1,type:{name:"boolean"}},className:{defaultValue:null,description:"",name:"className",required:!1,type:{name:"string"}},primary:{defaultValue:{value:"false"},description:"",name:"primary",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["src/components/ui/Spin.tsx#Spin"]={docgenInfo:Spin.__docgenInfo,name:"Spin",path:"src/components/ui/Spin.tsx#Spin"})}catch(__react_docgen_typescript_loader_error){}},"./node_modules/react/cjs/react-jsx-runtime.production.min.js":(__unused_webpack_module,exports,__webpack_require__)=>{var f=__webpack_require__("./node_modules/react/index.js"),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function q(c,a,g){var b,d={},e=null,h=null;for(b in void 0!==g&&(e=""+g),void 0!==a.key&&(e=""+a.key),void 0!==a.ref&&(h=a.ref),a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l,exports.jsx=q,exports.jsxs=q},"./node_modules/react/jsx-runtime.js":(module,__unused_webpack_exports,__webpack_require__)=>{module.exports=__webpack_require__("./node_modules/react/cjs/react-jsx-runtime.production.min.js")}}]); \ No newline at end of file diff --git a/components-ui-Drawer-stories.0d7b5edb.iframe.bundle.js.LICENSE.txt b/components-ui-Drawer-stories.27a50333.iframe.bundle.js.LICENSE.txt similarity index 100% rename from components-ui-Drawer-stories.0d7b5edb.iframe.bundle.js.LICENSE.txt rename to components-ui-Drawer-stories.27a50333.iframe.bundle.js.LICENSE.txt diff --git a/iframe.html b/iframe.html index 07c8c5e7..f45c19f4 100644 --- a/iframe.html +++ b/iframe.html @@ -348,7 +348,7 @@ window['DOCS_OPTIONS'] = {"defaultName":"Docs","autodocs":true};