commit 1395669d677cad20a5f9ce4a84d0619b60505b60 Author: val966 Date: Mon May 18 15:01:11 2026 +0200 add comms diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3dcaf1c --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +node_modules/ +/out +/build +build/ +/.gradle +/logs +/.idea + +save_flow.xml +*.iml + +.env +.env.* +!.env.example + +.DS_Store +Thumbs.db + +# Python virtual environment +**/.venv/ +**/venv/ + +# Python cache +**/__pycache__/ +*.py[cod] +*.pyo +*.pyd diff --git a/README.md b/README.md new file mode 100644 index 0000000..f7cabbb --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +### Projekt obsahuje Furhat skill určený na podporu vybraných kognitívnych funkcií používateľa. + +## Obsah projektu + +- `src/main/kotlin` – hlavná implementácia Furhat skillu +- `src/main/resources` – zdroje používané skillom +- `src/main/realtime` – proxy modul pre komunikáciu s OpenAI Realtime API +- `assets` – doplnkové súbory aplikácie, ak sa používajú +- `skill.properties` – konfiguračný súbor Furhat skillu + +## Spustenie skillu + +1. Otvoriť projekt v IntelliJ IDEA. +2. Skontrolovať konfiguráciu Furhat SDK. +3. Spustiť skill cez Gradle alebo cez Run konfiguráciu. + +## Spustenie proxy modulu + +1. Vytvoriť `.env` podľa súboru `.env.example`. +2. Nainštalovať potrebné Python balíky. +3. Spustiť FastAPI server. + +## Poznámka + +Súbory s logmi a súkromné konfiguračné údaje nie sú súčasťou repozitára. \ No newline at end of file diff --git a/assets/webTemplates/BASIC/css/bootstrap.min.css b/assets/webTemplates/BASIC/css/bootstrap.min.css new file mode 100644 index 0000000..ad65b4e --- /dev/null +++ b/assets/webTemplates/BASIC/css/bootstrap.min.css @@ -0,0 +1,7 @@ +/*! + * Bootstrap v4.0.0-beta.2 (https://getbootstrap.com) + * Copyright 2011-2017 The Bootstrap Authors + * Copyright 2011-2017 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#868e96;--gray-dark:#343a40;--primary:#007bff;--secondary:#868e96;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--font-family-monospace:"SFMono-Regular",Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}@media print{*,::after,::before{text-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}abbr[title]::after{content:" (" attr(title) ")"}pre{white-space:pre-wrap!important}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.badge{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}@-ms-viewport{width:device-width}article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg:not(:root){overflow:hidden}[role=button],a,area,button,input:not([type=range]),label,select,summary,textarea{-ms-touch-action:manipulation;touch-action:manipulation}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#868e96;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item}template{display:none}[hidden]{display:none!important}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.5rem;font-family:inherit;font-weight:500;line-height:1.2;color:inherit}.h1,h1{font-size:2.5rem}.h2,h2{font-size:2rem}.h3,h3{font-size:1.75rem}.h4,h4{font-size:1.5rem}.h5,h5{font-size:1.25rem}.h6,h6{font-size:1rem}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:6rem;font-weight:300;line-height:1.2}.display-2{font-size:5.5rem;font-weight:300;line-height:1.2}.display-3{font-size:4.5rem;font-weight:300;line-height:1.2}.display-4{font-size:3.5rem;font-weight:300;line-height:1.2}hr{margin-top:1rem;margin-bottom:1rem;border:0;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:400}.mark,mark{padding:.2em;background-color:#fcf8e3}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline-item{display:inline-block}.list-inline-item:not(:last-child){margin-right:5px}.initialism{font-size:90%;text-transform:uppercase}.blockquote{margin-bottom:1rem;font-size:1.25rem}.blockquote-footer{display:block;font-size:80%;color:#868e96}.blockquote-footer::before{content:"\2014 \00A0"}.img-fluid{max-width:100%;height:auto}.img-thumbnail{padding:.25rem;background-color:#fff;border:1px solid #ddd;border-radius:.25rem;transition:all .2s ease-in-out;max-width:100%;height:auto}.figure{display:inline-block}.figure-img{margin-bottom:.5rem;line-height:1}.figure-caption{font-size:90%;color:#868e96}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}code{padding:.2rem .4rem;font-size:90%;color:#bd4147;background-color:#f8f9fa;border-radius:.25rem}a>code{padding:0;color:inherit;background-color:inherit}kbd{padding:.2rem .4rem;font-size:90%;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:100%;font-weight:700}pre{display:block;margin-top:0;margin-bottom:1rem;font-size:90%;color:#212529}pre code{padding:0;font-size:inherit;color:inherit;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}}@media (min-width:992px){.container{max-width:960px}}@media (min-width:1200px){.container{max-width:1140px}}.container-fluid{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.no-gutters{margin-right:0;margin-left:0}.no-gutters>.col,.no-gutters>[class*=col-]{padding-right:0;padding-left:0}.col,.col-1,.col-10,.col-11,.col-12,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-auto,.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-auto,.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-auto,.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-auto,.col-xl,.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-auto{position:relative;width:100%;min-height:1px;padding-right:15px;padding-left:15px}.col{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-first{-ms-flex-order:-1;order:-1}.order-1{-ms-flex-order:1;order:1}.order-2{-ms-flex-order:2;order:2}.order-3{-ms-flex-order:3;order:3}.order-4{-ms-flex-order:4;order:4}.order-5{-ms-flex-order:5;order:5}.order-6{-ms-flex-order:6;order:6}.order-7{-ms-flex-order:7;order:7}.order-8{-ms-flex-order:8;order:8}.order-9{-ms-flex-order:9;order:9}.order-10{-ms-flex-order:10;order:10}.order-11{-ms-flex-order:11;order:11}.order-12{-ms-flex-order:12;order:12}.offset-1{margin-left:8.333333%}.offset-2{margin-left:16.666667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.333333%}.offset-5{margin-left:41.666667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.333333%}.offset-8{margin-left:66.666667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.333333%}.offset-11{margin-left:91.666667%}@media (min-width:576px){.col-sm{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-sm-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-sm-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-sm-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-sm-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-sm-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-sm-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-sm-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-sm-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-sm-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-sm-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-sm-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-sm-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-sm-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-sm-first{-ms-flex-order:-1;order:-1}.order-sm-1{-ms-flex-order:1;order:1}.order-sm-2{-ms-flex-order:2;order:2}.order-sm-3{-ms-flex-order:3;order:3}.order-sm-4{-ms-flex-order:4;order:4}.order-sm-5{-ms-flex-order:5;order:5}.order-sm-6{-ms-flex-order:6;order:6}.order-sm-7{-ms-flex-order:7;order:7}.order-sm-8{-ms-flex-order:8;order:8}.order-sm-9{-ms-flex-order:9;order:9}.order-sm-10{-ms-flex-order:10;order:10}.order-sm-11{-ms-flex-order:11;order:11}.order-sm-12{-ms-flex-order:12;order:12}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.333333%}.offset-sm-2{margin-left:16.666667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.333333%}.offset-sm-5{margin-left:41.666667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.333333%}.offset-sm-8{margin-left:66.666667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.333333%}.offset-sm-11{margin-left:91.666667%}}@media (min-width:768px){.col-md{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-md-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-md-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-md-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-md-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-md-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-md-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-md-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-md-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-md-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-md-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-md-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-md-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-md-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-md-first{-ms-flex-order:-1;order:-1}.order-md-1{-ms-flex-order:1;order:1}.order-md-2{-ms-flex-order:2;order:2}.order-md-3{-ms-flex-order:3;order:3}.order-md-4{-ms-flex-order:4;order:4}.order-md-5{-ms-flex-order:5;order:5}.order-md-6{-ms-flex-order:6;order:6}.order-md-7{-ms-flex-order:7;order:7}.order-md-8{-ms-flex-order:8;order:8}.order-md-9{-ms-flex-order:9;order:9}.order-md-10{-ms-flex-order:10;order:10}.order-md-11{-ms-flex-order:11;order:11}.order-md-12{-ms-flex-order:12;order:12}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.333333%}.offset-md-2{margin-left:16.666667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.333333%}.offset-md-5{margin-left:41.666667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.333333%}.offset-md-8{margin-left:66.666667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.333333%}.offset-md-11{margin-left:91.666667%}}@media (min-width:992px){.col-lg{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-lg-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-lg-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-lg-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-lg-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-lg-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-lg-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-lg-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-lg-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-lg-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-lg-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-lg-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-lg-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-lg-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-lg-first{-ms-flex-order:-1;order:-1}.order-lg-1{-ms-flex-order:1;order:1}.order-lg-2{-ms-flex-order:2;order:2}.order-lg-3{-ms-flex-order:3;order:3}.order-lg-4{-ms-flex-order:4;order:4}.order-lg-5{-ms-flex-order:5;order:5}.order-lg-6{-ms-flex-order:6;order:6}.order-lg-7{-ms-flex-order:7;order:7}.order-lg-8{-ms-flex-order:8;order:8}.order-lg-9{-ms-flex-order:9;order:9}.order-lg-10{-ms-flex-order:10;order:10}.order-lg-11{-ms-flex-order:11;order:11}.order-lg-12{-ms-flex-order:12;order:12}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.333333%}.offset-lg-2{margin-left:16.666667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.333333%}.offset-lg-5{margin-left:41.666667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.333333%}.offset-lg-8{margin-left:66.666667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.333333%}.offset-lg-11{margin-left:91.666667%}}@media (min-width:1200px){.col-xl{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-xl-auto{-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-xl-1{-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-xl-2{-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-xl-3{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-xl-4{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-xl-5{-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-xl-6{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-xl-7{-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-xl-8{-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-xl-9{-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-xl-10{-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-xl-11{-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-xl-12{-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-xl-first{-ms-flex-order:-1;order:-1}.order-xl-1{-ms-flex-order:1;order:1}.order-xl-2{-ms-flex-order:2;order:2}.order-xl-3{-ms-flex-order:3;order:3}.order-xl-4{-ms-flex-order:4;order:4}.order-xl-5{-ms-flex-order:5;order:5}.order-xl-6{-ms-flex-order:6;order:6}.order-xl-7{-ms-flex-order:7;order:7}.order-xl-8{-ms-flex-order:8;order:8}.order-xl-9{-ms-flex-order:9;order:9}.order-xl-10{-ms-flex-order:10;order:10}.order-xl-11{-ms-flex-order:11;order:11}.order-xl-12{-ms-flex-order:12;order:12}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.333333%}.offset-xl-2{margin-left:16.666667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.333333%}.offset-xl-5{margin-left:41.666667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.333333%}.offset-xl-8{margin-left:66.666667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.333333%}.offset-xl-11{margin-left:91.666667%}}.table{width:100%;max-width:100%;margin-bottom:1rem;background-color:transparent}.table td,.table th{padding:.75rem;vertical-align:top;border-top:1px solid #e9ecef}.table thead th{vertical-align:bottom;border-bottom:2px solid #e9ecef}.table tbody+tbody{border-top:2px solid #e9ecef}.table .table{background-color:#fff}.table-sm td,.table-sm th{padding:.3rem}.table-bordered{border:1px solid #e9ecef}.table-bordered td,.table-bordered th{border:1px solid #e9ecef}.table-bordered thead td,.table-bordered thead th{border-bottom-width:2px}.table-striped tbody tr:nth-of-type(odd){background-color:rgba(0,0,0,.05)}.table-hover tbody tr:hover{background-color:rgba(0,0,0,.075)}.table-primary,.table-primary>td,.table-primary>th{background-color:#b8daff}.table-hover .table-primary:hover{background-color:#9fcdff}.table-hover .table-primary:hover>td,.table-hover .table-primary:hover>th{background-color:#9fcdff}.table-secondary,.table-secondary>td,.table-secondary>th{background-color:#dddfe2}.table-hover .table-secondary:hover{background-color:#cfd2d6}.table-hover .table-secondary:hover>td,.table-hover .table-secondary:hover>th{background-color:#cfd2d6}.table-success,.table-success>td,.table-success>th{background-color:#c3e6cb}.table-hover .table-success:hover{background-color:#b1dfbb}.table-hover .table-success:hover>td,.table-hover .table-success:hover>th{background-color:#b1dfbb}.table-info,.table-info>td,.table-info>th{background-color:#bee5eb}.table-hover .table-info:hover{background-color:#abdde5}.table-hover .table-info:hover>td,.table-hover .table-info:hover>th{background-color:#abdde5}.table-warning,.table-warning>td,.table-warning>th{background-color:#ffeeba}.table-hover .table-warning:hover{background-color:#ffe8a1}.table-hover .table-warning:hover>td,.table-hover .table-warning:hover>th{background-color:#ffe8a1}.table-danger,.table-danger>td,.table-danger>th{background-color:#f5c6cb}.table-hover .table-danger:hover{background-color:#f1b0b7}.table-hover .table-danger:hover>td,.table-hover .table-danger:hover>th{background-color:#f1b0b7}.table-light,.table-light>td,.table-light>th{background-color:#fdfdfe}.table-hover .table-light:hover{background-color:#ececf6}.table-hover .table-light:hover>td,.table-hover .table-light:hover>th{background-color:#ececf6}.table-dark,.table-dark>td,.table-dark>th{background-color:#c6c8ca}.table-hover .table-dark:hover{background-color:#b9bbbe}.table-hover .table-dark:hover>td,.table-hover .table-dark:hover>th{background-color:#b9bbbe}.table-active,.table-active>td,.table-active>th{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover{background-color:rgba(0,0,0,.075)}.table-hover .table-active:hover>td,.table-hover .table-active:hover>th{background-color:rgba(0,0,0,.075)}.table .thead-dark th{color:#fff;background-color:#212529;border-color:#32383e}.table .thead-light th{color:#495057;background-color:#e9ecef;border-color:#e9ecef}.table-dark{color:#fff;background-color:#212529}.table-dark td,.table-dark th,.table-dark thead th{border-color:#32383e}.table-dark.table-bordered{border:0}.table-dark.table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.05)}.table-dark.table-hover tbody tr:hover{background-color:rgba(255,255,255,.075)}@media (max-width:575px){.table-responsive-sm{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-sm.table-bordered{border:0}}@media (max-width:767px){.table-responsive-md{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-md.table-bordered{border:0}}@media (max-width:991px){.table-responsive-lg{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-lg.table-bordered{border:0}}@media (max-width:1199px){.table-responsive-xl{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive-xl.table-bordered{border:0}}.table-responsive{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar}.table-responsive.table-bordered{border:0}.form-control{display:block;width:100%;padding:.375rem .75rem;font-size:1rem;line-height:1.5;color:#495057;background-color:#fff;background-image:none;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control::-ms-expand{background-color:transparent;border:0}.form-control:focus{color:#495057;background-color:#fff;border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.form-control::-webkit-input-placeholder{color:#868e96;opacity:1}.form-control:-ms-input-placeholder{color:#868e96;opacity:1}.form-control::-ms-input-placeholder{color:#868e96;opacity:1}.form-control::placeholder{color:#868e96;opacity:1}.form-control:disabled,.form-control[readonly]{background-color:#e9ecef;opacity:1}select.form-control:not([size]):not([multiple]){height:calc(2.25rem + 2px)}select.form-control:focus::-ms-value{color:#495057;background-color:#fff}.form-control-file,.form-control-range{display:block}.col-form-label{padding-top:calc(.375rem + 1px);padding-bottom:calc(.375rem + 1px);margin-bottom:0;line-height:1.5}.col-form-label-lg{padding-top:calc(.5rem + 1px);padding-bottom:calc(.5rem + 1px);font-size:1.25rem;line-height:1.5}.col-form-label-sm{padding-top:calc(.25rem + 1px);padding-bottom:calc(.25rem + 1px);font-size:.875rem;line-height:1.5}.col-form-legend{padding-top:.375rem;padding-bottom:.375rem;margin-bottom:0;font-size:1rem}.form-control-plaintext{padding-top:.375rem;padding-bottom:.375rem;margin-bottom:0;line-height:1.5;background-color:transparent;border:solid transparent;border-width:1px 0}.form-control-plaintext.form-control-lg,.form-control-plaintext.form-control-sm,.input-group-lg>.form-control-plaintext.form-control,.input-group-lg>.form-control-plaintext.input-group-addon,.input-group-lg>.input-group-btn>.form-control-plaintext.btn,.input-group-sm>.form-control-plaintext.form-control,.input-group-sm>.form-control-plaintext.input-group-addon,.input-group-sm>.input-group-btn>.form-control-plaintext.btn{padding-right:0;padding-left:0}.form-control-sm,.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.input-group-sm>.input-group-btn>select.btn:not([size]):not([multiple]),.input-group-sm>select.form-control:not([size]):not([multiple]),.input-group-sm>select.input-group-addon:not([size]):not([multiple]),select.form-control-sm:not([size]):not([multiple]){height:calc(1.8125rem + 2px)}.form-control-lg,.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.input-group-lg>.input-group-btn>select.btn:not([size]):not([multiple]),.input-group-lg>select.form-control:not([size]):not([multiple]),.input-group-lg>select.input-group-addon:not([size]):not([multiple]),select.form-control-lg:not([size]):not([multiple]){height:calc(2.875rem + 2px)}.form-group{margin-bottom:1rem}.form-text{display:block;margin-top:.25rem}.form-row{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-5px;margin-left:-5px}.form-row>.col,.form-row>[class*=col-]{padding-right:5px;padding-left:5px}.form-check{position:relative;display:block;margin-bottom:.5rem}.form-check.disabled .form-check-label{color:#868e96}.form-check-label{padding-left:1.25rem;margin-bottom:0}.form-check-input{position:absolute;margin-top:.25rem;margin-left:-1.25rem}.form-check-inline{display:inline-block;margin-right:.75rem}.form-check-inline .form-check-label{vertical-align:middle}.valid-feedback{display:none;margin-top:.25rem;font-size:.875rem;color:#28a745}.valid-tooltip{position:absolute;top:100%;z-index:5;display:none;width:250px;padding:.5rem;margin-top:.1rem;font-size:.875rem;line-height:1;color:#fff;background-color:rgba(40,167,69,.8);border-radius:.2rem}.custom-select.is-valid,.form-control.is-valid,.was-validated .custom-select:valid,.was-validated .form-control:valid{border-color:#28a745}.custom-select.is-valid:focus,.form-control.is-valid:focus,.was-validated .custom-select:valid:focus,.was-validated .form-control:valid:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.custom-select.is-valid~.valid-feedback,.custom-select.is-valid~.valid-tooltip,.form-control.is-valid~.valid-feedback,.form-control.is-valid~.valid-tooltip,.was-validated .custom-select:valid~.valid-feedback,.was-validated .custom-select:valid~.valid-tooltip,.was-validated .form-control:valid~.valid-feedback,.was-validated .form-control:valid~.valid-tooltip{display:block}.form-check-input.is-valid+.form-check-label,.was-validated .form-check-input:valid+.form-check-label{color:#28a745}.custom-control-input.is-valid~.custom-control-indicator,.was-validated .custom-control-input:valid~.custom-control-indicator{background-color:rgba(40,167,69,.25)}.custom-control-input.is-valid~.custom-control-description,.was-validated .custom-control-input:valid~.custom-control-description{color:#28a745}.custom-file-input.is-valid~.custom-file-control,.was-validated .custom-file-input:valid~.custom-file-control{border-color:#28a745}.custom-file-input.is-valid~.custom-file-control::before,.was-validated .custom-file-input:valid~.custom-file-control::before{border-color:inherit}.custom-file-input.is-valid:focus,.was-validated .custom-file-input:valid:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.invalid-feedback{display:none;margin-top:.25rem;font-size:.875rem;color:#dc3545}.invalid-tooltip{position:absolute;top:100%;z-index:5;display:none;width:250px;padding:.5rem;margin-top:.1rem;font-size:.875rem;line-height:1;color:#fff;background-color:rgba(220,53,69,.8);border-radius:.2rem}.custom-select.is-invalid,.form-control.is-invalid,.was-validated .custom-select:invalid,.was-validated .form-control:invalid{border-color:#dc3545}.custom-select.is-invalid:focus,.form-control.is-invalid:focus,.was-validated .custom-select:invalid:focus,.was-validated .form-control:invalid:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.custom-select.is-invalid~.invalid-feedback,.custom-select.is-invalid~.invalid-tooltip,.form-control.is-invalid~.invalid-feedback,.form-control.is-invalid~.invalid-tooltip,.was-validated .custom-select:invalid~.invalid-feedback,.was-validated .custom-select:invalid~.invalid-tooltip,.was-validated .form-control:invalid~.invalid-feedback,.was-validated .form-control:invalid~.invalid-tooltip{display:block}.form-check-input.is-invalid+.form-check-label,.was-validated .form-check-input:invalid+.form-check-label{color:#dc3545}.custom-control-input.is-invalid~.custom-control-indicator,.was-validated .custom-control-input:invalid~.custom-control-indicator{background-color:rgba(220,53,69,.25)}.custom-control-input.is-invalid~.custom-control-description,.was-validated .custom-control-input:invalid~.custom-control-description{color:#dc3545}.custom-file-input.is-invalid~.custom-file-control,.was-validated .custom-file-input:invalid~.custom-file-control{border-color:#dc3545}.custom-file-input.is-invalid~.custom-file-control::before,.was-validated .custom-file-input:invalid~.custom-file-control::before{border-color:inherit}.custom-file-input.is-invalid:focus,.was-validated .custom-file-input:invalid:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.form-inline{display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap;-ms-flex-align:center;align-items:center}.form-inline .form-check{width:100%}@media (min-width:576px){.form-inline label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;margin-bottom:0}.form-inline .form-group{display:-ms-flexbox;display:flex;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-flow:row wrap;flex-flow:row wrap;-ms-flex-align:center;align-items:center;margin-bottom:0}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-plaintext{display:inline-block}.form-inline .input-group{width:auto}.form-inline .form-check{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:auto;margin-top:0;margin-bottom:0}.form-inline .form-check-label{padding-left:0}.form-inline .form-check-input{position:relative;margin-top:0;margin-right:.25rem;margin-left:0}.form-inline .custom-control{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-left:0}.form-inline .custom-control-indicator{position:static;display:inline-block;margin-right:.25rem;vertical-align:text-bottom}.form-inline .has-feedback .form-control-feedback{top:0}}.btn{display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}.btn:focus,.btn:hover{text-decoration:none}.btn.focus,.btn:focus{outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.btn.disabled,.btn:disabled{opacity:.65}.btn:not([disabled]):not(.disabled).active,.btn:not([disabled]):not(.disabled):active{background-image:none}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-primary{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary:hover{color:#fff;background-color:#0069d9;border-color:#0062cc}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-primary.disabled,.btn-primary:disabled{background-color:#007bff;border-color:#007bff}.btn-primary:not([disabled]):not(.disabled).active,.btn-primary:not([disabled]):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#0062cc;border-color:#005cbf;box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-secondary{color:#fff;background-color:#868e96;border-color:#868e96}.btn-secondary:hover{color:#fff;background-color:#727b84;border-color:#6c757d}.btn-secondary.focus,.btn-secondary:focus{box-shadow:0 0 0 .2rem rgba(134,142,150,.5)}.btn-secondary.disabled,.btn-secondary:disabled{background-color:#868e96;border-color:#868e96}.btn-secondary:not([disabled]):not(.disabled).active,.btn-secondary:not([disabled]):not(.disabled):active,.show>.btn-secondary.dropdown-toggle{color:#fff;background-color:#6c757d;border-color:#666e76;box-shadow:0 0 0 .2rem rgba(134,142,150,.5)}.btn-success{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success:hover{color:#fff;background-color:#218838;border-color:#1e7e34}.btn-success.focus,.btn-success:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-success.disabled,.btn-success:disabled{background-color:#28a745;border-color:#28a745}.btn-success:not([disabled]):not(.disabled).active,.btn-success:not([disabled]):not(.disabled):active,.show>.btn-success.dropdown-toggle{color:#fff;background-color:#1e7e34;border-color:#1c7430;box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-info{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info:hover{color:#fff;background-color:#138496;border-color:#117a8b}.btn-info.focus,.btn-info:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-info.disabled,.btn-info:disabled{background-color:#17a2b8;border-color:#17a2b8}.btn-info:not([disabled]):not(.disabled).active,.btn-info:not([disabled]):not(.disabled):active,.show>.btn-info.dropdown-toggle{color:#fff;background-color:#117a8b;border-color:#10707f;box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-warning{color:#111;background-color:#ffc107;border-color:#ffc107}.btn-warning:hover{color:#111;background-color:#e0a800;border-color:#d39e00}.btn-warning.focus,.btn-warning:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-warning.disabled,.btn-warning:disabled{background-color:#ffc107;border-color:#ffc107}.btn-warning:not([disabled]):not(.disabled).active,.btn-warning:not([disabled]):not(.disabled):active,.show>.btn-warning.dropdown-toggle{color:#111;background-color:#d39e00;border-color:#c69500;box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-danger{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger:hover{color:#fff;background-color:#c82333;border-color:#bd2130}.btn-danger.focus,.btn-danger:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-danger.disabled,.btn-danger:disabled{background-color:#dc3545;border-color:#dc3545}.btn-danger:not([disabled]):not(.disabled).active,.btn-danger:not([disabled]):not(.disabled):active,.show>.btn-danger.dropdown-toggle{color:#fff;background-color:#bd2130;border-color:#b21f2d;box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-light{color:#111;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:hover{color:#111;background-color:#e2e6ea;border-color:#dae0e5}.btn-light.focus,.btn-light:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-light.disabled,.btn-light:disabled{background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:not([disabled]):not(.disabled).active,.btn-light:not([disabled]):not(.disabled):active,.show>.btn-light.dropdown-toggle{color:#111;background-color:#dae0e5;border-color:#d3d9df;box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:hover{color:#fff;background-color:#23272b;border-color:#1d2124}.btn-dark.focus,.btn-dark:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-dark.disabled,.btn-dark:disabled{background-color:#343a40;border-color:#343a40}.btn-dark:not([disabled]):not(.disabled).active,.btn-dark:not([disabled]):not(.disabled):active,.show>.btn-dark.dropdown-toggle{color:#fff;background-color:#1d2124;border-color:#171a1d;box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-outline-primary{color:#007bff;background-color:transparent;background-image:none;border-color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary.focus,.btn-outline-primary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent}.btn-outline-primary:not([disabled]):not(.disabled).active,.btn-outline-primary:not([disabled]):not(.disabled):active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff;box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-secondary{color:#868e96;background-color:transparent;background-image:none;border-color:#868e96}.btn-outline-secondary:hover{color:#fff;background-color:#868e96;border-color:#868e96}.btn-outline-secondary.focus,.btn-outline-secondary:focus{box-shadow:0 0 0 .2rem rgba(134,142,150,.5)}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#868e96;background-color:transparent}.btn-outline-secondary:not([disabled]):not(.disabled).active,.btn-outline-secondary:not([disabled]):not(.disabled):active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#868e96;border-color:#868e96;box-shadow:0 0 0 .2rem rgba(134,142,150,.5)}.btn-outline-success{color:#28a745;background-color:transparent;background-image:none;border-color:#28a745}.btn-outline-success:hover{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success.focus,.btn-outline-success:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#28a745;background-color:transparent}.btn-outline-success:not([disabled]):not(.disabled).active,.btn-outline-success:not([disabled]):not(.disabled):active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#28a745;border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-info{color:#17a2b8;background-color:transparent;background-image:none;border-color:#17a2b8}.btn-outline-info:hover{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info.focus,.btn-outline-info:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#17a2b8;background-color:transparent}.btn-outline-info:not([disabled]):not(.disabled).active,.btn-outline-info:not([disabled]):not(.disabled):active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#17a2b8;border-color:#17a2b8;box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-warning{color:#ffc107;background-color:transparent;background-image:none;border-color:#ffc107}.btn-outline-warning:hover{color:#fff;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning.focus,.btn-outline-warning:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffc107;background-color:transparent}.btn-outline-warning:not([disabled]):not(.disabled).active,.btn-outline-warning:not([disabled]):not(.disabled):active,.show>.btn-outline-warning.dropdown-toggle{color:#fff;background-color:#ffc107;border-color:#ffc107;box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-danger{color:#dc3545;background-color:transparent;background-image:none;border-color:#dc3545}.btn-outline-danger:hover{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger.focus,.btn-outline-danger:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#dc3545;background-color:transparent}.btn-outline-danger:not([disabled]):not(.disabled).active,.btn-outline-danger:not([disabled]):not(.disabled):active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#dc3545;border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-light{color:#f8f9fa;background-color:transparent;background-image:none;border-color:#f8f9fa}.btn-outline-light:hover{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light.focus,.btn-outline-light:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#f8f9fa;background-color:transparent}.btn-outline-light:not([disabled]):not(.disabled).active,.btn-outline-light:not([disabled]):not(.disabled):active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa;box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-dark{color:#343a40;background-color:transparent;background-image:none;border-color:#343a40}.btn-outline-dark:hover{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark.focus,.btn-outline-dark:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#343a40;background-color:transparent}.btn-outline-dark:not([disabled]):not(.disabled).active,.btn-outline-dark:not([disabled]):not(.disabled):active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#343a40;border-color:#343a40;box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-link{font-weight:400;color:#007bff;background-color:transparent}.btn-link:hover{color:#0056b3;text-decoration:underline;background-color:transparent;border-color:transparent}.btn-link.focus,.btn-link:focus{border-color:transparent;box-shadow:none}.btn-link.disabled,.btn-link:disabled{color:#868e96}.btn-group-lg>.btn,.btn-lg{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.btn-group-sm>.btn,.btn-sm{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:.5rem}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;transition:opacity .15s linear}.fade.show{opacity:1}.collapse{display:none}.collapse.show{display:block}tr.collapse.show{display:table-row}tbody.collapse.show{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;transition:height .35s ease}.dropdown,.dropup{position:relative}.dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid;border-right:.3em solid transparent;border-bottom:0;border-left:.3em solid transparent}.dropdown-toggle:empty::after{margin-left:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:10rem;padding:.5rem 0;margin:.125rem 0 0;font-size:1rem;color:#212529;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:.25rem}.dropup .dropdown-menu{margin-top:0;margin-bottom:.125rem}.dropup .dropdown-toggle::after{display:inline-block;width:0;height:0;margin-left:.255em;vertical-align:.255em;content:"";border-top:0;border-right:.3em solid transparent;border-bottom:.3em solid;border-left:.3em solid transparent}.dropup .dropdown-toggle:empty::after{margin-left:0}.dropdown-divider{height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}.dropdown-item{display:block;width:100%;padding:.25rem 1.5rem;clear:both;font-weight:400;color:#212529;text-align:inherit;white-space:nowrap;background:0 0;border:0}.dropdown-item:focus,.dropdown-item:hover{color:#16181b;text-decoration:none;background-color:#f8f9fa}.dropdown-item.active,.dropdown-item:active{color:#fff;text-decoration:none;background-color:#007bff}.dropdown-item.disabled,.dropdown-item:disabled{color:#868e96;background-color:transparent}.dropdown-menu.show{display:block}.dropdown-header{display:block;padding:.5rem 1.5rem;margin-bottom:0;font-size:.875rem;color:#868e96;white-space:nowrap}.btn-group,.btn-group-vertical{position:relative;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;-ms-flex:0 1 auto;flex:0 1 auto}.btn-group-vertical>.btn:hover,.btn-group>.btn:hover{z-index:2}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group,.btn-group-vertical .btn+.btn,.btn-group-vertical .btn+.btn-group,.btn-group-vertical .btn-group+.btn,.btn-group-vertical .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:start;justify-content:flex-start}.btn-toolbar .input-group{width:auto}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn+.dropdown-toggle-split{padding-right:.5625rem;padding-left:.5625rem}.btn+.dropdown-toggle-split::after{margin-left:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-right:.375rem;padding-left:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.btn-group-vertical{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}.btn-group-vertical .btn,.btn-group-vertical .btn-group{width:100%}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:stretch;align-items:stretch;width:100%}.input-group .form-control{position:relative;z-index:2;-ms-flex:1 1 auto;flex:1 1 auto;width:1%;margin-bottom:0}.input-group .form-control:active,.input-group .form-control:focus,.input-group .form-control:hover{z-index:3}.input-group .form-control,.input-group-addon,.input-group-btn{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{white-space:nowrap}.input-group-addon{padding:.375rem .75rem;margin-bottom:0;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;text-align:center;background-color:#e9ecef;border:1px solid #ced4da;border-radius:.25rem}.input-group-addon.form-control-sm,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.input-group-addon.btn{padding:.25rem .5rem;font-size:.875rem;border-radius:.2rem}.input-group-addon.form-control-lg,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.input-group-addon.btn{padding:.5rem 1rem;font-size:1.25rem;border-radius:.3rem}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:not(:last-child),.input-group-addon:not(:last-child),.input-group-btn:not(:first-child)>.btn-group:not(:last-child)>.btn,.input-group-btn:not(:first-child)>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:not(:last-child)>.btn,.input-group-btn:not(:last-child)>.btn-group>.btn,.input-group-btn:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:not(:last-child){border-right:0}.input-group .form-control:not(:first-child),.input-group-addon:not(:first-child),.input-group-btn:not(:first-child)>.btn,.input-group-btn:not(:first-child)>.btn-group>.btn,.input-group-btn:not(:first-child)>.dropdown-toggle,.input-group-btn:not(:last-child)>.btn-group:not(:first-child)>.btn,.input-group-btn:not(:last-child)>.btn:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.form-control+.input-group-addon:not(:first-child){border-left:0}.input-group-btn{position:relative;-ms-flex-align:stretch;align-items:stretch;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:3}.input-group-btn:first-child>.btn+.btn{margin-left:0}.input-group-btn:not(:last-child)>.btn,.input-group-btn:not(:last-child)>.btn-group{margin-right:-1px}.input-group-btn:not(:first-child)>.btn,.input-group-btn:not(:first-child)>.btn-group{z-index:2;margin-left:0}.input-group-btn:not(:first-child)>.btn-group:first-child,.input-group-btn:not(:first-child)>.btn:first-child{margin-left:-1px}.input-group-btn:not(:first-child)>.btn-group:active,.input-group-btn:not(:first-child)>.btn-group:focus,.input-group-btn:not(:first-child)>.btn-group:hover,.input-group-btn:not(:first-child)>.btn:active,.input-group-btn:not(:first-child)>.btn:focus,.input-group-btn:not(:first-child)>.btn:hover{z-index:3}.custom-control{position:relative;display:-ms-inline-flexbox;display:inline-flex;min-height:1.5rem;padding-left:1.5rem;margin-right:1rem}.custom-control-input{position:absolute;z-index:-1;opacity:0}.custom-control-input:checked~.custom-control-indicator{color:#fff;background-color:#007bff}.custom-control-input:focus~.custom-control-indicator{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-control-input:active~.custom-control-indicator{color:#fff;background-color:#b3d7ff}.custom-control-input:disabled~.custom-control-indicator{background-color:#e9ecef}.custom-control-input:disabled~.custom-control-description{color:#868e96}.custom-control-indicator{position:absolute;top:.25rem;left:0;display:block;width:1rem;height:1rem;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#ddd;background-repeat:no-repeat;background-position:center center;background-size:50% 50%}.custom-checkbox .custom-control-indicator{border-radius:.25rem}.custom-checkbox .custom-control-input:checked~.custom-control-indicator{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E")}.custom-checkbox .custom-control-input:indeterminate~.custom-control-indicator{background-color:#007bff;background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E")}.custom-radio .custom-control-indicator{border-radius:50%}.custom-radio .custom-control-input:checked~.custom-control-indicator{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E")}.custom-controls-stacked{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.custom-controls-stacked .custom-control{margin-bottom:.25rem}.custom-controls-stacked .custom-control+.custom-control{margin-left:0}.custom-select{display:inline-block;max-width:100%;height:calc(2.25rem + 2px);padding:.375rem 1.75rem .375rem .75rem;line-height:1.5;color:#495057;vertical-align:middle;background:#fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center;background-size:8px 10px;border:1px solid #ced4da;border-radius:.25rem;-webkit-appearance:none;-moz-appearance:none;appearance:none}.custom-select:focus{border-color:#80bdff;outline:0}.custom-select:focus::-ms-value{color:#495057;background-color:#fff}.custom-select[multiple]{height:auto;background-image:none}.custom-select:disabled{color:#868e96;background-color:#e9ecef}.custom-select::-ms-expand{opacity:0}.custom-select-sm{height:calc(1.8125rem + 2px);padding-top:.375rem;padding-bottom:.375rem;font-size:75%}.custom-file{position:relative;display:inline-block;max-width:100%;height:calc(2.25rem + 2px);margin-bottom:0}.custom-file-input{min-width:14rem;max-width:100%;height:calc(2.25rem + 2px);margin:0;opacity:0}.custom-file-input:focus~.custom-file-control{box-shadow:0 0 0 .075rem #fff,0 0 0 .2rem #007bff}.custom-file-control{position:absolute;top:0;right:0;left:0;z-index:5;height:calc(2.25rem + 2px);padding:.375rem .75rem;line-height:1.5;color:#495057;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff;border:1px solid #ced4da;border-radius:.25rem}.custom-file-control:lang(en):empty::after{content:"Choose file..."}.custom-file-control::before{position:absolute;top:-1px;right:-1px;bottom:-1px;z-index:6;display:block;height:calc(2.25rem + 2px);padding:.375rem .75rem;line-height:1.5;color:#495057;background-color:#e9ecef;border:1px solid #ced4da;border-radius:0 .25rem .25rem 0}.custom-file-control:lang(en)::before{content:"Browse"}.nav{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none}.nav-link{display:block;padding:.5rem 1rem}.nav-link:focus,.nav-link:hover{text-decoration:none}.nav-link.disabled{color:#868e96}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs .nav-item{margin-bottom:-1px}.nav-tabs .nav-link{border:1px solid transparent;border-top-left-radius:.25rem;border-top-right-radius:.25rem}.nav-tabs .nav-link:focus,.nav-tabs .nav-link:hover{border-color:#e9ecef #e9ecef #ddd}.nav-tabs .nav-link.disabled{color:#868e96;background-color:transparent;border-color:transparent}.nav-tabs .nav-item.show .nav-link,.nav-tabs .nav-link.active{color:#495057;background-color:#fff;border-color:#ddd #ddd #fff}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.nav-pills .nav-link{border-radius:.25rem}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:#fff;background-color:#007bff}.nav-fill .nav-item{-ms-flex:1 1 auto;flex:1 1 auto;text-align:center}.nav-justified .nav-item{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;text-align:center}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.navbar{position:relative;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:.5rem 1rem}.navbar>.container,.navbar>.container-fluid{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}.navbar-brand{display:inline-block;padding-top:.3125rem;padding-bottom:.3125rem;margin-right:1rem;font-size:1.25rem;line-height:inherit;white-space:nowrap}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-nav{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding-left:0;margin-bottom:0;list-style:none}.navbar-nav .nav-link{padding-right:0;padding-left:0}.navbar-nav .dropdown-menu{position:static;float:none}.navbar-text{display:inline-block;padding-top:.5rem;padding-bottom:.5rem}.navbar-collapse{-ms-flex-preferred-size:100%;flex-basis:100%;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center}.navbar-toggler{padding:.25rem .75rem;font-size:1.25rem;line-height:1;background:0 0;border:1px solid transparent;border-radius:.25rem}.navbar-toggler:focus,.navbar-toggler:hover{text-decoration:none}.navbar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;content:"";background:no-repeat center center;background-size:100% 100%}@media (max-width:575px){.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:576px){.navbar-expand-sm{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-sm .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-sm .navbar-nav .dropdown-menu-right{right:0;left:auto}.navbar-expand-sm .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-sm .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}.navbar-expand-sm .dropup .dropdown-menu{top:auto;bottom:100%}}@media (max-width:767px){.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:768px){.navbar-expand-md{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-md .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-md .navbar-nav .dropdown-menu-right{right:0;left:auto}.navbar-expand-md .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-md>.container,.navbar-expand-md>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-md .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}.navbar-expand-md .dropup .dropdown-menu{top:auto;bottom:100%}}@media (max-width:991px){.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:992px){.navbar-expand-lg{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-lg .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-lg .navbar-nav .dropdown-menu-right{right:0;left:auto}.navbar-expand-lg .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-lg .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}.navbar-expand-lg .dropup .dropdown-menu{top:auto;bottom:100%}}@media (max-width:1199px){.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{padding-right:0;padding-left:0}}@media (min-width:1200px){.navbar-expand-xl{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand-xl .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-xl .navbar-nav .dropdown-menu-right{right:0;left:auto}.navbar-expand-xl .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand-xl .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}.navbar-expand-xl .dropup .dropdown-menu{top:auto;bottom:100%}}.navbar-expand{-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-pack:start;justify-content:flex-start}.navbar-expand>.container,.navbar-expand>.container-fluid{padding-right:0;padding-left:0}.navbar-expand .navbar-nav{-ms-flex-direction:row;flex-direction:row}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.navbar-expand .navbar-nav .dropdown-menu-right{right:0;left:auto}.navbar-expand .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand>.container,.navbar-expand>.container-fluid{-ms-flex-wrap:nowrap;flex-wrap:nowrap}.navbar-expand .navbar-collapse{display:-ms-flexbox!important;display:flex!important;-ms-flex-preferred-size:auto;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.navbar-expand .dropup .dropdown-menu{top:auto;bottom:100%}.navbar-light .navbar-brand{color:rgba(0,0,0,.9)}.navbar-light .navbar-brand:focus,.navbar-light .navbar-brand:hover{color:rgba(0,0,0,.9)}.navbar-light .navbar-nav .nav-link{color:rgba(0,0,0,.5)}.navbar-light .navbar-nav .nav-link:focus,.navbar-light .navbar-nav .nav-link:hover{color:rgba(0,0,0,.7)}.navbar-light .navbar-nav .nav-link.disabled{color:rgba(0,0,0,.3)}.navbar-light .navbar-nav .active>.nav-link,.navbar-light .navbar-nav .nav-link.active,.navbar-light .navbar-nav .nav-link.show,.navbar-light .navbar-nav .show>.nav-link{color:rgba(0,0,0,.9)}.navbar-light .navbar-toggler{color:rgba(0,0,0,.5);border-color:rgba(0,0,0,.1)}.navbar-light .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-light .navbar-text{color:rgba(0,0,0,.5)}.navbar-light .navbar-text a{color:rgba(0,0,0,.9)}.navbar-light .navbar-text a:focus,.navbar-light .navbar-text a:hover{color:rgba(0,0,0,.9)}.navbar-dark .navbar-brand{color:#fff}.navbar-dark .navbar-brand:focus,.navbar-dark .navbar-brand:hover{color:#fff}.navbar-dark .navbar-nav .nav-link{color:rgba(255,255,255,.5)}.navbar-dark .navbar-nav .nav-link:focus,.navbar-dark .navbar-nav .nav-link:hover{color:rgba(255,255,255,.75)}.navbar-dark .navbar-nav .nav-link.disabled{color:rgba(255,255,255,.25)}.navbar-dark .navbar-nav .active>.nav-link,.navbar-dark .navbar-nav .nav-link.active,.navbar-dark .navbar-nav .nav-link.show,.navbar-dark .navbar-nav .show>.nav-link{color:#fff}.navbar-dark .navbar-toggler{color:rgba(255,255,255,.5);border-color:rgba(255,255,255,.1)}.navbar-dark .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-dark .navbar-text{color:rgba(255,255,255,.5)}.navbar-dark .navbar-text a{color:#fff}.navbar-dark .navbar-text a:focus,.navbar-dark .navbar-text a:hover{color:#fff}.card{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:0;word-wrap:break-word;background-color:#fff;background-clip:border-box;border:1px solid rgba(0,0,0,.125);border-radius:.25rem}.card>hr{margin-right:0;margin-left:0}.card>.list-group:first-child .list-group-item:first-child{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.card>.list-group:last-child .list-group-item:last-child{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.card-body{-ms-flex:1 1 auto;flex:1 1 auto;padding:1.25rem}.card-title{margin-bottom:.75rem}.card-subtitle{margin-top:-.375rem;margin-bottom:0}.card-text:last-child{margin-bottom:0}.card-link:hover{text-decoration:none}.card-link+.card-link{margin-left:1.25rem}.card-header{padding:.75rem 1.25rem;margin-bottom:0;background-color:rgba(0,0,0,.03);border-bottom:1px solid rgba(0,0,0,.125)}.card-header:first-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-header+.list-group .list-group-item:first-child{border-top:0}.card-footer{padding:.75rem 1.25rem;background-color:rgba(0,0,0,.03);border-top:1px solid rgba(0,0,0,.125)}.card-footer:last-child{border-radius:0 0 calc(.25rem - 1px) calc(.25rem - 1px)}.card-header-tabs{margin-right:-.625rem;margin-bottom:-.75rem;margin-left:-.625rem;border-bottom:0}.card-header-pills{margin-right:-.625rem;margin-left:-.625rem}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:1.25rem}.card-img{width:100%;border-radius:calc(.25rem - 1px)}.card-img-top{width:100%;border-top-left-radius:calc(.25rem - 1px);border-top-right-radius:calc(.25rem - 1px)}.card-img-bottom{width:100%;border-bottom-right-radius:calc(.25rem - 1px);border-bottom-left-radius:calc(.25rem - 1px)}.card-deck{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.card-deck .card{margin-bottom:15px}@media (min-width:576px){.card-deck{-ms-flex-flow:row wrap;flex-flow:row wrap;margin-right:-15px;margin-left:-15px}.card-deck .card{display:-ms-flexbox;display:flex;-ms-flex:1 0 0%;flex:1 0 0%;-ms-flex-direction:column;flex-direction:column;margin-right:15px;margin-bottom:0;margin-left:15px}}.card-group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.card-group .card{margin-bottom:15px}@media (min-width:576px){.card-group{-ms-flex-flow:row wrap;flex-flow:row wrap}.card-group .card{-ms-flex:1 0 0%;flex:1 0 0%;margin-bottom:0}.card-group .card+.card{margin-left:0;border-left:0}.card-group .card:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.card-group .card:first-child .card-img-top{border-top-right-radius:0}.card-group .card:first-child .card-img-bottom{border-bottom-right-radius:0}.card-group .card:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.card-group .card:last-child .card-img-top{border-top-left-radius:0}.card-group .card:last-child .card-img-bottom{border-bottom-left-radius:0}.card-group .card:only-child{border-radius:.25rem}.card-group .card:only-child .card-img-top{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.card-group .card:only-child .card-img-bottom{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.card-group .card:not(:first-child):not(:last-child):not(:only-child){border-radius:0}.card-group .card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom,.card-group .card:not(:first-child):not(:last-child):not(:only-child) .card-img-top{border-radius:0}}.card-columns .card{margin-bottom:.75rem}@media (min-width:576px){.card-columns{-webkit-column-count:3;column-count:3;-webkit-column-gap:1.25rem;column-gap:1.25rem}.card-columns .card{display:inline-block;width:100%}}.breadcrumb{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:.75rem 1rem;margin-bottom:1rem;list-style:none;background-color:#e9ecef;border-radius:.25rem}.breadcrumb-item+.breadcrumb-item::before{display:inline-block;padding-right:.5rem;padding-left:.5rem;color:#868e96;content:"/"}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:underline}.breadcrumb-item+.breadcrumb-item:hover::before{text-decoration:none}.breadcrumb-item.active{color:#868e96}.pagination{display:-ms-flexbox;display:flex;padding-left:0;list-style:none;border-radius:.25rem}.page-item:first-child .page-link{margin-left:0;border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.page-item:last-child .page-link{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.page-item.active .page-link{z-index:2;color:#fff;background-color:#007bff;border-color:#007bff}.page-item.disabled .page-link{color:#868e96;pointer-events:none;background-color:#fff;border-color:#ddd}.page-link{position:relative;display:block;padding:.5rem .75rem;margin-left:-1px;line-height:1.25;color:#007bff;background-color:#fff;border:1px solid #ddd}.page-link:focus,.page-link:hover{color:#0056b3;text-decoration:none;background-color:#e9ecef;border-color:#ddd}.pagination-lg .page-link{padding:.75rem 1.5rem;font-size:1.25rem;line-height:1.5}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:.3rem;border-bottom-left-radius:.3rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:.3rem;border-bottom-right-radius:.3rem}.pagination-sm .page-link{padding:.25rem .5rem;font-size:.875rem;line-height:1.5}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:.2rem;border-bottom-left-radius:.2rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:.2rem;border-bottom-right-radius:.2rem}.badge{display:inline-block;padding:.25em .4em;font-size:75%;font-weight:700;line-height:1;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25rem}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.badge-pill{padding-right:.6em;padding-left:.6em;border-radius:10rem}.badge-primary{color:#fff;background-color:#007bff}.badge-primary[href]:focus,.badge-primary[href]:hover{color:#fff;text-decoration:none;background-color:#0062cc}.badge-secondary{color:#fff;background-color:#868e96}.badge-secondary[href]:focus,.badge-secondary[href]:hover{color:#fff;text-decoration:none;background-color:#6c757d}.badge-success{color:#fff;background-color:#28a745}.badge-success[href]:focus,.badge-success[href]:hover{color:#fff;text-decoration:none;background-color:#1e7e34}.badge-info{color:#fff;background-color:#17a2b8}.badge-info[href]:focus,.badge-info[href]:hover{color:#fff;text-decoration:none;background-color:#117a8b}.badge-warning{color:#111;background-color:#ffc107}.badge-warning[href]:focus,.badge-warning[href]:hover{color:#111;text-decoration:none;background-color:#d39e00}.badge-danger{color:#fff;background-color:#dc3545}.badge-danger[href]:focus,.badge-danger[href]:hover{color:#fff;text-decoration:none;background-color:#bd2130}.badge-light{color:#111;background-color:#f8f9fa}.badge-light[href]:focus,.badge-light[href]:hover{color:#111;text-decoration:none;background-color:#dae0e5}.badge-dark{color:#fff;background-color:#343a40}.badge-dark[href]:focus,.badge-dark[href]:hover{color:#fff;text-decoration:none;background-color:#1d2124}.jumbotron{padding:2rem 1rem;margin-bottom:2rem;background-color:#e9ecef;border-radius:.3rem}@media (min-width:576px){.jumbotron{padding:4rem 2rem}}.jumbotron-fluid{padding-right:0;padding-left:0;border-radius:0}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border:1px solid transparent;border-radius:.25rem}.alert-heading{color:inherit}.alert-link{font-weight:700}.alert-dismissible .close{position:absolute;top:0;right:0;padding:.75rem 1.25rem;color:inherit}.alert-primary{color:#004085;background-color:#cce5ff;border-color:#b8daff}.alert-primary hr{border-top-color:#9fcdff}.alert-primary .alert-link{color:#002752}.alert-secondary{color:#464a4e;background-color:#e7e8ea;border-color:#dddfe2}.alert-secondary hr{border-top-color:#cfd2d6}.alert-secondary .alert-link{color:#2e3133}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert-success hr{border-top-color:#b1dfbb}.alert-success .alert-link{color:#0b2e13}.alert-info{color:#0c5460;background-color:#d1ecf1;border-color:#bee5eb}.alert-info hr{border-top-color:#abdde5}.alert-info .alert-link{color:#062c33}.alert-warning{color:#856404;background-color:#fff3cd;border-color:#ffeeba}.alert-warning hr{border-top-color:#ffe8a1}.alert-warning .alert-link{color:#533f03}.alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-danger hr{border-top-color:#f1b0b7}.alert-danger .alert-link{color:#491217}.alert-light{color:#818182;background-color:#fefefe;border-color:#fdfdfe}.alert-light hr{border-top-color:#ececf6}.alert-light .alert-link{color:#686868}.alert-dark{color:#1b1e21;background-color:#d6d8d9;border-color:#c6c8ca}.alert-dark hr{border-top-color:#b9bbbe}.alert-dark .alert-link{color:#040505}@-webkit-keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:1rem 0}to{background-position:0 0}}.progress{display:-ms-flexbox;display:flex;height:1rem;overflow:hidden;font-size:.75rem;background-color:#e9ecef;border-radius:.25rem}.progress-bar{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:#fff;background-color:#007bff}.progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:1rem 1rem}.progress-bar-animated{-webkit-animation:progress-bar-stripes 1s linear infinite;animation:progress-bar-stripes 1s linear infinite}.media{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start}.media-body{-ms-flex:1;flex:1}.list-group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding-left:0;margin-bottom:0}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:focus,.list-group-item-action:hover{color:#495057;text-decoration:none;background-color:#f8f9fa}.list-group-item-action:active{color:#212529;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:.75rem 1.25rem;margin-bottom:-1px;background-color:#fff;border:1px solid rgba(0,0,0,.125)}.list-group-item:first-child{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.list-group-item:focus,.list-group-item:hover{text-decoration:none}.list-group-item.disabled,.list-group-item:disabled{color:#868e96;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#007bff;border-color:#007bff}.list-group-flush .list-group-item{border-right:0;border-left:0;border-radius:0}.list-group-flush:first-child .list-group-item:first-child{border-top:0}.list-group-flush:last-child .list-group-item:last-child{border-bottom:0}.list-group-item-primary{color:#004085;background-color:#b8daff}a.list-group-item-primary,button.list-group-item-primary{color:#004085}a.list-group-item-primary:focus,a.list-group-item-primary:hover,button.list-group-item-primary:focus,button.list-group-item-primary:hover{color:#004085;background-color:#9fcdff}a.list-group-item-primary.active,button.list-group-item-primary.active{color:#fff;background-color:#004085;border-color:#004085}.list-group-item-secondary{color:#464a4e;background-color:#dddfe2}a.list-group-item-secondary,button.list-group-item-secondary{color:#464a4e}a.list-group-item-secondary:focus,a.list-group-item-secondary:hover,button.list-group-item-secondary:focus,button.list-group-item-secondary:hover{color:#464a4e;background-color:#cfd2d6}a.list-group-item-secondary.active,button.list-group-item-secondary.active{color:#fff;background-color:#464a4e;border-color:#464a4e}.list-group-item-success{color:#155724;background-color:#c3e6cb}a.list-group-item-success,button.list-group-item-success{color:#155724}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#155724;background-color:#b1dfbb}a.list-group-item-success.active,button.list-group-item-success.active{color:#fff;background-color:#155724;border-color:#155724}.list-group-item-info{color:#0c5460;background-color:#bee5eb}a.list-group-item-info,button.list-group-item-info{color:#0c5460}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#0c5460;background-color:#abdde5}a.list-group-item-info.active,button.list-group-item-info.active{color:#fff;background-color:#0c5460;border-color:#0c5460}.list-group-item-warning{color:#856404;background-color:#ffeeba}a.list-group-item-warning,button.list-group-item-warning{color:#856404}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#856404;background-color:#ffe8a1}a.list-group-item-warning.active,button.list-group-item-warning.active{color:#fff;background-color:#856404;border-color:#856404}.list-group-item-danger{color:#721c24;background-color:#f5c6cb}a.list-group-item-danger,button.list-group-item-danger{color:#721c24}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#721c24;background-color:#f1b0b7}a.list-group-item-danger.active,button.list-group-item-danger.active{color:#fff;background-color:#721c24;border-color:#721c24}.list-group-item-light{color:#818182;background-color:#fdfdfe}a.list-group-item-light,button.list-group-item-light{color:#818182}a.list-group-item-light:focus,a.list-group-item-light:hover,button.list-group-item-light:focus,button.list-group-item-light:hover{color:#818182;background-color:#ececf6}a.list-group-item-light.active,button.list-group-item-light.active{color:#fff;background-color:#818182;border-color:#818182}.list-group-item-dark{color:#1b1e21;background-color:#c6c8ca}a.list-group-item-dark,button.list-group-item-dark{color:#1b1e21}a.list-group-item-dark:focus,a.list-group-item-dark:hover,button.list-group-item-dark:focus,button.list-group-item-dark:hover{color:#1b1e21;background-color:#b9bbbe}a.list-group-item-dark.active,button.list-group-item-dark.active{color:#fff;background-color:#1b1e21;border-color:#1b1e21}.close{float:right;font-size:1.5rem;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.5}.close:focus,.close:hover{color:#000;text-decoration:none;opacity:.75}button.close{padding:0;background:0 0;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;outline:0}.modal.fade .modal-dialog{transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.show .modal-dialog{-webkit-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px;pointer-events:none}.modal-content{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop.show{opacity:.5}.modal-header{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:justify;justify-content:space-between;padding:15px;border-bottom:1px solid #e9ecef;border-top-left-radius:.3rem;border-top-right-radius:.3rem}.modal-header .close{padding:15px;margin:-15px -15px -15px auto}.modal-title{margin-bottom:0;line-height:1.5}.modal-body{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;padding:15px}.modal-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end;padding:15px;border-top:1px solid #e9ecef}.modal-footer>:not(:first-child){margin-left:.25rem}.modal-footer>:not(:last-child){margin-right:.25rem}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:576px){.modal-dialog{max-width:500px;margin:30px auto}.modal-sm{max-width:300px}}@media (min-width:992px){.modal-lg{max-width:800px}}.tooltip{position:absolute;z-index:1070;display:block;margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;opacity:0}.tooltip.show{opacity:.9}.tooltip .arrow{position:absolute;display:block;width:5px;height:5px}.tooltip .arrow::before{position:absolute;border-color:transparent;border-style:solid}.tooltip.bs-tooltip-auto[x-placement^=top],.tooltip.bs-tooltip-top{padding:5px 0}.tooltip.bs-tooltip-auto[x-placement^=top] .arrow,.tooltip.bs-tooltip-top .arrow{bottom:0}.tooltip.bs-tooltip-auto[x-placement^=top] .arrow::before,.tooltip.bs-tooltip-top .arrow::before{margin-left:-3px;content:"";border-width:5px 5px 0;border-top-color:#000}.tooltip.bs-tooltip-auto[x-placement^=right],.tooltip.bs-tooltip-right{padding:0 5px}.tooltip.bs-tooltip-auto[x-placement^=right] .arrow,.tooltip.bs-tooltip-right .arrow{left:0}.tooltip.bs-tooltip-auto[x-placement^=right] .arrow::before,.tooltip.bs-tooltip-right .arrow::before{margin-top:-3px;content:"";border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.bs-tooltip-auto[x-placement^=bottom],.tooltip.bs-tooltip-bottom{padding:5px 0}.tooltip.bs-tooltip-auto[x-placement^=bottom] .arrow,.tooltip.bs-tooltip-bottom .arrow{top:0}.tooltip.bs-tooltip-auto[x-placement^=bottom] .arrow::before,.tooltip.bs-tooltip-bottom .arrow::before{margin-left:-3px;content:"";border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bs-tooltip-auto[x-placement^=left],.tooltip.bs-tooltip-left{padding:0 5px}.tooltip.bs-tooltip-auto[x-placement^=left] .arrow,.tooltip.bs-tooltip-left .arrow{right:0}.tooltip.bs-tooltip-auto[x-placement^=left] .arrow::before,.tooltip.bs-tooltip-left .arrow::before{right:0;margin-top:-3px;content:"";border-width:5px 0 5px 5px;border-left-color:#000}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:.25rem}.popover{position:absolute;top:0;left:0;z-index:1060;display:block;max-width:276px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem}.popover .arrow{position:absolute;display:block;width:.8rem;height:.4rem}.popover .arrow::after,.popover .arrow::before{position:absolute;display:block;border-color:transparent;border-style:solid}.popover .arrow::before{content:"";border-width:.8rem}.popover .arrow::after{content:"";border-width:.8rem}.popover.bs-popover-auto[x-placement^=top],.popover.bs-popover-top{margin-bottom:.8rem}.popover.bs-popover-auto[x-placement^=top] .arrow,.popover.bs-popover-top .arrow{bottom:0}.popover.bs-popover-auto[x-placement^=top] .arrow::after,.popover.bs-popover-auto[x-placement^=top] .arrow::before,.popover.bs-popover-top .arrow::after,.popover.bs-popover-top .arrow::before{border-bottom-width:0}.popover.bs-popover-auto[x-placement^=top] .arrow::before,.popover.bs-popover-top .arrow::before{bottom:-.8rem;margin-left:-.8rem;border-top-color:rgba(0,0,0,.25)}.popover.bs-popover-auto[x-placement^=top] .arrow::after,.popover.bs-popover-top .arrow::after{bottom:calc((.8rem - 1px) * -1);margin-left:-.8rem;border-top-color:#fff}.popover.bs-popover-auto[x-placement^=right],.popover.bs-popover-right{margin-left:.8rem}.popover.bs-popover-auto[x-placement^=right] .arrow,.popover.bs-popover-right .arrow{left:0}.popover.bs-popover-auto[x-placement^=right] .arrow::after,.popover.bs-popover-auto[x-placement^=right] .arrow::before,.popover.bs-popover-right .arrow::after,.popover.bs-popover-right .arrow::before{margin-top:-.8rem;border-left-width:0}.popover.bs-popover-auto[x-placement^=right] .arrow::before,.popover.bs-popover-right .arrow::before{left:-.8rem;border-right-color:rgba(0,0,0,.25)}.popover.bs-popover-auto[x-placement^=right] .arrow::after,.popover.bs-popover-right .arrow::after{left:calc((.8rem - 1px) * -1);border-right-color:#fff}.popover.bs-popover-auto[x-placement^=bottom],.popover.bs-popover-bottom{margin-top:.8rem}.popover.bs-popover-auto[x-placement^=bottom] .arrow,.popover.bs-popover-bottom .arrow{top:0}.popover.bs-popover-auto[x-placement^=bottom] .arrow::after,.popover.bs-popover-auto[x-placement^=bottom] .arrow::before,.popover.bs-popover-bottom .arrow::after,.popover.bs-popover-bottom .arrow::before{margin-left:-.8rem;border-top-width:0}.popover.bs-popover-auto[x-placement^=bottom] .arrow::before,.popover.bs-popover-bottom .arrow::before{top:-.8rem;border-bottom-color:rgba(0,0,0,.25)}.popover.bs-popover-auto[x-placement^=bottom] .arrow::after,.popover.bs-popover-bottom .arrow::after{top:calc((.8rem - 1px) * -1);border-bottom-color:#fff}.popover.bs-popover-auto[x-placement^=bottom] .popover-header::before,.popover.bs-popover-bottom .popover-header::before{position:absolute;top:0;left:50%;display:block;width:20px;margin-left:-10px;content:"";border-bottom:1px solid #f7f7f7}.popover.bs-popover-auto[x-placement^=left],.popover.bs-popover-left{margin-right:.8rem}.popover.bs-popover-auto[x-placement^=left] .arrow,.popover.bs-popover-left .arrow{right:0}.popover.bs-popover-auto[x-placement^=left] .arrow::after,.popover.bs-popover-auto[x-placement^=left] .arrow::before,.popover.bs-popover-left .arrow::after,.popover.bs-popover-left .arrow::before{margin-top:-.8rem;border-right-width:0}.popover.bs-popover-auto[x-placement^=left] .arrow::before,.popover.bs-popover-left .arrow::before{right:-.8rem;border-left-color:rgba(0,0,0,.25)}.popover.bs-popover-auto[x-placement^=left] .arrow::after,.popover.bs-popover-left .arrow::after{right:calc((.8rem - 1px) * -1);border-left-color:#fff}.popover-header{padding:.5rem .75rem;margin-bottom:0;font-size:1rem;color:inherit;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-top-left-radius:calc(.3rem - 1px);border-top-right-radius:calc(.3rem - 1px)}.popover-header:empty{display:none}.popover-body{padding:.5rem .75rem;color:#212529}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-item{position:relative;display:none;-ms-flex-align:center;align-items:center;width:100%;transition:-webkit-transform .6s ease;transition:transform .6s ease;transition:transform .6s ease,-webkit-transform .6s ease;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-item-next,.carousel-item-prev,.carousel-item.active{display:block}.carousel-item-next,.carousel-item-prev{position:absolute;top:0}.carousel-item-next.carousel-item-left,.carousel-item-prev.carousel-item-right{-webkit-transform:translateX(0);transform:translateX(0)}@supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){.carousel-item-next.carousel-item-left,.carousel-item-prev.carousel-item-right{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.active.carousel-item-right,.carousel-item-next{-webkit-transform:translateX(100%);transform:translateX(100%)}@supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){.active.carousel-item-right,.carousel-item-next{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}.active.carousel-item-left,.carousel-item-prev{-webkit-transform:translateX(-100%);transform:translateX(-100%)}@supports ((-webkit-transform-style:preserve-3d) or (transform-style:preserve-3d)){.active.carousel-item-left,.carousel-item-prev{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}.carousel-control-next,.carousel-control-prev{position:absolute;top:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:15%;color:#fff;text-align:center;opacity:.5}.carousel-control-next:focus,.carousel-control-next:hover,.carousel-control-prev:focus,.carousel-control-prev:hover{color:#fff;text-decoration:none;outline:0;opacity:.9}.carousel-control-prev{left:0}.carousel-control-next{right:0}.carousel-control-next-icon,.carousel-control-prev-icon{display:inline-block;width:20px;height:20px;background:transparent no-repeat center center;background-size:100% 100%}.carousel-control-prev-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E")}.carousel-control-next-icon{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E")}.carousel-indicators{position:absolute;right:0;bottom:10px;left:0;z-index:15;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;padding-left:0;margin-right:15%;margin-left:15%;list-style:none}.carousel-indicators li{position:relative;-ms-flex:0 1 auto;flex:0 1 auto;width:30px;height:3px;margin-right:3px;margin-left:3px;text-indent:-999px;background-color:rgba(255,255,255,.5)}.carousel-indicators li::before{position:absolute;top:-10px;left:0;display:inline-block;width:100%;height:10px;content:""}.carousel-indicators li::after{position:absolute;bottom:-10px;left:0;display:inline-block;width:100%;height:10px;content:""}.carousel-indicators .active{background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center}.align-baseline{vertical-align:baseline!important}.align-top{vertical-align:top!important}.align-middle{vertical-align:middle!important}.align-bottom{vertical-align:bottom!important}.align-text-bottom{vertical-align:text-bottom!important}.align-text-top{vertical-align:text-top!important}.bg-primary{background-color:#007bff!important}a.bg-primary:focus,a.bg-primary:hover{background-color:#0062cc!important}.bg-secondary{background-color:#868e96!important}a.bg-secondary:focus,a.bg-secondary:hover{background-color:#6c757d!important}.bg-success{background-color:#28a745!important}a.bg-success:focus,a.bg-success:hover{background-color:#1e7e34!important}.bg-info{background-color:#17a2b8!important}a.bg-info:focus,a.bg-info:hover{background-color:#117a8b!important}.bg-warning{background-color:#ffc107!important}a.bg-warning:focus,a.bg-warning:hover{background-color:#d39e00!important}.bg-danger{background-color:#dc3545!important}a.bg-danger:focus,a.bg-danger:hover{background-color:#bd2130!important}.bg-light{background-color:#f8f9fa!important}a.bg-light:focus,a.bg-light:hover{background-color:#dae0e5!important}.bg-dark{background-color:#343a40!important}a.bg-dark:focus,a.bg-dark:hover{background-color:#1d2124!important}.bg-white{background-color:#fff!important}.bg-transparent{background-color:transparent!important}.border{border:1px solid #e9ecef!important}.border-0{border:0!important}.border-top-0{border-top:0!important}.border-right-0{border-right:0!important}.border-bottom-0{border-bottom:0!important}.border-left-0{border-left:0!important}.border-primary{border-color:#007bff!important}.border-secondary{border-color:#868e96!important}.border-success{border-color:#28a745!important}.border-info{border-color:#17a2b8!important}.border-warning{border-color:#ffc107!important}.border-danger{border-color:#dc3545!important}.border-light{border-color:#f8f9fa!important}.border-dark{border-color:#343a40!important}.border-white{border-color:#fff!important}.rounded{border-radius:.25rem!important}.rounded-top{border-top-left-radius:.25rem!important;border-top-right-radius:.25rem!important}.rounded-right{border-top-right-radius:.25rem!important;border-bottom-right-radius:.25rem!important}.rounded-bottom{border-bottom-right-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.rounded-left{border-top-left-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.rounded-circle{border-radius:50%!important}.rounded-0{border-radius:0!important}.clearfix::after{display:block;clear:both;content:""}.d-none{display:none!important}.d-inline{display:inline!important}.d-inline-block{display:inline-block!important}.d-block{display:block!important}.d-table{display:table!important}.d-table-row{display:table-row!important}.d-table-cell{display:table-cell!important}.d-flex{display:-ms-flexbox!important;display:flex!important}.d-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}@media (min-width:576px){.d-sm-none{display:none!important}.d-sm-inline{display:inline!important}.d-sm-inline-block{display:inline-block!important}.d-sm-block{display:block!important}.d-sm-table{display:table!important}.d-sm-table-row{display:table-row!important}.d-sm-table-cell{display:table-cell!important}.d-sm-flex{display:-ms-flexbox!important;display:flex!important}.d-sm-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:768px){.d-md-none{display:none!important}.d-md-inline{display:inline!important}.d-md-inline-block{display:inline-block!important}.d-md-block{display:block!important}.d-md-table{display:table!important}.d-md-table-row{display:table-row!important}.d-md-table-cell{display:table-cell!important}.d-md-flex{display:-ms-flexbox!important;display:flex!important}.d-md-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:992px){.d-lg-none{display:none!important}.d-lg-inline{display:inline!important}.d-lg-inline-block{display:inline-block!important}.d-lg-block{display:block!important}.d-lg-table{display:table!important}.d-lg-table-row{display:table-row!important}.d-lg-table-cell{display:table-cell!important}.d-lg-flex{display:-ms-flexbox!important;display:flex!important}.d-lg-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:1200px){.d-xl-none{display:none!important}.d-xl-inline{display:inline!important}.d-xl-inline-block{display:inline-block!important}.d-xl-block{display:block!important}.d-xl-table{display:table!important}.d-xl-table-row{display:table-row!important}.d-xl-table-cell{display:table-cell!important}.d-xl-flex{display:-ms-flexbox!important;display:flex!important}.d-xl-inline-flex{display:-ms-inline-flexbox!important;display:inline-flex!important}}.d-print-block{display:none!important}@media print{.d-print-block{display:block!important}}.d-print-inline{display:none!important}@media print{.d-print-inline{display:inline!important}}.d-print-inline-block{display:none!important}@media print{.d-print-inline-block{display:inline-block!important}}@media print{.d-print-none{display:none!important}}.embed-responsive{position:relative;display:block;width:100%;padding:0;overflow:hidden}.embed-responsive::before{display:block;content:""}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-21by9::before{padding-top:42.857143%}.embed-responsive-16by9::before{padding-top:56.25%}.embed-responsive-4by3::before{padding-top:75%}.embed-responsive-1by1::before{padding-top:100%}.flex-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-center{-ms-flex-align:center!important;align-items:center!important}.align-items-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}@media (min-width:576px){.flex-sm-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-sm-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-sm-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-sm-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-sm-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-sm-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-sm-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-sm-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-sm-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-sm-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-sm-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-sm-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-sm-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-sm-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-sm-center{-ms-flex-align:center!important;align-items:center!important}.align-items-sm-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-sm-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-sm-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-sm-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-sm-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-sm-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-sm-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-sm-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-sm-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-sm-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-sm-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-sm-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-sm-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-sm-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:768px){.flex-md-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-md-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-md-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-md-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-md-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-md-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-md-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-md-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-md-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-md-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-md-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-md-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-md-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-md-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-md-center{-ms-flex-align:center!important;align-items:center!important}.align-items-md-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-md-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-md-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-md-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-md-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-md-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-md-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-md-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-md-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-md-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-md-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-md-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-md-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-md-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:992px){.flex-lg-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-lg-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-lg-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-lg-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-lg-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-lg-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-lg-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-lg-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-lg-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-lg-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-lg-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-lg-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-lg-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-lg-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-lg-center{-ms-flex-align:center!important;align-items:center!important}.align-items-lg-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-lg-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-lg-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-lg-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-lg-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-lg-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-lg-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-lg-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-lg-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-lg-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-lg-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-lg-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-lg-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-lg-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:1200px){.flex-xl-row{-ms-flex-direction:row!important;flex-direction:row!important}.flex-xl-column{-ms-flex-direction:column!important;flex-direction:column!important}.flex-xl-row-reverse{-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-xl-column-reverse{-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-xl-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-xl-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-xl-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-xl-start{-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-xl-end{-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-xl-center{-ms-flex-pack:center!important;justify-content:center!important}.justify-content-xl-between{-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-xl-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-xl-start{-ms-flex-align:start!important;align-items:flex-start!important}.align-items-xl-end{-ms-flex-align:end!important;align-items:flex-end!important}.align-items-xl-center{-ms-flex-align:center!important;align-items:center!important}.align-items-xl-baseline{-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-xl-stretch{-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-xl-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-xl-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-xl-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-xl-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-xl-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-xl-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-xl-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-xl-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-xl-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-xl-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-xl-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-xl-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}.float-left{float:left!important}.float-right{float:right!important}.float-none{float:none!important}@media (min-width:576px){.float-sm-left{float:left!important}.float-sm-right{float:right!important}.float-sm-none{float:none!important}}@media (min-width:768px){.float-md-left{float:left!important}.float-md-right{float:right!important}.float-md-none{float:none!important}}@media (min-width:992px){.float-lg-left{float:left!important}.float-lg-right{float:right!important}.float-lg-none{float:none!important}}@media (min-width:1200px){.float-xl-left{float:left!important}.float-xl-right{float:right!important}.float-xl-none{float:none!important}}.position-static{position:static!important}.position-relative{position:relative!important}.position-absolute{position:absolute!important}.position-fixed{position:fixed!important}.position-sticky{position:-webkit-sticky!important;position:sticky!important}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.fixed-bottom{position:fixed;right:0;bottom:0;left:0;z-index:1030}@supports ((position:-webkit-sticky) or (position:sticky)){.sticky-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;-webkit-clip-path:inset(50%);clip-path:inset(50%);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal;-webkit-clip-path:none;clip-path:none}.w-25{width:25%!important}.w-50{width:50%!important}.w-75{width:75%!important}.w-100{width:100%!important}.h-25{height:25%!important}.h-50{height:50%!important}.h-75{height:75%!important}.h-100{height:100%!important}.mw-100{max-width:100%!important}.mh-100{max-height:100%!important}.m-0{margin:0!important}.mt-0,.my-0{margin-top:0!important}.mr-0,.mx-0{margin-right:0!important}.mb-0,.my-0{margin-bottom:0!important}.ml-0,.mx-0{margin-left:0!important}.m-1{margin:.25rem!important}.mt-1,.my-1{margin-top:.25rem!important}.mr-1,.mx-1{margin-right:.25rem!important}.mb-1,.my-1{margin-bottom:.25rem!important}.ml-1,.mx-1{margin-left:.25rem!important}.m-2{margin:.5rem!important}.mt-2,.my-2{margin-top:.5rem!important}.mr-2,.mx-2{margin-right:.5rem!important}.mb-2,.my-2{margin-bottom:.5rem!important}.ml-2,.mx-2{margin-left:.5rem!important}.m-3{margin:1rem!important}.mt-3,.my-3{margin-top:1rem!important}.mr-3,.mx-3{margin-right:1rem!important}.mb-3,.my-3{margin-bottom:1rem!important}.ml-3,.mx-3{margin-left:1rem!important}.m-4{margin:1.5rem!important}.mt-4,.my-4{margin-top:1.5rem!important}.mr-4,.mx-4{margin-right:1.5rem!important}.mb-4,.my-4{margin-bottom:1.5rem!important}.ml-4,.mx-4{margin-left:1.5rem!important}.m-5{margin:3rem!important}.mt-5,.my-5{margin-top:3rem!important}.mr-5,.mx-5{margin-right:3rem!important}.mb-5,.my-5{margin-bottom:3rem!important}.ml-5,.mx-5{margin-left:3rem!important}.p-0{padding:0!important}.pt-0,.py-0{padding-top:0!important}.pr-0,.px-0{padding-right:0!important}.pb-0,.py-0{padding-bottom:0!important}.pl-0,.px-0{padding-left:0!important}.p-1{padding:.25rem!important}.pt-1,.py-1{padding-top:.25rem!important}.pr-1,.px-1{padding-right:.25rem!important}.pb-1,.py-1{padding-bottom:.25rem!important}.pl-1,.px-1{padding-left:.25rem!important}.p-2{padding:.5rem!important}.pt-2,.py-2{padding-top:.5rem!important}.pr-2,.px-2{padding-right:.5rem!important}.pb-2,.py-2{padding-bottom:.5rem!important}.pl-2,.px-2{padding-left:.5rem!important}.p-3{padding:1rem!important}.pt-3,.py-3{padding-top:1rem!important}.pr-3,.px-3{padding-right:1rem!important}.pb-3,.py-3{padding-bottom:1rem!important}.pl-3,.px-3{padding-left:1rem!important}.p-4{padding:1.5rem!important}.pt-4,.py-4{padding-top:1.5rem!important}.pr-4,.px-4{padding-right:1.5rem!important}.pb-4,.py-4{padding-bottom:1.5rem!important}.pl-4,.px-4{padding-left:1.5rem!important}.p-5{padding:3rem!important}.pt-5,.py-5{padding-top:3rem!important}.pr-5,.px-5{padding-right:3rem!important}.pb-5,.py-5{padding-bottom:3rem!important}.pl-5,.px-5{padding-left:3rem!important}.m-auto{margin:auto!important}.mt-auto,.my-auto{margin-top:auto!important}.mr-auto,.mx-auto{margin-right:auto!important}.mb-auto,.my-auto{margin-bottom:auto!important}.ml-auto,.mx-auto{margin-left:auto!important}@media (min-width:576px){.m-sm-0{margin:0!important}.mt-sm-0,.my-sm-0{margin-top:0!important}.mr-sm-0,.mx-sm-0{margin-right:0!important}.mb-sm-0,.my-sm-0{margin-bottom:0!important}.ml-sm-0,.mx-sm-0{margin-left:0!important}.m-sm-1{margin:.25rem!important}.mt-sm-1,.my-sm-1{margin-top:.25rem!important}.mr-sm-1,.mx-sm-1{margin-right:.25rem!important}.mb-sm-1,.my-sm-1{margin-bottom:.25rem!important}.ml-sm-1,.mx-sm-1{margin-left:.25rem!important}.m-sm-2{margin:.5rem!important}.mt-sm-2,.my-sm-2{margin-top:.5rem!important}.mr-sm-2,.mx-sm-2{margin-right:.5rem!important}.mb-sm-2,.my-sm-2{margin-bottom:.5rem!important}.ml-sm-2,.mx-sm-2{margin-left:.5rem!important}.m-sm-3{margin:1rem!important}.mt-sm-3,.my-sm-3{margin-top:1rem!important}.mr-sm-3,.mx-sm-3{margin-right:1rem!important}.mb-sm-3,.my-sm-3{margin-bottom:1rem!important}.ml-sm-3,.mx-sm-3{margin-left:1rem!important}.m-sm-4{margin:1.5rem!important}.mt-sm-4,.my-sm-4{margin-top:1.5rem!important}.mr-sm-4,.mx-sm-4{margin-right:1.5rem!important}.mb-sm-4,.my-sm-4{margin-bottom:1.5rem!important}.ml-sm-4,.mx-sm-4{margin-left:1.5rem!important}.m-sm-5{margin:3rem!important}.mt-sm-5,.my-sm-5{margin-top:3rem!important}.mr-sm-5,.mx-sm-5{margin-right:3rem!important}.mb-sm-5,.my-sm-5{margin-bottom:3rem!important}.ml-sm-5,.mx-sm-5{margin-left:3rem!important}.p-sm-0{padding:0!important}.pt-sm-0,.py-sm-0{padding-top:0!important}.pr-sm-0,.px-sm-0{padding-right:0!important}.pb-sm-0,.py-sm-0{padding-bottom:0!important}.pl-sm-0,.px-sm-0{padding-left:0!important}.p-sm-1{padding:.25rem!important}.pt-sm-1,.py-sm-1{padding-top:.25rem!important}.pr-sm-1,.px-sm-1{padding-right:.25rem!important}.pb-sm-1,.py-sm-1{padding-bottom:.25rem!important}.pl-sm-1,.px-sm-1{padding-left:.25rem!important}.p-sm-2{padding:.5rem!important}.pt-sm-2,.py-sm-2{padding-top:.5rem!important}.pr-sm-2,.px-sm-2{padding-right:.5rem!important}.pb-sm-2,.py-sm-2{padding-bottom:.5rem!important}.pl-sm-2,.px-sm-2{padding-left:.5rem!important}.p-sm-3{padding:1rem!important}.pt-sm-3,.py-sm-3{padding-top:1rem!important}.pr-sm-3,.px-sm-3{padding-right:1rem!important}.pb-sm-3,.py-sm-3{padding-bottom:1rem!important}.pl-sm-3,.px-sm-3{padding-left:1rem!important}.p-sm-4{padding:1.5rem!important}.pt-sm-4,.py-sm-4{padding-top:1.5rem!important}.pr-sm-4,.px-sm-4{padding-right:1.5rem!important}.pb-sm-4,.py-sm-4{padding-bottom:1.5rem!important}.pl-sm-4,.px-sm-4{padding-left:1.5rem!important}.p-sm-5{padding:3rem!important}.pt-sm-5,.py-sm-5{padding-top:3rem!important}.pr-sm-5,.px-sm-5{padding-right:3rem!important}.pb-sm-5,.py-sm-5{padding-bottom:3rem!important}.pl-sm-5,.px-sm-5{padding-left:3rem!important}.m-sm-auto{margin:auto!important}.mt-sm-auto,.my-sm-auto{margin-top:auto!important}.mr-sm-auto,.mx-sm-auto{margin-right:auto!important}.mb-sm-auto,.my-sm-auto{margin-bottom:auto!important}.ml-sm-auto,.mx-sm-auto{margin-left:auto!important}}@media (min-width:768px){.m-md-0{margin:0!important}.mt-md-0,.my-md-0{margin-top:0!important}.mr-md-0,.mx-md-0{margin-right:0!important}.mb-md-0,.my-md-0{margin-bottom:0!important}.ml-md-0,.mx-md-0{margin-left:0!important}.m-md-1{margin:.25rem!important}.mt-md-1,.my-md-1{margin-top:.25rem!important}.mr-md-1,.mx-md-1{margin-right:.25rem!important}.mb-md-1,.my-md-1{margin-bottom:.25rem!important}.ml-md-1,.mx-md-1{margin-left:.25rem!important}.m-md-2{margin:.5rem!important}.mt-md-2,.my-md-2{margin-top:.5rem!important}.mr-md-2,.mx-md-2{margin-right:.5rem!important}.mb-md-2,.my-md-2{margin-bottom:.5rem!important}.ml-md-2,.mx-md-2{margin-left:.5rem!important}.m-md-3{margin:1rem!important}.mt-md-3,.my-md-3{margin-top:1rem!important}.mr-md-3,.mx-md-3{margin-right:1rem!important}.mb-md-3,.my-md-3{margin-bottom:1rem!important}.ml-md-3,.mx-md-3{margin-left:1rem!important}.m-md-4{margin:1.5rem!important}.mt-md-4,.my-md-4{margin-top:1.5rem!important}.mr-md-4,.mx-md-4{margin-right:1.5rem!important}.mb-md-4,.my-md-4{margin-bottom:1.5rem!important}.ml-md-4,.mx-md-4{margin-left:1.5rem!important}.m-md-5{margin:3rem!important}.mt-md-5,.my-md-5{margin-top:3rem!important}.mr-md-5,.mx-md-5{margin-right:3rem!important}.mb-md-5,.my-md-5{margin-bottom:3rem!important}.ml-md-5,.mx-md-5{margin-left:3rem!important}.p-md-0{padding:0!important}.pt-md-0,.py-md-0{padding-top:0!important}.pr-md-0,.px-md-0{padding-right:0!important}.pb-md-0,.py-md-0{padding-bottom:0!important}.pl-md-0,.px-md-0{padding-left:0!important}.p-md-1{padding:.25rem!important}.pt-md-1,.py-md-1{padding-top:.25rem!important}.pr-md-1,.px-md-1{padding-right:.25rem!important}.pb-md-1,.py-md-1{padding-bottom:.25rem!important}.pl-md-1,.px-md-1{padding-left:.25rem!important}.p-md-2{padding:.5rem!important}.pt-md-2,.py-md-2{padding-top:.5rem!important}.pr-md-2,.px-md-2{padding-right:.5rem!important}.pb-md-2,.py-md-2{padding-bottom:.5rem!important}.pl-md-2,.px-md-2{padding-left:.5rem!important}.p-md-3{padding:1rem!important}.pt-md-3,.py-md-3{padding-top:1rem!important}.pr-md-3,.px-md-3{padding-right:1rem!important}.pb-md-3,.py-md-3{padding-bottom:1rem!important}.pl-md-3,.px-md-3{padding-left:1rem!important}.p-md-4{padding:1.5rem!important}.pt-md-4,.py-md-4{padding-top:1.5rem!important}.pr-md-4,.px-md-4{padding-right:1.5rem!important}.pb-md-4,.py-md-4{padding-bottom:1.5rem!important}.pl-md-4,.px-md-4{padding-left:1.5rem!important}.p-md-5{padding:3rem!important}.pt-md-5,.py-md-5{padding-top:3rem!important}.pr-md-5,.px-md-5{padding-right:3rem!important}.pb-md-5,.py-md-5{padding-bottom:3rem!important}.pl-md-5,.px-md-5{padding-left:3rem!important}.m-md-auto{margin:auto!important}.mt-md-auto,.my-md-auto{margin-top:auto!important}.mr-md-auto,.mx-md-auto{margin-right:auto!important}.mb-md-auto,.my-md-auto{margin-bottom:auto!important}.ml-md-auto,.mx-md-auto{margin-left:auto!important}}@media (min-width:992px){.m-lg-0{margin:0!important}.mt-lg-0,.my-lg-0{margin-top:0!important}.mr-lg-0,.mx-lg-0{margin-right:0!important}.mb-lg-0,.my-lg-0{margin-bottom:0!important}.ml-lg-0,.mx-lg-0{margin-left:0!important}.m-lg-1{margin:.25rem!important}.mt-lg-1,.my-lg-1{margin-top:.25rem!important}.mr-lg-1,.mx-lg-1{margin-right:.25rem!important}.mb-lg-1,.my-lg-1{margin-bottom:.25rem!important}.ml-lg-1,.mx-lg-1{margin-left:.25rem!important}.m-lg-2{margin:.5rem!important}.mt-lg-2,.my-lg-2{margin-top:.5rem!important}.mr-lg-2,.mx-lg-2{margin-right:.5rem!important}.mb-lg-2,.my-lg-2{margin-bottom:.5rem!important}.ml-lg-2,.mx-lg-2{margin-left:.5rem!important}.m-lg-3{margin:1rem!important}.mt-lg-3,.my-lg-3{margin-top:1rem!important}.mr-lg-3,.mx-lg-3{margin-right:1rem!important}.mb-lg-3,.my-lg-3{margin-bottom:1rem!important}.ml-lg-3,.mx-lg-3{margin-left:1rem!important}.m-lg-4{margin:1.5rem!important}.mt-lg-4,.my-lg-4{margin-top:1.5rem!important}.mr-lg-4,.mx-lg-4{margin-right:1.5rem!important}.mb-lg-4,.my-lg-4{margin-bottom:1.5rem!important}.ml-lg-4,.mx-lg-4{margin-left:1.5rem!important}.m-lg-5{margin:3rem!important}.mt-lg-5,.my-lg-5{margin-top:3rem!important}.mr-lg-5,.mx-lg-5{margin-right:3rem!important}.mb-lg-5,.my-lg-5{margin-bottom:3rem!important}.ml-lg-5,.mx-lg-5{margin-left:3rem!important}.p-lg-0{padding:0!important}.pt-lg-0,.py-lg-0{padding-top:0!important}.pr-lg-0,.px-lg-0{padding-right:0!important}.pb-lg-0,.py-lg-0{padding-bottom:0!important}.pl-lg-0,.px-lg-0{padding-left:0!important}.p-lg-1{padding:.25rem!important}.pt-lg-1,.py-lg-1{padding-top:.25rem!important}.pr-lg-1,.px-lg-1{padding-right:.25rem!important}.pb-lg-1,.py-lg-1{padding-bottom:.25rem!important}.pl-lg-1,.px-lg-1{padding-left:.25rem!important}.p-lg-2{padding:.5rem!important}.pt-lg-2,.py-lg-2{padding-top:.5rem!important}.pr-lg-2,.px-lg-2{padding-right:.5rem!important}.pb-lg-2,.py-lg-2{padding-bottom:.5rem!important}.pl-lg-2,.px-lg-2{padding-left:.5rem!important}.p-lg-3{padding:1rem!important}.pt-lg-3,.py-lg-3{padding-top:1rem!important}.pr-lg-3,.px-lg-3{padding-right:1rem!important}.pb-lg-3,.py-lg-3{padding-bottom:1rem!important}.pl-lg-3,.px-lg-3{padding-left:1rem!important}.p-lg-4{padding:1.5rem!important}.pt-lg-4,.py-lg-4{padding-top:1.5rem!important}.pr-lg-4,.px-lg-4{padding-right:1.5rem!important}.pb-lg-4,.py-lg-4{padding-bottom:1.5rem!important}.pl-lg-4,.px-lg-4{padding-left:1.5rem!important}.p-lg-5{padding:3rem!important}.pt-lg-5,.py-lg-5{padding-top:3rem!important}.pr-lg-5,.px-lg-5{padding-right:3rem!important}.pb-lg-5,.py-lg-5{padding-bottom:3rem!important}.pl-lg-5,.px-lg-5{padding-left:3rem!important}.m-lg-auto{margin:auto!important}.mt-lg-auto,.my-lg-auto{margin-top:auto!important}.mr-lg-auto,.mx-lg-auto{margin-right:auto!important}.mb-lg-auto,.my-lg-auto{margin-bottom:auto!important}.ml-lg-auto,.mx-lg-auto{margin-left:auto!important}}@media (min-width:1200px){.m-xl-0{margin:0!important}.mt-xl-0,.my-xl-0{margin-top:0!important}.mr-xl-0,.mx-xl-0{margin-right:0!important}.mb-xl-0,.my-xl-0{margin-bottom:0!important}.ml-xl-0,.mx-xl-0{margin-left:0!important}.m-xl-1{margin:.25rem!important}.mt-xl-1,.my-xl-1{margin-top:.25rem!important}.mr-xl-1,.mx-xl-1{margin-right:.25rem!important}.mb-xl-1,.my-xl-1{margin-bottom:.25rem!important}.ml-xl-1,.mx-xl-1{margin-left:.25rem!important}.m-xl-2{margin:.5rem!important}.mt-xl-2,.my-xl-2{margin-top:.5rem!important}.mr-xl-2,.mx-xl-2{margin-right:.5rem!important}.mb-xl-2,.my-xl-2{margin-bottom:.5rem!important}.ml-xl-2,.mx-xl-2{margin-left:.5rem!important}.m-xl-3{margin:1rem!important}.mt-xl-3,.my-xl-3{margin-top:1rem!important}.mr-xl-3,.mx-xl-3{margin-right:1rem!important}.mb-xl-3,.my-xl-3{margin-bottom:1rem!important}.ml-xl-3,.mx-xl-3{margin-left:1rem!important}.m-xl-4{margin:1.5rem!important}.mt-xl-4,.my-xl-4{margin-top:1.5rem!important}.mr-xl-4,.mx-xl-4{margin-right:1.5rem!important}.mb-xl-4,.my-xl-4{margin-bottom:1.5rem!important}.ml-xl-4,.mx-xl-4{margin-left:1.5rem!important}.m-xl-5{margin:3rem!important}.mt-xl-5,.my-xl-5{margin-top:3rem!important}.mr-xl-5,.mx-xl-5{margin-right:3rem!important}.mb-xl-5,.my-xl-5{margin-bottom:3rem!important}.ml-xl-5,.mx-xl-5{margin-left:3rem!important}.p-xl-0{padding:0!important}.pt-xl-0,.py-xl-0{padding-top:0!important}.pr-xl-0,.px-xl-0{padding-right:0!important}.pb-xl-0,.py-xl-0{padding-bottom:0!important}.pl-xl-0,.px-xl-0{padding-left:0!important}.p-xl-1{padding:.25rem!important}.pt-xl-1,.py-xl-1{padding-top:.25rem!important}.pr-xl-1,.px-xl-1{padding-right:.25rem!important}.pb-xl-1,.py-xl-1{padding-bottom:.25rem!important}.pl-xl-1,.px-xl-1{padding-left:.25rem!important}.p-xl-2{padding:.5rem!important}.pt-xl-2,.py-xl-2{padding-top:.5rem!important}.pr-xl-2,.px-xl-2{padding-right:.5rem!important}.pb-xl-2,.py-xl-2{padding-bottom:.5rem!important}.pl-xl-2,.px-xl-2{padding-left:.5rem!important}.p-xl-3{padding:1rem!important}.pt-xl-3,.py-xl-3{padding-top:1rem!important}.pr-xl-3,.px-xl-3{padding-right:1rem!important}.pb-xl-3,.py-xl-3{padding-bottom:1rem!important}.pl-xl-3,.px-xl-3{padding-left:1rem!important}.p-xl-4{padding:1.5rem!important}.pt-xl-4,.py-xl-4{padding-top:1.5rem!important}.pr-xl-4,.px-xl-4{padding-right:1.5rem!important}.pb-xl-4,.py-xl-4{padding-bottom:1.5rem!important}.pl-xl-4,.px-xl-4{padding-left:1.5rem!important}.p-xl-5{padding:3rem!important}.pt-xl-5,.py-xl-5{padding-top:3rem!important}.pr-xl-5,.px-xl-5{padding-right:3rem!important}.pb-xl-5,.py-xl-5{padding-bottom:3rem!important}.pl-xl-5,.px-xl-5{padding-left:3rem!important}.m-xl-auto{margin:auto!important}.mt-xl-auto,.my-xl-auto{margin-top:auto!important}.mr-xl-auto,.mx-xl-auto{margin-right:auto!important}.mb-xl-auto,.my-xl-auto{margin-bottom:auto!important}.ml-xl-auto,.mx-xl-auto{margin-left:auto!important}}.text-justify{text-align:justify!important}.text-nowrap{white-space:nowrap!important}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-left{text-align:left!important}.text-right{text-align:right!important}.text-center{text-align:center!important}@media (min-width:576px){.text-sm-left{text-align:left!important}.text-sm-right{text-align:right!important}.text-sm-center{text-align:center!important}}@media (min-width:768px){.text-md-left{text-align:left!important}.text-md-right{text-align:right!important}.text-md-center{text-align:center!important}}@media (min-width:992px){.text-lg-left{text-align:left!important}.text-lg-right{text-align:right!important}.text-lg-center{text-align:center!important}}@media (min-width:1200px){.text-xl-left{text-align:left!important}.text-xl-right{text-align:right!important}.text-xl-center{text-align:center!important}}.text-lowercase{text-transform:lowercase!important}.text-uppercase{text-transform:uppercase!important}.text-capitalize{text-transform:capitalize!important}.font-weight-light{font-weight:300!important}.font-weight-normal{font-weight:400!important}.font-weight-bold{font-weight:700!important}.font-italic{font-style:italic!important}.text-white{color:#fff!important}.text-primary{color:#007bff!important}a.text-primary:focus,a.text-primary:hover{color:#0062cc!important}.text-secondary{color:#868e96!important}a.text-secondary:focus,a.text-secondary:hover{color:#6c757d!important}.text-success{color:#28a745!important}a.text-success:focus,a.text-success:hover{color:#1e7e34!important}.text-info{color:#17a2b8!important}a.text-info:focus,a.text-info:hover{color:#117a8b!important}.text-warning{color:#ffc107!important}a.text-warning:focus,a.text-warning:hover{color:#d39e00!important}.text-danger{color:#dc3545!important}a.text-danger:focus,a.text-danger:hover{color:#bd2130!important}.text-light{color:#f8f9fa!important}a.text-light:focus,a.text-light:hover{color:#dae0e5!important}.text-dark{color:#343a40!important}a.text-dark:focus,a.text-dark:hover{color:#1d2124!important}.text-muted{color:#868e96!important}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.visible{visibility:visible!important}.invisible{visibility:hidden!important} +/*# sourceMappingURL=bootstrap.min.css.map */ \ No newline at end of file diff --git a/assets/webTemplates/BASIC/css/style.css b/assets/webTemplates/BASIC/css/style.css new file mode 100644 index 0000000..caa6be1 --- /dev/null +++ b/assets/webTemplates/BASIC/css/style.css @@ -0,0 +1,18 @@ +*{ + box-sizing: border-box; +} + +body{ + background: linear-gradient(-60deg, #ff5858 0%, #f09819 100%); +} + +.center{ + text-align: center; +} + +p{ + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-size: 30px; + font-weight: 700; + color: #fff; +} \ No newline at end of file diff --git a/assets/webTemplates/BASIC/dist/bundle.js b/assets/webTemplates/BASIC/dist/bundle.js new file mode 100644 index 0000000..4b5cf45 --- /dev/null +++ b/assets/webTemplates/BASIC/dist/bundle.js @@ -0,0 +1,342 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/dist/"; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 2); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(3) + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(4) + + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _furhatCore = __webpack_require__(0); + +var _furhatCore2 = _interopRequireDefault(_furhatCore); + +var _furhatGui = __webpack_require__(1); + +var _furhatGui2 = _interopRequireDefault(_furhatGui); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(0, _furhatGui2.default)(function (furhat) { + furhat.subscribe('furhatos.event.responses.ResponseSkillGUIName', function (data) { + if (data.port == window.location.port) { + setPageTitle(data.name); + } + }); + + furhat.subscribe('furhatos.event.actions.ActionSkillGUIClear', function (data) { + if (data.port == window.location.port) { + clearScreen(); + } + }); + + furhat.subscribe('furhatos.event.actions.ActionSkillGUIWrite', function (data) { + if (data.port == window.location.port) { + clearScreen(); + appendText(data.text); + } + }); + + furhat.subscribe('furhatos.event.actions.ActionSkillGUIAppend', function (data) { + if (data.port == window.location.port) { + appendText(data.text); + } + }); + + furhat.send({ + event_name: 'furhatos.event.requests.RequestSkillGUIName', + port: window.location.port + }); +}); + +function setPageTitle(title) { + document.getElementsByTagName("title")[0].innerText = title; +} + +function appendText(text) { + var p = document.createElement('p'); + + p.innerText = text; + document.getElementById('root').appendChild(p); +} + +function clearScreen() { + var root = document.getElementById('root'); + + while (root.firstChild) { + root.removeChild(root.firstChild); + } +} + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +// Constants +const OPEN = 'open'; +const CLOSE = 'closed'; +const FAIL = 'failed'; + +/** + * Furhat main class. Maintains the websocket connection to furhatOS and + * has methods to send events, subscribe to events and helper methods such as say, + * gesture, etc. + */ +class Furhat { + constructor() { + this.eventFunctions = {}; + } + + /** + * Initializes the furhat socket connection and executes the callback method. + * @param domain IP Address for furhatOS - localhost if SDK. + * @param port port for RealTimeAPI module of furhatOS. + * @param route route for RealTimeAPI module of furhatOS. + * @param callback callback method to be executed on successful opening of websocket. + */ + init(domain, port, route, callback) { + if (this.socket !== undefined) { + this.socket.close(); + } + console.log(`initializing ws://${domain}:${port}/${route}`); // eslint-disable-line no-console + this.socket = new window.WebSocket(`ws://${domain}:${port}/${route}`); // eslint-disable-line no-undef + + this.socket.onopen = () => { + this.status = OPEN; + if (callback !== undefined) { + callback(OPEN, this); + } + }; + this.socket.onmessage = event => { + if (this.eventFunctions[JSON.parse(event.data).event_name] !== undefined) { + this.eventFunctions[JSON.parse(event.data).event_name](JSON.parse(event.data)); + } + }; + this.socket.onclose = () => { + this.status = CLOSE; + if (callback !== undefined) { + callback(CLOSE, this); + } + }; + this.socket.onerror = () => { + this.status = FAIL; + if (callback !== undefined) { + callback(FAIL, this); + } + }; + } + + /** + * Sends an event to furhatOS + * @param event Object containing the event. Mandtory to have event_name parameter in the object + */ + send(event) { + if (this.socket.readyState === 2 || this.socket.readyState === 3) { + // SHIT + } else if (this.socket.readyState === 1) { + this.socket.send(JSON.stringify(event)); + } + } + + /** + * Subscribes to the given event and triggers the supplied callback on event + * @param eventName Name of the event to subscribe + * @param callback Function which needs to be triggered when the given event is recieved + * @param dontSend [Optional] [false by default] Boolean which determines wether to send + * the subscribe event or not. use it to set callbacks for event that are already subscribed to, + * for instance with group subscriptions + */ + subscribe(eventName, callback, dontSend = false) { + const event = { event_name: 'furhatos.event.actions.ActionRealTimeAPISubscribe', name: eventName }; + this.eventFunctions[eventName] = callback; + if (!dontSend) { + this.send(event); + } + } + + /** + * Subscribes to the given event group + * @param groupNumber Number(Assigned ENUM) of the group that needs to be subscribed to + */ + subscribeGroup(groupNumber) { + const event = { event_name: 'furhatos.event.actions.ActionRealTimeAPISubscribe', group: groupNumber }; + this.send(event); + } + + /** + * Says a given text + * @param text Text which needs to be said by Furhat + */ + say(text) { + const event = { event_name: 'furhatos.event.actions.ActionSpeech', text }; + this.send(event); + } + + /** + * Stimulates the speech of a user in the interaction space + * @param text Text which needs to be said by the user + */ + userSpeech(text) { + const event = { event_name: 'furhatos.event.senses.SenseTypingEnd', messageText: text }; + this.send(event); + } + + /** + * Stimulates SenseSpeechStart event. Can be used to stimulate user speech via typing + */ + userSpeechStart() { + const event = { event_name: 'furhatos.event.senses.SenseTypingStart' }; + this.send(event); + } + + /** + * Performs the given gesture + * @param name Name of the gesture that needs to be performed + */ + gesture(name) { + const event = { event_name: 'furhatos.event.actions.ActionGesture', name }; + this.send(event); + } +} + +exports.default = Furhat; + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _furhatCore = __webpack_require__(0); + +var _furhatCore2 = _interopRequireDefault(_furhatCore); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +let portNumber; +let callbackFun; + +const InitCallback = (status, hat) => { + if (status === 'open') { + hat.send({ + event_name: 'furhatos.event.senses.SenseSkillGUIConnected', + port: portNumber + }); + callbackFun(hat); + } +}; + +/** + * FurhatGUI Function which sets up a connection to the furhat skill and gives + * the furhat object to send and recieve events to the skill. + * @param callback callback that needs to be triggered when a sucessful connection is established + */ +const FurhatGUI = callback => { + if (callback !== undefined && typeof callback === 'function') { + window.fetch('/port', { method: 'GET' }).then(r => { + // eslint-disable-line no-undef + r.json().then(o => { + const furhat = new _furhatCore2.default(); + portNumber = o.port; + callbackFun = callback; + furhat.init(o.address, o.port, 'api', InitCallback); // eslint-disable-line no-undef + }); + }); + } +}; + +exports.default = FurhatGUI; + +/***/ }) +/******/ ]); \ No newline at end of file diff --git a/assets/webTemplates/BASIC/index.html b/assets/webTemplates/BASIC/index.html new file mode 100644 index 0000000..739a184 --- /dev/null +++ b/assets/webTemplates/BASIC/index.html @@ -0,0 +1,21 @@ + + + + + + + + Furhat Skill + + +
+
+
+
+
+
+
+
+ + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..52c756e --- /dev/null +++ b/build.gradle @@ -0,0 +1,70 @@ +plugins { + id 'org.jetbrains.kotlin.jvm' version '1.8.21' + id 'com.github.johnrengelman.shadow' version '6.1.0' +} + +apply plugin: 'java' +apply plugin: 'kotlin' + +//Defines what version of Java to use. +sourceCompatibility = 1.8 + +//Defines how Kotlin should compile. +compileKotlin { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + kotlinOptions { + //Defines what jvm bytecode to use, 1.8 rather than 1.6 + jvmTarget = "1.8" + apiVersion = "1.8" + languageVersion = "1.8" + } +} + +//Defines how Kotlin should compile when testingTry to keep it the same as compileKotlin. +compileTestKotlin { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + kotlinOptions { + //Defines what jvm bytecode to use, 1.8 rather than 1.6 + jvmTarget = "1.8" + apiVersion = "1.8" + languageVersion = "1.8" + } +} + +repositories { + mavenLocal() + mavenCentral() + maven { url "https://s3-eu-west-1.amazonaws.com/furhat-maven/releases"} + maven { url 'https://repo.gradle.org/gradle/libs-releases' } + maven { url { "https://repo1.maven.org/maven2/" } } +} + + +dependencies { + implementation 'com.furhatrobotics.furhatos:furhat-commons:2.9.0' + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3" +} + +jar { + def lowerCasedName = baseName.toLowerCase() + def normalizedName = lowerCasedName.substring(0,1).toUpperCase() + lowerCasedName.substring(1) + manifest.attributes( + 'Class-Path': configurations.compileClasspath.collect { it.getName() }.join(' '), + 'Main-Class': "furhatos.app.${lowerCasedName}.${normalizedName}Skill" + ) +} + +//ShadowJar depends on jar being finished properly. +shadowJar { + manifest { + exclude '**/Log4j2Plugins.dat' + exclude '**/node_modules' + } + from "skill.properties" + from "assets" + extension 'skill' +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7a3265e Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..273a260 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/skill.properties b/skill.properties new file mode 100644 index 0000000..0e3807c --- /dev/null +++ b/skill.properties @@ -0,0 +1,15 @@ +name = Blank +mainclass = furhatos.app.blank.BlankSkill +version = 1.0.0 +language = en-US +logLevel = INFO +#You may set this to a Furhat version. +requiresVersion = false +#Set to true if this skill should fail if there is no camera +requiresCamera = false +#Set to true if this skill should fail if there is no speaker +requiresSpeaker = false +#Set to true if this skill should fail if there is no microphone +requiresMicrophone = false +#Set to true if this skill should fail if there is no active recognizer +requiresRecognizer = false \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/init.kt b/src/main/kotlin/furhatos/app/blank/flow/init.kt new file mode 100644 index 0000000..15e18dc --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/init.kt @@ -0,0 +1,26 @@ +package furhatos.app.blank.flow + +import furhatos.app.blank.flow.main.Idle +import furhatos.app.blank.flow.main.supporting.SmileIdle +import furhatos.app.blank.setting.DISTANCE_TO_ENGAGE +import furhatos.app.blank.setting.MAX_NUMBER_OF_USERS +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.furhat +import furhatos.flow.kotlin.state +import furhatos.flow.kotlin.users +import furhatos.util.Gender +import furhatos.util.Language + +val Init: State = state { + init { + /** Set our default interaction parameters */ + users.setSimpleEngagementPolicy(DISTANCE_TO_ENGAGE, MAX_NUMBER_OF_USERS) + furhat.setVoice(Language.SLOVAK, gender = Gender.FEMALE) + furhat.gesture(SmileIdle, async = true) + } + onEntry { + + goto(Idle) + } + +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/SessionLogger.kt b/src/main/kotlin/furhatos/app/blank/flow/main/SessionLogger.kt new file mode 100644 index 0000000..b66b247 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/SessionLogger.kt @@ -0,0 +1,433 @@ +package furhatos.app.blank.flow.main + +import furhatos.app.blank.flow.main.supporting.general.sendLogEvent +import furhatos.app.blank.flow.main.supporting.general.sendLogJsonLine +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths +import java.nio.file.StandardOpenOption +import java.util.UUID +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import kotlin.concurrent.thread +import java.util.concurrent.atomic.AtomicBoolean + +object SessionLogger { + + private val logsDir: Path = Paths.get(System.getProperty("user.dir"), "logs") + private val csvLogFile: Path = logsDir.resolve("sessions_log.csv") + private val pendingLogFile: Path = logsDir.resolve("pending_logs.jsonl") + private var sessionId: String = "" + + private val pendingFileLock = Any() + private val flushInProgress = AtomicBoolean(false) + + init { + if (!Files.exists(logsDir)) { + Files.createDirectories(logsDir) + } + + if (!Files.exists(csvLogFile)) { + Files.write( + csvLogFile, + "timestamp;session_id;game;phase;question;attempt;result;correct_answer;user_answer;hint_used\n" + .toByteArray(Charsets.UTF_8), + StandardOpenOption.CREATE, + StandardOpenOption.APPEND + ) + } + + if (!Files.exists(pendingLogFile)) { + Files.createFile(pendingLogFile) + } + } + + private fun newSessionId(): String { + return UUID.randomUUID() + .toString() + .replace("-", "") + .take(6) + .uppercase() + } + + private fun esc(value: String?): String { + if (value == null) return "" + return value + .replace("\"", "\"\"") + .replace("\n", " ") + .replace("\r", " ") + .trim() + } + + private fun jsonEscape(value: String?): String { + if (value == null) return "" + return value + .replace("\\", "\\\\") + .replace("\"", "\\\"") + .replace("\n", "\\n") + .replace("\r", "\\r") + .replace("\t", "\\t") + } + + private fun buildCsvLine( + ts: String, + sessionId: String, + game: String, + phase: String, + question: String, + attempt: Int, + result: String, + correctAnswer: String, + userAnswer: String?, + hintUsed: Boolean + ): String { + return buildString { + append('"').append(esc(ts)).append('"').append(';') + append('"').append(esc(sessionId)).append('"').append(';') + append('"').append(esc(game)).append('"').append(';') + append('"').append(esc(phase)).append('"').append(';') + append('"').append(esc(question)).append('"').append(';') + append(attempt).append(';') + append('"').append(esc(result)).append('"').append(';') + append('"').append(esc(correctAnswer)).append('"').append(';') + append('"').append(esc(userAnswer)).append('"').append(';') + append(hintUsed) + append('\n') + } + } + + private fun buildJsonLine( + ts: String, + sessionId: String, + game: String, + phase: String, + question: String, + attempt: Int, + result: String, + correctAnswer: String, + userAnswer: String?, + hintUsed: Boolean + ): String { + return buildString { + append("{") + append("\"created_at\":\"").append(jsonEscape(ts)).append("\",") + append("\"session_id\":\"").append(jsonEscape(sessionId)).append("\",") + append("\"game\":\"").append(jsonEscape(game)).append("\",") + append("\"phase\":\"").append(jsonEscape(phase)).append("\",") + append("\"question\":\"").append(jsonEscape(question)).append("\",") + append("\"attempt\":").append(attempt).append(",") + append("\"result\":\"").append(jsonEscape(result)).append("\",") + + append("\"user_answer\":") + if (userAnswer.isNullOrBlank()) append("null") + else append("\"").append(jsonEscape(userAnswer)).append("\"") + append(",") + + append("\"correct_answer\":") + if (correctAnswer.isBlank()) append("null") + else append("\"").append(jsonEscape(correctAnswer)).append("\"") + append(",") + + append("\"hint_used\":").append(hintUsed) + append("}") + } + } + + // NEW: all pending-file operations go through one lock + private fun readPendingLinesLocked(): List { + if (!Files.exists(pendingLogFile)) return emptyList() + + return Files.readAllLines(pendingLogFile, Charsets.UTF_8) + .map { it.trim() } + .filter { it.isNotBlank() } + } + + // NEW + private fun writePendingLinesLocked(lines: List) { + val content = + if (lines.isEmpty()) "" + else lines.joinToString(separator = "\n", postfix = "\n") + + Files.write( + pendingLogFile, + content.toByteArray(Charsets.UTF_8), + StandardOpenOption.CREATE, + StandardOpenOption.TRUNCATE_EXISTING + ) + } + + private fun appendPendingJsonLine(jsonLine: String) { + synchronized(pendingFileLock) { + Files.write( + pendingLogFile, + (jsonLine + "\n").toByteArray(Charsets.UTF_8), + StandardOpenOption.CREATE, + StandardOpenOption.APPEND + ) + } + } + +// private fun appendPendingJsonLine(jsonLine: String) { +// Files.write( +// pendingLogFile, +// (jsonLine + "\n").toByteArray(Charsets.UTF_8), +// StandardOpenOption.CREATE, +// StandardOpenOption.APPEND +// ) +// } + +// @Synchronized +// fun flushPendingLogs() { +// if (!Files.exists(pendingLogFile)) return +// +// val lines = Files.readAllLines(pendingLogFile, Charsets.UTF_8) +// .map { it.trim() } +// .filter { it.isNotBlank() } +// +// if (lines.isEmpty()) return +// +// val failedLines = mutableListOf() +// +// for (line in lines) { +// val sent = try { +// sendLogJsonLine(line) +// } catch (e: Exception) { +// println("flushPendingLogs exception: ${e.message}") +// false +// } +// +// if (!sent) { +// failedLines.add(line) +// } +// } +// +// val newContent = +// if (failedLines.isEmpty()) "" +// else failedLines.joinToString(separator = "\n", postfix = "\n") +// +// Files.write( +// pendingLogFile, +// newContent.toByteArray(Charsets.UTF_8), +// StandardOpenOption.TRUNCATE_EXISTING +// ) +// } + + // NEW: background flush + fun flushPendingLogsAsync() { + if (!flushInProgress.compareAndSet(false, true)) { + println("SessionLogger: flush already in progress, skip") + return + } + + thread(isDaemon = true, name = "pending-log-flush") { + try { + // 1) Take current batch and immediately free file for new records + val batch = synchronized(pendingFileLock) { + val lines = readPendingLinesLocked() + if (lines.isNotEmpty()) { + writePendingLinesLocked(emptyList()) + } + lines + } + + if (batch.isEmpty()) { + println("SessionLogger: no pending logs to flush") + return@thread + } + + // 2) Send outside file lock + val failedLines = mutableListOf() + + for (line in batch) { + val sent = try { + sendLogJsonLine(line) + } catch (e: Exception) { + println("flushPendingLogsAsync exception: ${e.message}") + false + } + + if (!sent) { + failedLines.add(line) + } + } + + // 3) Put back only failed old lines + lines added meanwhile + synchronized(pendingFileLock) { + val freshLines = readPendingLinesLocked() + val merged = failedLines + freshLines + writePendingLinesLocked(merged) + } + + println("SessionLogger: background flush finished, failed=${failedLines.size}") + } finally { + flushInProgress.set(false) + } + } + } + + @Synchronized + fun startNewSession() { + sessionId = newSessionId() + + log( + game = "system", + phase = "session", + question = "greeting", + attempt = 0, + result = "session_started", + correctAnswer = "", + userAnswer = "", + hintUsed = false + ) + } + + @Synchronized + fun log( + game: String, + phase: String, + question: String, + attempt: Int, + result: String, + correctAnswer: String = "", + userAnswer: String? = "", + hintUsed: Boolean = false + ) { + if (sessionId.isBlank()) { + sessionId = newSessionId() + } + + val ts = OffsetDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME) +// val ts = OffsetDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + + val csvLine = buildCsvLine( + ts = ts, + sessionId = sessionId, + game = game, + phase = phase, + question = question, + attempt = attempt, + result = result, + correctAnswer = correctAnswer, + userAnswer = userAnswer, + hintUsed = hintUsed + ) + + val jsonLine = buildJsonLine( + ts = ts, + sessionId = sessionId, + game = game, + phase = phase, + question = question, + attempt = attempt, + result = result, + correctAnswer = correctAnswer, + userAnswer = userAnswer, + hintUsed = hintUsed + ) + + // локальный архив + if (shouldWriteCsv()) { + Files.write( + csvLogFile, + csvLine.toByteArray(Charsets.UTF_8), + StandardOpenOption.CREATE, + StandardOpenOption.APPEND + ) + } else { + println("SessionLogger: CSV logging skipped because skill is running on robot") + } +// Files.write( +// csvLogFile, +// csvLine.toByteArray(Charsets.UTF_8), +// StandardOpenOption.CREATE, +// StandardOpenOption.APPEND +// ) + + // потом текущую + val sent = try { + sendLogEvent( + createdAt = ts, + sessionId = sessionId, + game = game, + phase = phase, + question = question, + attempt = attempt, + result = result, + userAnswer = userAnswer?.ifBlank { null }, + correctAnswer = correctAnswer.ifBlank { null }, + hintUsed = hintUsed + ) +// sendLogJsonLine(jsonLine) + } catch (e: Exception) { + println("SessionLogger remote send exception: ${e.message}") + false + } + + if (!sent) { + appendPendingJsonLine(jsonLine) + println("SessionLogger: remote logging failed, saved to pending_logs.jsonl") + } else { + println("SessionLogger: remote logging success") + } + } + + fun isLocalProjectRun(): Boolean { + val userDir = Paths.get(System.getProperty("user.dir")) + + val localMarkers = listOf( + ".idea", + "src", + "build.gradle", + "settings.gradle", + "gradlew", + "gradlew.bat" + ) + + return localMarkers.any { marker -> + Files.exists(userDir.resolve(marker)) + } + } + + fun isRunningOnRobot(): Boolean = !isLocalProjectRun() + + fun shouldWriteCsv(): Boolean = isLocalProjectRun() + + @Synchronized + fun clearCsvIfRunningOnRobot() { + if (!isRunningOnRobot()) return + if (!Files.exists(csvLogFile)) return + + Files.write( + csvLogFile, + "timestamp;session_id;game;phase;question;attempt;result;correct_answer;user_answer;hint_used\n" + .toByteArray(Charsets.UTF_8), + StandardOpenOption.TRUNCATE_EXISTING + ) + + println("SessionLogger: CSV cleared because skill is running on robot") + } + + fun getSessionId(): String = sessionId +} + +//==== test ====== +fun pendingFileStatusMessage(): String { + return try { + val file = Paths.get(System.getProperty("user.dir"), "logs", "pending_logs.jsonl") + + if (!Files.exists(file)) { + return "Pending súbor neexistuje." + } + + val lines = Files.readAllLines(file, Charsets.UTF_8) + .map { it.trim() } + .filter { it.isNotBlank() } + + when { + lines.isEmpty() -> "Pending súbor je prázdny." + else -> "Pending súbor obsahuje ${lines.size} záznamov." + } + } catch (e: Exception) { + "Nepodarilo sa skontrolovať pending súbor." + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/StartQuestion.kt b/src/main/kotlin/furhatos/app/blank/flow/main/StartQuestion.kt new file mode 100644 index 0000000..a10d209 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/StartQuestion.kt @@ -0,0 +1,58 @@ +package furhatos.app.blank.flow.main + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.attention.AttentionTrainingIntro +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.* +import furhatos.flow.kotlin.furhat +import furhatos.app.blank.flow.main.say_time.TimeTrainingIntro +import furhatos.app.blank.flow.main.memory.MemoryTrainingIntro +import furhatos.app.blank.flow.main.say_time.resetTimeQuestions +import furhatos.app.blank.flow.main.supporting.calm +import kotlin.random.Random + +// 1 = TimeTrainingIntro, 2 = MemoryTrainingIntro, 3 = AttentionTrainingIntro + +private var gameBag: MutableList = mutableListOf() + +private fun nextGameFromBag(): Int { + if (gameBag.isEmpty()) { + gameBag = mutableListOf(1, 2, 3).also { it.shuffle() } + } + return gameBag.removeAt(0) +} + +// Reset bag for a new user/session +fun resetTrainingGameBag() { + gameBag.clear() +} + +val StartQuestion: State = state(Parent) { + onEntry { + calm() + when (nextGameFromBag()) { + 1 -> { + furhat.say("Poďme zahrať hru na orientáciu v čase.") + furhat.say("Budem Vám klásť rôzne otázky a Vašou úlohou bude správne pomenovať aktuálny čas.") + delay(1000) + resetTimeQuestions() + goto(TimeTrainingIntro) + } + 2 -> { +// furhat.say("Poviem Vám zoznam slov a Vašou úlohou bude ho zopakovať.") + furhat.say("Poďme zahrať hru na pamäť.") + delay(1000) + resetTimeQuestions() + goto(MemoryTrainingIntro) + } + 3 -> { + furhat.say("Poďme zahrať hru na pozornosť.") + furhat.say("Budem hovoriť slová a pri jednom z nich ma budete musieť zastaviť.") + delay(1000) + resetTimeQuestions() + goto(AttentionTrainingIntro) + } + } + } +} + diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/attention/AST.kt b/src/main/kotlin/furhatos/app/blank/flow/main/attention/AST.kt new file mode 100644 index 0000000..5da43c5 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/attention/AST.kt @@ -0,0 +1,106 @@ +package furhatos.app.blank.flow.main.attention + +object AttentionSmallTalkPhrases { + + fun questionFor(theme: String, target: String): String { + val byTheme = when (theme.lowercase()) { + "ovocie" -> listOf( + "Povedali ste stop pri slove „$target“. Máte radi ovocie?", + "Aké ovocie vám chutí najviac?", + "Dávate si ovocie skôr ráno, alebo počas dňa?" + ) + + "sladké" -> listOf( + "Povedali ste stop pri slove „$target“. Máte radi sladké?", + "Doprajete si občas niečo sladké, alebo skôr nie?", + "Ak by ste si mali vybrať niečo sladké, čo by to bolo?" + ) + + "zelenina" -> listOf( + "„$target“ je zelenina. Máte radi zeleninu?", + "Ktorú zeleninu máte najradšej?", + "Jedávate zeleninu skôr surovú, alebo varenú?" + ) + + "jedlo" -> listOf( + "Slovo „$target“ patrí medzi jedlo. Máte nejaké jedlo, ktoré máte obzvlášť radi?", + "Keď sa povie „$target“, napadne vám naň chuť?", + "Varíte si radšej doma, alebo máte radi aj jedálne či reštaurácie?" + ) + + "bobuľa" -> listOf( + "„$target“ patrí medzi bobule. Máte radi bobuľové ovocie?", + "Spájate si „$target“ skôr s letom, alebo si ho dávate aj počas roka?", + "Máte radšej čerstvé bobule, alebo napríklad v koláči či jogurte?" + ) + + "nápoje" -> listOf( + "„$target“ patrí medzi nápoje. Čo najčastejšie pijete počas dňa?", + "Máte radšej teplé nápoje alebo studené?", + "Keď si chcete oddýchnuť, aký nápoj vám spraví najväčšiu radosť?" + ) + + "prísady" -> listOf( + "„$target“ patrí medzi prísady. Radi varíte alebo pečiete?", + "Používate pri varení skôr jednoduché prísady, alebo radi skúšate nové veci?", + "Máte nejakú prísadu, bez ktorej si varenie neviete predstaviť?" + ) + + "dom" -> listOf( + "Slovo „$target“ patrí k téme domov. Máte doma nejaké miesto, kde sa cítite najlepšie?", + "Máte radšej, keď je doma ticho, alebo keď je tam „živo“?", + "Keď si chcete oddýchnuť doma, čo vám najviac pomáha?" + ) + + "domáce potreby" -> listOf( + "„$target“ patrí medzi domáce potreby. Máte doma veci, ktoré používate každý deň?", + "Máte radi poriadok a systém, alebo skôr „prirodzený chaos“?", + "Keď niečo v domácnosti chýba, všimnete si to hneď?" + ) + + "technika" -> listOf( + "„$target“ patrí medzi techniku. Používate techniku radi, alebo len keď treba?", + "Ktoré zariadenie vám doma najviac uľahčuje život?", + "Skôr máte radi jednoduché veci, alebo vás baví skúšať nové technológie?" + ) + + "príroda" -> listOf( + "„$target“ patrí k prírode. Máte radi pobyt vonku?", + "Čo vám je v prírode príjemnejšie — les, voda, alebo hory?", + "Chodíte radšej na krátke prechádzky, alebo na dlhšie výlety?" + ) + + "mesto" -> listOf( + "„$target“ patrí k téme mesto. Máte radi ruch mesta, alebo skôr pokoj?", + "Keď ste v meste, čo je pre vás najdôležitejšie — doprava, služby, alebo atmosféra?", + "Máte v meste nejaké obľúbené miesto, kam sa radi vraciate?" + ) + + "telo" -> listOf( + "„$target“ súvisí s telom. Venujete sa počas dňa aspoň trochu pohybu?", + "Máte radi, keď je deň aktívny, alebo skôr pokojný?", + "Čo vám najviac pomáha cítiť sa dobre — prechádzka, oddych, alebo rutina?" + ) + + "oblečenie" -> listOf( + "„$target“ patrí k oblečeniu. Máte radi pohodlné oblečenie, alebo skôr elegantné?", + "Vyberáte si oblečenie podľa počasia, alebo skôr podľa nálady?", + "Máte nejakú farbu, ktorú nosíte najradšej?" + ) + + "druh zábavy" -> listOf( + "„$target“ patrí k zábave. Ako najradšej trávite voľný čas?", + "Máte radšej spoločnú zábavu s ľuďmi, alebo pokojnejšie aktivity?", + "Keď si chcete oddýchnuť, čo vás poteší najviac?" + ) + + else -> listOf( + "Zachytili ste slovo „$target“. Je to téma „$theme“. Máte k tomu nejaký vzťah?", + "„$target“ — je to z oblasti „$theme“. Páči sa vám táto téma, alebo skôr nie?", + "Keď počujete „$target“, napadne vám niečo príjemné, alebo skôr neutrálne?" + ) + } + + return byTheme.random() + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/attention/AskAttention.kt b/src/main/kotlin/furhatos/app/blank/flow/main/attention/AskAttention.kt new file mode 100644 index 0000000..b47c3b4 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/attention/AskAttention.kt @@ -0,0 +1,634 @@ +package furhatos.app.blank.flow.main.attention + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.SessionLogger +import furhatos.app.blank.flow.main.StartQuestion +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.flow.main.supporting.AskToContinue +import furhatos.app.blank.flow.main.supporting.general.WordBank +import furhatos.app.blank.flow.main.supporting.general.WordEntry +import furhatos.app.blank.flow.main.supporting.empathy +import furhatos.app.blank.flow.main.supporting.littleSad +import furhatos.app.blank.flow.main.supporting.veryHappy +import furhatos.app.blank.flow.main.supporting.AskIncreaseDifficulty +import furhatos.app.blank.flow.main.memory.WordsChecker +import furhatos.app.blank.flow.main.supporting.AskDecreaseDifficulty +import furhatos.app.blank.flow.main.supporting.ReadyToTrain +import furhatos.app.blank.flow.main.supporting.SmallTalk +import furhatos.app.blank.flow.main.supporting.general.SmallTalkContext +import furhatos.app.blank.flow.main.supporting.general.TrainingMenuFlags +import furhatos.app.blank.flow.main.supporting.general.callProxyRespond +import furhatos.app.blank.flow.main.supporting.general.genericSmallTalk +import furhatos.app.blank.flow.main.supporting.general.isProxyAvailable +import furhatos.app.blank.flow.main.supporting.general.requestSmallTalk +import furhatos.app.blank.flow.main.supporting.happyNod +import furhatos.app.blank.flow.main.supporting.happyShake +import furhatos.app.blank.nlu.base_answer.Repeat +import furhatos.app.blank.nlu.base_answer.StopTraining +import furhatos.flow.kotlin.* +import furhatos.gestures.Gestures +import kotlin.random.Random + +// -------------------- parametre -------------------- + +// na sledovanie toku otázok +private const val MAX_LEVEL = 3 +private const val QUESTIONS_PER_LEVEL = 2 +private const val MAX_SMALLTALK_PER_SESSION = 3 +private const val MAX_SAME_LEVEL_QUESTIONS = 6 + +var sameLevelQuestionsDone: Int = 0 +var difficultyWasIncreased: Boolean = false + +// koľko kôl v aktuálnom bloku z 2 bolo neúspešných +var failedQuestions: Int = 0 + +// Bol aktuálny blok z 2 kôl začatý po zvýšení náročnosti +var currentBlockWasIncreased: Boolean = false + +// príznak výsledku aktuálneho kola pre AfterAttentionResolved +private var attentionRoundFailed: Boolean = false + +// pomocne premenne pre SmallTak +var attentionSmallTalkUsed = 0 +var lastAttentionTheme: String = "" +var lastAttentionTarget: String = "" + +// dĺžka radu slov rastie s úrovňou +private fun lengthForLevel(level: Int, rng: Random = Random.Default): Int = when (level) { + 1 -> listOf(4, 5).random(rng) + 2 -> listOf(8, 9).random(rng) + else -> listOf(10, 11).random(rng) +} + +// okno čakania na „stop“ po každom slove +private fun listenWindowForLevel(level: Int): Long = when (level) { + 1 -> 3800 + 2 -> 3500 + else -> 3200 +// 1 -> 1800 +// 2 -> 1500 +// else -> 1200 +} + +// -------------------- stav sedenia -------------------- + +var attentionLevel: Int = 1 +var doneAtLevel: Int = 0 + +private var wrongAttempts: Int = 0 + +private var targetWord: WordEntry? = null +private var targetIndex: Int = -1 +private var sequence: List = emptyList() +private var currentIndex: Int = 0 + +// -------------------- generovanie zoznamu -------------------- + +private fun buildNewAttentionRound() { + val len = lengthForLevel(attentionLevel) + + // target sa vyberá podľa úrovne + val target = WordBank.pickSequence(length = 1, maxDifficulty = attentionLevel).first() + + // vyberáju sa ostatné slovaokrem target + val others = mutableListOf() + while (others.size < len - 1) { + val cand = WordBank.pickSequence(length = 1, maxDifficulty = attentionLevel).first() + if (cand.canonical != target.canonical && others.none { it.canonical == cand.canonical }) { + others.add(cand) + } + } + + // vkladánie target do náhodnej pozície + val insertAt = Random.nextInt(0, len) + val mixed = others.toMutableList() + mixed.add(insertAt, target) + + targetWord = target + targetIndex = insertAt + sequence = mixed + + currentIndex = 0 + wrongAttempts = 0 +} + +// -------------------- helpery -------------------- + +private fun userSaidStop(text: String?): Boolean { + val t = text ?: return false + val tokens = WordsChecker.tokenizeMeaningful(t) + return tokens.any { it == "stop" } +} + +private fun FlowControlRunner.restartSameRound() { + currentIndex = 0 + // sequence/target остаются те же, чтобы попытка была честной + goto(SayNextWord) +} + +fun requestAttentionExplainWrong(mistakeType: String): String { + val target = targetWord?.canonical ?: "" + val position = targetIndex + 1 + + if (!isProxyAvailable()) { + return "" + } + + return callProxyRespond( + userText = "Používateľ urobil chybu v cvičení pozornosti.", + task = "explain_wrong", + context = mapOf( + "exercise" to "attention", + "mistake_type" to mistakeType, // early_stop / missed_target / wrong_word + "target_word" to target, + "target_position" to position, + "theme" to (targetWord?.theme ?: ""), + "level" to attentionLevel + ) + ) ?: "" +} + +//============================================================== +// Hint +//============================================================== +fun requestAttentionHint(mistakeType: String): String { + val target = targetWord?.canonical ?: "" + + if (!isProxyAvailable()) { + return "" + } + + return callProxyRespond( + userText = "Používateľ potrebuje nápovedu.", + task = "hint", + context = mapOf( + "exercise" to "attention", + "mistake_type" to mistakeType, // early_stop / missed_target + "target_word" to target, + "theme" to (targetWord?.theme ?: ""), + "level" to attentionLevel + ) + ) ?: "" +} + + +//============================================================== +// Small Talk +//============================================================== +val AttentionThemeSmallTalk: State by lazy { + SmallTalk(nextState = AfterAttentionResolved) { + AttentionSmallTalkPhrases.questionFor(lastAttentionTheme, lastAttentionTarget) + } +} + +fun nextStateAfterCorrectAttention(): State { + if (attentionSmallTalkUsed >= MAX_SMALLTALK_PER_SESSION) return AfterAttentionResolved + + // šanca dostať dodatočnú otázku + val totalPlanned = MAX_LEVEL * QUESTIONS_PER_LEVEL // условные 6 заданий + val progress = (attentionLevel - 1) * QUESTIONS_PER_LEVEL + doneAtLevel + val denom = (totalPlanned - progress).coerceAtLeast(1) + + val smallTalkLeft = MAX_SMALLTALK_PER_SESSION - attentionSmallTalkUsed + val percent = minOf(0.5, smallTalkLeft.toDouble() / denom.toDouble()) + + val doSmallTalk = Random.nextDouble() < percent + if (!doSmallTalk) return AfterAttentionResolved + + attentionSmallTalkUsed++ + return AttentionThemeSmallTalk +} + +fun buildSmallTalkContextAttention(): SmallTalkContext { + return SmallTalkContext( + exercise = "attention", + topic = lastAttentionTheme, + subtopic = "theme_question", + targetWord = lastAttentionTarget, + responseMode = "open" + ) +} + +fun smallTalkManagerAttention(): State { + if (attentionSmallTalkUsed >= MAX_SMALLTALK_PER_SESSION) return AfterAttentionResolved + + val totalPlanned = MAX_LEVEL * QUESTIONS_PER_LEVEL + val progress = (attentionLevel - 1) * QUESTIONS_PER_LEVEL + doneAtLevel + val denom = (totalPlanned - progress).coerceAtLeast(1) + + val smallTalkLeft = MAX_SMALLTALK_PER_SESSION - attentionSmallTalkUsed + val percent = minOf(0.5, smallTalkLeft.toDouble() / denom.toDouble()) + + val doSmallTalk = Random.nextDouble() < percent + if (!doSmallTalk) return AfterAttentionResolved + + val ctx = buildSmallTalkContextAttention() + val proxyQuestion = requestSmallTalk(ctx) + + attentionSmallTalkUsed++ + + return if (proxyQuestion.isNotBlank()) { + genericSmallTalk( + context = ctx, + nextState = AfterAttentionResolved, + preparedQuestion = proxyQuestion + ) + } else { + AttentionThemeSmallTalk + } +} + +//============================================================== +// Proces hry +//============================================================== + +// Intro +val AttentionTrainingIntro: State = state(Parent) { + onEntry { + attentionLevel = 1 + doneAtLevel = 0 + attentionSmallTalkUsed = 0 + + sameLevelQuestionsDone = 0 + difficultyWasIncreased = false + + failedQuestions = 0 + currentBlockWasIncreased = false + attentionRoundFailed = false + + buildNewAttentionRound() + goto(AskAttention) + } +} + +// Inštrukcia a začiatok +val AskAttention: State = state(Parent) { + onEntry { + val target = targetWord ?: run { + buildNewAttentionRound() + targetWord!! + } + + delay(1000) + furhat.say("Pripravte sa.") + furhat.say("Keď budete počuť slovo „${target.canonical}“, povedzte prosím: stop.") + delay(1000) + furhat.say("Začíname.") + + SessionLogger.log( + game = "attention", + phase = "question_shown", + question = "LEVEL_${attentionLevel}", + attempt = wrongAttempts + 1, + result = "asked", + correctAnswer = "${target.canonical}@${targetIndex + 1}", + userAnswer = "", + hintUsed = wrongAttempts > 0 + ) + + + + goto(SayNextWord) + } +} + +// ďalšie iné slovo +val SayNextWord: State = state(Parent) { + onEntry { + if (currentIndex >= sequence.size) { + goto(HandleMissedStop) + return@onEntry + } + + val w = sequence[currentIndex] + furhat.say(w.canonical) + + // сразу после слова — короткое окно "молчаливого слушания" + goto(ListenForStop) + } +} + +// počuvanie stop +val ListenForStop: State = state(Parent) { + onEntry { + furhat.param.endSilTimeout = 350 + furhat.param.noSpeechTimeout = listenWindowForLevel(attentionLevel).toInt() + + furhat.attend(users.current) + furhat.listen() + } + + onResponse { + if (handleStop(it.intent, + "attention", + "LEVEL_${attentionLevel}", + it.text ?: "")) + { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } + } + +// onResponse{ +// if (handleRepeat( +// it.intent, +// "attention", +// "LEVEL_${attentionLevel}", +// "${targetWord?.canonical}@${targetIndex + 1}", +// it.text ?: "", +// true +// )) { +// return@onResponse +// } +// } + + onResponse { + if (userSaidStop(it.text)) { + val isCorrectMoment = (currentIndex == targetIndex) + + if (isCorrectMoment) { + SessionLogger.log( + game = "attention", + phase = "answer", + question = "LEVEL_${attentionLevel}", + attempt = wrongAttempts + 1, + result = "success", + correctAnswer = "${targetWord?.canonical}@${targetIndex + 1}", + userAnswer = it.text ?: "", + hintUsed = wrongAttempts > 0 + ) + + furhat.gesture(Gestures.Nod, async = true) + veryHappy() + furhat.say("Výborne! Správne ste zareagovali.") + delay(1000) + + val t = targetWord!! + lastAttentionTheme = t.theme + lastAttentionTarget = t.canonical + + attentionRoundFailed = false + +// goto(nextStateAfterCorrectAttention()) + goto(smallTalkManagerAttention()) + } else { + // 'stop' na inom slove + wrongAttempts++ + + SessionLogger.log( + game = "attention", + phase = "answer", + question = "LEVEL_${attentionLevel}", + attempt = wrongAttempts, + result = "early_stop", + correctAnswer = "${targetWord?.canonical}@${targetIndex + 1}", + userAnswer = it.text ?: "", + hintUsed = wrongAttempts >= 2 + ) + + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say("Zastavili ste ma pri inom slove.") + + val hint = requestAttentionHint("early_stop") + + SessionLogger.log( + game = "attention", + phase = "event", + question = "LEVEL_${attentionLevel}", + attempt = wrongAttempts, + result = "hint_requested_early_stop", + correctAnswer = "${targetWord?.canonical}@${targetIndex + 1}", + userAnswer = it.text ?: "", + hintUsed = true + ) + + if (hint.isNotBlank()){ + furhat.say("Trochu pomôžem Vám! Dajte mi chvíľu, prosím") + furhat.say(hint) + delay(1300) + }else{ + happyShake() + furhat.say("Nevadí.") + furhat.say("Skúsme to ešte raz. Povedzte stop až keď zaznie správne slovo.") + } + + restartSameRound() + } + 2 -> { + val explanation = requestAttentionExplainWrong("early_stop") + val target = targetWord!!.canonical + + if (explanation.isNotBlank()){ + furhat.say(explanation) + }else{ + empathy() + furhat.say("Pomôžem Vám. Správne slovo je „$target“. Skúsme znova.") + } + + restartSameRound() + } + else -> { + goto(FinalWrongAnswer) + } + } + } + return@onResponse + } + + // používateľ povedal niečo iné — ignorovať + currentIndex++ + goto(SayNextWord) + + } + + onNoResponse { + currentIndex++ + goto(SayNextWord) + } +} + +// -------------------- nebolo žiadného stop -------------------- + +val HandleMissedStop: State = state(Parent) { + onEntry { + wrongAttempts++ + + SessionLogger.log( + game = "attention", + phase = "answer", + question = "LEVEL_${attentionLevel}", + attempt = wrongAttempts, + result = "missed_target", + correctAnswer = "${targetWord?.canonical}@${targetIndex + 1}", + userAnswer = "", + hintUsed = wrongAttempts >= 2 + ) + + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say("Zmeškali ste správny moment, keď ste ma mali zastaviť.") + + val hint = requestAttentionHint("missed_target") + + if (hint.isNotBlank()){ + furhat.say("Trochu pomôžem Vám! Dajte mi chvíľu, prosím") + furhat.say(hint) + }else{ + happyShake() + furhat.say("Nevadí.") + furhat.say("Skúsme to ešte raz. Keď zaznie správne slovo, povedzte stop.") + } + + restartSameRound() + } + 2 -> { + val explanation = requestAttentionExplainWrong("missed_target") + val target = targetWord!!.canonical + + if (explanation.isNotBlank()){ + furhat.say(explanation) + }else{ + happyNod() + furhat.say("Pomôžem Vám. Správne slovo bolo „$target“. Skúsme to znova.") + } + + restartSameRound() + } + else -> goto(FinalWrongAnswer) + } + } +} + +/* -------------------- 3. chyba -------------------- */ + +val FinalWrongAnswer: State = state(Parent) { + onEntry { + empathy() + + val target = targetWord!!.canonical + val position = targetIndex + 1 + + SessionLogger.log( + game = "attention", + phase = "resolved", + question = "LEVEL_${attentionLevel}", + attempt = wrongAttempts, + result = "final_fail", + correctAnswer = "$target@$position", + userAnswer = "", + hintUsed = true + ) + + furhat.say("Tentoraz to nevyšlo,") + happyShake() + furhat.say("ale nič sa nedeje.") + furhat.say("Povedať stop ste mali pri slove „$target“, ktoré bolo na pozícii $position .") + delay(1000) + + attentionRoundFailed = true + + goto(AfterAttentionResolved) + } +} + +/* -------------------- prechod medzi urovni -------------------- */ + +val AfterAttentionResolved: State = state(Parent) { + onEntry { + doneAtLevel++ + + if (attentionRoundFailed) { + failedQuestions++ + } + attentionRoundFailed = false + + + if (!difficultyWasIncreased) { + sameLevelQuestionsDone++ + + if (sameLevelQuestionsDone >= MAX_SAME_LEVEL_QUESTIONS) { + veryHappy() + furhat.say("Výborne, dnes už stačí. Ukončíme toto cvičenie pozornosti. Ďakujem Vám!") + delay(1000) + + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onEntry + } + } + + + if (doneAtLevel < QUESTIONS_PER_LEVEL) { + buildNewAttentionRound() + goto(AskAttention) + return@onEntry + } + + // max -> koniec + if (attentionLevel >= MAX_LEVEL) { + veryHappy() + furhat.say("Týmto sme ukončili hru pozornosti. Ďakujem Vám!") + delay(1000) + + TrainingMenuFlags.allAttentionQuestionsCompleted = true + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onEntry + } + + // pokaračovanie + val wantsToContinue = call(AskToContinue()) as Boolean + if (!wantsToContinue) { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onEntry + } + + // 2 otázky neúspešné -> znižiť uroveň + if (currentBlockWasIncreased && + failedQuestions >= QUESTIONS_PER_LEVEL && + attentionLevel > 1 + ) { + val goBack = call(AskDecreaseDifficulty) as Boolean + + if (goBack) { + attentionLevel-- + furhat.say("Dobre, vrátime sa na ľahšiu úroveň.") + } else { + furhat.say("Dobre, zostaneme na rovnakej úrovni.") + } + + doneAtLevel = 0 + failedQuestions = 0 + currentBlockWasIncreased = false + + buildNewAttentionRound() + goto(AskAttention) + return@onEntry + } + + // zväčšiť uroveň + val increase = call(AskIncreaseDifficulty) as Boolean + if (increase && attentionLevel < MAX_LEVEL) { + difficultyWasIncreased = true + attentionLevel++ + currentBlockWasIncreased = true + furhat.say("Dobre, zvýšime náročnosť.") + } else { + currentBlockWasIncreased = false + furhat.say("Dobre, zostaneme na rovnakej úrovni.") + } + + doneAtLevel = 0 + failedQuestions = 0 + + buildNewAttentionRound() + goto(AskAttention) + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/greeting.kt b/src/main/kotlin/furhatos/app/blank/flow/main/greeting.kt new file mode 100644 index 0000000..ff295d9 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/greeting.kt @@ -0,0 +1,119 @@ +package furhatos.app.blank.flow.main + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.attention.AttentionTrainingIntro +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleRephrase +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.flow.main.memory.MemoryTrainingIntro +import furhatos.app.blank.flow.main.say_time.TimeTrainingIntro +import furhatos.app.blank.flow.main.supporting.CheckCondition +import furhatos.app.blank.flow.main.supporting.happyNod +import furhatos.app.blank.flow.main.SessionLogger +import furhatos.app.blank.flow.main.memory.currentSequence +import furhatos.app.blank.flow.main.memory.memoryLevel +import furhatos.app.blank.flow.main.supporting.ReadyToTrain +import furhatos.app.blank.flow.main.supporting.general.TrainingMenuFlags +import furhatos.app.blank.flow.main.supporting.general.isProxyAvailable +import furhatos.app.blank.flow.main.supporting.littleSad +import furhatos.app.blank.nlu.base_answer.Repeat +import furhatos.app.blank.nlu.base_answer.StopTraining +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.onResponse +import furhatos.flow.kotlin.state +import furhatos.flow.kotlin.* +import java.net.HttpURLConnection +import java.net.URL +import kotlin.concurrent.thread + +import java.nio.file.Files +import java.nio.file.Paths +import java.nio.file.StandardOpenOption + +private const val PROXY_BASE_URL = "http://127.0.0.1:8000" + +fun resetRealtimeProxyAsync() { + thread(isDaemon = true) { + try { + val url = URL("$PROXY_BASE_URL/reset") + val conn = url.openConnection() as HttpURLConnection + conn.requestMethod = "POST" + conn.setRequestProperty("Content-Type", "application/json") + conn.doOutput = true + conn.outputStream.use { it.write("{}".toByteArray()) } + conn.inputStream.use { it.readBytes() } // просто чтобы завершить запрос корректно + conn.disconnect() + } catch (e: Exception) { + // не ломаем диалог, если прокси недоступен + } + } +} + +val Greeting: State = state(Parent) { + onEntry { + resetTrainingGameBag() // новый пользователь => новая случайная тройка игр + TrainingMenuFlags.hasTrainedOnce = false; + + resetRealtimeProxyAsync() // сброс прокси + + println("user.dir = ${System.getProperty("user.dir")}") + println("isLocalProjectRun = ${SessionLogger.isLocalProjectRun()}") + println("isRunningOnRobot = ${SessionLogger.isRunningOnRobot()}") + + SessionLogger.clearCsvIfRunningOnRobot() +// SessionLogger.flushPendingLogs() + SessionLogger.flushPendingLogsAsync() + SessionLogger.startNewSession() + + happyNod() + furhat.say { + random { + +"Ahoj! Teším sa na náš rozhovor." + +"Dobrý deň! Ďakujem, že ste prišli." + +"Dobrý deň, vítam vás." + +"Dobrý deň! Som ráda, že vás vidím." + } + } + + furhat.say(pendingFileStatusMessage()) + + furhat.listen() + } + + onResponse { + if (handleStop(it.intent, + "system", + "greeting", + it.text ?: "")) + { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } + } + + onResponse{ + if (handleRepeat( + it.intent, + "repeat", + "system", + "greeting", + it.text ?: "" + )) + { + return@onResponse + } + } + + onResponse { + if (handleRephrase(it.intent)){ + return@onResponse + } + + goto(CheckCondition) +// goto(TimeTrainingIntro) +// goto(MemoryTrainingIntro) + } +} + diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/handlers/Goodbye.kt b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/Goodbye.kt new file mode 100644 index 0000000..f6db2b1 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/Goodbye.kt @@ -0,0 +1,26 @@ +package furhatos.app.blank.flow.main.handlers +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.Idle +import furhatos.app.blank.flow.main.supporting.calm +import furhatos.flow.kotlin.* +import furhatos.gestures.Gestures + +val Goodbye: State = state(Parent) { + + onEntry { + furhat.gesture(Gestures.BigSmile, async = true) + furhat.say { + random { + +"Ďakujem za dnešok. Prajem vám pekný deň!" + +"Bolo mi potešením. Dovidenia!" + +"Ďakujem, že ste so mnou cvičili. Majte sa krásne." + +"Oddýchnite si a uvidíme sa nabudúce. Dovidenia!" + +"Ak budete chcieť pokračovať, som tu pre vás. Dovidenia!" + +"Majte sa dobre a dávajte na seba pozor. Dovidenia!" + +"Dovidenia!" + } + } + furhat.attendNobody() + goto(Idle) + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/handlers/RepeatHandler.kt b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/RepeatHandler.kt new file mode 100644 index 0000000..cdeb418 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/RepeatHandler.kt @@ -0,0 +1,86 @@ +package furhatos.app.blank.flow.main.handlers +import furhatos.app.blank.flow.main.SessionLogger +import furhatos.app.blank.flow.main.say_time.wrongAttempts +import furhatos.app.blank.flow.main.supporting.happyNod +import furhatos.app.blank.nlu.base_answer.Repeat +import furhatos.flow.kotlin.* +import furhatos.nlu.IntentInstance + +var lastPhrase: String? = null +var lastPhraseIsQuestion: Boolean = false + +fun FlowControlRunner.askRepeatable(text: String) { + lastPhrase = text + lastPhraseIsQuestion = true + furhat.ask(text) +} + +fun FlowControlRunner.sayRepeatable(text: String) { + lastPhrase = text + lastPhraseIsQuestion = false + furhat.say(text) +} + +//fun FlowControlRunner.handleRepeat(intent: IntentInstance?): Boolean { +// if (intent is Repeat) { +// val phrase = lastPhrase +// if (phrase != null) { +// happyNod() +// furhat.say("Samozrejme môžem zopakovať.") +// +// if (lastPhraseIsQuestion) { +// furhat.ask(phrase) +// } else { +// furhat.say(phrase) +// furhat.listen() +// } +// } else { +// furhat.say("Prepáčte, momentálne nemám čo zopakovať.") +// furhat.listen() +// } +// return true +// } +// return false +//} + +fun FlowControlRunner.handleRepeat( + intent: IntentInstance?, + game: String, + question: String, + correctAnswer: String = "", + userAnswer: String = "", + hintUsed: Boolean = false +): Boolean { + if (intent is Repeat) { + val phrase = lastPhrase + + SessionLogger.log( + game = game, + phase = "event", + question = question, + attempt = wrongAttempts + 1, + result = "repeat_requested", + correctAnswer = correctAnswer, + userAnswer = userAnswer, + hintUsed = hintUsed + ) + + if (phrase != null) { + happyNod() + furhat.say("Samozrejme môžem zopakovať.") + + if (lastPhraseIsQuestion) { + furhat.ask(phrase) + } else { + furhat.say(phrase) + furhat.listen() + } + } else { + furhat.say("Prepáčte, momentálne nemám čo zopakovať.") + furhat.listen() + } + return true + } + return false +} + diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/handlers/RephraseHandler.kt b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/RephraseHandler.kt new file mode 100644 index 0000000..c8ce3ea --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/RephraseHandler.kt @@ -0,0 +1,40 @@ +package furhatos.app.blank.flow.main.handlers + +import furhatos.app.blank.flow.main.supporting.general.callProxyRespond +import furhatos.app.blank.flow.main.supporting.general.isProxyAvailable +import furhatos.app.blank.flow.main.supporting.veryHappy +import furhatos.app.blank.nlu.base_answer.Rephrase +import furhatos.flow.kotlin.FlowControlRunner +import furhatos.flow.kotlin.furhat +import furhatos.nlu.IntentInstance + +fun FlowControlRunner.handleRephrase(intent: IntentInstance?): Boolean { + if (intent is Rephrase) { + val phrase = lastPhrase + + if (phrase != null) { + if (isProxyAvailable()) { + val rephrased = callProxyRespond( + userText = phrase, + task = "rephrase", + context = mapOf( + "original_question" to phrase + ) + ) + + if (!rephrased.isNullOrBlank()) { + veryHappy() + furhat.say("Poviem to pre Vas inak.") + askRepeatable(rephrased) + } + }else{ + furhat.say("Poviem to pre Vas inak.") + askRepeatable(phrase) + } + } else { + furhat.say("Prepáčte, momentálne nemám čo preformulovať.") + } + return true + } + return false +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/handlers/StopHandler.kt b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/StopHandler.kt new file mode 100644 index 0000000..dd9ccaf --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/handlers/StopHandler.kt @@ -0,0 +1,62 @@ +package furhatos.app.blank.flow.main.handlers + +import furhatos.app.blank.flow.main.SessionLogger +import furhatos.app.blank.flow.main.say_time.hintUsedForCurrentQuestion +import furhatos.app.blank.flow.main.say_time.questionsSinceLastCheck +import furhatos.app.blank.flow.main.say_time.wrongAttempts +import furhatos.app.blank.flow.main.supporting.empathy +import furhatos.app.blank.nlu.base_answer.StopTraining +import furhatos.flow.kotlin.FlowControlRunner +import furhatos.flow.kotlin.furhat +import furhatos.nlu.IntentInstance + +//fun FlowControlRunner.handleStop(intent: IntentInstance?): Boolean { +// if (intent is StopTraining) { +// empathy() +// furhat.say{ +// random{ +// +"Rozumiem. Zastavíme to, nič sa nedeje." +// +"Dobre, zastavme sa tu." +// } +// } +// +// wrongAttempts = 0 +// questionsSinceLastCheck = 0 +// return true +// } +// return false +//} + +fun FlowControlRunner.handleStop( + intent: IntentInstance?, + game: String, + question: String, + userAnswer: String = "" +): Boolean { + if (intent is StopTraining) { + println("DEBUG handleStop: StopTraining matched") + SessionLogger.log( + game = game, + phase = "event", + question = question, + attempt = wrongAttempts + 1, + result = "stop_requested", + correctAnswer = "", + userAnswer = userAnswer, + hintUsed = hintUsedForCurrentQuestion + ) + + empathy() + furhat.say { + random { + +"Rozumiem. Zastavíme to, nič sa nedeje." + +"Dobre, zastavme sa tu." + } + } + + wrongAttempts = 0 + questionsSinceLastCheck = 0 + return true + } + return false +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/idle.kt b/src/main/kotlin/furhatos/app/blank/flow/main/idle.kt new file mode 100644 index 0000000..706923c --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/idle.kt @@ -0,0 +1,27 @@ +package furhatos.app.blank.flow.main + +import furhatos.app.blank.flow.main.supporting.general.Test +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.furhat +import furhatos.flow.kotlin.onUserEnter +import furhatos.flow.kotlin.onUserLeave +import furhatos.flow.kotlin.state + +val Idle: State = state { + onEntry { + furhat.attendNobody() + } + + onUserEnter { + furhat.attend(it) + goto(Greeting) +// goto(Test) + } + + onUserLeave(){ +// furhat.attend(it) +// sayGoodbye() + furhat.attendNobody() + } + +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/memory/AskSequence.kt b/src/main/kotlin/furhatos/app/blank/flow/main/memory/AskSequence.kt new file mode 100644 index 0000000..9b7cd33 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/memory/AskSequence.kt @@ -0,0 +1,642 @@ +package furhatos.app.blank.flow.main.memory + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.SessionLogger +import furhatos.app.blank.flow.main.StartQuestion +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.flow.main.supporting.AskToContinue +import furhatos.app.blank.flow.main.supporting.general.WordBank +import furhatos.app.blank.flow.main.supporting.general.WordEntry +import furhatos.app.blank.flow.main.supporting.empathy +import furhatos.app.blank.flow.main.supporting.sayPhraseForWrongAnswer +import furhatos.app.blank.flow.main.supporting.littleSad +import furhatos.app.blank.flow.main.supporting.veryHappy +import furhatos.app.blank.nlu.base_answer.DontKnow +import furhatos.app.blank.nlu.base_answer.Help +import furhatos.app.blank.nlu.base_answer.Repeat +import furhatos.app.blank.nlu.base_answer.StopTraining +import furhatos.flow.kotlin.* +import kotlin.math.ceil +import kotlin.random.Random +import furhatos.app.blank.flow.main.say_time.wrongAttempts +import furhatos.app.blank.flow.main.say_time.hintUsedForCurrentQuestion +import furhatos.app.blank.flow.main.supporting.AskDecreaseDifficulty +import furhatos.app.blank.flow.main.supporting.AskIncreaseDifficulty +import furhatos.app.blank.flow.main.supporting.ReadyToTrain +import furhatos.app.blank.flow.main.supporting.general.SmallTalkContext +import furhatos.app.blank.flow.main.supporting.general.TrainingMenuFlags +import furhatos.app.blank.flow.main.supporting.general.callProxyRespond +import furhatos.app.blank.flow.main.supporting.general.genericSmallTalk +import furhatos.app.blank.flow.main.supporting.general.isProxyAvailable +import furhatos.app.blank.flow.main.supporting.general.requestSmallTalk +import furhatos.app.blank.flow.main.supporting.general.sendLogEvent +import furhatos.gestures.Gestures + +// -------------------- parametre -------------------- + +private const val MAX_LEVEL = 3 +private const val QUESTIONS_PER_LEVEL = 2 + +private const val SUCCESS_THRESHOLD = 0.90 +private const val NEAR_SUCCESS_THRESHOLD = 0.60 + +private const val MAX_SAME_LEVEL_QUESTIONS = 6 + +var memoryLevel: Int = 1 +var sequencesDoneAtLevel: Int = 0 + +var sameLevelQuestionsDone: Int = 0 +var difficultyWasIncreased: Boolean = false + +// koľko otázok v aktuálnom bloku z 2 bolo neúspešných +var failedQuestions: Int = 0 + +// Bol aktuálny blok z 2 kôl začatý po zvýšení náročnosti +var currentBlockWasIncreased: Boolean = false + +private var sequencePresented: Boolean = false +var currentSequence: List = emptyList() + +// slová používateľa po jednom +val collectedTokens: MutableList = mutableListOf() + +// pozície chýb v poslednom pokuse +var lastWrongPositions: List = emptyList() + +var memoryHintReason: String = "general" + +// -------------------- hodnotenie pokusu -------------------- +private fun requiredCorrectCount(n: Int, threshold: Double): Int = + ceil(n * threshold).toInt().coerceAtLeast(1) + + +private fun evaluateCollected(collected: List, target: List): Pair> { + val n = target.size + var correct = 0 + val wrongPos = mutableListOf() + + for (i in 0 until n) { + val userTok = collected.getOrNull(i) + val ok = userTok != null && WordsChecker.matchesWord(userTok, target[i]) + if (ok) correct++ else wrongPos.add(i + 1) + } + return Pair(correct, wrongPos) +} + +// -------------------- generovanie postupnosti -------------------- + +private fun lengthForLevel(level: Int, rng: Random = Random.Default): Int = when (level) { + 1 -> listOf(3, 3).random(rng) + 2 -> listOf(5, 6).random(rng) + else -> listOf(6, 7).random(rng) +} + +private fun buildNewSequence() { + val len = lengthForLevel(memoryLevel) + currentSequence = WordBank.pickSequence( + length = len, + maxDifficulty = memoryLevel + ) + sequencePresented = false + lastWrongPositions = emptyList() + collectedTokens.clear() +} +//============================================================== +// Small Talk +//============================================================== +fun buildMemorySmallTalkContext(): SmallTalkContext { + val theme = currentSequence.firstOrNull()?.theme ?: "memory" + + return SmallTalkContext( + exercise = "memory", + topic = theme, + subtopic = "sequence_recall", + targetWord = currentSequence.firstOrNull()?.canonical, + responseMode = "open" + ) +} + +fun memorySmallTalkSmart(nextState: State): State { + val ctx = buildMemorySmallTalkContext() + val proxyQuestion = requestSmallTalk(ctx) + + return if (proxyQuestion.isNotBlank()) { + genericSmallTalk( + context = ctx, + nextState = nextState, + fallbackQuestion = "Spája sa Vám niektoré z týchto slov s niečím známym?", + preparedQuestion = proxyQuestion + ) + } else { + genericSmallTalk( + context = ctx, + nextState = nextState, + fallbackQuestion = "Spája sa Vám niektoré z týchto slov s niečím známym?" + ) + } +} +//============================================================== +// Hint +//============================================================== + +fun requestMemoryExplainWrong(mistakeType: String): String { + val sequenceWords = currentSequence.map { it.canonical }.joinToString(", ") + val pos = lastWrongPositions.distinct().sorted().joinToString(", ") + + if (!isProxyAvailable()) { + return "" + } + + return callProxyRespond( + userText = "Používateľ urobil chybu v cvičení pamäte.", + task = "explain_wrong", + context = mapOf( + "exercise" to "memory", + "mistake_type" to mistakeType, // final_failure / partial_wrong + "level" to memoryLevel, + "sequence_length" to currentSequence.size, + "target_sequence" to sequenceWords, + "wrong_positions" to pos + ) + ) ?: "" +} +//=============================================== +// Proces hry +//=============================================== +// Intro + +val MemoryTrainingIntro: State = state(Parent) { + onEntry { + wrongAttempts = 0 + hintUsedForCurrentQuestion = false + + sameLevelQuestionsDone = 0 + difficultyWasIncreased = false + + failedQuestions = 0 + currentBlockWasIncreased = false + + memoryLevel = 1 + sequencesDoneAtLevel = 0 + + buildNewSequence() + goto(AskSequence) + } +} + +// -------------------- AskSequence - zobrazuje zoznam 1 raz, potom prejde k zberu -------------------- + +val AskSequence: State = state(Parent) { + + onEntry { + furhat.say("Teraz pomenujem niekoľko pojmov.") + + if (!sequencePresented) { + furhat.say("Pozorne počúvajte a zapamätajte si ich.") + //delay(1000) + furhat.say("Poradie slov je také:") + delay(1000) + + currentSequence.forEachIndexed { i, w -> + furhat.say(w.canonical) + if (i != currentSequence.lastIndex) delay(1700) + } + + delay(1300) + furhat.say("Skúste ich teraz zopakovať v rovnakom poradí.") + sequencePresented = true + + memoryLogWithDebug("question_shown / asked"){ + SessionLogger.log( + game = "memory", + phase = "question_shown", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts + 1, + result = "asked", + correctAnswer = currentSequence.joinToString(", ") { it.canonical }, + userAnswer = "", + hintUsed = hintUsedForCurrentQuestion + )} + } + + collectedTokens.clear() + goto(CollectSequence) + } +} + +// -------------------- CollectSequence: pocuvanie slov ---------------- + +val CollectSequence: State = state(Parent) { + + onEntry { + furhat.param.endSilTimeout = 400 + furhat.attend(users.current) + + furhat.listen() + } + + onResponse { + memoryLogWithDebug("Don't know"){ + SessionLogger.log( + game = "memory", + phase = "event", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts + 1, + result = "dont_know", + correctAnswer = currentSequence.joinToString(", ") { it.canonical }, + userAnswer = it.text ?: "", + hintUsed = hintUsedForCurrentQuestion + )} + + empathy() + furhat.say("Rozumiem, to je v poriadku.") + + if (!hintUsedForCurrentQuestion) { + memoryHintReason = "dont_know" + if (wrongAttempts < 2) wrongAttempts = 2 + goto(MemoryHintOffer) + return@onResponse + } + + // napoveda uz bola + wrongAttempts = 3 + lastWrongPositions = (1..currentSequence.size).toList() + goto(AfterSequenceResolved) + } + + onResponse { + memoryLogWithDebug("Help"){ + SessionLogger.log( + game = "memory", + phase = "event", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts + 1, + result = "help_requested", + correctAnswer = currentSequence.joinToString(", ") { it.canonical }, + userAnswer = it.text ?: "", + hintUsed = hintUsedForCurrentQuestion + )} + + if (!hintUsedForCurrentQuestion) { + veryHappy() + + memoryHintReason = "help" + furhat.say("Samozrejme, pomôžem Vám!") + + if (wrongAttempts < 2) wrongAttempts = 2 + goto(MemoryHintOffer) + return@onResponse + } + + empathy() + furhat.say("Už som Vám raz zopakoval zoznam.") + + furhat.gesture(Gestures.ExpressSad(strength = 0.35, duration = 0.8), async = true) + furhat.say("Je mi ľúto, že Vám nepomohol. Skúste to ešte raz.") + collectedTokens.clear() + reentry() + } + + onResponse { + if (handleStop(it.intent, + "memory", + "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + it.text ?: "")) + { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } + } + +// onResponse { +// if (handleRepeat( +// it.intent, +// "memory", +// "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", +// currentSequence.joinToString(", ") { it.canonical }, +// it.text ?: "", +// true +// )) +// { +// return@onResponse +// } +// } + + onResponse { + if (it.intent is Repeat) { + SessionLogger.log( + game = "memory", + phase = "event", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts + 1, + result = "repeat_requested", + correctAnswer = currentSequence.joinToString(", ") { it.canonical }, + userAnswer = it.text ?: "", + hintUsed = true + ) + + hintUsedForCurrentQuestion = true + collectedTokens.clear() + + furhat.say("Zopakujem Vám zoznam ešte raz.") + delay(1000) + furhat.say("Slová sú:") + delay(1000) + currentSequence.forEachIndexed { i, w -> + furhat.say(w.canonical) + if (i != currentSequence.lastIndex) delay(1200) + } + reentry() + return@onResponse + } + + val text = it.text ?: "" + val token = WordsChecker.tokenizeMeaningful(text).firstOrNull() + + if (token == null) { + // nic zmyslene nebolo + + memoryLogWithDebug("Zber sekvencii - null"){ + SessionLogger.log( + game = "memory", + phase = "event", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts + 1, + result = "unrecognized_token", + correctAnswer = currentSequence.joinToString(", ") { it.canonical }, + userAnswer = text, + hintUsed = hintUsedForCurrentQuestion + )} + + littleSad() + reentry() + return@onResponse + } + + collectedTokens.add(token) + + furhat.gesture(Gestures.Nod, async = true) + + if (collectedTokens.size < currentSequence.size) { + reentry() + return@onResponse + } + + // pokus je cely -> hodnotenie + val n = currentSequence.size + val requiredSuccess = requiredCorrectCount(n, SUCCESS_THRESHOLD) + val requiredNear = requiredCorrectCount(n, NEAR_SUCCESS_THRESHOLD) + + val (correct, wrongPos) = evaluateCollected(collectedTokens, currentSequence) + lastWrongPositions = wrongPos + + val targetSequence = currentSequence.joinToString(", ") { it.canonical } + val userSequence = collectedTokens.joinToString(", ") + + val resultForLog = when { + correct >= requiredSuccess -> "success" + correct >= requiredNear -> "partial_success" + else -> "fail" + } + + memoryLogWithDebug("Zber sekvencii / answer"){ + SessionLogger.log( + game = "memory", + phase = "answer", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts + 1, + result = resultForLog, + correctAnswer = targetSequence, + userAnswer = userSequence, + hintUsed = hintUsedForCurrentQuestion + )} + + when { + // full uspech + correct >= requiredSuccess -> { + wrongAttempts = 0 + hintUsedForCurrentQuestion = false + + veryHappy() + furhat.say("Výborne! To bolo správne.") + delay(1000) + + goto(memorySmallTalkSmart(AfterSequenceResolved)) + return@onResponse + } + + // >= 60% a < 80% + correct >= requiredNear -> { + wrongAttempts = 0 + hintUsedForCurrentQuestion = false + + veryHappy() + furhat.say("Takmer všetky slová ste pomenovali správne!") + delay(1000) + + goto(memorySmallTalkSmart(AfterSequenceResolved)) + return@onResponse + } + + else -> { + wrongAttempts++ + when (wrongAttempts) { + 1 -> { + val hint = requestMemoryHint("partial_wrong") + + if (hint.isNotBlank()){ + furhat.say("Dajte mi chvíľu. Pokúsim sa Vám pomôcť.") + furhat.say(hint) + } + else{ + littleSad() + furhat.say("Nie celkom správne. Skúste to ešte raz.") + } + + + collectedTokens.clear() + reentry() + } + 2 -> { + sayPhraseForWrongAnswer() + collectedTokens.clear() + goto(MemoryHintOffer) + } + else -> goto(AfterSequenceResolved) + } + } + } + } + + onNoResponse { + memoryLogWithDebug("No response"){ + SessionLogger.log( + game = "memory", + phase = "answer", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts + 1, + result = "no_response", + correctAnswer = currentSequence.joinToString(", ") { it.canonical }, + userAnswer = "", + hintUsed = hintUsedForCurrentQuestion + )} + + if (!hintUsedForCurrentQuestion) { + if (wrongAttempts < 2) wrongAttempts = 2 + goto(MemoryHintOffer) + } else { + wrongAttempts = 3 + lastWrongPositions = (1..currentSequence.size).toList() + goto(AfterSequenceResolved) + } + } +} + +// -------------------- prechod medzi urovni -------------------- + +val AfterSequenceResolved: State = state(Parent) { + onEntry { + if (wrongAttempts >= 3) { + memoryLogWithDebug("Resolved sequence"){ + SessionLogger.log( + game = "memory", + phase = "resolved", + question = "LEVEL_${memoryLevel}_LEN_${currentSequence.size}", + attempt = wrongAttempts, + result = "final_fail", + correctAnswer = currentSequence.joinToString(", ") { it.canonical }, + userAnswer = collectedTokens.joinToString(", "), + hintUsed = hintUsedForCurrentQuestion + )} + + val pos = lastWrongPositions.distinct().sorted().joinToString(", ") + val explanation = requestMemoryExplainWrong("final_failure") + + littleSad() + furhat.say("Je mi ľúto, ale nedali ste správnu odpoveď. Tentoraz to nevyšlo, ale to nevadí.") + + if (explanation.isNotBlank()){ + furhat.say(explanation) + } + else{ + furhat.say("V poslednej odpovedi boli nesprávne slová na pozíciách: $pos.") + } + + delay(1000) + } + + // zatvorenie otazky + val questionFailed = wrongAttempts >= 3 + wrongAttempts = 0 + hintUsedForCurrentQuestion = false + collectedTokens.clear() + lastWrongPositions = emptyList() + + sequencesDoneAtLevel++ + + if (questionFailed) { + failedQuestions++ + } + + if (!difficultyWasIncreased) { + sameLevelQuestionsDone++ + + if (sameLevelQuestionsDone >= MAX_SAME_LEVEL_QUESTIONS) { + veryHappy() + furhat.say("Výborne, dnes už stačí. Ukončíme tuto hru na pamäť. Ďakujem Vám!") + delay(1000) + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onEntry + } + } + + if (sequencesDoneAtLevel < QUESTIONS_PER_LEVEL) { + buildNewSequence() + goto(AskSequence) + return@onEntry + } + + if (memoryLevel >= MAX_LEVEL) { + veryHappy() + furhat.say("Týmto sme ukončili dnešnú hru na pamäť. Ďakujem Vám!") + delay(1000) + + TrainingMenuFlags.allMemoryQuestionsCompleted = true + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onEntry + } + + val wantsToContinue = call(AskToContinue()) as Boolean + if (!wantsToContinue) { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onEntry + } + + // vrátiť sa, ak boli obe otázky na novej úrovni neúspešné + if (currentBlockWasIncreased && failedQuestions >= QUESTIONS_PER_LEVEL && memoryLevel > 1) { + + val goBack = call(AskDecreaseDifficulty) as Boolean + + if (goBack) { + memoryLevel-- + furhat.say("Dobre, vrátime sa na ľahšiu úroveň.") + } else { + furhat.say("Dobre, zostaneme na rovnakej úrovni.") + } + + sequencesDoneAtLevel = 0 + failedQuestions = 0 + currentBlockWasIncreased = false + + buildNewSequence() + goto(AskSequence) + return@onEntry + } + + + val increase = call(AskIncreaseDifficulty) as Boolean + if (increase && memoryLevel < MAX_LEVEL) { + difficultyWasIncreased = true + memoryLevel++ + currentBlockWasIncreased = true + furhat.say("Dobre, zvýšime náročnosť.") + } else { + currentBlockWasIncreased = false + furhat.say("Dobre, zostaneme na rovnakej úrovni.") + } + + sequencesDoneAtLevel = 0 + failedQuestions = 0 + buildNewSequence() + goto(AskSequence) + } +} + + +private fun memoryLogDebug(stage: String) { + val now = java.time.LocalTime.now() + println("[MEMORY DEBUG $now] $stage") +} + +private inline fun memoryLogWithDebug( + stage: String, + block: () -> Unit +) { + val start = System.currentTimeMillis() + memoryLogDebug("START log -> $stage") + + try { + block() + val elapsed = System.currentTimeMillis() - start + memoryLogDebug("END log -> $stage (${elapsed} ms)") + } catch (e: Exception) { + val elapsed = System.currentTimeMillis() - start + memoryLogDebug("ERROR log -> $stage (${elapsed} ms): ${e.message}") + throw e + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/memory/MemoryHint.kt b/src/main/kotlin/furhatos/app/blank/flow/main/memory/MemoryHint.kt new file mode 100644 index 0000000..5d0d2e7 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/memory/MemoryHint.kt @@ -0,0 +1,64 @@ +package furhatos.app.blank.flow.main.memory + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.say_time.hintUsedForCurrentQuestion +import furhatos.app.blank.flow.main.supporting.HintOffer +import furhatos.app.blank.flow.main.supporting.general.callProxyRespond +import furhatos.app.blank.flow.main.supporting.general.isProxyAvailable +import furhatos.app.blank.flow.main.supporting.veryHappy +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.furhat +import furhatos.flow.kotlin.state + +fun requestMemoryHint(mistakeType: String): String { + val sequenceWords = currentSequence.map { it.canonical }.joinToString(", ") + + if (!isProxyAvailable()) { + return "" + } + + return callProxyRespond( + userText = "Používateľ potrebuje nápovedu v cvičení pamäte.", + task = "hint", + context = mapOf( + "exercise" to "memory", + "mistake_type" to mistakeType, // partial_wrong / dont_know / no_response / help + "level" to memoryLevel, + "sequence_length" to currentSequence.size, + "target_sequence" to sequenceWords, + "wrong_positions" to lastWrongPositions.joinToString(", ") + ) + ) ?: "" +} + +val MemoryHintOffer: State by lazy { + HintOffer(nextState = MemoryHint, exitState = CollectSequence) +} + +val MemoryHint: State = state(Parent) { + onEntry { + hintUsedForCurrentQuestion = true + collectedTokens.clear() + + val proxyHint = requestMemoryHint(memoryHintReason) + + if (proxyHint.isNotBlank()){ + furhat.say(proxyHint) + } + else{ + veryHappy() + furhat.say("Dobre! Zopakujem Vám zoznam ešte raz.") + + furhat.say("Slová sú:") + + currentSequence.forEachIndexed { i, w -> + furhat.say(w.canonical) + if (i != currentSequence.lastIndex) delay(1300) + } + + } + + furhat.say("Prosím, pokračujte.") + goto(CollectSequence) + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/memory/WordsCompare.kt b/src/main/kotlin/furhatos/app/blank/flow/main/memory/WordsCompare.kt new file mode 100644 index 0000000..96b2028 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/memory/WordsCompare.kt @@ -0,0 +1,52 @@ +package furhatos.app.blank.flow.main.memory + +import furhatos.app.blank.flow.main.supporting.general.WordEntry +import java.text.Normalizer + +// -------------------- zbytocne slova -------------------- +private val STOPWORDS: Set = setOf( + "eee", "ehm", "hm", "hmm", "mmm", + "no", "tak", "teda", "proste", "akoze", "akože", "vlastne", + "prosím", "prosim", "prosímťa", "prosimta", + "a", "aj", "že", "ze", "potom", "takže", "takze", "iii", "i" +) + +object WordsChecker { + // normalizacia + private fun stripDiacritics(s: String): String { + val norm = Normalizer.normalize(s, Normalizer.Form.NFD) + return norm.replace("\\p{Mn}+".toRegex(), "") + } + + private fun normalizeToken(token: String): String = + stripDiacritics(token.lowercase()) + .replace("[^a-z0-9]".toRegex(), "") + + fun tokenizeMeaningful(text: String): List { + val cleaned = text + .lowercase() + .replace("[,.;:!?()\\[\\]{}\"“”„–—]".toRegex(), " ") + .replace("\\s+".toRegex(), " ") + .trim() + + if (cleaned.isEmpty()) return emptyList() + + return cleaned.split(" ") + .map { it.trim() } + .filter { it.isNotEmpty() } + .filter { normalizeToken(it).isNotEmpty() } + .filter { normalizeToken(it) !in STOPWORDS } + } + + fun matchesWord(userToken: String, target: WordEntry): Boolean { + val userNorm = normalizeToken(userToken) + if (userNorm.isEmpty()) return false + + val acceptable = (target.variants + target.canonical) + .map { normalizeToken(it) } + .filter { it.isNotEmpty() } + .toSet() + + return userNorm in acceptable + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/say_time/AskTime.kt b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/AskTime.kt new file mode 100644 index 0000000..9a9ca69 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/AskTime.kt @@ -0,0 +1,907 @@ +package furhatos.app.blank.flow.main.say_time + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.SessionLogger +import furhatos.app.blank.flow.main.StartQuestion +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.askRepeatable +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleRephrase +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.nlu.base_answer.StopTraining +import furhatos.app.blank.flow.main.memory.currentSequence +import furhatos.app.blank.flow.main.memory.memoryLevel +import furhatos.app.blank.flow.main.pendingFileStatusMessage +import furhatos.app.blank.flow.main.supporting.AskToContinue +import furhatos.app.blank.nlu.base_answer.DontKnow +import furhatos.app.blank.nlu.base_answer.Rephrase +import furhatos.app.blank.nlu.base_answer.Help +import furhatos.app.blank.flow.main.supporting.CurrentMonthSmallTalk +import furhatos.app.blank.flow.main.supporting.CurrentTimeSmallTalk +import furhatos.app.blank.flow.main.supporting.DayPeriodSmallTalk +import furhatos.app.blank.flow.main.supporting.ReadyToTrain +import furhatos.app.blank.flow.main.supporting.TodayDateSmallTalk +import furhatos.app.blank.flow.main.supporting.TomorrowDateSmallTalk +import furhatos.app.blank.flow.main.supporting.general.TrainingMenuFlags +import furhatos.app.blank.flow.main.supporting.WeekdaySmallTalk +import furhatos.app.blank.flow.main.supporting.calm +import furhatos.app.blank.flow.main.supporting.empathy +import furhatos.app.blank.flow.main.supporting.happyShake +import furhatos.app.blank.flow.main.supporting.littleSad +import furhatos.app.blank.flow.main.supporting.explainWhyWrong +import furhatos.app.blank.flow.main.supporting.general.SmallTalkContext +import furhatos.app.blank.flow.main.supporting.general.genericSmallTalk +import furhatos.app.blank.flow.main.supporting.general.requestSmallTalk +import furhatos.app.blank.flow.main.supporting.sayPhraseForWrongAnswer +import furhatos.app.blank.flow.main.supporting.veryHappy +import furhatos.app.blank.nlu.base_answer.Repeat +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.furhat +import furhatos.flow.kotlin.state +import furhatos.flow.kotlin.* +import kotlin.random.Random + + +var TimeQuestionTypes: MutableList = mutableListOf( + TimeQuestionType.CURRENT_TIME, + TimeQuestionType.TODAY_DATE, + TimeQuestionType.TOMORROW_DATE, + TimeQuestionType.CURRENT_MONTH, + TimeQuestionType.TODAY_WEEKDAY, + TimeQuestionType.DAY_PERIOD +) + +val priorityTimeQuestionOrder: List = listOf( + TimeQuestionType.CURRENT_MONTH, + TimeQuestionType.TODAY_DATE, + TimeQuestionType.TOMORROW_DATE +) + +var priorityIndex: Int = 0 +private const val MAX_SMALLTALK_PER_SESSION = 3 // половина из 6 +var smallTalkUsed = 0 + + +//============================================================== +// Small Talk +//============================================================== +fun buildSmallTalkContextTime(question: TimeQuestionType): SmallTalkContext { + return when (question) { + TimeQuestionType.CURRENT_TIME -> SmallTalkContext( + exercise = "time", + topic = "time", + subtopic = "current_time", + responseMode = "open" + ) + + TimeQuestionType.TODAY_DATE -> SmallTalkContext( + exercise = "time", + topic = "date", + subtopic = "today_date", + responseMode = "open" + ) + + TimeQuestionType.TOMORROW_DATE -> SmallTalkContext( + exercise = "time", + topic = "date", + subtopic = "tomorrow_date", + responseMode = "open" + ) + + TimeQuestionType.CURRENT_MONTH -> SmallTalkContext( + exercise = "time", + topic = "month", + subtopic = "current_month", + responseMode = "open" + ) + + TimeQuestionType.TODAY_WEEKDAY -> SmallTalkContext( + exercise = "time", + topic = "weekday", + subtopic = DateTimeChecker.CorrectTodayWeekday(), + responseMode = "open" + ) + + TimeQuestionType.DAY_PERIOD -> SmallTalkContext( + exercise = "time", + topic = "day_period", + subtopic = lastDayPeriod, + responseMode = "yes_no" + ) + } +} + +fun fallbackSmallTalk(question: TimeQuestionType): State { + return when (question) { + TimeQuestionType.CURRENT_TIME -> CurrentTimeSmallTalk + TimeQuestionType.TODAY_DATE -> TodayDateSmallTalk + TimeQuestionType.TOMORROW_DATE -> TomorrowDateSmallTalk + TimeQuestionType.CURRENT_MONTH -> CurrentMonthSmallTalk + TimeQuestionType.TODAY_WEEKDAY -> WeekdaySmallTalk + TimeQuestionType.DAY_PERIOD -> DayPeriodSmallTalk + } +} + +fun smallTalkManagerTime(question: TimeQuestionType): State { + if (smallTalkUsed >= MAX_SMALLTALK_PER_SESSION) return TimeTrainingSuccess + + // kolko otazok este su v liste + val denom = TimeQuestionTypes.size + 1 + val smallTalkLeft = MAX_SMALLTALK_PER_SESSION - smallTalkUsed + + // výpočty šancov + val percent = minOf(0.5, smallTalkLeft.toDouble() / denom.toDouble()) + val doSmallTalk = Random.nextDouble() < percent + + if (!doSmallTalk) return TimeTrainingSuccess + if (TimeQuestionTypes.isEmpty()) return TimeTrainingSuccess + + val ctx = buildSmallTalkContextTime(question) + val proxyQuestion = requestSmallTalk(ctx) + + smallTalkUsed++ + + return if (proxyQuestion.isNotBlank()) { + genericSmallTalk( + context = ctx, + nextState = TimeTrainingSuccess, + preparedQuestion = proxyQuestion + ) + } else { + fallbackSmallTalk(question) + } +} + +fun smallTalkAfterQuestion(question: TimeQuestionType): State { + if (smallTalkUsed >= MAX_SMALLTALK_PER_SESSION) return TimeTrainingSuccess + + // kolko otazok este su v liste + val denom = TimeQuestionTypes.size + 1 + + val smallTalkLeft = MAX_SMALLTALK_PER_SESSION - smallTalkUsed + + // výpočty šancov + val percent = minOf(0.5, smallTalkLeft.toDouble() / denom.toDouble()) + val doSmallTalk = Random.nextDouble() < percent + + if (!doSmallTalk) return TimeTrainingSuccess + if (TimeQuestionTypes.isEmpty()) return TimeTrainingSuccess + + smallTalkUsed++ + return when (question) { + TimeQuestionType.CURRENT_TIME -> CurrentTimeSmallTalk + TimeQuestionType.TODAY_DATE -> TodayDateSmallTalk + TimeQuestionType.TOMORROW_DATE -> TomorrowDateSmallTalk + TimeQuestionType.CURRENT_MONTH -> CurrentMonthSmallTalk + TimeQuestionType.TODAY_WEEKDAY -> WeekdaySmallTalk + TimeQuestionType.DAY_PERIOD -> DayPeriodSmallTalk + } +} +//----------------------------------------------------------------- + +// vráti náhodný ešte nepoužitý typ a zároveň ho odstráni zo zoznamu. +fun pickRandomTimeQuestionType(): TimeQuestionType { + // prioritne otazky -> potom ostatne + while (priorityIndex < priorityTimeQuestionOrder.size) { + val candidate = priorityTimeQuestionOrder[priorityIndex] + priorityIndex++ + + if (TimeQuestionTypes.remove(candidate)) { + return candidate + } + } + + val chosen = TimeQuestionTypes.random() + TimeQuestionTypes.remove(chosen) + return chosen +} + +fun resetTimeQuestions() { + TimeQuestionTypes = mutableListOf( + TimeQuestionType.CURRENT_TIME, + TimeQuestionType.TODAY_DATE, + TimeQuestionType.TOMORROW_DATE, + TimeQuestionType.CURRENT_MONTH, + TimeQuestionType.TODAY_WEEKDAY, + TimeQuestionType.DAY_PERIOD + ) + priorityIndex = 0 +} + +private fun correctAnswerFor(question: TimeQuestionType): String = when (question) { + TimeQuestionType.CURRENT_TIME -> DateTimeChecker.CorrectCurrentTime() + TimeQuestionType.TODAY_DATE -> DateTimeChecker.CorrectTodayDate() + TimeQuestionType.TOMORROW_DATE -> DateTimeChecker.CorrectTomorrowDate() + TimeQuestionType.CURRENT_MONTH -> DateTimeChecker.CorrectCurrentMonth() + TimeQuestionType.TODAY_WEEKDAY -> DateTimeChecker.CorrectTodayWeekday() + TimeQuestionType.DAY_PERIOD -> DateTimeChecker.CorrectCurrentDayPeriod() +} + +// pre treti nespravny pokus +fun FlowControlRunner.finalWrongAnswer() { + val correct = correctAnswerFor(currentTimeQuestionType) + + SessionLogger.log( + game = "time", + phase = "resolved", + question = currentTimeQuestionType.name, + attempt = wrongAttempts, + result = "final_fail", + correctAnswer = correct, + userAnswer = "", + hintUsed = hintUsedForCurrentQuestion + ) + + lastWrongAttemptsForQuestion = wrongAttempts + wrongAttempts = 0 + + when (currentTimeQuestionType) { + TimeQuestionType.CURRENT_TIME -> { + happyShake() + furhat.say( + "Dali ste nesprávnu odpoveď, ale nič sa nedeje! " + + "Správna odpoveď by bola, že je teraz $correct." + ) + delay(1000) + } + + TimeQuestionType.TODAY_DATE -> { + happyShake() + furhat.say( + "Nevyšlo Vám to, ale vôbec to neprekáža. " + + "Správna odpoveď by bola, že dnes je $correct. " + + "Teraz si to pamätáte!" + ) + delay(1000) + } + + TimeQuestionType.TOMORROW_DATE -> { + empathy() + furhat.say( + "Vyzerá to, že je to dnes náročné, ale to je v poriadku " + + "Správna odpoveď by bola, že zajtra bude $correct. " + ) + furhat.say("Teraz si to pamätáte!") + delay(1000) + } + + TimeQuestionType.CURRENT_MONTH -> { + empathy() + furhat.say( + "Nechajte to tak, dnes je to náročné. " + + "Správna odpoveď by bola, že je teraz mesiac $correct. " + ) + delay(1000) + } + + TimeQuestionType.TODAY_WEEKDAY -> { + calm() + furhat.say( + "Tentoraz to nevyšlo, ale nevadí. " + + "Správna odpoveď by bola: $correct." + ) + delay(1000) + } + + TimeQuestionType.DAY_PERIOD -> { + happyShake() + furhat.say( + "Dali ste nesprávnu odpoveď, ale nič sa nedeje! " + + "Správna odpoveď by bola, že je teraz $correct." + ) + delay(1000) + } + } + + goto(TimeTrainingSuccess) +} + +//-------------------------------------------------------------- +// Pomocne premenne +//-------------------------------------------------------------- + +var currentTimeQuestionType: TimeQuestionType = TimeQuestionType.CURRENT_TIME +var questionsSinceLastCheck = 0 +var questionText: String = "" + +var wrongAttempts = 0 +var lastWrongAttemptsForQuestion = 0 + +var hintUsedForCurrentQuestion: Boolean = false + +var lastDayPeriod: String = "" + +//============================================================== +// Proces hry +//============================================================== + +// Intro +val TimeTrainingIntro: State = state(Parent) { + onEntry { + wrongAttempts = 0 + smallTalkUsed = 0 + questionsSinceLastCheck = 0 + resetTimeQuestions() //ранее не было + hintUsedForCurrentQuestion = false + + currentTimeQuestionType = pickRandomTimeQuestionType() + goto(AskTime) + } +} + +// AskTime: otazky a reakcia na vysledok +val AskTime: State = state(Parent) { + onEntry { + questionText = when (currentTimeQuestionType) { + TimeQuestionType.CURRENT_TIME -> "Môžete mi, prosím, povedať, koľko je teraz hodín?" + TimeQuestionType.TODAY_DATE -> "Viete mi povedať, aký je dnes dátum?" + TimeQuestionType.TOMORROW_DATE -> "Aký dátum bude zajtra?" + TimeQuestionType.CURRENT_MONTH -> "Viete, aký je práve mesiac?" + TimeQuestionType.TODAY_WEEKDAY -> "Aký je dnes deň v týždni?" + TimeQuestionType.DAY_PERIOD -> "Povedzte, prosím, aká je teraz približne denná doba?" + } + askRepeatable(questionText) + + SessionLogger.log( + game = "time", + phase = "question_shown", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = "asked", + correctAnswer = correctAnswerFor(currentTimeQuestionType), + userAnswer = "", + hintUsed = hintUsedForCurrentQuestion + ) + } + + onResponse { + + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = "dont_know", + correctAnswer = correctAnswerFor(currentTimeQuestionType), + userAnswer = it.text ?: "", + hintUsed = hintUsedForCurrentQuestion + ) + + furhat.say(pendingFileStatusMessage()) + + empathy() + furhat.say("Rozumiem, to je v poriadku.") + + // este nebola napoveda + if (!hintUsedForCurrentQuestion) { + if (wrongAttempts < 2) wrongAttempts = 2 + goto(TimeHintOffer) + return@onResponse + } + + wrongAttempts = 3 + finalWrongAnswer() + } + + onResponse { + handleRephrase(it.intent) + } + + onResponse { + + SessionLogger.log( + game = "time", + phase = "event", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = "help_requested", + correctAnswer = correctAnswerFor(currentTimeQuestionType), + userAnswer = it.text ?: "", + hintUsed = hintUsedForCurrentQuestion + ) + + if (!hintUsedForCurrentQuestion) { + veryHappy() + furhat.say("Samozrejme, pomôžem Vám! Dajte mi chvíľu, prosím") + if (wrongAttempts < 2) wrongAttempts = 2 + goto(TimeHint) + return@onResponse + } + + empathy() + furhat.say("Prepáčte, už som Vám dala nápovedu.") + delay(700) + + littleSad() + furhat.say("Je mi ľúto, že Vám nepomohla. Skúste odpovedať podľa toho, čo si pamätáte.") + + val questionText = when (currentTimeQuestionType) { + TimeQuestionType.CURRENT_TIME -> + "Môžete mi ešte raz povedať, koľko je teraz približne hodín?" + + TimeQuestionType.TODAY_DATE -> + "Skúste mi ešte raz povedať, aký je dnes dátum." + + TimeQuestionType.TOMORROW_DATE -> + "Skúste mi ešte raz povedať, aký dátum bude zajtra." + + TimeQuestionType.CURRENT_MONTH -> + "Skúste mi, prosím, ešte raz povedať, aký je teraz mesiac." + + TimeQuestionType.TODAY_WEEKDAY -> + "Skúste mi ešte raz povedať, aký je dnes deň v týždni." + + TimeQuestionType.DAY_PERIOD -> + "Skúste mi, prosím, ešte raz povedať, či je teraz ráno, deň alebo večer." + } + + askRepeatable(questionText) + } + + onResponse { + if (handleStop(it.intent, + "time", + currentTimeQuestionType.name, + it.text ?: "")) + { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } + } + + onResponse{ + if (handleRepeat( + it.intent, + "time", + currentTimeQuestionType.name, + correctAnswerFor(currentTimeQuestionType), + it.text ?: "", + hintUsedForCurrentQuestion)) + { + return@onResponse + } + } + + onResponse { + val text = it.text ?: "" + + when (currentTimeQuestionType) { + TimeQuestionType.CURRENT_TIME -> { + val success = DateTimeChecker.isCorrectCurrentTime(text) + val correct = correctAnswerFor(currentTimeQuestionType) + + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = if (success) "success" else "fail", + correctAnswer = correct, + userAnswer = text, + hintUsed = hintUsedForCurrentQuestion + ) + + if (success) { + lastWrongAttemptsForQuestion = wrongAttempts + wrongAttempts = 0 + veryHappy() + furhat.say("Správne! Povedali ste aktuálny čas. ") + goto(smallTalkManagerTime(currentTimeQuestionType)) + } else { + wrongAttempts++ + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say( + "Nezdá sa, že to bol aktuálny čas. " + + "Skúste ho povedať napríklad ako „je päť hodín“ alebo „je 5:00“." + ) + delay(700) + reentry() + } + + 2 -> { +// val correct = correctAnswerFor(currentTimeQuestionType) + explainWhyWrong( + question = questionText, + correctAnswer = correct, + userAnswer = text, + attempt = wrongAttempts + ) + goto(TimeHintOffer) + } + + else -> { + finalWrongAnswer() + } + } + } + +// if (DateTimeChecker.isCorrectCurrentTime(text)) { +// lastWrongAttemptsForQuestion = wrongAttempts +// wrongAttempts = 0 +// veryHappy() +// furhat.say("Správne! Povedali ste aktuálny čas. ") +// goto(smallTalkManagerTime(currentTimeQuestionType)) +// } else { +// wrongAttempts++ +// when (wrongAttempts) { +// 1 -> { +// littleSad() +// furhat.say( +// "Nezdá sa, že to bol aktuálny čas. " + +// "Skúste ho povedať napríklad ako „je päť hodín“ alebo „je 5:00“." +// ) +// delay(700) +// reentry() +// } +// +// 2 -> { +//// val correct = correctAnswerFor(currentTimeQuestionType) +// explainWhyWrong( +// question = questionText, +// correctAnswer = correct, +// userAnswer = text, +// attempt = wrongAttempts +// ) +// goto(TimeHintOffer) +// } +// +// else -> { +// finalWrongAnswer() +// } +// } +// } + } + + TimeQuestionType.TODAY_DATE -> { + val success = DateTimeChecker.isCorrectTodayDate(text) + val correct = correctAnswerFor(currentTimeQuestionType) + + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = if (success) "success" else "fail", + correctAnswer = correct, + userAnswer = text, + hintUsed = hintUsedForCurrentQuestion + ) + + if (success) { + lastWrongAttemptsForQuestion = wrongAttempts + wrongAttempts = 0 + veryHappy() + furhat.say("Správne, dnes je takýto dátum.") + goto(smallTalkManagerTime(currentTimeQuestionType)) + } else { + wrongAttempts++ + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say( + "Zdá sa, že to nie je dnešný dátum. " + + "Skúste ho povedať ešte raz, napríklad \"dnes je dvadsiatý decembr\"." + ) + delay(700) + reentry() + } + 2 -> { + val correct = correctAnswerFor(currentTimeQuestionType) + explainWhyWrong( + question = questionText, + correctAnswer = correct, + userAnswer = text, + attempt = wrongAttempts + ) + goto(TimeHintOffer) + } + else -> { + finalWrongAnswer() + } + } + } + } + + TimeQuestionType.TOMORROW_DATE -> { + val success = DateTimeChecker.isCorrectTomorrowDate(text) + val correct = correctAnswerFor(currentTimeQuestionType) + + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = if (success) "success" else "fail", + correctAnswer = correct, + userAnswer = text, + hintUsed = hintUsedForCurrentQuestion + ) + + if (success) { + lastWrongAttemptsForQuestion = wrongAttempts + wrongAttempts = 0 + veryHappy() + furhat.say("Správne! To je zajtrajší dátum.") + goto(smallTalkManagerTime(currentTimeQuestionType)) + } else { + wrongAttempts++ + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say( + "Nie som si istá, že to je zajtrajší dátum. " + + "Skúste ho povedať ešte raz." + ) + delay(700) + reentry() + } + 2 -> { + val correct = correctAnswerFor(currentTimeQuestionType) + explainWhyWrong( + question = questionText, + correctAnswer = correct, + userAnswer = text, + attempt = wrongAttempts + ) + goto(TimeHintOffer) + } + else -> { + finalWrongAnswer() + } + } + } + } + + TimeQuestionType.CURRENT_MONTH -> { + val success = DateTimeChecker.isCorrectCurrentMonth(text) + val correct = correctAnswerFor(currentTimeQuestionType) + + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = if (success) "success" else "fail", + correctAnswer = correct, + userAnswer = text, + hintUsed = hintUsedForCurrentQuestion + ) + + if (success) { + lastWrongAttemptsForQuestion = wrongAttempts + wrongAttempts = 0 + veryHappy() + furhat.say("Správne, je to aktuálny mesiac.") + goto(smallTalkManagerTime(currentTimeQuestionType)) + } else { + wrongAttempts++ + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say( + "Nezdá sa, že to bol aktuálny mesiac. " + + "Skúste ho povedať ešte raz." + ) + delay(700) + reentry() + } + 2 -> { + val correct = correctAnswerFor(currentTimeQuestionType) + explainWhyWrong( + question = questionText, + correctAnswer = correct, + userAnswer = text, + attempt = wrongAttempts + ) + goto(TimeHintOffer) + } + else -> { + finalWrongAnswer() + } + } + } + } + + TimeQuestionType.TODAY_WEEKDAY -> { + val success = DateTimeChecker.isCorrectTodayWeekday(text) + val correct = correctAnswerFor(currentTimeQuestionType) + + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = if (success) "success" else "fail", + correctAnswer = correct, + userAnswer = text, + hintUsed = hintUsedForCurrentQuestion + ) + + if (success) { + lastWrongAttemptsForQuestion = wrongAttempts + wrongAttempts = 0 + veryHappy() + furhat.say("Správne! Povedali ste dnešný deň v týždni.") + goto(smallTalkManagerTime(currentTimeQuestionType)) + } else { + wrongAttempts++ + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say( + "Nezdá sa, že to bol správny deň v týždni. " + + "Skúste to povedať inak." + ) + delay(700) + reentry() + } + 2 -> { + val correct = correctAnswerFor(currentTimeQuestionType) + explainWhyWrong( + question = questionText, + correctAnswer = correct, + userAnswer = text, + attempt = wrongAttempts + ) + goto(TimeHintOffer) + } + else -> { + finalWrongAnswer() + } + } + } + } + + TimeQuestionType.DAY_PERIOD -> { + val success = DateTimeChecker.isCorrectCurrentDayPeriod(text) + val correct = correctAnswerFor(currentTimeQuestionType) + + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = if (success) "success" else "fail", + correctAnswer = correct, + userAnswer = text, + hintUsed = hintUsedForCurrentQuestion + ) + + if (success) { + lastWrongAttemptsForQuestion = wrongAttempts + wrongAttempts = 0 + veryHappy() + furhat.say("Správne! Povedali ste dnešný deň v týždni.") + goto(smallTalkManagerTime(currentTimeQuestionType)) + } else { + wrongAttempts++ + + when (wrongAttempts) { + 1 -> { + littleSad() + furhat.say( + "Nie som si istá, že to sedí s aktuálnou dennou dobou. " + + "Skúste povedať, či je teraz skôr ráno, deň alebo večer." + ) + delay(700) + reentry() + } + + 2 -> { + val correct = correctAnswerFor(currentTimeQuestionType) + explainWhyWrong( + question = questionText, + correctAnswer = correct, + userAnswer = text, + attempt = wrongAttempts + ) + goto(TimeHintOffer) + } + + else -> { + finalWrongAnswer() + } + } + } + } + } + } + + onNoResponse { + SessionLogger.log( + game = "time", + phase = "answer", + question = currentTimeQuestionType.name, + attempt = wrongAttempts + 1, + result = "no_response", + correctAnswer = correctAnswerFor(currentTimeQuestionType), + userAnswer = "", + hintUsed = hintUsedForCurrentQuestion + ) + + when { + wrongAttempts < 2 -> { + wrongAttempts = 2 + goto(TimeHintOffer) + } + + // napoveda uz bola -> znova nespravny pokus -> hovori odpoved' + else -> { + val correct = correctAnswerFor(currentTimeQuestionType) + + lastWrongAttemptsForQuestion = 3 + wrongAttempts = 0 + + empathy() + furhat.say( + "Zdá sa, že je to teraz pre Vás náročné, ale to je v poriadku. " + + "Správna odpoveď na otázku je $correct." + ) + delay(1000) + goto(TimeTrainingSuccess) + } + } + } + +} + +val TimeTrainingSuccess: State = state(Parent) { + onEntry { + when (lastWrongAttemptsForQuestion) { + 1 -> { + veryHappy() + furhat.say("Vy ste šikovný!") + delay(1000) + } + 2 -> { + calm() + furhat.say("Aj keď Vám to zabralo čas, zvládli ste to dobre.") + delay(1000) + } + 3 -> { + empathy() + furhat.say("Nezvladli ste to, ale to je v pohode. Teraz je to pre Vás náročné, ale nezúfajte, časom si to osvojíte.") + delay(1000) + } + + else -> { + veryHappy() + furhat.say("Zvládli ste to veľmi dobre.") + } + } + + if (TimeQuestionTypes.isEmpty()) { + calm() + furhat.say("Týmto sme ukončili hru s časom.") + veryHappy() + furhat.say("Ďakujem, bolo to výborné.") + delay(1000) + + TrainingMenuFlags.allTimeQuestionsCompleted = true + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + } + + questionsSinceLastCheck++ + + val continueOffer = questionsSinceLastCheck >= 2 + + if (continueOffer) { + val wantsToContinue = call(AskToContinue()) as Boolean + if (!wantsToContinue) { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onEntry + } + questionsSinceLastCheck = 0 + } + wrongAttempts = 0 + hintUsedForCurrentQuestion = false + + currentTimeQuestionType = pickRandomTimeQuestionType() + goto(AskTime) + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/say_time/STT.kt b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/STT.kt new file mode 100644 index 0000000..0fbb256 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/STT.kt @@ -0,0 +1,158 @@ +package furhatos.app.blank.flow.main.supporting + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.StartQuestion +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.askRepeatable +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleRephrase +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.flow.main.say_time.DateTimeChecker +import furhatos.app.blank.flow.main.say_time.DayPeriod +import furhatos.app.blank.flow.main.say_time.TimeTrainingSuccess +import furhatos.app.blank.flow.main.say_time.currentTimeQuestionType +import furhatos.app.blank.flow.main.say_time.lastDayPeriod +import furhatos.app.blank.flow.main.supporting.general.TrainingMenuFlags +import furhatos.flow.kotlin.* +import furhatos.app.blank.nlu.base_answer.Ano +import furhatos.app.blank.nlu.base_answer.Nie +import furhatos.app.blank.nlu.base_answer.Rephrase +import furhatos.app.blank.nlu.base_answer.StopTraining + +val DayPeriodSmallTalk: State = state(Parent) { + + onEntry { + val question4 = when (lastDayPeriod.lowercase()) { + "ráno" -> "Povedali ste, že je teraz ráno. Na dobré ráno patria chutné raňajky – už ste raňajkovali?" + "deň" -> "Povedali ste, že je teraz deň. Počas dňa sa zíde mať plán – máte dnes niečo naplánované?" + else-> "Povedali ste, že je teraz večer. Večer je dobrý na oddych – už ste si dnes trochu oddýchli?" + } + + askRepeatable(question4) + } + + onResponse { + furhat.say("To je výborne. Pokračujme ďalej.") + goto(TimeTrainingSuccess) + } + + onResponse { + furhat.say("To nevadí. Dôležité je, že sa snažíte. Pokračujme ďalej.") + goto(TimeTrainingSuccess) + } + + onResponse { + handleRephrase(it.intent) + } + + onResponse { + if (handleStop(it.intent, + "time", + currentTimeQuestionType.name, + it.text ?: "")) + { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } + } + + onResponse { + if (handleStop(it.intent, "time", "small_talk", it.text ?: "")){ + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } +// if (handleRepeat(it.intent)){ +// return@onResponse +// } + + furhat.ask("Prepáčte, stačí povedať áno alebo nie.") + } +} + +// -------------------- CURRENT TIME -------------------- + +val CurrentTimeSmallTalk: State = SmallTalk { + val period = DateTimeChecker.currentDayPeriod() + val questionHodiny = when (period) { + DayPeriod.MORNING -> "Ešte je ráno, máte celý deň pred sebou. Máte dnes ešte niečo, čo chcete stihnúť?" + DayPeriod.DAY -> "Je ešte deň. Máte dnes ešte niečo, čo chcete stihnúť?" + DayPeriod.EVENING -> "Už je večer. Máte ešte dnes niečo, čo by ste chceli stihnúť?" + } + + listOf( + "Ste skôr ranný typ, alebo nočná sova?", + questionHodiny + ).random() +} + +// -------------------- TODAY DATE -------------------- + +val TodayDateSmallTalk: State = SmallTalk { + listOf( + "Máte dnes nejakú drobnosť, na ktorú sa tešíte?", + "Viete si spomenúť, či je dnes niečí sviatok alebo meniny vo vašom okolí?", + "Máte radšej začiatok mesiaca, alebo jeho koniec?" + ).random() +} + +// -------------------- TOMORROW DATE -------------------- + +val TomorrowDateSmallTalk: State = SmallTalk { + listOf( + "Máte zajtra niečo naplánované?", + "Tešíte sa viac na zajtrajšok, alebo ste spokojní s dneškom?", + "Zajtra je nový deň — chcete si zajtra niečo dopriať alebo urobiť inak?", + "Čo by vám zajtra urobilo radosť, aj keby to bola maličkosť?" + ).random() +} + +// -------------------- CURRENT MONTH -------------------- + +val CurrentMonthSmallTalk: State = SmallTalk { + listOf( + "Čím si ho najviac spájate — počasím, sviatkami, alebo niečím iným?", + "Máte v tomto mesiaci niečo, na čo sa radi pripravujete?", + "Viete, čo máte na tomto mesiaci najradšej?", + "Je tento mesiac pre vás skôr pokojný, alebo máte veľa povinností?" + ).random() +} + +//------------------------------ +private fun weekdayInPhrase(day: String): String = when (day.lowercase()) { + "pondelok" -> "v pondelok" + "utorok" -> "v utorok" + "streda" -> "v stredu" + "štvrtok" -> "vo štvrtok" + "piatok" -> "v piatok" + "sobota" -> "v sobotu" + "nedeľa", "nedela" -> "v nedeľu" + else -> "dnes" +} + +val WeekdaySmallTalk: State = SmallTalk { + val day = DateTimeChecker.CorrectTodayWeekday() + val dayLc = day.lowercase() + val dayPrep = weekdayInPhrase(day) + + val daySpecific = when (dayLc) { + "pondelok" -> "Povedali ste, že je dnes pondelok. Pondelok je často štart týždňa – máte chuť začať deň pomalšie, alebo hneď naplno?" + "utorok" -> "Povedali ste, že je dnes utorok. Utorok býva taký pracovný rozbeh – máte dnes niečo, čo chcete vybaviť?" + "streda" -> "Povedali ste, že je dnes streda. Streda je polovica týždňa – máte pocit, že týždeň ide rýchlo, alebo pomaly?" + "štvrtok" -> "Povedali ste, že je dnes štvrtok. Už sa blíži víkend – tešíte sa na niečo v najbližších dňoch?" + "piatok" -> "Povedali ste, že je dnes piatok. Piatok znie príjemne – plánujete si dnes dopriať trochu oddychu?" + "sobota" -> "Povedali ste, že je dnes sobota. Sobota je často na oddych – máte dnes niečo príjemné v pláne?" + "nedeľa", "nedela" -> "Povedali ste, že je dnes nedeľa. Nedeľa býva pokojná – ako najradšej trávite nedeľu?" + else -> "Ďakujem. A aký máte dnes deň?" + } + + val universal = listOf( + "Je pre vás $day skôr \"pracovný\" alebo \"oddychový\"?", + "Máte $dayPrep nejaký malý zvyk alebo rutinu?", + "Chcete si dnes radšej naplánovať niečo, alebo nechať deň plynúť voľne?", + "Keby ste si mali vybrať jednu vec na dnes, čo by to bolo?" + ) + + listOf(daySpecific, universal.random()).random() +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/say_time/TimeCompare.kt b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/TimeCompare.kt new file mode 100644 index 0000000..9e695e7 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/TimeCompare.kt @@ -0,0 +1,358 @@ +package furhatos.app.blank.flow.main.say_time + +import java.time.* +import java.time.format.DateTimeFormatter + +enum class TimeQuestionType { + CURRENT_TIME, + TODAY_DATE, + TOMORROW_DATE, + CURRENT_MONTH, + TODAY_WEEKDAY, + DAY_PERIOD +} + +enum class DayPeriod { + MORNING, + DAY, + EVENING +} + + +object DateTimeChecker { + + private fun now(): LocalDateTime = LocalDateTime.now() + + // ---------- 'slovo -> cislo' pre mesiac a hodiny ---------- + + private val NUMBER_WORDS = mapOf( + "nula" to 0, "nultý" to 0, + "jeden" to 1, "jedna" to 1, "jedno" to 1, "prvý" to 1, "prvá" to 1, + "dva" to 2, "dve" to 2, "druhý" to 2, "druhá" to 2, + "tri" to 3, "tretí" to 3, "tretia" to 3, + "štyri" to 4, "styri" to 4, "štvrtý" to 4, "štvrtá" to 4, + "päť" to 5, "pat" to 5, "piaty" to 5, "piata" to 5, + "šesť" to 6, "sest" to 6, "šiesty" to 6, "šiesta" to 6, + "sedem" to 7, "siedmy" to 7, "siedma" to 7, + "osem" to 8, "ôsmy" to 8, "ôsma" to 8, + "deväť" to 9, "devat" to 9, "deviaty" to 9, "deviatá" to 9, + + "desať" to 10, "desat" to 10, "desiaty" to 10, "desiatá" to 10, + "jedenásť" to 11, "jedenast" to 11, "jedenásty" to 11, "jedenásta" to 11, + "dvanásť" to 12, "dvanast" to 12, "dvanásty" to 12, "dvanásta" to 12, + "trinásť" to 13, "trinast" to 13, "trinásty" to 13, "trinásta" to 13, + "štrnásť" to 14, "strnast" to 14, "štrnact" to 14, "štrnásty" to 14, "štrnásta" to 14, + "pätnásť" to 15, "patnast" to 15, "pätnásty" to 15, "pätnásta" to 15, + "šestnásť" to 16, "sestnast" to 16, "šestnásty" to 16, "šestnásta" to 16, + "sedemnásť" to 17, "sedemnast" to 17, "sedemnásty" to 17, "sedemnástá" to 17, + "osemnásť" to 18, "osemnast" to 18, "osemnásty" to 18, "osemnásta" to 18, + "devätnásť" to 19, "devatnast" to 19, "devätnásty" to 19, "devätnásta" to 19, + + "dvadsať" to 20, "dvadsat" to 20, "dvadsiatá" to 20, + "dvadsaťjeden" to 21, "dvadsať jedna" to 21, "dvadsiaty prvý" to 21, "dvadsiať prvá" to 21, + "dvadsaťdva" to 22, "dvadsať dva" to 22, "dvadsiaty druhý" to 22, "dvadsiať druhá" to 22, + "dvadsaťtri" to 23, "dvadsať tri" to 23, "dvadsiaty tretí" to 23, "dvadsiať treťa" to 23 + ) + + private fun numberFromWord(raw: String): Int? { + val cleaned = raw + .trim('.', ',', ';') + .lowercase() + return NUMBER_WORDS[cleaned] + } + + // -------------- HODINY ---------------------------------- + fun parseClockTime(text: String): LocalTime? { + val regex = Regex("""\b(\d{1,2})[ ](\d{1,2})\b""") + val match = regex.find(text) ?: return null + + val (hStr, mStr) = match.destructured + val hour = hStr.toIntOrNull() ?: return null + val minute = mStr.toIntOrNull() ?: return null + + if (hour !in 0..23 || minute !in 0..59) return null + + return LocalTime.of(hour, minute) + } + // -------------- HODINY (len cas ) ---------------------------------- + private fun parseHour(text: String): Int? { + + val digitRegex = Regex("""\b(\d{1,2})\b""") + val digitMatch = digitRegex.find(text) + val hDigit = digitMatch?.groupValues?.get(1)?.toIntOrNull() + if (hDigit != null && hDigit in 0..23) { + return hDigit + } + + val wordRegex = Regex("""\b([\p{L}]+)\b""") + for (m in wordRegex.findAll(text.lowercase())) { + val word = m.groupValues[1] + val num = numberFromWord(word) ?: continue + if (num in 0..23) { + return num + } + } + + return null + } + + fun isCorrectCurrentTime( + text: String, + toleranceMinutes: Long = 10, + hourToleranceHours: Int = 1 // допуск по часам для "примерного" ответа + ): Boolean { + val nowTime = now().toLocalTime() + + // ak presny cas + val detailed = parseClockTime(text) + if (detailed != null) { + val diffMin = Duration.between(detailed, nowTime).abs().toMinutes() + return diffMin <= toleranceMinutes + } + + // ak len hodina + val hourOnly = parseHour(text) ?: return false + val diffHours = kotlin.math.abs(hourOnly - nowTime.hour) + return diffHours <= hourToleranceHours + } + + // -------------- DATUM ---------------------------- + private val MONTH_WORDS = mapOf( + "januar" to 1, "január" to 1, "januara" to 1, "januára" to 1, + "februar" to 2, "február" to 2, "februara" to 2, "februára" to 2, + "marec" to 3, "marca" to 3, + "april" to 4, "apríl" to 4, "aprila" to 4, "apríla" to 4, + "maj" to 5, "máj" to 5, "maja" to 5, "mája" to 5, + "jun" to 6, "jún" to 6, "juna" to 6, "júna" to 6, + "jul" to 7, "júl" to 7, "jula" to 7, "júla" to 7, + "august" to 8, "augusta" to 8, + "september" to 9, "septembra" to 9, + "oktober" to 10, "október" to 10, "oktobra" to 10, "októbra" to 10, + "november" to 11, "novembra" to 11, + "december" to 12, "decembra" to 12 + ) + + private fun monthFromWord(raw: String): Int? { + val cleaned = raw + .trim('.', ',', ';') + .lowercase() + return MONTH_WORDS[cleaned] + } + + private fun findAllNumbers(text: String): List { + val regex = Regex("""\b(\d{1,2})\b""") + return regex.findAll(text) + .mapNotNull { it.groupValues[1].toIntOrNull() } + .toList() + } + + fun parseDay(text: String): Int? { + val nums = findAllNumbers(text) + val digitDay = nums.firstOrNull { it in 1..31 } + if (digitDay != null) return digitDay + + // nie su cisla + val wordRegex = Regex("""\b([\p{L}]+)\b""") + for (m in wordRegex.findAll(text.lowercase())) { + val word = m.groupValues[1] + val num = numberFromWord(word) ?: continue + if (num in 1..31) { + return num + } + } + + return null + } + + fun parseMonth(text: String): Int? { + val normalized = text.lowercase() + + // standartne nazvy + val wordRegex = Regex("""\b([\p{L}]+)\b""") + for (m in wordRegex.findAll(normalized)) { + val word = m.groupValues[1] + val month = monthFromWord(word) + if (month != null) return month + } + + // cisla + val ordinalMonthRegex = Regex("""\b([\p{L}]+)\s+mesiac\w*\b""") + val ordMatch = ordinalMonthRegex.find(normalized) + if (ordMatch != null) { + val ordinalWord = ordMatch.groupValues[1] + val num = numberFromWord(ordinalWord) + if (num != null && num in 1..12) return num + } + + val nums = findAllNumbers(text) + if (nums.size >= 2) { + val month = nums[1] + if (month in 1..12) return month + } + val single = nums.firstOrNull { it in 1..12 } + return single + } + + // Dnesny datum -------------------- + fun isCorrectTodayDate(text: String): Boolean { + val today = LocalDate.now() + val day = parseDay(text) ?: return false + val month = parseMonth(text) + + return if (month == null) { + // пользователь сказал только число + day == today.dayOfMonth + } else { + // пользователь сказал и число, и месяц + day == today.dayOfMonth && month == today.monthValue + } + } + + // Zajtra --------------------------------------------------- + fun isCorrectTomorrowDate(text: String): Boolean { + val tomorrow = LocalDate.now().plusDays(1) + val day = parseDay(text) ?: return false + val month = parseMonth(text) + + return if (month == null) { + day == tomorrow.dayOfMonth + } else { + day == tomorrow.dayOfMonth && month == tomorrow.monthValue + } + } + + // Mesiac ----------------------------------------- + fun isCorrectCurrentMonth(text: String): Boolean { + val today = LocalDate.now() + val month = parseMonth(text) ?: return false + return month == today.monthValue + } + + // ---------- DEN TYZDN'A ---------- + + private val WEEKDAY_WORDS = mapOf( + "pondelok" to DayOfWeek.MONDAY, "pondelka" to DayOfWeek.MONDAY, + "utorok" to DayOfWeek.TUESDAY, "utorka" to DayOfWeek.TUESDAY, + "streda" to DayOfWeek.WEDNESDAY, "stredu" to DayOfWeek.WEDNESDAY, + "štvrtok" to DayOfWeek.THURSDAY, "stvrtok" to DayOfWeek.THURSDAY, + "štvrtka" to DayOfWeek.THURSDAY, "stvrtka" to DayOfWeek.THURSDAY, + "piatok" to DayOfWeek.FRIDAY, "piatka" to DayOfWeek.FRIDAY, + "sobota" to DayOfWeek.SATURDAY, "sobotu" to DayOfWeek.SATURDAY, + "nedeľa" to DayOfWeek.SUNDAY, "nedela" to DayOfWeek.SUNDAY, "nedeľu" to DayOfWeek.SUNDAY, "nedelu" to DayOfWeek.SUNDAY + ) + + private fun weekdayFromWord(raw: String): DayOfWeek? { + val cleaned = raw + .trim('.', ',', ';') + .lowercase() + return WEEKDAY_WORDS[cleaned] + } + + fun parseWeekday(text: String): DayOfWeek? { + val normalized = text.lowercase() + val wordRegex = Regex("""\b([\p{L}]+)\b""") + for (m in wordRegex.findAll(normalized)) { + val word = m.groupValues[1] + val weekday = weekdayFromWord(word) + if (weekday != null) return weekday + } + return null + } + + fun isCorrectTodayWeekday(text: String): Boolean { + val today = LocalDate.now() + val weekday = parseWeekday(text) ?: return false + + return weekday == today.dayOfWeek + } + + // ---------- DOBA ---------- + fun currentDayPeriod(): DayPeriod { + val t = now().toLocalTime() + return when { + t.hour in 5..11 -> DayPeriod.MORNING + t.hour in 12..17 -> DayPeriod.DAY + else -> DayPeriod.EVENING + } + } + + private fun parseDayPeriod(text: String): DayPeriod? { + val normalized = text.lowercase() + // ráno + if (Regex("""\b(ráno|rano|doobeda|dopoludnie)\b""").containsMatchIn(normalized)) + return DayPeriod.MORNING + // deň + if (Regex("""\b(deň|den|obed|na obed|poobede|popoludnie)\b""").containsMatchIn(normalized)) + return DayPeriod.DAY + // večer + if (Regex("""\b(večer|vecer|podvečer|podvecer)\b""").containsMatchIn(normalized)) + return DayPeriod.EVENING + return null + } + + /** Проверка: правильно ли пользователь назвал текущую "dennú dobu" (ráno / deň / večer). */ + fun isCorrectCurrentDayPeriod(text: String): Boolean { + val userPeriod = parseDayPeriod(text) ?: return false + val nowPeriod = currentDayPeriod() + return userPeriod == nowPeriod + } + + // ---------- format pre robota ---------- + + private val MONTHS_NOMINATIVE = listOf( + "január", "február", "marec", "apríl", "máj", "jún", + "júl", "august", "september", "október", "november", "december" + ) + +// private val MONTHS_GENITIVE = listOf( +// "januára", "februára", "marca", "apríla", "mája", "júna", +// "júla", "augusta", "septembra", "októbra", "novembra", "decembra" +// ) + + private val WEEKDAYS = mapOf( + DayOfWeek.MONDAY to "pondelok", + DayOfWeek.TUESDAY to "utorok", + DayOfWeek.WEDNESDAY to "streda", + DayOfWeek.THURSDAY to "štvrtok", + DayOfWeek.FRIDAY to "piatok", + DayOfWeek.SATURDAY to "sobota", + DayOfWeek.SUNDAY to "nedeľa" + ) + + // hodiny + fun CorrectCurrentTime(): String { + val t = now().toLocalTime() + return t.format(DateTimeFormatter.ofPattern("HH:mm")) + } + + // dnes + fun CorrectTodayDate(): String = formatDate(LocalDate.now()) + + // zajtra + fun CorrectTomorrowDate(): String = formatDate(LocalDate.now().plusDays(1)) + + // mesiac + fun CorrectCurrentMonth(): String { + val m = LocalDate.now().monthValue + return MONTHS_NOMINATIVE[m - 1] + } + + // dan tyzdna + fun CorrectTodayWeekday(): String { + val d = LocalDate.now() + val wd = WEEKDAYS[d.dayOfWeek] ?: d.dayOfWeek.name.lowercase() + return "$wd" + } + + // doba + fun CorrectCurrentDayPeriod(): String = when (currentDayPeriod()) { + DayPeriod.MORNING -> "ráno" + DayPeriod.DAY -> "deň" + DayPeriod.EVENING -> "večer" + } + + private fun formatDate(d: LocalDate): String { + val monthGen = MONTHS_NOMINATIVE[d.monthValue - 1] + return "${d.dayOfMonth}. $monthGen" + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/say_time/TimeHint.kt b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/TimeHint.kt new file mode 100644 index 0000000..ad3f199 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/say_time/TimeHint.kt @@ -0,0 +1,363 @@ +package furhatos.app.blank.flow.main.say_time + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.supporting.HintOffer +import furhatos.app.blank.flow.main.supporting.calm +import furhatos.app.blank.flow.main.supporting.general.callProxyRespond +import furhatos.app.blank.flow.main.supporting.general.isProxyAvailable +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.furhat +import furhatos.flow.kotlin.state +import java.time.LocalDate +import java.time.LocalTime +import java.time.DayOfWeek +import java.time.YearMonth + +//-------- Hours ------------ +private fun hourQuarter(minute: Int): String = when (minute) { + in 0..14 -> "prvej" + in 15..29 -> "druhej" + in 30..44 -> "tretej" + else -> "štvrtej" +} +//------- Date --------- + +private data class DateData( + val monthName: String, + val lastDay: Int, // 28/29/30/31 + val rangeStart: Int, + val rangeEnd: Int, + val section: String // opis pra napovedu +) + +private fun getDateData(date: LocalDate): DateData { + val lastDay = YearMonth.of(date.year, date.month).lengthOfMonth() + val day = date.dayOfMonth + + val (start, end, label) = when { + day <= 9 -> Triple(1, minOf(9, lastDay), "začiatok mesiaca") + day <= 19 -> Triple(10, minOf(19, lastDay), "desiate dni mesiaca") + day <= 26 -> Triple(20, minOf(26, lastDay), "dvadsiate dni mesiaca") + else -> Triple(27, lastDay, "koniec mesiaca") + } + + return DateData( + monthName = MonthNominative(date.monthValue), + lastDay = lastDay, + rangeStart = start, + rangeEnd = end, + section = label + ) +} + +//---------------------- + +private fun MonthNominative(m: Int): String = when (m) { + 1 -> "január" + 2 -> "február" + 3 -> "marec" + 4 -> "apríl" + 5 -> "máj" + 6 -> "jún" + 7 -> "júl" + 8 -> "august" + 9 -> "september" + 10 -> "október" + 11 -> "november" + else -> "december" +} + +//--------- den tyzdna ---------- +private fun weekdays(d: java.time.DayOfWeek): String = when (d) { + java.time.DayOfWeek.MONDAY -> "pondelok" + java.time.DayOfWeek.TUESDAY -> "utorok" + java.time.DayOfWeek.WEDNESDAY -> "streda" + java.time.DayOfWeek.THURSDAY -> "štvrtok" + java.time.DayOfWeek.FRIDAY -> "piatok" + java.time.DayOfWeek.SATURDAY -> "sobota" + java.time.DayOfWeek.SUNDAY -> "nedeľa" +} + +private fun weekdayIndex(d: java.time.DayOfWeek): Int = when (d) { + java.time.DayOfWeek.MONDAY -> 1 + java.time.DayOfWeek.TUESDAY -> 2 + java.time.DayOfWeek.WEDNESDAY -> 3 + java.time.DayOfWeek.THURSDAY -> 4 + java.time.DayOfWeek.FRIDAY -> 5 + java.time.DayOfWeek.SATURDAY -> 6 + java.time.DayOfWeek.SUNDAY -> 7 +} +private fun weekdayNumber(n: Int): String = when (n) { + 1 -> "prvý" + 2 -> "druhý" + 3 -> "tretí" + 4 -> "štvrtý" + 5 -> "piaty" + 6 -> "šiesty" + else -> "siedmy" +} + +private fun prevDay(d: DayOfWeek): DayOfWeek = + if (d == DayOfWeek.MONDAY) DayOfWeek.SUNDAY else DayOfWeek.of(d.value - 1) + +private fun nextDay(d: DayOfWeek): DayOfWeek = + if (d == DayOfWeek.SUNDAY) DayOfWeek.MONDAY else DayOfWeek.of(d.value + 1) + +private fun weekSection(idx: Int): String = when (idx) { + 1, 2 -> "začiatok týždňa" + 3, 4 -> "stred týždňa" + else -> "koniec týždňa" +} + +//----------- Mesiac ------------ +private data class SeasonMonth( + val season: String, + val n: Int +) + +private fun seasonMonth(month: Int): SeasonMonth = when (month) { + 12 -> SeasonMonth("zimy", 1) + 1 -> SeasonMonth("zimy", 2) + 2 -> SeasonMonth("zimy", 3) + + 3 -> SeasonMonth("jari", 1) + 4 -> SeasonMonth("jari", 2) + 5 -> SeasonMonth("jari", 3) + + 6 -> SeasonMonth("leta", 1) + 7 -> SeasonMonth("leta", 2) + 8 -> SeasonMonth("leta", 3) + + 9 -> SeasonMonth("jesene", 1) + 10 -> SeasonMonth("jesene", 2) + else -> SeasonMonth("jesene", 3) +} + +private fun seasonNumber(n: Int): String = when (n) { + 1 -> "prvý" + 2 -> "druhý" + else -> "tretí" +} + +private fun season(month: Int): String = when (month) { + 12, 1, 2 -> "Teraz je zima." + 3, 4, 5 -> "Teraz je jar." + 6, 7, 8 -> "Teraz je leto." + else -> "Teraz je jeseň." +} + +private fun buildHintContext(type: TimeQuestionType, baseHint: String): Map { + val ctx = mutableMapOf( + "task" to "hint", + "language" to "sk", + "question_type" to type.name, + "base_hint" to baseHint, + "rules" to mapOf( + "do_not_reveal_exact_answer" to true, + "max_sentences" to 2, + "keep_game_rules" to true + ) + ) + + // Если у тебя есть lastQuestionText (мы добавляли для explain_wrong) — раскомментируй: + // ctx["question"] = lastQuestionText + + when (type) { + TimeQuestionType.CURRENT_TIME -> { + val now = LocalTime.now() + val h = now.hour + val next = (h + 1) % 24 + ctx["hour_from"] = if (h == 0) "0" else h.toString() + ctx["hour_to"] = if (next == 0) "0" else next.toString() + ctx["minute_hint"] = hourQuarter(now.minute) + ctx["suggested_formats"] = listOf("je päť hodín", "5:00", "okolo piatej") + } + + TimeQuestionType.TODAY_DATE -> { + val d = getDateData(LocalDate.now()) + ctx["expected_format"] = "DD.MM.YYYY" + ctx["range_start"] = d.rangeStart + ctx["range_end"] = d.rangeEnd + ctx["section"] = d.section + ctx["month_name"] = d.monthName + ctx["year"] = LocalDate.now().year + } + + TimeQuestionType.TOMORROW_DATE -> { + val today = LocalDate.now() + val tomorrow = today.plusDays(1) + val d = getDateData(tomorrow) + val isNewMonth = tomorrow.dayOfMonth == 1 || tomorrow.month != today.month + + ctx["expected_format"] = "DD.MM.YYYY" + ctx["rule"] = "Zajtra je o jeden deň neskôr ako dnes." + ctx["is_new_month"] = isNewMonth + ctx["month_name"] = d.monthName + ctx["range_start"] = d.rangeStart + ctx["range_end"] = d.rangeEnd + ctx["section"] = d.section + ctx["year"] = tomorrow.year + } + + TimeQuestionType.CURRENT_MONTH -> { + val month = LocalDate.now().monthValue + val info = seasonMonth(month) + ctx["answer_kind"] = "month_name" + ctx["season"] = info.season + ctx["month_in_season"] = info.n + ctx["allowed_hints"] = listOf("season", "month_number_without_name", "first_letter") + } + + TimeQuestionType.TODAY_WEEKDAY -> { + val today = LocalDate.now() + val wd = today.dayOfWeek + val i = weekdayIndex(wd) + + ctx["answer_kind"] = "weekday_name" + ctx["weekday_index"] = i + ctx["week_section"] = weekSection(i) + ctx["yesterday"] = weekdays(prevDay(wd)) + ctx["tomorrow"] = weekdays(nextDay(wd)) + ctx["allowed_hints"] = listOf("weekday_or_weekend", "order_in_week_without_name") + } + + TimeQuestionType.DAY_PERIOD -> { + ctx["options"] = listOf("ráno", "deň", "večer") + ctx["rough_ranges"] = mapOf( + "ráno" to "5–11", + "deň" to "12–17", + "večer" to "18–23" + ) + } + } + + return ctx +} + +//---------------------------------------------------------------- + +val TimeHintOffer: State by lazy { + HintOffer(nextState = TimeHint, exitState = AskTime) +} + +val TimeHint = state(Parent) { + onEntry { + hintUsedForCurrentQuestion = true + val baseHint = when (currentTimeQuestionType) { + + TimeQuestionType.CURRENT_TIME -> { + val now = LocalTime.now() + val h = now.hour + val next = (h + 1) % 24 + val quarter = hourQuarter(now.minute) + + val hourFrom = if (h == 0) "0" else h.toString() + val hourTo = if (next == 0) "0" else next.toString() + + val hints = listOf( + "Malá nápoveda: je to medzi $hourFrom a $hourTo hodinou.", + "Dobre! Tu je moja nápoveda: teraz je čas niekde medzi $hourFrom a $hourTo hodinou, skôr v $quarter časti tejto hodiny.", + "Skúste odhad: je to medzi $hourFrom a $hourTo hodinou. A minúty sú približne v $quarter časti hodiny." + ) + + calm() + hints.random() + } + + TimeQuestionType.TODAY_DATE -> { + val d = getDateData(LocalDate.now()) + + val hints = listOf( + "Pomôcka: dnešné číslo je medzi ${d.rangeStart} a ${d.rangeEnd}", + "Teraz je ${d.section}, teda číslo je medzi ${d.rangeStart} a ${d.rangeEnd}." + ) + + calm() + hints.random() + } + + TimeQuestionType.TOMORROW_DATE -> { + val today = LocalDate.now() + val tomorrow = today.plusDays(1) + val d = getDateData(tomorrow) + + val isNewMonth = tomorrow.dayOfMonth == 1 || tomorrow.month != today.month + + val hints = mutableListOf() + + if (!isNewMonth) { + hints += "Malá nápoveda: zajtra bude stále v mesiaci ${d.monthName}." + } + if (isNewMonth) { + hints += "Malá nápoveda: zajtra už bude v mesiaci ${d.monthName}." + } + + hints += "Zajtra spadá do časti ${d.section}. Skúste číslo medzi ${d.rangeStart} a ${d.rangeEnd}." + hints += "Dobre! Tu je moja nápoveda: číslo zajtrajšieho dňa je medzi ${d.rangeStart} a ${d.rangeEnd}" + + calm() + hints.random() + } + + TimeQuestionType.CURRENT_MONTH -> { + + + val month = LocalDate.now().monthValue + val info = seasonMonth(month) + val number = seasonNumber(info.n) + + val hints = listOf( + "Malá nápoveda: teraz je $number mesiac ${info.season}. Pamätáte si, ktorý mesiac to je?", + "Dobre! Tu je moja nápoveda: sme v $number mesiaci ${info.season}.", + "Fajn! Skúsme to takto: ${season(month)}, čiže ide o $number mesiac ${info.season}. Ktorý mesiac to môže byť?", + ) + + calm() + hints.random() + } + + TimeQuestionType.TODAY_WEEKDAY -> { + val today = LocalDate.now() + val wd = today.dayOfWeek + + val i = weekdayIndex(today.dayOfWeek) + val n = weekdayNumber(i) + + val yesterdayWd = weekdays(prevDay(wd)) + val tomorrowWd = weekdays(nextDay(wd)) + + val section = weekSection(i) + + val hints = listOf( + "Fajn! Moja malá nápoveda: dnes je $n deň v týždni.", + "Tak teda, moja nápoveda: v týždni je to $n deň (počítame od pondelka).", + "Včera bol $yesterdayWd a zajtra bude $tomorrowWd. Aký deň je potom dnes?", + "Teraz je $section. Skúste si spomenúť, aký to je konkrétny deň." + ) + + calm() + hints.random() + } + + TimeQuestionType.DAY_PERIOD -> { + calm() + "Fajn! Malá pomôcka: ráno je približne päť až jedenásť, deň dvanásť až sedemnásť a večer osemnásť až dvadsaťtri. Čo z toho je teraz najbližšie?" + } + } + + val ctx = buildHintContext(currentTimeQuestionType, baseHint) + + val gptHint = if (isProxyAvailable()) { + callProxyRespond( + userText = "HINT_REQUEST", + task = "hint", + context = ctx + ) + } else null + + val finalHint = if (!gptHint.isNullOrBlank()) gptHint else baseHint + furhat.say(finalHint) + + goto(AskTime) + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/AskToContinue.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/AskToContinue.kt new file mode 100644 index 0000000..bd7f919 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/AskToContinue.kt @@ -0,0 +1,35 @@ +package furhatos.app.blank.flow.main.supporting + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.nlu.base_answer.Ano +import furhatos.app.blank.nlu.base_answer.Nie +import furhatos.flow.kotlin.* + +fun AskToContinue() = state(Parent) { + + onEntry { + furhat.ask( + "Chcete pokračovať hrať alebo by ste chceli skončiť?" + ) + } + + onResponse { + veryHappy() + furhat.say("Výborne, budeme pokračovať.") + delay(700) + terminate(true) + } + + onResponse { + empathy() + furhat.say("Rozumiem, nebudeme pokračovať hráť v tuto hru.") + delay(700) + terminate(false) + } + + onResponse { + furhat.say("Prepáčte, nerozumel som. Odpovedzte prosím chcete pokračovať alebo nechcete.") + delay(700) + reentry() + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/CheckCondition.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/CheckCondition.kt new file mode 100644 index 0000000..562422f --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/CheckCondition.kt @@ -0,0 +1,106 @@ +package furhatos.app.blank.flow.main.supporting +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.StartQuestion +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleRephrase +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.flow.main.supporting.general.TrainingMenuFlags +import furhatos.flow.kotlin.* +import furhatos.app.blank.nlu.other_responses.FeelGood +import furhatos.app.blank.nlu.other_responses.FeelBad +import furhatos.app.blank.nlu.base_answer.Ano +import furhatos.app.blank.nlu.base_answer.Nie + + +val CheckCondition: State = state(Parent) { + + onEntry { + TrainingMenuFlags.resetAll() + + furhat.ask { + random { + +"Ako sa máte?" + +"Ako sa dnes cítite?" + +"Ako sa vám dnes darí?" + +"Máte sa dobre?" + +"Ako sa cítite práve teraz?" + +"Ako sa cítite po dnešku?" + +"Je vám dnes dobre?" + } + } + } + + onResponse { + veryHappy() + furhat.say("Som rád, že sa cítite dobre.") + delay(1000) + goto(ReadyToTrain(StartQuestion, Goodbye)) + } + + + onResponse { + empathy() + furhat.say( + "Rozumiem, nechcem vás dnes zaťažovať. " + + "Dnes je lepšie odpočívať." + ) + goto(Goodbye) + } + + onResponse { + happyNod() + furhat.say("Ďakujem za odpoveď. Môžme skusíť si napriek tomu krátku hru.") + goto(StartQuestion) + } +} + +fun ReadyToTrain(nextState: State, exitState: State): State = state(Parent) { + + fun prompt(): String { + return if (TrainingMenuFlags.allExercisesCompleted()) + "Dnes sme už už odohrali všetky hry. Chcete si niektoré zopakovať?" + else if (TrainingMenuFlags.hasTrainedOnce) + "Chcete si zahrať inú hru?" + else + "Chcete si zahrať hru?" + } + + onEntry { + furhat.ask(prompt()) + } + + onReentry { + furhat.ask(prompt()) + } + + onResponse { + veryHappy() + furhat.say("Výborne, tak poďme na to.") + delay(1000) + goto(nextState) + } + + onResponse { + empathy() + furhat.say("Rozumiem, môžeme to skúsiť inokedy.") + goto(exitState) + } + + onResponse { + if (handleRephrase(it.intent)){ + return@onResponse + } +// if (handleRepeat(it.intent)){ +// return@onResponse +// } + if (handleStop(it.intent, "system", "check_condition", it.text ?: "")){ + goto(Goodbye) + return@onResponse + } + + furhat.say("Prepáčte, nerozumela som.") + reentry() + } +} + diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/Difficulty.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/Difficulty.kt new file mode 100644 index 0000000..0f70b42 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/Difficulty.kt @@ -0,0 +1,37 @@ +package furhatos.app.blank.flow.main.supporting + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.nlu.base_answer.Ano +import furhatos.app.blank.nlu.base_answer.Nie +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.furhat +import furhatos.flow.kotlin.onResponse +import furhatos.flow.kotlin.state + +val AskIncreaseDifficulty: State = state(Parent) { + onEntry { + furhat.ask("Chcete, aby som povedal viac slov?") + } + + onResponse { terminate(true) } + onResponse { terminate(false) } + + onResponse { + furhat.say("Prepáčte, odpovedzte prosím áno alebo nie.") + reentry() + } +} + +val AskDecreaseDifficulty: State = state(Parent) { + onEntry { + furhat.ask("Chcete sa vrátiť na predchádzajúcu, ľahšiu úroveň náročnosti?") + } + + onResponse { terminate(true) } + onResponse { terminate(false) } + + onResponse { + furhat.say("Prepáčte, odpovedzte prosím áno alebo nie.") + reentry() + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/HintOffer.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/HintOffer.kt new file mode 100644 index 0000000..39fbf45 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/HintOffer.kt @@ -0,0 +1,44 @@ +package furhatos.app.blank.flow.main.supporting +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.Idle +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.flow.kotlin.* +import furhatos.app.blank.nlu.base_answer.Ano +import furhatos.app.blank.nlu.base_answer.Nie +import furhatos.gestures.Gestures + + +fun HintOffer(nextState: State, exitState: State): State = state(Parent) { + onEntry { + calm() + furhat.ask { + random { + +"Chcete malú nápovedu?" + +"Pomôže Vám malá nápoveda?" + +"Možno by som mala Vám dať nápovedu?" + } + } + } + + onResponse { + calm() + goto(nextState) + } + + onResponse { + empathy() + furhat.say("Dobre! Tak potom jednoducho budeme pokračovať.") + goto(exitState) + } + + onResponse { + furhat.say { + random { + +"Stačí povedať áno alebo nie." + +"Prosím, povedzte áno alebo nie." + } + } + reentry() + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/Reactions.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/Reactions.kt new file mode 100644 index 0000000..d45e4b8 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/Reactions.kt @@ -0,0 +1,73 @@ +package furhatos.app.blank.flow.main.supporting + +import furhatos.flow.kotlin.FlowControlRunner +import furhatos.flow.kotlin.furhat +import furhatos.gestures.BasicParams +import furhatos.gestures.Gesture +import furhatos.gestures.Gestures +import furhatos.gestures.defineGesture + +fun FlowControlRunner.happyNod(async: Boolean = true) { + furhat.gesture(Gestures.Smile, async = async) + furhat.gesture(Gestures.Nod, async = async) +} + +fun FlowControlRunner.happyShake(async: Boolean = true) { + furhat.gesture(Gestures.Shake, async = async) + furhat.gesture(Gestures.Smile, async = async) +} + +val LittleSadHeadDown: Gesture = defineGesture("LittleSadHeadDown") { + frame(0.25) { + BasicParams.NECK_TILT to 2.0 + } + frame(0.55) { + BasicParams.NECK_TILT to 5.0 + } + frame(0.9, 2.0) { + BasicParams.NECK_TILT to 9.0 + } + + // плавное возвращение + frame(2.35) { + BasicParams.NECK_TILT to 5.0 + } + frame(2.65) { + BasicParams.NECK_TILT to 1.0 + } + reset(3.0) +} +fun FlowControlRunner.littleSad(async: Boolean = true) { + // грустная эмоция + furhat.gesture(Gestures.ExpressSad(strength = 0.4, duration = 0.8), async = true) + + // лёгкий наклон головы вниз примерно на 2 секунды + furhat.gesture(LittleSadHeadDown, async = async) +} + +fun FlowControlRunner.empathy(async: Boolean = true) { + furhat.gesture(Gestures.CloseEyes, async = false) + furhat.gesture(Gestures.Nod, async = async) + delay(700) + furhat.gesture(Gestures.OpenEyes, async = false) +} + +fun FlowControlRunner.calm(async: Boolean = true) { + furhat.gesture(Gestures.Smile, async = async) + furhat.gesture(Gestures.Blink, async = async) +} + +fun FlowControlRunner.veryHappy(async: Boolean = true) { + furhat.gesture(Gestures.BigSmile, async = async) + furhat.gesture(Gestures.BrowRaise, async = async) +} + +val SmileIdle: Gesture = defineGesture("SmileIdle") { + frame(0.2, persist = true) { + BasicParams.SMILE_CLOSED to 0.70 + BasicParams.BROW_UP_LEFT to 0.05 + BasicParams.BROW_UP_RIGHT to 0.05 + } +} + + diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/SmallTalk.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/SmallTalk.kt new file mode 100644 index 0000000..a383df7 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/SmallTalk.kt @@ -0,0 +1,75 @@ +package furhatos.app.blank.flow.main.supporting + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.StartQuestion +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.askRepeatable +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleRephrase +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.flow.main.say_time.TimeTrainingSuccess +import furhatos.app.blank.flow.main.supporting.general.TrainingMenuFlags +import furhatos.app.blank.nlu.base_answer.Ano +import furhatos.app.blank.nlu.base_answer.Rephrase +import furhatos.flow.kotlin.* + +fun neutralAck(): String = listOf( + "Rozumiem, ďakujem.", + "Rozumiem. Vážim si, že ste mi to povedali.", + "Ďakujem, že ste mi to povedali.", + "Je dobre, že o tom môžeme hovoriť.", + "Ďakujem, že ste mi venovali čas a porozprávali mi o tom.", + "Dobre, vnímam to. Ďakujem, že ste sa otvorili.", + "Ďakujem za vaše slová.", +).random() + +fun positiveAck(): String = listOf( + "To ma veľmi teší.", + "To je príjemné počuť.", + "Som rada, že to takto vnímate.", + "To znie naozaj dobre.", + "Teší ma, že sa vám darí.", + "To je skvelé, ďakujem, že ste sa podelili.", +).random() + +//private fun negativeAck(): String = listOf( +// "To ma mrzí.", +// "Je mi ľúto, že to takto dopadlo.", +// "Chápem. Musí to byť náročné.", +// "Mrzí ma to počuť. Verím, že sa situácia postupne zlepší.", +//).random() + +fun SmallTalk(nextState: State, question: () -> String): State = state(Parent) { + onEntry { + askRepeatable(question()) + } + + onResponse { + happyNod() + furhat.say(positiveAck()) + delay(1000) + goto(nextState) + } + + onResponse { + handleRephrase(it.intent) + } + + onResponse { +// if (handleRepeat(it.intent)) { +// return@onResponse +// } + if (handleStop(it.intent, "system", "small_talk", it.text ?: "")) { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } + + happyNod() + furhat.say(neutralAck()) + delay(1000) + goto(nextState) + } +} + +fun SmallTalk(question: () -> String): State = SmallTalk(TimeTrainingSuccess, question) diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/WrongAnswer.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/WrongAnswer.kt new file mode 100644 index 0000000..e9bf5f6 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/WrongAnswer.kt @@ -0,0 +1,52 @@ +package furhatos.app.blank.flow.main.supporting + +import furhatos.app.blank.flow.main.supporting.general.callProxyRespond +import furhatos.app.blank.flow.main.supporting.general.isProxyAvailable +import furhatos.flow.kotlin.FlowControlRunner +import furhatos.flow.kotlin.furhat + +fun FlowControlRunner.sayPhraseForWrongAnswer() { + littleSad() + furhat.say { + random { + +"Nie celkom, ale nevadí. " + +"Tentoraz to ešte nesedí. " + +"Ešte to nie je správne. " + +"Nie úplne, ale sme blízko. " + +"Ešte sa netrafili, ale je to v poriadku. " + +"Zatiaľ to nesedí. " + +"Nie je to správne, no vôbec to neprekáža. " + +"Bohužiaľ, opäť je to nesprávne. Ale nič sa nedeje!" + } + } +} + +fun FlowControlRunner.explainWhyWrong( + question: String, + correctAnswer: String, + userAnswer: String, + attempt: Int +) { + if (attempt >= 2) { + sayPhraseForWrongAnswer() + + val ctx = mapOf( + "question" to question, + "correct_answer" to correctAnswer, + "user_answer" to userAnswer, + "attempt" to attempt + ) + + val gptText = if (isProxyAvailable()){ + callProxyRespond( + userText = userAnswer, + task = "explain_wrong", + context = ctx + ) + } else null + + if (!gptText.isNullOrBlank()) { + furhat.say(gptText) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/ProxyClient.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/ProxyClient.kt new file mode 100644 index 0000000..8df800b --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/ProxyClient.kt @@ -0,0 +1,181 @@ +package furhatos.app.blank.flow.main.supporting.general + +import java.net.HttpURLConnection +import java.net.URL +import java.time.Instant + + // IP PC, where is running FastAPI-proxy. +private const val PROXY_URL = "http://127.0.0.1:8000" + +val PROXY_BASE_URL: String = + System.getenv("PROXY_BASE_URL") + ?.takeIf { it.isNotBlank() } + ?: System.getProperty("proxy.baseUrl") + ?.takeIf { it.isNotBlank() } + ?: PROXY_URL + + +fun isProxyAvailable(): Boolean { + return try { + val url = URL("$PROXY_BASE_URL/test") + val conn = (url.openConnection() as HttpURLConnection).apply { + requestMethod = "GET" + setRequestProperty("Accept", "application/json") + connectTimeout = 500 + readTimeout = 500 + } + + val code = conn.responseCode + code in 200..299 + } catch (e: Exception) { + false + } +} + +fun callProxyRespond( + userText: String, + task: String, + context: Map = emptyMap() +): String? { + val url = URL("$PROXY_BASE_URL/respond") + val conn = (url.openConnection() as HttpURLConnection).apply { + requestMethod = "POST" + setRequestProperty("Content-Type", "application/json; charset=UTF-8") + setRequestProperty("Accept", "application/json") + connectTimeout = 4000 + readTimeout = 4000 + doOutput = true + } + + val safeText = jsonEscape(userText) + val safeTask = jsonEscape(task) + val ctxJson = mapToJson(context) + + // context вставляем как JSON-объект, а не строкой + val body = """{"user_text":"$safeText","task":"$safeTask","context":$ctxJson}""" + + return try { + conn.outputStream.use { it.write(body.toByteArray(Charsets.UTF_8)) } + + val code = conn.responseCode + val stream = if (code in 200..299) conn.inputStream else conn.errorStream + val raw = stream?.bufferedReader(Charsets.UTF_8)?.use { it.readText() } + + println("Proxy respond: $PROXY_BASE_URL/respond -> HTTP $code") + println("Proxy raw response: $raw") + + if (code !in 200..299 || raw.isNullOrBlank()) { + return null + } + + // Простой парсинг поля "answer" + val match = Regex("\"answer\"\\s*:\\s*\"(.*?)\"").find(raw) ?: return null + match.groupValues[1] + .replace("\\n", "\n") + .replace("\\\"", "\"") + .replace("\\\\", "\\") + } catch (e: Exception) { + println("Proxy request failed: ${e.message}") + null + } finally { + conn.disconnect() + } +} + +private fun jsonEscape(s: String): String = + s.replace("\\", "\\\\") + .replace("\"", "\\\"") + .replace("\n", "\\n") + .replace("\r", "\\r") + .replace("\t", "\\t") + +private fun valueToJson(v: Any?): String = when (v) { + null -> "null" + is String -> "\"${jsonEscape(v)}\"" + is Number, is Boolean -> v.toString() + is Map<*, *> -> mapToJson(v.entries.associate { it.key.toString() to it.value }) + is List<*> -> v.joinToString(prefix = "[", postfix = "]") { valueToJson(it) } + else -> "\"${jsonEscape(v.toString())}\"" +} + +private fun mapToJson(map: Map): String = + map.entries.joinToString(prefix = "{", postfix = "}") { (k, v) -> + "\"${jsonEscape(k)}\":${valueToJson(v)}" + } + +fun sendLogEvent( + createdAt: String, + sessionId: String, + game: String, + phase: String, + question: String, + attempt: Int, + result: String, + userAnswer: String? = null, + correctAnswer: String? = null, + hintUsed: Boolean = false, +): Boolean { + val url = URL("$PROXY_BASE_URL/log") + val conn = (url.openConnection() as HttpURLConnection).apply { + requestMethod = "POST" + setRequestProperty("Content-Type", "application/json") + connectTimeout = 700 + readTimeout = 1000 + doOutput = true + } + + val payload = mapOf( + "session_id" to sessionId, + "game" to game, + "phase" to phase, + "question" to question, + "attempt" to attempt, + "result" to result, + "user_answer" to userAnswer, + "correct_answer" to correctAnswer, + "hint_used" to hintUsed, + "created_at" to createdAt + ) + + val body = mapToJson(payload) + + return try { + conn.outputStream.use { it.write(body.toByteArray(Charsets.UTF_8)) } + + val code = conn.responseCode + println("Proxy log: $PROXY_BASE_URL/log -> HTTP $code") + + code in 200..299 + } catch (e: Exception) { + println("LOG SEND ERROR: ${e.message}") + false + } finally { + conn.disconnect() + } +} + +fun sendLogJsonLine(jsonLine: String): Boolean { + val url = URL("$PROXY_BASE_URL/log") + val conn = (url.openConnection() as HttpURLConnection).apply { + requestMethod = "POST" + setRequestProperty("Content-Type", "application/json; charset=UTF-8") + setRequestProperty("Accept", "application/json") + connectTimeout = 600 + readTimeout = 900 + doOutput = true + } + + return try { + conn.outputStream.use { it.write(jsonLine.toByteArray(Charsets.UTF_8)) } + + val code = conn.responseCode + println("sendLogJsonLine -> HTTP $code") + + code in 200..299 + } catch (e: Exception) { + println("sendLogJsonLine ERROR: ${e.message}") + false + } finally { + conn.disconnect() + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/SessionState.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/SessionState.kt new file mode 100644 index 0000000..7851838 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/SessionState.kt @@ -0,0 +1,18 @@ +package furhatos.app.blank.flow.main.supporting.general + +object TrainingMenuFlags { + var hasTrainedOnce: Boolean = false + + var allTimeQuestionsCompleted: Boolean = false + var allAttentionQuestionsCompleted: Boolean = false + var allMemoryQuestionsCompleted: Boolean = false + + fun resetAll() { + allTimeQuestionsCompleted = false + allAttentionQuestionsCompleted = false + allMemoryQuestionsCompleted = false + } + + fun allExercisesCompleted(): Boolean = + allTimeQuestionsCompleted && allAttentionQuestionsCompleted && allMemoryQuestionsCompleted +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/SmallTalkProxy.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/SmallTalkProxy.kt new file mode 100644 index 0000000..4480220 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/SmallTalkProxy.kt @@ -0,0 +1,128 @@ +package furhatos.app.blank.flow.main.supporting.general + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.StartQuestion +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.askRepeatable +import furhatos.app.blank.flow.main.handlers.handleRepeat +import furhatos.app.blank.flow.main.handlers.handleRephrase +import furhatos.app.blank.flow.main.handlers.handleStop +import furhatos.app.blank.flow.main.handlers.lastPhrase +import furhatos.app.blank.flow.main.supporting.ReadyToTrain +import furhatos.app.blank.flow.main.supporting.empathy +import furhatos.app.blank.flow.main.supporting.neutralAck +import furhatos.app.blank.flow.main.supporting.veryHappy +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.furhat +import furhatos.flow.kotlin.onNoResponse +import furhatos.flow.kotlin.onResponse +import furhatos.flow.kotlin.state + +data class SmallTalkContext( + val exercise: String, + val topic: String, + val subtopic: String? = null, + val targetWord: String? = null, + val responseMode: String = "open" // open / yes_no +) + +fun requestSmallTalk(context: SmallTalkContext): String { + if (!isProxyAvailable()) { + return "" + } + + return callProxyRespond( + userText = "Vygeneruj small talk otázku", + task = "smalltalk", + context = mapOf( + "exercise" to context.exercise, + "topic" to context.topic, + "subtopic" to context.subtopic, + "target_word" to context.targetWord, + "response_mode" to context.responseMode + ) + ) ?: "" +} + +fun genericSmallTalk( + context: SmallTalkContext, + nextState: State, + fallbackQuestion: String = "Ako sa dnes máte?", + preparedQuestion: String? = null +): State = state(Parent) { + + onEntry { + val generated = preparedQuestion ?: requestSmallTalk(context) + val finalQuestion = if (generated.isNotBlank()) generated else fallbackQuestion + askRepeatable(finalQuestion) + } + + onResponse { + if (handleRephrase(it.intent)) return@onResponse +// if (handleRepeat(it.intent)) return@onResponse + + if (handleStop(it.intent, "time", "small_talk_proxy", it.text ?: "")) { + TrainingMenuFlags.hasTrainedOnce = true + goto(ReadyToTrain(StartQuestion, Goodbye)) + return@onResponse + } + + val reaction = requestSmallTalkReaction( + userAnswer = it.text, + robotQuestion = lastPhrase + ) + + if (reaction != null) { + when (reaction.type) { + "positive" -> veryHappy() + else -> empathy() + } + furhat.say(reaction.text) + } else { + empathy() + furhat.say(neutralAck()) + } + + goto(nextState) + } + + onNoResponse { + goto(nextState) + } +} + +//---------------------------------------------------------- +// Reactions +//---------------------------------------------------------- +data class SmallTalkReaction( + val type: String, + val text: String +) + +fun requestSmallTalkReaction( + userAnswer: String, + robotQuestion: String? +): SmallTalkReaction? { + if (!isProxyAvailable()) { + return null + } + + val raw = callProxyRespond( + userText = userAnswer, + task = "reaction", + context = mapOf( + "question" to robotQuestion, + "user_answer" to userAnswer + ) + ) ?: return null + + val parts = raw.split("||", limit = 2) + if (parts.size < 2) return null + + val type = parts[0].trim().lowercase() + val text = parts[1].trim() + + if (text.isBlank()) return null + + return SmallTalkReaction(type = type, text = text) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/Test.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/Test.kt new file mode 100644 index 0000000..156432c --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/Test.kt @@ -0,0 +1,12 @@ +package furhatos.app.blank.flow.main.supporting.general + +import furhatos.app.blank.flow.Parent +import furhatos.app.blank.flow.main.supporting.littleSad +import furhatos.flow.kotlin.State +import furhatos.flow.kotlin.state + +val Test: State = state(Parent) { + onEntry { + littleSad() + } +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/Words.kt b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/Words.kt new file mode 100644 index 0000000..0c28092 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/main/supporting/general/Words.kt @@ -0,0 +1,79 @@ +package furhatos.app.blank.flow.main.supporting.general + +import java.io.BufferedReader +import java.io.InputStreamReader +import kotlin.random.Random + +data class WordEntry( + val canonical: String, + val theme: String, + val difficulty: Int, + val variants: Set +) + +object WordBank { + + private const val RESOURCE_PATH = "wordbank.csv" + + val entries: List by lazy { loadCsv(RESOURCE_PATH) } + + fun pickSequence( + length: Int, + allowedThemes: Set? = null, + maxDifficulty: Int? = null, + rng: Random = Random.Default + ): List { + val pool = entries.asSequence() + .filter { allowedThemes == null || it.theme in allowedThemes } + .filter { maxDifficulty == null || it.difficulty <= maxDifficulty } + .distinctBy { it.canonical.lowercase() } + .toList() + + require(pool.size >= length) { + "WordBank: There aren't enough words for the filters. Need to $length, there is ${pool.size}." + } + + return pool.shuffled(rng).take(length) + } + + private fun loadCsv(path: String): List { + val stream = Thread.currentThread().contextClassLoader.getResourceAsStream(path) + ?: error("WordBank: Resource is not found '$path' в src/main/resources") + + BufferedReader(InputStreamReader(stream, Charsets.UTF_8)).use { br -> + return br.lineSequence() + .map { it.trim() } + .filter { it.isNotEmpty() } + .filter { !it.startsWith("#") } + .mapIndexed { idx, line -> + // canonical,theme,difficulty,variants + val parts = line.split(',', limit = 4) + require(parts.size >= 3) { + "WordBank CSV error (line ${idx + 1}): At least 3 fields 'canonical;theme;difficulty'" + } + + val canonical = parts[0].trim() + val theme = parts[1].trim() + val difficulty = parts[2].trim().toIntOrNull() + ?: error("WordBank CSV error (line ${idx + 1}): difficulty is not a number") + + val variantsRaw = parts.getOrNull(3)?.trim().orEmpty() + val variants = variantsRaw + .split('|') + .map { it.trim() } + .filter { it.isNotEmpty() } + .toMutableSet() + + variants.add(canonical) + + WordEntry( + canonical = canonical, + theme = theme, + difficulty = difficulty, + variants = variants + ) + } + .toList() + } + } +} diff --git a/src/main/kotlin/furhatos/app/blank/flow/parent.kt b/src/main/kotlin/furhatos/app/blank/flow/parent.kt new file mode 100644 index 0000000..7cee90e --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/flow/parent.kt @@ -0,0 +1,56 @@ +package furhatos.app.blank.flow + +import furhatos.app.blank.flow.main.handlers.Goodbye +import furhatos.app.blank.flow.main.handlers.lastPhrase +import furhatos.app.blank.flow.main.supporting.SmileIdle +import furhatos.flow.kotlin.* +import furhatos.app.blank.nlu.base_answer.Repeat + +val Parent: State = state { + + onEntry(inherit = true, priority = true) { + furhat.param.noSpeechTimeout = 60_000 + furhat.param.endSilTimeout = 1_000 + furhat.param.maxSpeechTimeout = 120_000 + furhat.gesture(SmileIdle, async = true) + propagate() + } + + onUserEnter(instant = true) { + when { // "it" is the user that entered + furhat.isAttendingUser -> furhat.glance(it) // Glance at new users entering + !furhat.isAttendingUser -> furhat.attend(it) // Attend user if not attending anyone + } + } + + onUserLeave(instant = true) { + when { + !users.hasAny() -> { // last user left + goto(Goodbye) + } + furhat.isAttending(it) -> furhat.attend(users.other) // current user left + !furhat.isAttending(it) -> furhat.glance(it.head.location) // other user left, just glance + } + } + + onResponse { + val phrase = lastPhrase + if (phrase != null) { + furhat.say("Samozrejme, zopakujem. ") + furhat.ask(phrase) + } else { + furhat.say("Momentálne nemám čo zopakovať.") + furhat.listen() + } + } + +// onResponse { +// handleStop(it.intent) +// } + + onNoResponse { + furhat.say("Je v poriadku, môžete si dať čas. Keď budete pripravení, odpovedzte, prosím.") + reentry() + } + +} diff --git a/src/main/kotlin/furhatos/app/blank/main.kt b/src/main/kotlin/furhatos/app/blank/main.kt new file mode 100644 index 0000000..069d819 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/main.kt @@ -0,0 +1,18 @@ +package furhatos.app.blank + +import furhatos.app.blank.flow.Init +import furhatos.flow.kotlin.Flow +import furhatos.skills.Skill + +class BlankSkill : Skill() { + override fun start() { + Flow().run(Init) + } +} + +fun main(args: Array) { + Skill.main(args) +} + + + diff --git a/src/main/kotlin/furhatos/app/blank/nlu/AttentionTraining.kt b/src/main/kotlin/furhatos/app/blank/nlu/AttentionTraining.kt new file mode 100644 index 0000000..c534b91 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/AttentionTraining.kt @@ -0,0 +1,24 @@ +package furhatos.app.blank.nlu + +import furhatos.nlu.Intent +import furhatos.util.Language + +class AttentionTraining : Intent() { + override fun getExamples(lang: Language) = listOf( + "pozornosť", + "trénovať pozornosť", + "chcem trénovať pozornosť", + "chcem si precvičiť pozornosť", + "chcem skúšať pozornosť", + "chcem skúsiť pozornosť", + "chcem otestovať pozornosť", + "otestovať pozornosť", + "skúšať pozornosť", + "test pozornosti", + "trénovať pozornosť teraz", + "poďme na pozornosť", + "ideme na pozornosť", + "chcem test pozornosti", + "chcem precvičiť sústredenie" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/nlu/MemoryTraining.kt b/src/main/kotlin/furhatos/app/blank/nlu/MemoryTraining.kt new file mode 100644 index 0000000..f110f1e --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/MemoryTraining.kt @@ -0,0 +1,25 @@ +package furhatos.app.blank.nlu + +import furhatos.nlu.Intent +import furhatos.util.Language + +class MemoryTraining : Intent() { + override fun getExamples(lang: Language) = listOf( + "pamäť", + "cvičenie na pamäť", + "pamäťové cvičenie", + "trénovať pamäť", + "precvičiť pamäť", + "chcem trénovať pamäť", + "tréning pamäti", + "skúsme si pamäť", + "chcem skúsiť čas", + "chcem si vyskúšať zapamätanie slov", + "Ideme na pamäťové slová", + "Môžeme začať s pamäťou?", + "Chcem trénovať pamäť so slovami", + "Rád by som si skúsil pamäť", + "Rada by som si skúsila pamäť", + "chcem otestovať pamäť" + ) +} diff --git a/src/main/kotlin/furhatos/app/blank/nlu/TimeTraining.kt b/src/main/kotlin/furhatos/app/blank/nlu/TimeTraining.kt new file mode 100644 index 0000000..fd8caee --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/TimeTraining.kt @@ -0,0 +1,18 @@ +package furhatos.app.blank.nlu + +import furhatos.nlu.Intent +import furhatos.util.Language + +class TimeTraining : Intent() { + override fun getExamples(lang: Language) = listOf( + "orientáciu v čase", + "čas", + "trénovať čas", + "chcem trénovať čas", + "chcem trénovať orientáciu v čase", + "povedať čas", + "chcem skúšať čas", + "chcem skúsiť čas", + "chcem otestovať čas" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Ano.kt b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Ano.kt new file mode 100644 index 0000000..8e2936f --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Ano.kt @@ -0,0 +1,30 @@ +package furhatos.app.blank.nlu.base_answer + +import furhatos.nlu.Intent +import furhatos.util.Language + +class Ano : Intent() { + override fun getExamples(lang: Language): List = listOf( + "ano", + "áno", + "hej", + "jasné", + "samozrejme", + "určite", + "áno, prosím", + "áno, mám", + "ok", + "pokračujme", + "môžeme pokračovať", + "poďme ďalej", + "áno, prosím", + "áno, môžeme", + "áno, chcem pokračovať", + "chcela by som pokračovať", + "chcel by som pokračovať", + "chcem pokračovať", + "mám rada", + "mám rad" + ) +} + diff --git a/src/main/kotlin/furhatos/app/blank/nlu/base_answer/DontKnow.kt b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/DontKnow.kt new file mode 100644 index 0000000..242ca05 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/DontKnow.kt @@ -0,0 +1,24 @@ +package furhatos.app.blank.nlu.base_answer + +import furhatos.nlu.Intent +import furhatos.util.Language + +class DontKnow: Intent() { + override fun getExamples(lang: Language) = listOf( + "Neviem", + "Neviem to", + "Nie som si istý", + "Nie som si istá", + "Nepamätám si", + "Nemám tušenie.", + "Netuším", + "Vypadlo mi to z hlavy", + "Zabudol som", + "Zabudola som", + "Neviem to povedať", + "Neviem sa rozhodnúť", + "Bez tušenia", + "Je to pre mňa ťažké", + "Neviem si spomenúť" + ) +} diff --git a/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Help.kt b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Help.kt new file mode 100644 index 0000000..f73e4f9 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Help.kt @@ -0,0 +1,19 @@ +package furhatos.app.blank.nlu.base_answer + +import furhatos.nlu.Intent +import furhatos.util.Language + +class Help: Intent() { + override fun getExamples(lang: Language) = listOf( + "Potrebujem pomoc", + "Môžete mi pomôcť?", + "Pomôž mi, prosím", + "Prosím o pomoc", + "Daj mi nápovedu, prosím", + "Nemám tušenie.", + "Netuším", + "chcem nápovedu", + "potrebujem nápovedu", + "daj mi napovedu" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Nie.kt b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Nie.kt new file mode 100644 index 0000000..3d6ed31 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Nie.kt @@ -0,0 +1,27 @@ +package furhatos.app.blank.nlu.base_answer + +import furhatos.nlu.Intent +import furhatos.util.Language + +class Nie : Intent() { + override fun getExamples(lang: Language): List = listOf( + "nie", + "nie, nemám", + "vôbec nie", + "ani náhodou", + "nie, ďakujem", + "nie, prosím", + "nie, nechcem", + "nechcem pokračovať", + "nechcem ďalej", + "už nechcem", + "stačí", + "to stačí", + "pre dnešok stačí", + "radšej nie", + "asi nie", + "dnes nie", + "môžeme to ukončiť", + "chcem skončiť" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Repeat.kt b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Repeat.kt new file mode 100644 index 0000000..fb1efcb --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Repeat.kt @@ -0,0 +1,18 @@ +package furhatos.app.blank.nlu.base_answer + +import furhatos.nlu.Intent +import furhatos.util.Language + +class Repeat: Intent() { + override fun getExamples(lang: Language) = listOf( + "môžeš to zopakovať", + "prosím zopakuj", + "môžeš to povedať ešte raz", + "ešte raz prosím", + "nepočul som ťa", + "môžeš zopakovať otázku", + "čo si povedal", + "čo si povedala", + "zopakuj" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Rephrase.kt b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Rephrase.kt new file mode 100644 index 0000000..55d92a8 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/Rephrase.kt @@ -0,0 +1,23 @@ +package furhatos.app.blank.nlu.base_answer + +import furhatos.nlu.Intent +import furhatos.util.Language + +class Rephrase : Intent() { + override fun getExamples(lang: Language)= listOf( + "nerozumiem", + "povedz to inak", + "môžeš to povedať jednoduchšie", + "povedz to prosím inak", + "preformuluj to prosím", + "ja som tomu nerozumel", + "ja som tomu nerozumela", + "skúste to povedať inak", + "môžeš to vysvetliť jednoduchšie", + "nepochopil som", + "nepochopila som", + "perifrázuj to", + "prefrázuj to", + "povedz to ešte inak" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/nlu/base_answer/StopTraining.kt b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/StopTraining.kt new file mode 100644 index 0000000..86af312 --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/base_answer/StopTraining.kt @@ -0,0 +1,40 @@ +package furhatos.app.blank.nlu.base_answer + +import furhatos.nlu.Intent +import furhatos.util.Language + +class StopTraining: Intent() { + override fun getExamples(lang: Language) = listOf( + "zastaviť", + "zastav sa", + "zastavme sa", + "zastavme sa prosím", + "stačí", + "dosť", + "koniec", + "ukončiť", + "ukonči to", + "ukonči cvičenie", + "skončiť", + "skončime", + "môžeme prestať", + "prestať", + "chcem prestať", + "chcem skončiť", + "chcem ukončiť cvičenie", + "už nechcem pokračovať", + "nechcem pokračovať", + "nechcem ďalej", + "chcela by som skončiť", + "chcel by som skončiť", + "skončiť", + + // bez diakritiky + "chcem skoncit", + "chcem prestat", + "ukoncit cvicenie", + "nechcem pokracovat", + "chcela by som skoncit", + "chcel by som skoncit" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/nlu/other_responses/Feeling.kt b/src/main/kotlin/furhatos/app/blank/nlu/other_responses/Feeling.kt new file mode 100644 index 0000000..37f0dea --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/nlu/other_responses/Feeling.kt @@ -0,0 +1,29 @@ +package furhatos.app.blank.nlu.other_responses + +import furhatos.util.Language +import furhatos.nlu.Intent + +class FeelGood : Intent() { + override fun getExamples(lang: Language) = listOf( + "Cítim sa dobre", + "Cítim sa fajn", + "Som v poriadku", + "Je mi dobre", + "Cítim sa výborne", + "dobre", + "super" + ) +} + +class FeelBad : Intent() { + override fun getExamples(lang: Language) = listOf( + "Som unavený", + "Som unavená", + "Cítim sa unavene", + "Necítim sa dobre", + "Je mi zle", + "Nie veľmi dobré", + "zle", + "hrozne" + ) +} \ No newline at end of file diff --git a/src/main/kotlin/furhatos/app/blank/setting/interactionParams.kt b/src/main/kotlin/furhatos/app/blank/setting/interactionParams.kt new file mode 100644 index 0000000..1deeb2b --- /dev/null +++ b/src/main/kotlin/furhatos/app/blank/setting/interactionParams.kt @@ -0,0 +1,5 @@ +package furhatos.app.blank.setting + +/** Engagement parameters */ +const val MAX_NUMBER_OF_USERS = 2 // Max amount of people that Furhat will recognize as users simultaneously +const val DISTANCE_TO_ENGAGE = 1.0 // Min distance for people to be recognised as users \ No newline at end of file diff --git a/src/main/realtime/main.py b/src/main/realtime/main.py new file mode 100644 index 0000000..4a51095 --- /dev/null +++ b/src/main/realtime/main.py @@ -0,0 +1,290 @@ +import os +import asyncio +from typing import Optional, Dict, Any + +from fastapi import FastAPI, HTTPException +from pydantic import BaseModel, Field + +from openai import AsyncOpenAI + +import pymysql +from datetime import datetime + +from dotenv import load_dotenv +load_dotenv() + +# ----------------------------- +# Config +# ----------------------------- +OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") +if not OPENAI_API_KEY: + # Лучше падать сразу, чтобы не ловить странные ошибки позже + raise RuntimeError("Environment variable OPENAI_API_KEY is not set.") + +# Вы можете поменять на нужную realtime-модель +REALTIME_MODEL = os.getenv("REALTIME_MODEL", "gpt-realtime") + +BASE_INSTRUCTIONS = os.getenv( + "REALTIME_INSTRUCTIONS", + # Эти инструкции НЕ должны дублировать весь ваш сценарий из Kotlin. + # Это только общий стиль/ограничения. + ( + "Si sociálny robot, ktorý pomáha ľuďom s kognitívno-komunikačnými problémami pomocou krátkych hier a dialógov. " + "Vždy odpovedaj po slovensky. " + "Odpovedaj veľmi stručne v rozsahu 1–2 viet, priateľsky a s použitím jednoduchého slovníka. " + "Nevymýšľaj nové pravidlá hry. Ak nemáš dosť informácií, polož jednu krátku otázku. " + ), +) + +print("ENV KEY PRESENT:", bool(os.getenv("OPENAI_API_KEY"))) +print("MODEL:", os.getenv("REALTIME_MODEL")) + +OUTPUT_MODALITIES = ["text"] # мы используем только текстовый realtime :contentReference[oaicite:1]{index=1} + +MYSQL_HOST = os.getenv("MYSQL_HOST", "127.0.0.1") +MYSQL_PORT = int(os.getenv("MYSQL_PORT", "3306")) +MYSQL_DATABASE = os.getenv("MYSQL_DATABASE", "furhat_logs") +MYSQL_USER = os.getenv("MYSQL_USER", "localhost") +MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD", "") + +# ----------------------------- +# HTTP API models +# ----------------------------- +class RespondRequest(BaseModel): +# session_id: str = Field(..., description="ID логической сессии (пришлёт Kotlin).") +# user_text: str = Field(..., description="Текст пользователя из Furhat STT / onResponse.") + user_text: str + # Опционально: чтобы Kotlin мог попросить конкретный тип помощи + task: Optional[str] = Field( + default=None, + description="Напр. 'hint', 'rephrase', 'explain_wrong', 'smalltalk' и т.п.", + ) + # Опционально: краткий контекст текущего шага (вопрос, попытки и т.д.) + context: Optional[Dict[str, Any]] = Field(default=None) + + +class RespondResponse(BaseModel): + answer: str + +# ----------------------------- +# DB +# ----------------------------- +class LogRequest(BaseModel): + session_id: str + game: str + phase: str + question: str + attempt: int + result: str + user_answer: Optional[str] = None + correct_answer: Optional[str] = None + hint_used: bool = False + created_at: Optional[datetime] = None + +def get_db_connection(): + return pymysql.connect( + host=MYSQL_HOST, + port=MYSQL_PORT, + user=MYSQL_USER, + password=MYSQL_PASSWORD, + database=MYSQL_DATABASE, + charset="utf8mb4", + cursorclass=pymysql.cursors.DictCursor, + autocommit=True, + ) + +# ----------------------------- +# Realtime connection manager +# ----------------------------- +app = FastAPI(title="Realtime Proxy", version="0.1.0") + +openai_client = AsyncOpenAI(api_key=OPENAI_API_KEY) + +def _build_prompt(task: Optional[str], context: Optional[Dict[str, Any]]) -> str: + ctx = context or {} + + if task == "hint": + return ( + "Daj veľmi jemnú, ale konkretnú nápovedu bez toho, aby si prezradil správnu odpoveď. 1-2 vety" + f"Kontekst: {ctx}" + ) + if task == "rephrase": + return ( + "Preformuluj otázku jednoduchšie, použivaj jednoduche slova, ale zachovaj význam, 1-2 vety. NEPREZRAĎ správnu odpoveď. " + f"Kontekst: {ctx}" + ) + if task == "explain_wrong": + return ( + "Vysvetli stručne, PREČO odpoveď nie je správna, ale NEPREZRAĎ správnu odpoveď. " + "Namiesto toho daj jemnú nápovedu jednou vetou (napríklad „Poplietli ste poradie slov“ alebo „Uviedli ste čas o 2 hodiny skôr, než je aktuálny“). " + "Povzbuď na ďalší pokus. " + f"Kontekst: {ctx}" + ) + if task == "reaction": + return ( + "Vyhodnoť odpoveď používateľa na small-talk otázku robota. " + "Rozhodni iba medzi dvoma typmi reakcie: positive alebo neutral. " + "positive použi, ak odpoveď znie príjemne, pozitívne, radostne alebo povzbudivo. " + "neutral použi, ak je odpoveď vecná, nejasná, krátka, zmiešaná alebo ju nemožno bezpečne chápať ako pozitívnu. " + "Potom vytvor veľmi krátku empatickú reakciu robota v jednoduchej slovenčine. " + "Štýl má byť priateľský a úprimný, napríklad: 'To ma veľmi teší.', 'Ďakujem, že ste mi to povedali.', atď. Nepoužívaj ich stále, použivaj rôzne" + "Nevysvetľuj svoje rozhodnutie. " + "Výstup musí mať presne formát: typ||reakcia " + "kde typ je iba positive alebo neutral. " + f"Kontekst: {ctx}" + ) + if task == "smalltalk": + exercise = ctx.get("exercise", "") + topic = ctx.get("topic", "") + subtopic = ctx.get("subtopic", "") + target_word = ctx.get("target_word", "") + response_mode = ctx.get("response_mode", "open") + return ( + "Polož krátku prirodzenú small-talk otázku súvisiacu s témou aktuálneho cvičenia. " + "Použi jednoduché slová, 1-2 vety. " + "Nemeň tému a nevymýšľaj nové pravidlá hry. " + "Nevypisuj viac otázok naraz. " + f"Typ cvičenia: {exercise}. " + f"Téma: {topic}. " + f"Podtéma: {subtopic}. " + f"Kľúčové slovo: {target_word}. " + f"Formát odpovede používateľa: {response_mode}. " + "Ak je formát 'yes_no', vytvor otázku, na ktorú sa prirodzene odpovedá áno alebo nie. " + "Ak je formát 'open', vytvor otvorenú každodennú otázku. " + ) + + # default + return f"Odpovedaj stručne a vecne. Kontekst: {ctx}" + + +async def _ask_realtime(user_text: str, task: Optional[str], context: Optional[Dict[str, Any]]) -> str: + per_turn_instructions = _build_prompt(task, context) + + async with openai_client.realtime.connect(model=REALTIME_MODEL) as conn: + await conn.session.update( + session={ + "type": "realtime", + "output_modalities": ["text"], + "instructions": BASE_INSTRUCTIONS, + "tool_choice": "none", + "tools": [], + "audio": {"input": {"turn_detection": None}}, + } + ) + + await conn.conversation.item.create( + item={ + "type": "message", + "role": "user", + "content": [{"type": "input_text", "text": user_text}], + } + ) + + await conn.response.create( + response={ + "instructions": per_turn_instructions, + "max_output_tokens": 70, + } + ) + + chunks = [] + + async for event in conn: +# print("EV:", event.type) + + if event.type in ("response.output_text.delta", "response.text.delta"): + chunks.append(event.delta) + + elif event.type == "response.done": + # ЛОГИ — всегда, чтобы видеть, что реально пришло в DONE + resp = getattr(event, "response", None) + output = getattr(resp, "output", None) or [] +# print("DONE output len:", len(output)) +# print("DONE output raw:", output) +# print("DONE response obj:", resp) + + # Если дельт не было — пробуем достать финальный текст из response.output + if not chunks: + for item in output: + if getattr(item, "type", None) == "message": + for c in getattr(item, "content", []) or []: + ctype = getattr(c, "type", None) + if ctype in ("output_text", "text"): + txt = getattr(c, "text", "") or "" + if txt: + chunks.append(txt) + + break + + elif event.type == "error": + raise RuntimeError(f"Realtime error: {event.error}") + + answer = "".join(chunks).strip() + return answer or "Prepáčte, môžete to prosím zopakovať?" + + +# ----------------------------- +# FastAPI endpoints +# ----------------------------- +@app.get("/test") +async def health(): + return {"status": "ok"} + + +@app.post("/respond", response_model=RespondResponse) +async def respond(req: RespondRequest): + try: + answer = await _ask_realtime(req.user_text, req.task, req.context) + print("RESPOND:", req.user_text, req.task) + return RespondResponse(answer=answer) + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + +@app.post("/reset") +async def reset(): + print("RESET called") + return {"status": "reset"} + +@app.post("/log") +async def log_event(req: LogRequest): + try: + conn = get_db_connection() + try: + with conn.cursor() as cur: + cur.execute( + """ + INSERT INTO session_logs ( + session_id, + game, + phase, + question, + attempt, + result, + user_answer, + correct_answer, + hint_used, + created_at + ) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) + """, + ( + req.session_id, + req.game, + req.phase, + req.question, + req.attempt, + req.result, + req.user_answer, + req.correct_answer, + req.hint_used, + req.created_at or datetime.utcnow(), + ) + ) + finally: + conn.close() + + return {"status": "ok"} + + except Exception as e: + print("LOG ERROR:", repr(e)) + traceback.print_exc() + raise HTTPException(status_code=500, detail=f"log insert failed: {str(e)}") \ No newline at end of file diff --git a/src/main/realtime/requirements.txt b/src/main/realtime/requirements.txt new file mode 100644 index 0000000..4cb1d0f --- /dev/null +++ b/src/main/realtime/requirements.txt @@ -0,0 +1,4 @@ +fastapi +uvicorn[standard] +openai +python-dotenv \ No newline at end of file diff --git a/src/main/resources/wordbank.csv b/src/main/resources/wordbank.csv new file mode 100644 index 0000000..ff71a85 --- /dev/null +++ b/src/main/resources/wordbank.csv @@ -0,0 +1,159 @@ + +jablko,ovocie,1,jablka|jablk|jablky +hruška,ovocie,1,hruska|hruška|hrušk +banán,ovocie,1,banan|banán|banana +pomaranč,ovocie,2,pomaranc|pomaranče +citrón,ovocie,2,citron|citróny|citróne +jahoda,bobuľa,1,jahoda|jahod|jahda +malina,bobuľa,2,malina|maliny +orech,jedlo,1,orech +chlieb,jedlo,1,chlieb +maslo,jedlo,1,maslo +syr,jedlo,1,syr +mlieko,nápoje,1,mlieko +voda,nápoje,1,voda +čaj,nápoje,1,caj|čaj +káva,nápoje,1,kava|káva +polievka,jedlo,2,polievka +ryža,jedlo,2,ryza|ryža +cestovina,jedlo,2,cestovina +mäso,jedlo,1,maso|mäso +kurča,jedlo,2,kurca|kurča +ryba,jedlo,1,ryba +vajce,jedlo,1,vajce +soľ,prísady,1,sol|soľ +cukor,prísady,1,cukor +med,sladké,1,med +jogurt,jedlo,2,jogurt +koláč,sladké,2,kolac|koláč +čokoláda,sladké,2,cokolada|čokoláda +zmrzlina,sladké,2,zmrzlina +paradajka,zelenina,1,paradajka +uhorka,zelenina,1,uhorka +zemiak,zelenina,1,zemiaky +mrkva,zelenina,1,mrkva +cibuľa,zelenina,2,cibula|cibuľa +cesnak,zelenina,1,cesnak +paprika,zelenina,1,paprika +šalát,zelenina,2,salat|šalát +fazuľa,zelenina,2,fazula|fazuľa +hrášok,zelenina,2,hrasok|hrášok +múka,jedlo,2,muka|múka +ocot,prísady,2,ocot +stôl,domáce potreby,1,stol|stôl +stolička,domáce potreby,1,stolicka|stolička +posteľ,domáce potreby,2,postel|posteľ +vankúš,domáce potreby,2,vankus|vankúš +deka,domáce potreby,1,deka +skriňa,domáce potreby,2,skrina|skriňa +dvere,dom,1,dvere +okno,dom,1,okno +lampa,technika,1,lampa +koberec,domáce potreby,2,koberec +zrkadlo,domáce potreby,2,zrkadlo +kľúč,dom,1,kluc|kľúč +zásuvka,dom,2,zasuvka|zásuvka +polica,dom,1,polica +chladnička,dom,3,chladnicka|chladnička +rúra,dom,2,rura|rúra +sporák,dom,3,sporak|sporák +umývadlo,hygiena,3,umyvadlo|umývadlo +sprcha,hygiena,2,sprcha +vaňa,dom,2,vana|vaňa +uterák,dom,2,uterak|uterák +mydlo,hygiena,1,mydlo +šampón,hygiena,3,sampón|sampon|šampón +práčka,technika,3,pracka|práčka +žehlička,technika,3,zehlicka|žehlička +televízor,druh zábavy,3,televizor|televízor +rádio,technika,2,radio|rádio +počítač,technika,3,pocitac|počítač +telefón,technika,2,telefon|telefón +hodiny,technika,2,hodiny +vypínač,technika,3,vypinac|vypínač +batéria,technika,2,bateria|batéria +strom,príroda,1,strom +kvet,príroda,1,kvet +tráva,príroda,1,trava|tráva +list,príroda,1,list +vetva,príroda,1,vetva +rieka,príroda,1,rieka +jazero,príroda,2,jazero +more,príroda,1,more +hora,príroda,1,hora +les,príroda,1,les +lúka,príroda,2,luka|lúka +dážď,príroda,2,dazd|dážď +sneh,príroda,1,sneh +vietor,príroda,1,vietor +slnko,príroda,1,slnko +oblak,príroda,1,oblak +hviezda,príroda,2,hviezda +mesiac,príroda,1,mesiac +kameň,príroda,2,kamen|kameň +piesok,príroda,1,piesok +pôda,príroda,2,poda|pôda +oheň,príroda,2,ohen|oheň +plameň,príroda,3,plamen|plameň +vlna,príroda,2,vlna +hmla,príroda,2,hmla +ulica,mesto,1,ulica +námestie,mesto,2,namestie|námestie +škola,mesto,1,skola|škola +obchod,mesto,1,obchod +trh,mesto,2,trh +banka,mesto,1,banka +pošta,mesto,2,posta|pošta +nemocnica,mesto,3,nemocnica +lekáreň,mesto,3,lekaren|lekáreň +stanica,mesto,2,stanica +zastávka,mesto,2,zastavka|zastávka +autobus,mesto,1,autobus +vlak,mesto,1,vlak +taxi,mesto,2,taxi +most,mesto,1,most +park,mesto,1,park +kino,druh zábavy,1,kino +divadlo,druh zábavy,2,divadlo +reštaurácia,mesto,3,restauracia|reštaurácia +kaviareň,mesto,3,kavieren|kaviareň +hotel,mesto,2,hotel +múzeum,druh zábavy,3,muzeum|múzeum +knižnica,mesto,3,kniznica|knižnica +polícia,mesto,3,policia|polícia +hlava,telo,1,hlava +oko,telo,1,oko +ucho,telo,1,ucho +nos,telo,1,nos +ústa,telo,2,usta|ústa +zub,telo,1,zub +jazyk,telo,2,jazyk +krk,telo,1,krk +rameno,telo,2,rameno +ruka,telo,1,ruka +dlaň,telo,2,dlan|dlaň +prst,telo,1,prst +lakeť,telo,3,laket|lakeť +chrbát,telo,3,chrbat|chrbát +brucho,telo,1,brucho +noha,telo,1,noha +koleno,telo,1,koleno +členok,telo,3,clenok|členok +päta,telo,2,peta|päta +srdce,telo,2,srdce +pľúca,telo,3,pluca|pľúca +žalúdok,telo,3,zaludok|žalúdok +pečeň,telo,3,pecen|pečeň +tričko,oblečenie,2,tricko|tričko +nohavice,oblečenie,1,nohavice +sukňa,oblečenie,2,sukna|sukňa +šaty,oblečenie,1,saty|šaty +sveter,oblečenie,2,sveter +bunda,oblečenie,1,bunda +kabát,oblečenie,2,kabat|kabát +topánka,oblečenie,2,topanka|topánka +ponožka,oblečenie,2,ponozka|ponožka +čiapka,oblečenie,2,ciapka|čiapka +šál,oblečenie,2,sal|šál +rukavica,oblečenie,2,rukavica +opasok,oblečenie,2,opasok