commit d6bd6202075336bea355ab0b8edc73e6e584df87 Author: DESKTOP-C9V2M01\Zeeri Date: Wed Sep 7 08:58:00 2022 -0700 Initial check in; All but the history pages working. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd799ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +private/settings.json +package-lock.json \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/Tempest.iml b/.idea/Tempest.iml new file mode 100644 index 0000000..65a80c9 --- /dev/null +++ b/.idea/Tempest.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..9a1795f --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1181cac --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 0000000..560ddd1 --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/.meteor/.finished-upgraders b/.meteor/.finished-upgraders new file mode 100644 index 0000000..c07b6ff --- /dev/null +++ b/.meteor/.finished-upgraders @@ -0,0 +1,19 @@ +# This file contains information which helps Meteor properly upgrade your +# app when you run 'meteor update'. You should check it into version control +# with your project. + +notices-for-0.9.0 +notices-for-0.9.1 +0.9.4-platform-file +notices-for-facebook-graph-api-2 +1.2.0-standard-minifiers-package +1.2.0-meteor-platform-split +1.2.0-cordova-changes +1.2.0-breaking-changes +1.3.0-split-minifiers-package +1.4.0-remove-old-dev-bundle-link +1.4.1-add-shell-server-package +1.4.3-split-account-service-packages +1.5-add-dynamic-import-package +1.7-split-underscore-from-meteor-base +1.8.3-split-jquery-from-blaze diff --git a/.meteor/.gitignore b/.meteor/.gitignore new file mode 100644 index 0000000..4083037 --- /dev/null +++ b/.meteor/.gitignore @@ -0,0 +1 @@ +local diff --git a/.meteor/.id b/.meteor/.id new file mode 100644 index 0000000..40036be --- /dev/null +++ b/.meteor/.id @@ -0,0 +1,7 @@ +# This file contains a token that is unique to your project. +# Check it into your repository along with the rest of this directory. +# It can be used for purposes such as: +# - ensuring you don't accidentally deploy one app on top of another +# - providing package authors with aggregated statistics + +icx08c5o8tue.o91vpgtmehj diff --git a/.meteor/packages b/.meteor/packages new file mode 100644 index 0000000..40d59bd --- /dev/null +++ b/.meteor/packages @@ -0,0 +1,29 @@ +# Meteor packages used by this project, one per line. +# Check this file (and the other files in this directory) into your repository. +# +# 'meteor add' and 'meteor remove' will edit this file for you, +# but you can also edit it by hand. + +meteor-base@1.5.1 # Packages every Meteor app needs to have +mobile-experience@1.1.0 # Packages for a great mobile UX +mongo@1.15.0 # The database Meteor supports right now +jquery # Wrapper package for npm-installed jquery +reactive-var@1.0.11 # Reactive variable for tracker + +standard-minifier-css@1.8.1 # CSS minifier run for production mode +standard-minifier-js@2.8.0 # JS minifier run for production mode +es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers +ecmascript@0.16.2 # Enable ECMAScript2015+ syntax in app code +typescript@4.5.4 # Enable TypeScript syntax in .ts and .tsx modules +shell-server@0.5.0 # Server-side component of the `meteor shell` command + +static-html@1.3.2 # Define static page content in .html files +react-meteor-data # React higher-order component for reactively tracking Meteor data +accounts-ui@1.4.2 +accounts-password@2.3.1 +accounts-google@1.4.0 +service-configuration@1.3.0 +google-config-ui@1.0.3 # Adds the UI for logging in via Google +alanning:roles # Adds roles to the user + +msavin:mongol # Free version of MeteorToys - Provides access to the client side MongoDB for debugging. (Ctrl-M to activate :: https://atmospherejs.com/msavin/mongol) \ No newline at end of file diff --git a/.meteor/platforms b/.meteor/platforms new file mode 100644 index 0000000..efeba1b --- /dev/null +++ b/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/.meteor/release b/.meteor/release new file mode 100644 index 0000000..66dd7b6 --- /dev/null +++ b/.meteor/release @@ -0,0 +1 @@ +METEOR@2.7.3 diff --git a/.meteor/versions b/.meteor/versions new file mode 100644 index 0000000..0f7c141 --- /dev/null +++ b/.meteor/versions @@ -0,0 +1,99 @@ +accounts-base@2.2.4 +accounts-google@1.4.0 +accounts-oauth@1.4.1 +accounts-password@2.3.1 +accounts-ui@1.4.2 +accounts-ui-unstyled@1.7.0 +alanning:roles@3.4.0 +allow-deny@1.1.1 +autoupdate@1.8.0 +babel-compiler@7.9.2 +babel-runtime@1.5.1 +base64@1.0.12 +binary-heap@1.0.11 +blaze@2.5.0 +blaze-tools@1.1.3 +boilerplate-generator@1.7.1 +caching-compiler@1.2.2 +caching-html-compiler@1.2.1 +callback-hook@1.4.0 +check@1.3.1 +ddp@1.4.0 +ddp-client@2.5.0 +ddp-common@1.4.0 +ddp-rate-limiter@1.1.0 +ddp-server@2.5.0 +diff-sequence@1.1.1 +dynamic-import@0.7.2 +ecmascript@0.16.2 +ecmascript-runtime@0.8.0 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.2 +email@2.2.1 +es5-shim@4.8.0 +fetch@0.1.1 +geojson-utils@1.0.10 +google-config-ui@1.0.3 +google-oauth@1.4.2 +hot-code-push@1.0.4 +html-tools@1.1.3 +htmljs@1.1.1 +id-map@1.1.1 +inter-process-messaging@0.1.1 +jquery@3.0.0 +launch-screen@1.3.0 +less@3.0.2 +localstorage@1.2.0 +logging@1.3.1 +meteor@1.10.0 +meteor-base@1.5.1 +meteortoys:toykit@10.0.0 +minifier-css@1.6.1 +minifier-js@2.7.5 +minimongo@1.8.0 +mobile-experience@1.1.0 +mobile-status-bar@1.1.0 +modern-browsers@0.1.8 +modules@0.18.0 +modules-runtime@0.13.0 +mongo@1.15.0 +mongo-decimal@0.1.3 +mongo-dev-server@1.1.0 +mongo-id@1.0.8 +msavin:mongol@10.0.1 +npm-mongo@4.3.1 +oauth@2.1.2 +oauth2@1.3.1 +observe-sequence@1.0.20 +ordered-dict@1.1.0 +promise@0.12.0 +random@1.2.0 +rate-limit@1.0.9 +react-fast-refresh@0.2.3 +react-meteor-data@2.5.1 +reactive-dict@1.3.0 +reactive-var@1.0.11 +reload@1.3.1 +retry@1.1.0 +routepolicy@1.1.1 +service-configuration@1.3.0 +session@1.2.0 +sha@1.0.9 +shell-server@0.5.0 +socket-stream-client@0.5.0 +spacebars@1.2.0 +spacebars-compiler@1.3.1 +standard-minifier-css@1.8.2 +standard-minifier-js@2.8.1 +static-html@1.3.2 +templating@1.4.1 +templating-compiler@1.4.1 +templating-runtime@1.5.0 +templating-tools@1.2.2 +tracker@1.2.0 +typescript@4.5.4 +underscore@1.0.10 +url@1.3.2 +webapp@1.13.1 +webapp-hashing@1.1.0 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e7e147a --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Simple Todo List (archived) + +The new React Tutorial lives here +https://github.com/meteor/react-tutorial/ + +Any PRs or issues should be created there now. + +You can check the tutorial here https://react-tutorial.meteor.com/ diff --git a/client/_app.sass b/client/_app.sass new file mode 100644 index 0000000..c17ef49 --- /dev/null +++ b/client/_app.sass @@ -0,0 +1,133 @@ +/* CSS declarations go here */ +.Mongol_row, .Mongol_row_name + color: white + +* + box-sizing: border-box + +html + padding: 0 + margin: 0 + +body + font-family: sans-serif + background-attachment: fixed + position: absolute + top: 0 + bottom: 0 + left: 0 + right: 0 + padding: 0 + margin: 0 + +//.container +// max-width: 600px +// margin: 0 auto +// min-height: 100% +// background: white + +h1 + font-size: 1.5em + margin: 0 0 1rem 0 + display: inline-block + +form + margin-top: 10px + margin-bottom: 10px + position: relative + +.new-task input + box-sizing: border-box + padding: 10px 0 + background: transparent + border: none + width: 100% + padding-right: 80px + font-size: 1em + +.new-task input:focus + outline: 0 + +ul + margin: 0 + padding: 0 + background: white + +.delete + float: right + font-weight: bold + background: none + font-size: 1em + border: none + position: relative + +table + min-width: 650px + +table > thead > tr > th.headerCell + color: white + background-color: #333447 + +table > thead.sticky > tr > th.headerCell + position: sticky + top: 0 + +table > tbody > tr > td + background: white + user-select: none + +table > tbody > tr.selected > td + background: #f8ef8d + +table .tableRow + &:last-child td, &:last-child th + border: 0 + +.userTable + max-height: 64rem + +li + position: relative + list-style: none + padding: 15px + border-bottom: #eee solid 1px + +li .text + margin-left: 10px + +li.checked + color: #888 + +li.checked .text + text-decoration: line-through + +li.private + background: #eee + border-color: #ddd + +header .hide-completed + float: right + +.toggle-private + margin-left: 5px + +html + font-size: 16px + +@media (max-width: 900px) + html + font-size: 14px + +@media (max-width: 600px) + li + padding: 12px 15px + + .search + width: 150px + clear: both + + .new-task input + padding-bottom: 5px + + html + font-size: 10px diff --git a/client/_material-icons.sass b/client/_material-icons.sass new file mode 100644 index 0000000..5f1501f --- /dev/null +++ b/client/_material-icons.sass @@ -0,0 +1,32 @@ +// https://github.com/google/material-design-icons + +@font-face + font-family: 'Material Icons' + font-style: normal + font-weight: 400 + src: local('Material Icons'), local('MaterialIcons-Regular'), url(/fonts/MaterialIcons-Regular.ttf) format('truetype') + +.material-icons + font-family: 'Material Icons' + font-weight: normal + font-style: normal + font-size: 24px + /* Preferred icon size */ + display: inline-block + line-height: 1 + text-transform: none + letter-spacing: normal + word-wrap: normal + white-space: nowrap + direction: ltr + /* Support for all WebKit browsers. */ + -webkit-font-smoothing: antialiased + /* Support for Safari and Chrome. */ + text-rendering: optimizeLegibility + /* Support for Firefox. */ + -moz-osx-font-smoothing: grayscale + /* Support for IE. */ + font-feature-settings: 'liga' + +.material-symbols-outlined + font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 48 diff --git a/client/_page.sass b/client/_page.sass new file mode 100644 index 0000000..7712f07 --- /dev/null +++ b/client/_page.sass @@ -0,0 +1,106 @@ +@font-face + font-family: 'KaushanScript-Regular' + font-style: normal + font-weight: 400 + src: url('/fonts/KaushanScript-Regular.ttf') format('truetype') + +.nav-separator + height: 0.2rem + width: 40% + margin-left: 30% + background-color: white + +nav + font-size: 1.4rem + +nav a + display: inline-block + color: #AF8A62 + text-decoration: none + +nav a:hover + color: #F9F1E1 + text-decoration: underline +nav a:active + color: #F9F1E1 + text-decoration: none + +nav a + a + margin-left: 2rem + +.pageHeaderContainer + background-image: url("/images/header.svg") + background-origin: border-box + background-size: cover + background-position: center + +.pageHeader + //background: #2c031c + color: white + /*background-image: linear-gradient(to bottom, #d0edf5, #e1e5f0 100%)*/ + padding: 20px 15px 15px 15px + position: relative + +.pageNavContainer + background: #28211A + +.pageContentContainer + margin: 0 auto + width: 85% + padding-top: 2rem + +.title + margin-bottom: 0 + color: white + font-family: "KaushanScript-Regular", sans-serif + font-size: 4rem + display: inline-block + +.logo + position: absolute + left: 0 + top: 0 + width: 8rem + +.logoContainer + height: 0 + position: relative + +.login + position: absolute + right: 0 + top: 0 + +.login button + background: #28211A + border-radius: 999px + box-shadow: 0.2rem .3rem .4rem .1rem #886f59 + //box-shadow: #886f59 0 1px 2px -1px + box-sizing: border-box + color: #FFFFFF + cursor: pointer + font-family: Inter, Helvetica, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols, -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", sans-serif + font-weight: 700 + line-height: 24px + opacity: 1 + outline: 0 solid transparent + padding: 8px 18px + user-select: none + -webkit-user-select: none + touch-action: manipulation + width: fit-content + word-break: break-word + border: 0 + +@media (max-width: 600px) + .logo + position: absolute + left: 0 + right: 0 + top: 0 + margin: 0 auto + width: 8rem + + .logoContainer + height: 6rem + diff --git a/client/_roboto.sass b/client/_roboto.sass new file mode 100644 index 0000000..e024edb --- /dev/null +++ b/client/_roboto.sass @@ -0,0 +1,7 @@ +// https://fonts.google.com/specimen/Roboto + +@font-face + font-family: 'Roboto' + font-style: normal + font-weight: 400 + src: local('Roboto'), local('Roboto-Regular'), url(/fonts/Roboto-Regular.ttf) format('truetype') diff --git a/client/_simple-grid.sass b/client/_simple-grid.sass new file mode 100644 index 0000000..daef9a3 --- /dev/null +++ b/client/_simple-grid.sass @@ -0,0 +1,186 @@ +@import url(https://fonts.googleapis.com/css?family=Lato:400,300,300italic,400italic,700,700italic) + +html, body + height: 100% + width: 100% + margin: 0 + padding: 0 + left: 0 + top: 0 + +/* ROOT FONT STYLES + +* + font-family: 'Lato', Helvetica, sans-serif + color: #333447 + line-height: 1.5 + +/* TYPOGRAPHY + +h1 + font-size: 2.5rem + +h2 + font-size: 2rem + +h3 + font-size: 1.375rem + +h4 + font-size: 1.125rem + +h5 + font-size: 1rem + +h6 + font-size: 0.875rem + +p + font-size: 1.125rem + font-weight: 200 + line-height: 1.8 + +.font-light + font-weight: 300 + +.font-regular + font-weight: 400 + +.font-heavy + font-weight: 700 + +/* POSITIONING + +.left + text-align: left + +.right + text-align: right + +.center + text-align: center + margin-left: auto + margin-right: auto + +.justify + text-align: justify + +/* ==== GRID SYSTEM ==== + +.container + //width: 90% + width: 100% + margin-left: auto + margin-right: auto + +.row + position: relative + //width: 100% + + [class^="col"] + float: left + margin: 0.5rem 2% + min-height: 0.125rem + +.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 + width: 96% + margin: auto + +.col-1-sm + width: 4.33% + +.col-2-sm + width: 12.66% + +.col-3-sm + width: 21% + +.col-4-sm + width: 29.33% + +.col-5-sm + width: 37.66% + +.col-6-sm + width: 46% + +.col-7-sm + width: 54.33% + +.col-8-sm + width: 62.66% + +.col-9-sm + width: 71% + +.col-10-sm + width: 79.33% + +.col-11-sm + width: 87.66% + +.col-12-sm + width: 96% + +.row::after + content: "" + display: table + clear: both + +.hidden-sm + display: none + +@media only screen and (min-width: 33.75em) + /* 540px + + .container + width: 80% + +@media only screen and (min-width: 45em) + /* 720px + + .col-1 + width: 4.33% + + .col-2 + width: 12.66% + + .col-3 + width: 21% + + .col-4 + width: 29.33% + + .col-5 + width: 37.66% + + .col-6 + width: 46% + + .col-7 + width: 54.33% + + .col-8 + width: 62.66% + + .col-9 + width: 71% + + .col-10 + width: 79.33% + + .col-11 + width: 87.66% + + .col-12 + width: 96% + + .hidden-sm + display: block + +@media only screen and (min-width: 60em) + /* 960px + + .container + width: 75% + max-width: 60rem diff --git a/client/main.css b/client/main.css new file mode 100644 index 0000000..86b764c --- /dev/null +++ b/client/main.css @@ -0,0 +1,540 @@ +@import url(https://fonts.googleapis.com/css?family=Lato:400,300,300italic,400italic,700,700italic); +html, body { + height: 100%; + width: 100%; + margin: 0; + padding: 0; + left: 0; + top: 0; +} + +/* ROOT FONT STYLES */ +* { + font-family: "Lato", Helvetica, sans-serif; + color: #333447; + line-height: 1.5; +} + +/* TYPOGRAPHY */ +h1 { + font-size: 2.5rem; +} + +h2 { + font-size: 2rem; +} + +h3 { + font-size: 1.375rem; +} + +h4 { + font-size: 1.125rem; +} + +h5 { + font-size: 1rem; +} + +h6 { + font-size: 0.875rem; +} + +p { + font-size: 1.125rem; + font-weight: 200; + line-height: 1.8; +} + +.font-light { + font-weight: 300; +} + +.font-regular { + font-weight: 400; +} + +.font-heavy { + font-weight: 700; +} + +/* POSITIONING */ +.left { + text-align: left; +} + +.right { + text-align: right; +} + +.center { + text-align: center; + margin-left: auto; + margin-right: auto; +} + +.justify { + text-align: justify; +} + +/* ==== GRID SYSTEM ==== */ +.container { + width: 100%; + margin-left: auto; + margin-right: auto; +} + +.row { + position: relative; +} +.row [class^=col] { + float: left; + margin: 0.5rem 2%; + min-height: 0.125rem; +} + +.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 { + width: 96%; + margin: auto; +} + +.col-1-sm { + width: 4.33%; +} + +.col-2-sm { + width: 12.66%; +} + +.col-3-sm { + width: 21%; +} + +.col-4-sm { + width: 29.33%; +} + +.col-5-sm { + width: 37.66%; +} + +.col-6-sm { + width: 46%; +} + +.col-7-sm { + width: 54.33%; +} + +.col-8-sm { + width: 62.66%; +} + +.col-9-sm { + width: 71%; +} + +.col-10-sm { + width: 79.33%; +} + +.col-11-sm { + width: 87.66%; +} + +.col-12-sm { + width: 96%; +} + +.row::after { + content: ""; + display: table; + clear: both; +} + +.hidden-sm { + display: none; +} + +@media only screen and (min-width: 33.75em) { + /* 540px */ + .container { + width: 80%; + } +} +@media only screen and (min-width: 45em) { + /* 720px */ + .col-1 { + width: 4.33%; + } + .col-2 { + width: 12.66%; + } + .col-3 { + width: 21%; + } + .col-4 { + width: 29.33%; + } + .col-5 { + width: 37.66%; + } + .col-6 { + width: 46%; + } + .col-7 { + width: 54.33%; + } + .col-8 { + width: 62.66%; + } + .col-9 { + width: 71%; + } + .col-10 { + width: 79.33%; + } + .col-11 { + width: 87.66%; + } + .col-12 { + width: 96%; + } + .hidden-sm { + display: block; + } +} +@media only screen and (min-width: 60em) { + /* 960px */ + .container { + width: 75%; + max-width: 60rem; + } +} +/* CSS declarations go here */ +.Mongol_row, .Mongol_row_name { + color: white; +} + +* { + box-sizing: border-box; +} + +html { + padding: 0; + margin: 0; +} + +body { + font-family: sans-serif; + background-attachment: fixed; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + padding: 0; + margin: 0; +} + +h1 { + font-size: 1.5em; + margin: 0 0 1rem 0; + display: inline-block; +} + +form { + margin-top: 10px; + margin-bottom: 10px; + position: relative; +} + +.new-task input { + box-sizing: border-box; + padding: 10px 0; + background: transparent; + border: none; + width: 100%; + padding-right: 80px; + font-size: 1em; +} + +.new-task input:focus { + outline: 0; +} + +ul { + margin: 0; + padding: 0; + background: white; +} + +.delete { + float: right; + font-weight: bold; + background: none; + font-size: 1em; + border: none; + position: relative; +} + +table { + min-width: 650px; +} + +table > thead > tr > th.headerCell { + color: white; + background-color: #333447; +} + +table > thead.sticky > tr > th.headerCell { + position: sticky; + top: 0; +} + +table > tbody > tr > td { + background: white; + user-select: none; +} + +table > tbody > tr.selected > td { + background: #f8ef8d; +} + +table .tableRow:last-child td, table .tableRow:last-child th { + border: 0; +} + +.userTable { + max-height: 64rem; +} + +li { + position: relative; + list-style: none; + padding: 15px; + border-bottom: #eee solid 1px; +} + +li .text { + margin-left: 10px; +} + +li.checked { + color: #888; +} + +li.checked .text { + text-decoration: line-through; +} + +li.private { + background: #eee; + border-color: #ddd; +} + +header .hide-completed { + float: right; +} + +.toggle-private { + margin-left: 5px; +} + +html { + font-size: 16px; +} + +@media (max-width: 900px) { + html { + font-size: 14px; + } +} +@media (max-width: 600px) { + li { + padding: 12px 15px; + } + .search { + width: 150px; + clear: both; + } + .new-task input { + padding-bottom: 5px; + } + html { + font-size: 10px; + } +} +@font-face { + font-family: "Material Icons"; + font-style: normal; + font-weight: 400; + src: local("Material Icons"), local("MaterialIcons-Regular"), url(/fonts/MaterialIcons-Regular.ttf) format("truetype"); +} +.material-icons { + font-family: "Material Icons"; + font-weight: normal; + font-style: normal; + font-size: 24px; + /* Preferred icon size */ + display: inline-block; + line-height: 1; + text-transform: none; + letter-spacing: normal; + word-wrap: normal; + white-space: nowrap; + direction: ltr; + /* Support for all WebKit browsers. */ + -webkit-font-smoothing: antialiased; + /* Support for Safari and Chrome. */ + text-rendering: optimizeLegibility; + /* Support for Firefox. */ + -moz-osx-font-smoothing: grayscale; + /* Support for IE. */ + font-feature-settings: "liga"; +} + +.material-symbols-outlined { + font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 48; +} + +@font-face { + font-family: "Roboto"; + font-style: normal; + font-weight: 400; + src: local("Roboto"), local("Roboto-Regular"), url(/fonts/Roboto-Regular.ttf) format("truetype"); +} +@font-face { + font-family: "KaushanScript-Regular"; + font-style: normal; + font-weight: 400; + src: url("/fonts/KaushanScript-Regular.ttf") format("truetype"); +} +.nav-separator { + height: 0.2rem; + width: 40%; + margin-left: 30%; + background-color: white; +} + +nav { + font-size: 1.4rem; +} + +nav a { + display: inline-block; + color: #AF8A62; + text-decoration: none; +} + +nav a:hover { + color: #F9F1E1; + text-decoration: underline; +} + +nav a:active { + color: #F9F1E1; + text-decoration: none; +} + +nav a + a { + margin-left: 2rem; +} + +.pageHeaderContainer { + background-image: url("/images/header.svg"); + background-origin: border-box; + background-size: cover; + background-position: center; +} + +.pageHeader { + color: white; + /*background-image: linear-gradient(to bottom, #d0edf5, #e1e5f0 100%)*/ + padding: 20px 15px 15px 15px; + position: relative; +} + +.pageNavContainer { + background: #28211A; +} + +.pageContentContainer { + margin: 0 auto; + width: 85%; + padding-top: 2rem; +} + +.title { + margin-bottom: 0; + color: white; + font-family: "KaushanScript-Regular", sans-serif; + font-size: 4rem; + display: inline-block; +} + +.logo { + position: absolute; + left: 0; + top: 0; + width: 8rem; +} + +.logoContainer { + height: 0; + position: relative; +} + +.login { + position: absolute; + right: 0; + top: 0; +} + +.login button { + background: #28211A; + border-radius: 999px; + box-shadow: 0.2rem 0.3rem 0.4rem 0.1rem #886f59; + box-sizing: border-box; + color: #FFFFFF; + cursor: pointer; + font-family: Inter, Helvetica, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols, -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", sans-serif; + font-weight: 700; + line-height: 24px; + opacity: 1; + outline: 0 solid transparent; + padding: 8px 18px; + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; + width: fit-content; + word-break: break-word; + border: 0; +} + +@media (max-width: 600px) { + .logo { + position: absolute; + left: 0; + right: 0; + top: 0; + margin: 0 auto; + width: 8rem; + } + .logoContainer { + height: 6rem; + } +} +.userTable .userEditorContainer { + width: 100%; +} +.userTable .userEditorGrid { + display: grid; + grid-template-columns: auto 10rem 10rem; + width: 100%; +} +.userTable .insetPermissions { + padding-left: 2rem; +} + +/*# sourceMappingURL=main.css.map */ diff --git a/client/main.css.map b/client/main.css.map new file mode 100644 index 0000000..0ce04eb --- /dev/null +++ b/client/main.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["_simple-grid.sass","_app.sass","_material-icons.sass","_roboto.sass","_page.sass","pages/_Users.sass"],"names":[],"mappings":"AAAQ;AAER;EACC;EACA;EACA;EACA;EACA;EACA;;;AAED;AAEA;EACC;EACA;EACA;;;AAED;AAEA;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;EACA;EACA;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;AAEA;EACC;;;AAED;EACC;;;AAED;EACC;EACA;EACA;;;AAED;EACC;;;AAED;AAEA;EAEC;EACA;EACA;;;AAED;EACC;;AAGA;EACC;EACA;EACA;;;AAEF;EACC;EACA;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;EACA;EACA;;;AAED;EACC;;;AAED;AACC;EAEA;IACC;;;AAEF;AACC;EAEA;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;EAED;IACC;;;AAEF;AACC;EAEA;IACC;IACA;;;ACzLF;AACA;EACC;;;AAED;EACC;;;AAED;EACC;EACA;;;AAED;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAQD;EACC;EACA;EACA;;;AAED;EACC;EACA;EACA;;;AAED;EACC;EACA;EACA;EACA;EACA;EACA;EACA;;;AAED;EACC;;;AAED;EACC;EACA;EACA;;;AAED;EACC;EACA;EACA;EACA;EACA;EACA;;;AAED;EACC;;;AAED;EACC;EACA;;;AAED;EACC;EACA;;;AAED;EACC;EACA;;;AAED;EACC;;;AAGA;EACC;;;AAEF;EACC;;;AAED;EACC;EACA;EACA;EACA;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;EACA;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;;;AAED;EACC;IACC;;;AAEF;EACC;IACC;;EAED;IACC;IACA;;EAED;IACC;;EAED;IACC;;;AClIF;EACC;EACA;EACA;EACA;;AAED;EACC;EACA;EACA;EACA;AACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACA;EACA;AACA;EACA;AACA;EACA;AACA;EACA;;;AAED;EACC;;;AC7BD;EACC;EACA;EACA;EACA;;ACND;EACC;EACA;EACA;EACA;;AAED;EACC;EACA;EACA;EACA;;;AAED;EACC;;;AAED;EACC;EACA;EACA;;;AAED;EACC;EACA;;;AACD;EACC;EACA;;;AAED;EACC;;;AAED;EACC;EACA;EACA;EACA;;;AAED;EAEC;AACA;EACA;EACA;;;AAED;EACC;;;AAED;EACC;EACA;EACA;;;AAED;EACC;EACA;EACA;EACA;EACA;;;AAED;EACC;EACA;EACA;EACA;;;AAED;EACC;EACA;;;AAED;EACC;EACA;EACA;;;AAED;EACC;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAED;EACC;IACC;IACA;IACA;IACA;IACA;IACA;;EAED;IACC;;;ACvGD;EACC;;AAED;EACC;EACA;EACA;;AAED;EACC","file":"main.css"} \ No newline at end of file diff --git a/client/main.html b/client/main.html new file mode 100644 index 0000000..193f9e8 --- /dev/null +++ b/client/main.html @@ -0,0 +1,10 @@ + + K12 Tempest + + + + + + +
+ diff --git a/client/main.jsx b/client/main.jsx new file mode 100644 index 0000000..0421d79 --- /dev/null +++ b/client/main.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { Meteor } from 'meteor/meteor'; +import { createRoot } from 'react-dom/client'; +import {App} from '/imports/ui/App'; +import '../imports/startup/accounts-config.js'; + +Meteor.startup(() => { + createRoot(document.getElementById('react-target')).render() + //render(, document.getElementById('react-target')); +}); diff --git a/client/main.sass b/client/main.sass new file mode 100644 index 0000000..7bfc086 --- /dev/null +++ b/client/main.sass @@ -0,0 +1,16 @@ + +@import "./simple-grid.sass" +@import "./app.sass" +@import './material-icons.sass' +@import './roboto.sass' +@import './page.sass' + +@import './pages/Users.sass' + +//@import './smui.sass' + + +//.mdc-floating-label +// transform: translateY(-80%) +//.mdc-select__selected-text-container +// transform: translateY(30%) \ No newline at end of file diff --git a/client/pages/_Users.sass b/client/pages/_Users.sass new file mode 100644 index 0000000..f70c3b2 --- /dev/null +++ b/client/pages/_Users.sass @@ -0,0 +1,11 @@ +.userTable + .userEditorContainer + width: 100% + + .userEditorGrid + display: grid + grid-template-columns: auto 10rem 10rem + width: 100% + + .insetPermissions + padding-left: 2rem \ No newline at end of file diff --git a/imports/api/admin.js b/imports/api/admin.js new file mode 100644 index 0000000..0bbcfb0 --- /dev/null +++ b/imports/api/admin.js @@ -0,0 +1,60 @@ +import {Meteor} from "meteor/meteor"; +import { _ } from 'underscore'; +import { Roles } from 'meteor/alanning:roles'; + +// console.log("Setting Up Admin...") + +if (Meteor.isServer) { + Meteor.methods({ + 'admin.fixRecords'(input) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + console.log("In Fix Records"); + console.log("Deleting invalid records..."); + + // Delete any records missing key fields. + Meteor.Records.remove({serial: {$exists: false}}); + Meteor.Records.remove({deviceId: {$exists: false}}); + Meteor.Records.remove({endTime: {$exists: false}}); + + console.log("Consolidating records..."); + + let emails = _.uniq(Meteor.Records.find({}, { + sort: {email: 1}, + fields: {email: true} + }).fetch().map(function (x) { + return x.email; + }), true); + + emails.forEach(email => { + // Find all records for the user sorted from oldest to newest. + let records = Meteor.Records.find({email}, {sort: {startTime: 1}}).fetch(); + let newRecords = []; + let record = records[0]; + + for (let index = 1; index < records.length; index++) { + let nextRecord = records[index]; + + if (record.deviceId === nextRecord.deviceId) { + record.endTime = nextRecord.endTime; + record.count += nextRecord.count; + record.internalCount += nextRecord.internalCount; + } else { + if (!record.endTime) record.endTime = nextRecord.startTime; + newRecords.push(record); + record = nextRecord; + } + } + newRecords.push(record); + + Meteor.Records.remove({email}); + + for (let index = 0; index < newRecords.length; index++) { + Meteor.Records.insert(newRecords[index]); + } + }); + } + }, + }); +} + +// console.log("Admin setup.") \ No newline at end of file diff --git a/imports/api/asset-assignment-history.js b/imports/api/asset-assignment-history.js new file mode 100644 index 0000000..6003d14 --- /dev/null +++ b/imports/api/asset-assignment-history.js @@ -0,0 +1,20 @@ +import {Mongo} from "meteor/mongo"; + +export const AssetAssignmentHistory = new Mongo.Collection('assetAssignmentHistory'); + +/* +Maintains a historical record of asset assignments. +assetKey: The MongoID of the asset. AssetID's could be reused, so this prevents that eventuality from messing up historical records. +assetId: The asset's assigned ID (not a MongoID). +serial: The asset's serial number (part of the device, or defined by the manufacturer). In some cases this may be a partial serial. It is not a unique identifier, but should be mostly unique. This might be undefined if a serial was never provided for the original asset. +assetTypeName: The name of the asset type, or "UNK" if one could not be found (shouldn't happen). This is stored because these records could be kept longer than the assets in the system. +assigneeType: One of 'Student' or 'Staff'. +assigneeId: The MongoID of the student or staff the asset was assigned to. +startDate: The date/time of the assignment. +endDate: The date/time of the unassignment. +comment: A text block detailing the reason for the unassignment of the device. Eg: 'Broke Screen' or 'End of year' or 'Not charging' or 'Needs replacement'. +startCondition: One of the condition options: [New, Like New, Good, Okay, Damaged] (see assets.unassign for details). +endCondition: One of the condition options: [New, Like New, Good, Okay, Damaged] (see assets.unassign for details). +startConditionDetails: An optional text block for details on the condition. +endConditionDetails: An optional text block for details on the condition. + */ \ No newline at end of file diff --git a/imports/api/asset-types.js b/imports/api/asset-types.js new file mode 100644 index 0000000..2865146 --- /dev/null +++ b/imports/api/asset-types.js @@ -0,0 +1,79 @@ +import {Mongo} from "meteor/mongo"; +import {Meteor} from "meteor/meteor"; +import { check } from 'meteor/check'; +import { Roles } from 'meteor/alanning:roles'; +//import SimpleSchema from "simpl-schema"; + +// console.log("Setting Up Asset Types...") + +// +// An asset type is a specific type of equipment. Example: Lenovo 100e Chromebook. +// +export const AssetTypes = new Mongo.Collection('assetTypes'); +/* + +const AssetTypesSchema = new SimpleSchema({ + name: { + type: String, + label: "Model Name", + optional: false, + trim: true, + }, + description: { + type: String, + label: "Description", + optional: true, + trim: true, + defaultValue: "", + }, +}); + +AssetTypes.attachSchema(AssetTypesSchema); + */ + +if (Meteor.isServer) { + // Drop any old indexes we no longer will use. Create indexes we need. + try {AssetTypes._dropIndex("External ID")} catch(e) {} + //AssetTypes.createIndex({name: "text"}, {name: "name", unique: false}); + //AssetTypes.createIndex({id: 1}, {name: "External ID", unique: true}); + + //Debug: Show all indexes. + // AssetTypes.rawCollection().indexes((err, indexes) => { + // console.log(indexes); + // }); + + // This code only runs on the server + Meteor.publish('assetTypes', function() { + return AssetTypes.find({}); + }); +} +Meteor.methods({ + 'assetTypes.add'(name, description, year) { + check(name, String); + check(description, String); + check(year, String); + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + AssetTypes.insert({name, description, year}); + } + }, + 'assetTypes.update'(_id, name, description, year) { + check(_id, String); + check(name, String); + check(description, String); + check(year, String); + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + AssetTypes.update({_id}, {$set: {name, description, year}}); + } + }, + 'assetTypes.remove'(_id) { + check(_id, String); + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + //TODO: Need to either remove all assets of this type, or change their type. + } + }, +}); + +// console.log("Asset types setup.") diff --git a/imports/api/assets.js b/imports/api/assets.js new file mode 100644 index 0000000..73871a0 --- /dev/null +++ b/imports/api/assets.js @@ -0,0 +1,302 @@ +import {Mongo} from "meteor/mongo"; +import {Meteor} from "meteor/meteor"; +import { check } from 'meteor/check'; +import { Roles } from 'meteor/alanning:roles'; +//import SimpleSchema from "simpl-schema"; +import {AssetTypes} from "./asset-types"; +import {AssetAssignmentHistory} from "/imports/api/asset-assignment-history"; + +// console.log("Setting Up Assets...") + +export const Assets = new Mongo.Collection('assets'); +export const conditions = ['New','Like New','Good','Okay','Damaged'] + +/* +const AssetsSchema = new SimpleSchema({ + assetTypeId: { + type: String, + label: "Asset Type ID", + optional: false, + trim: true, + }, + assetId: { + type: String, + label: "Asset ID", + optional: false, + trim: true, + index: 1, + unique: true + }, + serial: { + type: String, + label: "Serial", + optional: true, + trim: false, + index: 1, + unique: false + }, + assigneeId: { //Should be undefined or non-existent if not assigned. + type: String, + label: "Assignee ID", + optional: true, + }, + assigneeType: { // 0: Student, 1: Staff, Should be undefined or non-existent if not assigned. + type: SimpleSchema.Integer, + label: "Assignee Type", + optional: true, + min: 0, + max: 1, + exclusiveMin: false, + exclusiveMax: false, + }, + assignmentDate: { + type: Date, + label: "Assignment Date", + optional: true, + }, + condition: { //One of the condition options: [New, Like New, Good, Okay, Damaged] (see assets.unassign for details). + type: String, + label: "Condition", + optional: false, + }, + conditionDetails: { //An optional text block for details on the condition. + type: String, + label: "Condition Details", + optional: true, + } +}); +Assets.attachSchema(AssetsSchema); + */ + +if (Meteor.isServer) { + // Drop any old indexes we no longer will use. Create indexes we need. + //try {Assets._dropIndex("serial")} catch(e) {} + Assets.createIndex({assetId: 1}, {name: "AssetID", unique: true}); + Assets.createIndex({serial: 1}, {name: "Serial", unique: false}); + + // This code only runs on the server + Meteor.publish('assets', function() { + return Assets.find({}); + }); + Meteor.publish('assetsAssignedTo', function(personId) { + return Assets.find({assigneeId: personId}); + }); +} +Meteor.methods({ + 'assets.add'(assetTypeId, assetId, serial, condition, conditionDetails) { + check(assetTypeId, String); + check(assetId, String); + check(serial, String); + check(condition, String); + if(conditionDetails) check(conditionDetails, String); + + if(condition !== 'New' && condition !== 'Like New' && condition !== 'Good' && condition !== 'Okay' && condition !== 'Damaged') { + //Should never happen. + console.error("Invalid condition option in assets.add(..)"); + throw new Meteor.Error("Invalid condition option."); + } + + // Convert the asset ID's to uppercase for storage to make searching easier. + assetId = assetId.toUpperCase(); + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + let assetType = AssetTypes.findOne({assetTypeId}); + + if(Assets.findOne({assetId})) { + //return {error: true, errorType: 'duplicateAssetId'} + throw new Meteor.Error("Duplicate Asset Id", "Cannot use the same asset ID twice.") + } + else if(serial) { + Assets.insert({assetTypeId, assetId, serial, condition, conditionDetails}); + } + else { + Assets.insert({assetTypeId, assetId, condition, conditionDetails}); + } + } + else throw new Meteor.Error("User Permission Error"); + }, + 'assets.update'(_id, assetTypeId, assetId, serial, condition, conditionDetails) { + check(_id, String); + check(assetTypeId, String); + check(assetId, String); + if(serial) check(serial, String); + check(condition, String); + if(conditionDetails) check(conditionDetails, String); + + if(condition !== 'New' && condition !== 'Like New' && condition !== 'Good' && condition !== 'Okay' && condition !== 'Damaged') { + //Should never happen. + console.error("Invalid condition option in assets.update(..)"); + throw new Meteor.Error("Invalid condition option."); + } + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + //TODO: Need to first verify there are no checked out assets to the staff member. + Assets.update({_id}, {$set: {assetTypeId, assetId, serial, condition, conditionDetails}}); + } + else throw new Meteor.Error("User Permission Error"); + }, + 'assets.remove'(_id) { + check(_id, String); + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + let asset = Assets.findOne({_id}); + + if(asset) { + // Ensure the asset is not assigned still. Must unassign then remove. That allows us to maintain historical records for assignees. + if(asset.assigneeId) { + throw new Meteor.Error("Must unassign the asset before removal."); + } + else { + Assets.remove({_id}); + } + } + else { + //This should never happen. + throw new Meteor.Error("Could not find the asset: " + _id); + } + } + else throw new Meteor.Error("User Permission Error"); + }, + /** + * Assigns the asset to the assignee. The assignee should either be a Student or Staff member. + * @param assetId The Asset ID (eg: 'Z1Q') of the asset (asset.assetId). + * @param assigneeType One of: 'Student', 'Staff' + * @param assigneeId The Mongo ID of the Student or Staff (person._id). + * @param condition One of the condition options: [New, Like New, Good, Okay, Damaged]. 'Like New' is defined as very minor cosmetic damage. 'Good' is defined as some cosmetic damage or very minor screen damage. 'Okay' is defined as significant cosmetic damage, or screen/keyboard/trackpad damage but is still useable. 'Damaged' indicates significant damage and the device should not be reissued until it is repaired. + * @param conditionDetails A text block detailing the current condition (if it is needed). + * @param date The date/time of the action. Will be set to the current date/time if not provided. + */ + 'assets.assign'(assetId, assigneeType, assigneeId, condition, conditionDetails, date) { + check(assigneeId, String); + check(assigneeType, String); + check(assetId, String); + check(condition, String); + if(conditionDetails) check(conditionDetails, String); + if(date) check(date, Date); + + if(!date) date = new Date(); + + if(condition !== 'New' && condition !== 'Like New' && condition !== 'Good' && condition !== 'Okay' && condition !== 'Damaged') { + //Should never happen. + console.error("Invalid condition option in assets.unassign(..)"); + throw new Meteor.Error("Invalid condition option."); + } + + if(assigneeType !== 'Student' && assigneeType !== 'Staff') { + // Should never happen. + console.error("Error: Received incorrect assignee type in adding an assignment."); + console.error(assigneeType); + throw new Meteor.Error("Error: Received incorrect assignee type in adding an assignment."); + } + else if(Roles.userIsInRole(Meteor.userId(), "laptop-management", {anyScope:true})) { + let asset = Assets.findOne({assetId}); + + if(asset) { + if(asset.assigneeId) { + //TODO: Should we unassign and re-assign???? + console.error("Asset is already assigned! " + assetId); + throw new Meteor.Error("Asset is already assigned.", "Cannot assign an asset that has already been assigned."); + } + else { + Assets.update({assetId}, {$set: {assigneeType, assigneeId, assignmentDate: date, condition, conditionDetails}}); + } + } + else { + console.error("Could not find the asset: " + assetId) + } + } + else throw new Meteor.Error("User Permission Error"); + }, + /** + * Removes an assignment for the asset. + * TODO: Should create a historical record. + * @param assetId The Asset ID (eg: 'Z1Q') of the asset (asset.assetId). + * @param comment A textual comment on the reason for unassigning the asset. Should not contain condition information. + * @param condition One of the condition options: [New, Like New, Good, Okay, Damaged]. 'Like New' is defined as very minor cosmetic damage. 'Good' is defined as some cosmetic damage or very minor screen damage. 'Okay' is defined as significant cosmetic damage, or screen/keyboard/trackpad damage but is still useable. 'Damaged' indicates significant damage and the device should not be reissued until it is repaired. + * @param conditionDetails A text block detailing the current condition (if it is needed). + * @param date The date/time of the action. Will be set to the current date/time if not provided. + */ + 'assets.unassign'(assetId, comment, condition, conditionDetails, date) { + check(assetId, String); + if(date) check(date, Date); + if(comment) check(comment, String); + check(condition, String); + if(conditionDetails) check(conditionDetails, String); + + if(!date) date = new Date(); + + if(condition !== 'New' && condition !== 'Like New' && condition !== 'Good' && condition !== 'Okay' && condition !== 'Damaged') { + //Should never happen. + console.error("Invalid condition option in assets.unassign(..)"); + throw new Meteor.Error("Invalid condition option."); + } + + if(Roles.userIsInRole(Meteor.userId(), "laptop-management", {anyScope:true})) { + let asset = Assets.findOne({assetId}); + + if(asset) { + let assetType = AssetTypes.findOne({_id: asset.assetTypeId}); + + try { + AssetAssignmentHistory.insert({assetKey: asset._id, assetId, serial: asset.serial, assetTypeName: (assetType ? assetType.name : "UNK"), assigneeType: asset.assigneeType, assigneeId: asset.assigneeId, startDate: asset.assignmentDate, endDate: date, startCondition: asset.condition, endCondition: condition, startConditionDetails: asset.conditionDetails, endConditionDetails: conditionDetails, comment}); + } catch (e) { + console.error(e); + } + Assets.update({assetId}, {$unset: {assigneeType: "", assigneeId: "", assignmentDate: ""}, $set: {condition, conditionDetails}}); + } + else { + console.error("Could not find the asset: " + assetId); + throw new Meteor.Error("Could not find the asset: " + assetId); + } + } + else throw new Meteor.Error("User Permission Error"); + }, + /** + * A fix to remove the AssetAssignment collection and merge it with the Asset collection. + */ + 'assets.fixAssetAssignments'() { + // Removed this since it should no longer be relevant. + + // let assignmentDate = new Date(); + // //This function just removes the need for the asset-assignments collection and merges it with assets. + // if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + // let assets = Assets.find({}).fetch(); + // let assetAssignments = AssetAssignments.find({}).fetch(); + // + // let assetMap = assets.reduce((map, obj) => { + // map[obj.assetId] = obj; + // return map; + // }, {}); + // + // console.log(assetMap); + // console.log(""); + // + // for(let next of assetAssignments) { + // console.log(next); + // let asset = assetMap[next.assetId]; + // console.log("Updating " + asset.assetId + " to be assigned to " + next.assigneeType + ": " + next.assigneeId); + // let c = Assets.update({assetId: asset.assetId}, {$set: {assigneeType: next.assigneeType, assigneeId: next.assigneeId, assignmentDate}}); + // console.log("Updated " + c + " Assets"); + // console.log(Assets.findOne({assetId: asset.assetId})); + // } + // } + }, + /** + * A fix to remove the AssetAssignment collection and merge it with the Asset collection. + */ + 'assets.fixAssetCondition'() { + // Removed this since it should no longer be relevant. + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + Assets.update({assetTypeId: 'xPu8YK39pmQW93Fuz', condition: {$exists: false}}, {$set: {condition: 'Okay', conditionDetails: 'Automated Condition'}}, {multi: true}); //Lenovo E100 CB + Assets.update({assetTypeId: 'casMp4pJ9t8FtpyuR', condition: {$exists: false}}, {$set: {condition: 'Good', conditionDetails: 'Automated Condition'}}, {multi: true}); //Lenovo E100 Charger + Assets.update({assetTypeId: 'ZD9XiHqGr6TcKH9Nv', condition: {$exists: false}}, {$set: {condition: 'New'}}, {multi: true}); //Acer CB315 CB + Assets.update({assetTypeId: 'mfE9NtiFBotb8kp4v', condition: {$exists: false}}, {$set: {condition: 'New'}}, {multi: true}); //Acer CB315 Charger + Assets.update({assetTypeId: 'btEsKYxW4Sgf7T8nA', condition: {$exists: false}}, {$set: {condition: 'Good',conditionDetails: 'Automated Condition'}}, {multi: true}); //Dell 3100 Charger + Assets.update({assetTypeId: '9bszeFJNPteMDbye5', condition: {$exists: false}}, {$set: {condition: 'Like New',conditionDetails: 'Automated Condition'}}, {multi: true}); //HP 11A CB + Assets.update({assetTypeId: 'tCj7s5T2YcFXZEaqE', condition: {$exists: false}}, {$set: {condition: 'Like New',conditionDetails: 'Automated Condition'}}, {multi: true}); //HP 11A Charger + } + } +}); + +// console.log("Assets setup.") \ No newline at end of file diff --git a/imports/api/data-collection.js b/imports/api/data-collection.js new file mode 100644 index 0000000..be6fbfe --- /dev/null +++ b/imports/api/data-collection.js @@ -0,0 +1,149 @@ +import { Meteor } from 'meteor/meteor'; +import { Mongo } from 'meteor/mongo'; +import { check } from 'meteor/check'; +import { MongoClient } from 'mongodb'; +import {Assets} from "/imports/api/assets"; +import {Students} from "/imports/api/students"; +import {Staff} from "/imports/api/staff"; +import {AssetTypes} from "/imports/api/asset-types"; +//import {Roles} from 'alanning/roles'; + +// console.log("Setting Up Data Collection...") + +//export const Records = new Mongo.Collection('records'); +let client; +let database; +let dataCollection; + +if (Meteor.isServer) { + // let uri = process.env.MONGO_URL2; + // uri = "mongodb://localhost:27017"; + // + // //client = new MongoClient(uri); + // MongoClient.connect(uri, (err, c) => { + // client = c; + // database = client.db("avusd-data-collection"); + // dataCollection = database.collection("records"); + // dataCollection.find({deviceId: "1e3e99ef-adf4-4aa2-8784-205bc60f0ce3"}).toArray((e, a) => { + // if(e) console.log(e); + // else console.log("Found " + a.length + " records."); + // }) + // }); + + + // let results = Meteor.Records.find({deviceId: "1e3e99ef-adf4-4aa2-8784-205bc60f0ce3"}).fetch(); + // console.log(results); +} + +if (Meteor.isServer) { + Meteor.methods({ + /** + * Collects Chromebook history given one of the possible parameters. + * @param params An object with a single attribute. The attribute must be one of: deviceId, serial, email. It will find all Chromebook data that starts with the given attribute value. + * @returns {any} Array of Chromebook data objects. + */ + 'DataCollection.chromebookData'(params) { + if(Roles.userIsInRole(Meteor.userId(), "laptop-management", {anyScope:true})) { + let query = {}; + + // For asset ID's, we need to get the serial from the asset collection first. + if(params.assetId) { + let asset = Assets.findOne({assetId : params.assetId}); + + if(asset) { + params.serial = asset.serial; + params.regex = false; + } + } + + if (params.deviceId) query.deviceId = params.regex ? { + $regex: params.deviceId, + $options: "i" + } : params.deviceId; + else if (params.serial) query.serial = params.regex ? { + $regex: params.serial, + $options: "i" + } : params.serial; + // else if (params.assetId) { + // let asset = Assets.findOne({assetId: params.assetId}); + // + // if(asset.serial) { + // // An exact search. + // query.serial = asset.serial; + // } + // } + else if (params.email) query.email = params.regex ? { + $regex: params.email, + $options: "i" + } : params.email; + else if (params.date) { //Assume that date is a number. Finds all Chromebook Data with the last check in time greater than or equal to the given date. + query.endTime = {'$gte': params.date} + } + else { + query = undefined; + } + + if(query) { + // console.log("Collecting Chromebook Data: "); + // console.log(query); + + //Sort by the last time the record was updated from most to least recent. + let result = Meteor.Records.find(query, {sort: {endTime: -1}}).fetch(); + // console.log("Found: "); + // console.log(result); + + //Add some additional data to the records. + for (let next of result) { + if (next.serial) { + next.asset = Assets.findOne({serial: next.serial}); + } + + if (next.email) { + next.person = Students.findOne({email: next.email}); + + if (!next.person) next.person = Staff.findOne({email: next.email}); + } + + if (next.asset) { + next.assetType = AssetTypes.findOne({_id: next.asset.assetType}) + + if (next.asset.assigneeId) { + next.assignedTo = next.asset.assigneeType === "Student" ? Students.findOne({_id: next.asset.assigneeId}) : Staff.findOne({_id: next.asset.assigneeId}) + } + } + } + + return result; + } else return null; + } + else return null; + } + // 'tasks.setChecked'(taskId, setChecked) { + // check(taskId, String); + // check(setChecked, Boolean); + // + // const task = Tasks.findOne(taskId); + // if (task.private && task.owner !== this.userId) { + // // If the task is private, make sure only the owner can check it off + // throw new Meteor.Error('not-authorized'); + // } + // + // Tasks.update(taskId, { $set: { checked: setChecked } }); + // }, + // 'tasks.setPrivate'(taskId, setToPrivate) { + // check(taskId, String); + // check(setToPrivate, Boolean); + // + // const task = Tasks.findOne(taskId); + // + // // Make sure only the task owner can make a task private + // if (task.owner !== this.userId) { + // throw new Meteor.Error('not-authorized'); + // } + // + // Tasks.update(taskId, { $set: { private: setToPrivate } }); + // }, + }); +} + +// console.log("Data Collection setup.") \ No newline at end of file diff --git a/imports/api/example-schema.js b/imports/api/example-schema.js new file mode 100644 index 0000000..d7f3a5b --- /dev/null +++ b/imports/api/example-schema.js @@ -0,0 +1,93 @@ +import {AssetTypes} from "./asset-types"; +import {SimpleSchema} from "simpl-schema/dist/SimpleSchema"; + +const AssetTypesSchema = new SimpleSchema({ + name: { + type: String, + label: "Name", + optional: false, + trim: true, + index: 1, + unique: true + }, + tags: { //An array of ProductTag names. Note that we are not using the ProductTag ID's because I want a looser connection (if a ProductTag is deleted, it isn't a big deal if it isn't maintained in the Product records). + type: [String], + label: "Tags", + optional: false, + defaultValue: [] + }, + measures: { //A JSON array of Measure ID's. + type: Array, + label: "Measures", + optional: false, + defaultValue: [] + }, + 'measures.$': { + type: String, + label: "Measure ID", + regEx: SimpleSchema.RegEx.Id + }, + aliases: { //A JSON array of alternate names. + type: Array, + label: "Aliases", + optional: false, + defaultValue: [] + }, + 'aliases.$': { + type: String + }, + createdAt: { + type: Date, + label: "Created On", + optional: false + }, + updatedAt: { + type: Date, + label: "Updated On", + optional: true + }, + deactivated: { //This is turned on first, if true it will hide the product in production views, but keep the product available in the sale views. It is intended to be turned on for products that are no longer produced, but for which we have remaining inventory. + type: Boolean, + label: "Deactivated", + optional: true + }, + hidden: { //Deactivated must first be true. Hides the product everywhere in the system except in historical pages. The inventory should be all sold prior to hiding a product. + type: Boolean, + label: "Hidden", + optional: true + }, + timestamp: { + type: Date, + label: "Timestamp", + optional: true + }, + weekOfYear: { + type: Number, + label: "Week Of Year", + optional: true + }, + amount: { + type: Number, + label: "Amount", + optional: false, + decimal: true + }, + price: { + type: Number, + label: "Price", + optional: false, + min: 0, + exclusiveMin: true, + }, + assigneeType: { + type: SimpleSchema.Integer, + label: "Assignee Type", + optional: false, + min: 1, + max: 2, + exclusiveMin: false, + exclusiveMax: false, + }, +}); + +AssetTypes.attachSchema(AssetTypesSchema); diff --git a/imports/api/index.js b/imports/api/index.js new file mode 100644 index 0000000..5c32ba9 --- /dev/null +++ b/imports/api/index.js @@ -0,0 +1,11 @@ +import "./users.js"; +import "./data-collection.js"; +import "./admin.js"; +import "./students.js"; +import "./staff.js"; +import "./sites.js"; +import "./asset-types.js"; +import "./assets.js"; +import "./asset-assignment-history.js"; + +// console.log("Finished setting up server side models."); \ No newline at end of file diff --git a/imports/api/records.js b/imports/api/records.js new file mode 100644 index 0000000..81b4608 --- /dev/null +++ b/imports/api/records.js @@ -0,0 +1,40 @@ +import { Meteor } from 'meteor/meteor'; +import { Mongo } from 'meteor/mongo'; +import { check } from 'meteor/check'; + +export const Records = new Mongo.Collection('records'); + +if (Meteor.isServer) { + // This code only runs on the server + Meteor.publish('records', function() { + return Records.find({}); + }); +} + +Meteor.methods({ + // 'tasks.setChecked'(taskId, setChecked) { + // check(taskId, String); + // check(setChecked, Boolean); + // + // const task = Tasks.findOne(taskId); + // if (task.private && task.owner !== this.userId) { + // // If the task is private, make sure only the owner can check it off + // throw new Meteor.Error('not-authorized'); + // } + // + // Tasks.update(taskId, { $set: { checked: setChecked } }); + // }, + // 'tasks.setPrivate'(taskId, setToPrivate) { + // check(taskId, String); + // check(setToPrivate, Boolean); + // + // const task = Tasks.findOne(taskId); + // + // // Make sure only the task owner can make a task private + // if (task.owner !== this.userId) { + // throw new Meteor.Error('not-authorized'); + // } + // + // Tasks.update(taskId, { $set: { private: setToPrivate } }); + // }, +}); diff --git a/imports/api/sites.js b/imports/api/sites.js new file mode 100644 index 0000000..efe2f49 --- /dev/null +++ b/imports/api/sites.js @@ -0,0 +1,38 @@ +import {Mongo} from "meteor/mongo"; +import {Meteor} from "meteor/meteor"; +import {Students} from "./students"; +import {Staff} from "./staff"; +import { Roles } from 'meteor/alanning:roles'; + +export const Sites = new Mongo.Collection('sites'); + +if (Meteor.isServer) { + // This code only runs on the server + Meteor.publish('sites', function() { + return Sites.find({}); + }); +} +Meteor.methods({ + 'sites.update'(_id, name) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + Sites.update({_id}, {$set: {name}}); + } + }, + 'sites.add'(name) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + Sites.insert({name}); + } + }, + 'sites.remove'(_id) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + let site = Sites.find({_id}); + + if(site) { + //Clear any site references in student/room entries. + Students.update({siteId: _id}, {$unset: {siteId: 1}}); + Staff.update({siteId: _id}, {$unset: {siteId: 1}}); + Sites.remove({_id}); + } + } + }, +}); diff --git a/imports/api/staff.js b/imports/api/staff.js new file mode 100644 index 0000000..2ed44f4 --- /dev/null +++ b/imports/api/staff.js @@ -0,0 +1,161 @@ +import {Mongo} from "meteor/mongo"; +import {Meteor} from "meteor/meteor"; +import { Roles } from 'meteor/alanning:roles'; +import {check} from "meteor/check"; +import {Sites} from "/imports/api/sites"; +import {parse} from "csv-parse"; + +// console.log("Setting Up Staff...") + +export const Staff = new Mongo.Collection('staff'); + +if (Meteor.isServer) { + // This code only runs on the server + Meteor.publish('staff', function(siteId) { + if(siteId) check(siteId, String); + return siteId ? Staff.find({siteId}) : Staff.find({}); + }); +} +Meteor.methods({ + 'staff.add'(id, firstName, lastName, email, siteId) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + Staff.insert({id, firstName, lastName, email, siteId}); + } + }, + 'staff.update'(_id, id, firstName, lastName, email, siteId) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + Staff.update({_id}, {$set: {id, firstName, lastName, email, siteId}}); + } + }, + 'staff.remove'(_id) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + //TODO: Need to first verify there are no checked out assets to the staff member. + } + }, + /** + * Assumes that the ID field is a unique ID that never changes for staff. + * This must be true in order for duplicate staff to be avoided. + * Will automatically update staff data, including the site he/she is associated with. + * + * Expects the CSV string to contain comma delimited data in the form: + * ID, email, first name, last name + * + * The query in Aeries is: `LIST STF ID FN LN EM PSC`. + * A more complete Aeries query: `LIST STF ID FN LN EM BY FN IF PSC = 5` + * Note that you will want to run this query for each school, and the district. The example above sets the school to #5 (PSC). + * Run the query in Aeries as a `Report`, select TXT, and upload here. + * + * Aeries adds a header per 'page' of data (I think 35 entries per page). + * Example: + * Anderson Valley Jr/Sr High School,6/11/2022 + * 2021-2022,Page 1 + * StuEmail,Student ID,First Name,Last Name,Grade,First Name Alias,Last Name Alias + * @type: Currently only supports 'CSV' or 'Aeries Text Report' + */ + 'staff.loadCsv'(csv, type, siteId) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + check(csv, String); + check(siteId, String); + + let site = Sites.findOne({_id: siteId}); + + if(site) { + let cleanCsv; + let lines = csv.split(/\r?\n/); + let pageHeader = type === 'Aeries Text Report' ? lines[0] : null; // Skip the repeating header lines for an Aeries text report. + let skip = type === 'CSV' ? 1 : 0; // Skip the first line of a CSV file (headers). + + // Remove headers from the CSV. + for(const line of lines) { + if (skip > 0) skip--; + else if (pageHeader && line === pageHeader) { + skip = 2; + } else { + if(!cleanCsv) cleanCsv = ""; + else cleanCsv += '\r\n'; + cleanCsv += line; + } + } + + //console.log(cleanCsv); + + // Note: This doesn't work because some values are quoted and contain commas as a value character. + // Parse the CSV (now without any headers). + // lines = cleanCsv.split(/\r\n/); + // for(const line of lines) { + // let values = line.split(/\s*,\s*/); + // + // if(values.length >= 5) { + // let id = values[0]; + // let email = values[1]; + // let firstName = values[2]; + // let lastName = values[3]; + // let grade = parseInt(values[4], 10); + // let firstNameAlias = ""; + // let active = true; + // + // if(values.length > 5) firstNameAlias = values[5]; + // + // let student = {siteId, email, id, firstName, lastName, grade, firstNameAlias, active}; + // + // // console.log(student); + // // Update or insert in the db. + // console.log("Upserting: " + student); + // Students.upsert({id}, {$set: student}); + // } + // } + + const bound = Meteor.bindEnvironment((callback) => {callback();}); + + parse(cleanCsv, {}, function(err, records) { + bound(() => { + if(err) console.error(err); + else { + let foundIds = new Set(); + let duplicates = []; + console.log("Found " + records.length + " records."); + + for(const values of records) { + let id = values[0]; + let email = values[1]; + let firstName = values[2]; + let lastName = values[3]; + let grade = parseInt(values[4], 10); + let firstNameAlias = ""; + let active = true; + + if(values.length > 5) firstNameAlias = values[5]; + + let staff = {siteId, email, id, firstName, lastName, active}; + + // Track the staff ID's and record duplicates. This is used to ensure our counts are accurate later. + if(foundIds.has(staff.id)) { + duplicates.push(staff.id); + } + else { + foundIds.add(staff.id); + } + + //console.log(staff); + try { + Staff.upsert({id: staff.id}, {$set: staff}); + } + catch(err) { + console.error(err); + } + } + + console.log(duplicates.length + " records were duplicates:"); + console.log(duplicates); + } + }); + }) + } + else { + console.log("Failed to find the site with the ID: " + siteId); + } + } + } +}); + +// console.log("Staff setup.") \ No newline at end of file diff --git a/imports/api/students.js b/imports/api/students.js new file mode 100644 index 0000000..6fdc83c --- /dev/null +++ b/imports/api/students.js @@ -0,0 +1,150 @@ +import { Meteor } from 'meteor/meteor'; +import { Mongo } from 'meteor/mongo'; +import { check } from 'meteor/check'; +import {Sites} from "./sites"; +import { Roles } from 'meteor/alanning:roles'; +import {parse} from 'csv-parse'; + +export const Students = new Mongo.Collection('students'); + +if (Meteor.isServer) { + Students.createIndex({id: 1}, {name: "External ID", unique: true}); + + // This code only runs on the server + Meteor.publish('students', function(siteId) { + if(siteId) check(siteId, String); + return siteId ? Students.find({siteId}) : Students.find({}); + }); + + Meteor.methods({ + 'students.add'(id, firstName, lastName, email, siteId, grade) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + Students.insert({id, firstName, lastName, email, siteId, grade}); + } + }, + 'students.update'(_id, id, firstName, lastName, email, siteId, grade) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + Students.update({_id}, {$set: {id, firstName, lastName, email, siteId, grade}}); + } + }, + 'students.remove'(_id) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + //TODO: Need to first verify there are no checked out assets to the staff member. + } + }, + 'students.getPossibleGrades'() { + return Students.rawCollection().distinct('grade', {}); + }, + /** + * Sets a first name alias that can be overridden by the one that is imported. + * @param _id The student's database ID. + * @param alias The alias to set for the student. + */ + 'students.setAlias'(_id, alias) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + check(_id, String); + check(alias, String); + + Students.update({_id}, !alias || !alias.length() ? {$unset: {alias: true}} : {$set: {alias}}); + } + }, + /** + * Assumes that the ID field is a unique ID that never changes for a student. + * This must be true in order for duplicate students to be avoided. + * Will automatically update a student's data, including the site he/she is associated with. + * + * Expects the CSV string to contain comma delimited data in the form: + * email, student ID, first name, last name, grade, first name alias, last name alias + * + * The query in Aeries is: `LIST STU ID SEM FN LN NG FNA`. + * A more complete Aeries query: `LIST STU STU.ID STU.SEM STU.FN STU.LN STU.NG BY STU.NG STU.SEM IF STU.NG >= 7 AND NG <= 12 AND STU.NS = 5` + * Note that FNA (First Name Alias) is optional. + * Note that you might want to include a school ID in the IF if you have multiple schools in the district. + * The query in SQL is: `SELECT [STU].[ID] AS [Student ID], [STU].[SEM] AS [StuEmail], STU.FN AS [First Name], STU.LN AS [Last Name], [STU].[GR] AS [Grade], [STU].[FNA] AS [First Name Alias], [STU].[LNA] AS [Last Name Alias] FROM (SELECT [STU].* FROM STU WHERE [STU].DEL = 0) STU WHERE ( [STU].SC = 5) ORDER BY [STU].[LN], [STU].[FN];`. + * Run the query in Aeries as a `Report`, select TXT, and upload here. + * + * Aeries adds a header per 'page' of data (I think 35 entries per page). + * Example: + * Anderson Valley Jr/Sr High School,6/11/2022 + * 2021-2022,Page 1 + * Student ID, Email, First Name,Last Name,Grade,(opt) First Name Alias + * @type: Currently only supports 'CSV' or 'Aeries Text Report' + */ + 'students.loadCsv'(csv, type, siteId) { + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + check(csv, String); + check(siteId, String); + + let site = Sites.findOne({_id: siteId}); + + if(site) { + let cleanCsv; + let lines = csv.split(/\r?\n/); + let pageHeader = type === 'Aeries Text Report' ? lines[0] : null; // Skip the repeating header lines for an Aeries text report. + let skip = type === 'CSV' ? 1 : 0; // Skip the first line of a CSV file (headers). + + // Remove headers from the CSV. + for(const line of lines) { + if (skip > 0) skip--; + else if (pageHeader && line === pageHeader) { + skip = 2; + } else { + if(!cleanCsv) cleanCsv = ""; + else cleanCsv += '\r\n'; + cleanCsv += line; + } + } + + const bound = Meteor.bindEnvironment((callback) => {callback();}); + + parse(cleanCsv, {}, function(err, records) { + bound(() => { + if(err) console.error(err); + else { + let foundIds = new Set(); + let duplicates = []; + console.log("Found " + records.length + " records."); + + for(const values of records) { + let id = values[0]; + let email = values[1]; + let firstName = values[2]; + let lastName = values[3]; + let grade = parseInt(values[4], 10); + let firstNameAlias = ""; + let active = true; + + if(values.length > 5) firstNameAlias = values[5]; + + let student = {siteId, email, id, firstName, lastName, grade, firstNameAlias, active}; + + // Track the student ID's and record duplicates. This is used to ensure our counts are accurate later. + if(foundIds.has(student.id)) { + duplicates.push(student.id); + } + else { + foundIds.add(student.id); + } + + try { + Students.upsert({id: student.id}, {$set: student}); + } + catch(err) { + console.error(err); + } + } + + console.log(duplicates.length + " records were duplicates:"); + console.log(duplicates); + } + }); + }) + } + else { + console.log("Failed to find the site with the ID: " + siteId); + } + } + } + }); + +} \ No newline at end of file diff --git a/imports/startup/accounts-config.js b/imports/startup/accounts-config.js new file mode 100644 index 0000000..2e1d414 --- /dev/null +++ b/imports/startup/accounts-config.js @@ -0,0 +1,74 @@ +import { Accounts } from 'meteor/accounts-base' +import { Roles } from 'meteor/alanning:roles' +import {Meteor} from "meteor/meteor"; + +console.log("Setting up accounts-config...") + +if(Meteor.isClient) { + Accounts.ui.config({ + passwordSignupFields: 'USERNAME_ONLY' + }); +} + +Accounts.config({ + // Allow only certain email domains. + restrictCreationByEmailDomain: function(address) { + let pattern = process.env.EMAIL_REGEX; + + return new RegExp(pattern, 'i').test(address) + } +}); + +if(Meteor.isServer) { + let adminEmail = process.env.ADMIN_EMAIL; + let watchForAdmin = false; + + //Setup the roles. + Roles.createRole('admin', {unlessExists: true}); + Roles.createRole('laptop-management', {unlessExists: true}); + Roles.addRolesToParent('laptop-management', 'admin', {unlessExists: true}); + //Roles.addUsersToRoles("zwbMiaSKHix4bWQ8d", 'admin', 'global', {unlessExists: true}); + + // If we are passed an email address that should be admin by default, then ensure that user is admin, or mark it as needing to be admin if the user ever logs in. + // Given that this app requires Google OAuth2, and we expect logins to be restricted to district email addresses, this should be very secure. + if(adminEmail) { + let user = Meteor.users.findOne({"services.google.email": adminEmail}); + + if(user) { + let assignment = Meteor.roleAssignment.findOne({'user._id': user._id, "role._id": "admin"}); + + // console.log("Admin Role Assignment: " + JSON.stringify(assignment)); + if(!assignment) { + Roles.addUsersToRoles(user._id, ['admin']); + } + } + else { + watchForAdmin = true; + } + } + + // Listen for users logging in so we can setup the admin user automatically once they log in the first time. + if(watchForAdmin) { + // TODO: It would be nice to remove this handler after the admin user is found, but the docs are pretty ambiguous about how to do that. Not a big deal, just annoying. + Accounts.onLogin(function (data) { + // console.log("User logged in:"); + // console.log(data.user.services.google.email); + + // data.user == Meteor.user() + + //console.log(JSON.stringify(Meteor.user())); + if (watchForAdmin) { + try { + if (data.user.services.google.email === adminEmail) { + Roles.addUsersToRoles(data.user._id, ['admin']); + watchForAdmin = false; + } + } catch (err) { + console.log(err); + } + } + }); + } +} + +console.log("Finished setting up accounts-config.") \ No newline at end of file diff --git a/imports/ui/App.jsx b/imports/ui/App.jsx new file mode 100644 index 0000000..f1aa6b3 --- /dev/null +++ b/imports/ui/App.jsx @@ -0,0 +1,55 @@ +import { Meteor } from 'meteor/meteor'; +import {Roles} from 'meteor/alanning:roles'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import {BrowserRouter, Routes, Route} from 'react-router-dom'; +import {Page} from './Page' +import Assignments from './pages/Assignments' +import Assets from './pages/Assets' +import History from './pages/History' +import Users from './pages/Users' +import Admin from './pages/Admin' + +export const App = () => { + const {user, canManageLaptops, isAdmin} = useTracker(() => { + const user = Meteor.user(); + const canManageLaptops = user && Roles.userIsInRole(user._id, 'laptop-management', 'global'); + const isAdmin = user && Roles.userIsInRole(user._id, 'admin', 'global'); + + return { + user, + canManageLaptops, + isAdmin + } + }) + + return ( + + + +
+
+ TODO: Some statistics and such. +
+
+ }/> + + {canManageLaptops && } + }/> + + {isAdmin && } + }/> + + {isAdmin && } + }/> + + {canManageLaptops && } + }/> + + {isAdmin && } + }/> +
+
+ ) +} \ No newline at end of file diff --git a/imports/ui/Page.jsx b/imports/ui/Page.jsx new file mode 100644 index 0000000..b26b23c --- /dev/null +++ b/imports/ui/Page.jsx @@ -0,0 +1,77 @@ +import { Meteor } from 'meteor/meteor'; +import {Roles} from 'meteor/alanning:roles'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import {Link} from 'react-router-dom'; +import _ from 'lodash'; + +export const Page = (props) => { + const {user, canManageLaptops, isAdmin} = useTracker(() => { + const user = Meteor.user(); + const canManageLaptops = user && Roles.userIsInRole(user._id, 'laptop-management', 'global'); + const isAdmin = user && Roles.userIsInRole(user._id, 'admin', 'global'); + + return { + user, + canManageLaptops, + isAdmin + } + }) + + function performLogin() { + //Login style can be "popup" or "redirect". I am not sure we need to request and offline token. + Meteor.loginWithGoogle({loginStyle: "popup", requestOfflineToken: true}, (err) => { + if (err) { + console.log(err); + } else { + //console.log("Logged in"); + } + }) + } + + function performLogout() { + Meteor.logout(); + } + + return ( +
+
+
+
+
+ Logo +
+ {!user ? + + : + + } +
+
+
K12 Tempest
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ {props.children} +
+
+ ) +} \ No newline at end of file diff --git a/imports/ui/pages/Admin.jsx b/imports/ui/pages/Admin.jsx new file mode 100644 index 0000000..31be235 --- /dev/null +++ b/imports/ui/pages/Admin.jsx @@ -0,0 +1,58 @@ +import React, {lazy, useState} from 'react'; +import TabNav from '../util/TabNav'; +// This is needed because there is some problem with the lazy loading of the pages when they import this file. +// Importing it here pre-loads it and avoids the issue. +// It has something to do with the students.js file and its import of the csv parsing library. +import {Students} from "/imports/api/students"; + +export default () => { + let tabs = [ + { + title: "Sites", + getElement: () => { + const Sites = lazy(()=>import('./Admin/Sites')) + return + }, + path: '/sites', + href: 'sites' + }, + { + title: "Students", + getElement: () => { + const Students = lazy(()=>import('./Admin/Students')) + return + }, + path: '/students', + href: 'students' + }, + { + title: "Staff", + getElement: () => { + const Staff = lazy(()=>import('./Admin/Staff')) + return + }, + path: '/staff', + href: 'staff' + }, + { + title: "Asset Types", + getElement: () => { + const AssetTypes = lazy(()=>import('./Admin/AssetTypes')) + return + }, + path: '/assetTypes', + href: 'assetTypes' + }, + { + title: "Functions", + getElement: () => { + const Functions = lazy(()=>import('./Admin/Functions')) + return + }, + path: '/functions', + href: 'functions' + }, + ] + + return +} \ No newline at end of file diff --git a/imports/ui/pages/Admin/AssetTypes.jsx b/imports/ui/pages/Admin/AssetTypes.jsx new file mode 100644 index 0000000..a121814 --- /dev/null +++ b/imports/ui/pages/Admin/AssetTypes.jsx @@ -0,0 +1,113 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import MenuItem from '@mui/material/MenuItem'; +import {AssetTypes} from "/imports/api/asset-types"; + +const cssFieldColumnContainer = { + display: 'flex', + flexDirection: 'column', + backgroundColor: '#DDD', + padding: '0.5rem', + border: '1px solid #999', + borderRadius: '0.2rem' +} +const cssEditorField = { + marginTop: '0.6rem', +} +const cssGridFieldContainer = { + display: 'grid', + gridTemplateColumns: "1fr 1fr", + columnGap: '1rem', + rowGap: '0.4rem', + marginBottom: '1.5rem' +} +const cssButtonContainer = { + display: 'flex', + gap: '1rem', + justifyContent: 'flex-end' +} + +const AssetTypeEditor = ({value, close}) => { + const [year, setYear] = useState(value.year || "") + const [name, setName] = useState(value.name || "") + const [description, setDescription] = useState(value.description || "") + + const applyChanges = () => { + close() + //TODO Should invert this and only close if there was success on the server. + if(value._id) + Meteor.call("assetType.update", value._id, name, description, year); + else + Meteor.call("assetType.add", name, description, year); + } + const rejectChanges = () => { + close() + } + const change = (e) => { + console.log(e); + + setYear(e.target.value); + } + + return ( +
+

Asset Type Editor

+
+ change}/> + {setName(e.target.value)}}/> + {setDescription(e.target.value)}}/> +
+
+ + +
+
+ ) +} + +export default () => { + Meteor.subscribe('assetTypes'); + + const {assetTypes} = useTracker(() => { + let assetTypes = AssetTypes.find().fetch(); + + return {assetTypes} + }); + + const columns = [ + { + name: "Year", + value: (row) => row.year, + }, + { + name: "Name", + value: (row) => row.name, + }, + { + name: "Description", + value: (row) => row.description, + }, + ] + + const options = { + key: (row) => row._id, + editor: (row, close) => {return ()}, + add: true, + maxHeight: '40rem', + keyHandler: (e, selected) => { + if(selected && selected._id && e.key === "Delete") { + Meteor.call("assetType.remove", selected._id); + } + } + } + + return ( + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/Admin/Functions.jsx b/imports/ui/pages/Admin/Functions.jsx new file mode 100644 index 0000000..e744cf8 --- /dev/null +++ b/imports/ui/pages/Admin/Functions.jsx @@ -0,0 +1,6 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; + +export default () => {return (
None
)} \ No newline at end of file diff --git a/imports/ui/pages/Admin/Sites.jsx b/imports/ui/pages/Admin/Sites.jsx new file mode 100644 index 0000000..ae60a66 --- /dev/null +++ b/imports/ui/pages/Admin/Sites.jsx @@ -0,0 +1,90 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import MenuItem from '@mui/material/MenuItem'; +import {Sites} from "/imports/api/sites"; + +const cssEditorField = { + margin: '0.6rem 0', +} +const cssFieldContainer = { + display: 'flex', + flexDirection: 'column', + backgroundColor: '#DDD', + padding: '0.5rem', + border: '1px solid #999', + borderRadius: '0.2rem', +} +const cssButtonContainer = { + display: 'flex', + gap: '1rem', + justifyContent: 'flex-end' +} + +const SiteEditor = ({value, close}) => { + const [name, setName] = useState(value.name || "") + + const applyChanges = () => { + close() + //TODO Should invert this and only close if there was success on the server. + if(value._id) + Meteor.call("sites.update", value._id, name); + else + Meteor.call("sites.add", name); + } + const rejectChanges = () => { + close() + } + + return ( +
+

Site Editor

+ {setName(e.target.value)}}/> +
+ + +
+
+ ) +} + +export default () => { + Meteor.subscribe('sites'); + + const {sites} = useTracker(() => { + const sites = Sites.find({}).fetch(); + return { + sites + } + }); + + const columns = [ + { + name: "Name", + value: (row) => row.name, + }, + ] + + const options = { + key: (row) => row._id, + editor: (row, close) => {return ()}, + add: true, + maxHeight: '40rem', + keyHandler: (e, selected) => { + if(selected && selected._id && e.key === "Delete") { + Meteor.call("sites.remove", selected._id); + } + } + } + + return ( + <> + + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/Admin/Staff.jsx b/imports/ui/pages/Admin/Staff.jsx new file mode 100644 index 0000000..1b0be5f --- /dev/null +++ b/imports/ui/pages/Admin/Staff.jsx @@ -0,0 +1,153 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import MenuItem from '@mui/material/MenuItem'; +import {Staff} from "/imports/api/staff"; +import {Sites} from "/imports/api/sites"; + +const cssSitesSelect = { + margin: '0.6rem 0', + minWidth: '20rem', +} +const cssFieldColumnContainer = { + display: 'flex', + flexDirection: 'column', + backgroundColor: '#DDD', + padding: '0.5rem', + border: '1px solid #999', + borderRadius: '0.2rem' +} +const cssGridFieldContainer = { + display: 'grid', + gridTemplateColumns: "1fr 1fr 1fr", + columnGap: '1rem', + rowGap: '0.4rem', + marginBottom: '1.5rem' +} +const cssButtonContainer = { + display: 'flex', + gap: '1rem', + justifyContent: 'flex-end' +} + +const StaffEditor = ({value, close, defaultSiteId}) => { + const [email, setEmail] = useState(value.email || "") + const [id, setId] = useState(value.id || "") + const [firstName, setFirstName] = useState(value.firstName || "") + const [lastName, setLastName] = useState(value.lastName || "") + const [siteId, setSiteId] = useState(value.siteId ? value.siteId : defaultSiteId) + + const {sites} = useTracker(() => { + let sites = Sites.find({}).fetch(); + + return {sites} + }); + + if(!siteId && sites && sites.length > 0) { + setSiteId(sites[0]._id) + } + + const applyChanges = () => { + close() + //TODO Should invert this and only close if there was success on the server. + if(value._id) + Meteor.call("staff.update", value._id, id, firstName, lastName, email, siteId); + else + Meteor.call("staff.add", id, firstName, lastName, email, siteId); + } + const rejectChanges = () => { + close() + } + + return ( +
+

Staff Editor

+
+ {setId(e.target.value)}}/> + {setEmail(e.target.value)}}/> +
+ {setFirstName(e.target.value)}}/> + {setLastName(e.target.value)}}/> + {setSiteId(e.target.value)}}> + {sites.map((next, i) => { + return {next.name} + })} + +
+
+ + +
+
+ ) +} + +export default () => { + const siteAll = {_id: 0, name: "All"} + const [site, setSite] = useState(siteAll._id) + + Meteor.subscribe('sites'); + Meteor.subscribe('staff'); + + const {sites} = useTracker(() => { + const sites = Sites.find({}).fetch(); + + sites.push(siteAll); + + return {sites} + }); + + const {staff} = useTracker(() => { + const staffQuery = site === siteAll._id ? {} : {siteId: site} + let staff = Staff.find(staffQuery).fetch(); + + return {staff} + }); + + const columns = [ + { + name: "ID", + value: (row) => row.id, + }, + { + name: "Email", + value: (row) => row.email, + }, + { + name: "First Name", + value: (row) => row.firstName, + }, + { + name: "Last Name", + value: (row) => row.lastName, + }, + ] + + const options = { + key: (row) => row._id, + editor: (row, close) => {return ()}, + add: true, + maxHeight: '40rem', + keyHandler: (e, selected) => { + if(selected && selected._id && e.key === "Delete") { + Meteor.call("staff.remove", selected._id); + } + } + } + + return ( + <> + {setSite(e.target.value)}}> + {sites.map((next, i) => { + return {next.name} + })} + + + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/Admin/Students.jsx b/imports/ui/pages/Admin/Students.jsx new file mode 100644 index 0000000..3655308 --- /dev/null +++ b/imports/ui/pages/Admin/Students.jsx @@ -0,0 +1,158 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import MenuItem from '@mui/material/MenuItem'; +import {Students} from "/imports/api/students"; +import {Sites} from "/imports/api/sites"; + +const cssSitesSelect = { + margin: '0.6rem 0', + minWidth: '20rem', +} +const cssFieldColumnContainer = { + display: 'flex', + flexDirection: 'column', + backgroundColor: '#DDD', + padding: '0.5rem', + border: '1px solid #999', + borderRadius: '0.2rem' +} +const cssGridFieldContainer = { + display: 'grid', + gridTemplateColumns: "1fr 1fr 1fr", + columnGap: '1rem', + rowGap: '0.4rem', + marginBottom: '1.5rem' +} +const cssButtonContainer = { + display: 'flex', + gap: '1rem', + justifyContent: 'flex-end' +} + +const StudentEditor = ({value, close, defaultSiteId}) => { + const [email, setEmail] = useState(value.email || "") + const [id, setId] = useState(value.id || "") + const [firstName, setFirstName] = useState(value.firstName || "") + const [lastName, setLastName] = useState(value.lastName || "") + const [grade, setGrade] = useState(value.grade || "") + const [siteId, setSiteId] = useState(value.siteId ? value.siteId : defaultSiteId) + + const {sites} = useTracker(() => { + let sites = Sites.find({}).fetch(); + + return {sites} + }); + + if(!siteId && sites && sites.length > 0) { + setSiteId(sites[0]._id) + } + + const applyChanges = () => { + close() + //TODO Should invert this and only close if there was success on the server. + if(value._id) + Meteor.call("students.update", value._id, id, firstName, lastName, email, siteId, grade); + else + Meteor.call("students.add", id, firstName, lastName, email, siteId, grade); + } + const rejectChanges = () => { + close() + } + + return ( +
+

Student Editor

+
+ {setId(e.target.value)}}/> + {setEmail(e.target.value)}}/> + {setGrade(e.target.value)}}/> + {setFirstName(e.target.value)}}/> + {setLastName(e.target.value)}}/> + {setSiteId(e.target.value)}}> + {sites.map((next, i) => { + return {next.name} + })} + +
+
+ + +
+
+ ) +} + +export default () => { + const siteAll = {_id: 0, name: "All"} + const [site, setSite] = useState(siteAll._id) + + Meteor.subscribe('sites'); + Meteor.subscribe('students'); + + const {sites} = useTracker(() => { + const sites = Sites.find({}).fetch(); + + sites.push(siteAll); + + return {sites} + }); + + const {students} = useTracker(() => { + const studentQuery = site === siteAll._id ? {} : {siteId: site} + let students = Students.find(studentQuery).fetch(); + + return {students} + }); + + const columns = [ + { + name: "ID", + value: (row) => row.id, + }, + { + name: "Email", + value: (row) => row.email, + }, + { + name: "First Name", + value: (row) => row.firstName, + }, + { + name: "Last Name", + value: (row) => row.lastName, + }, + { + name: "GRD", + value: (row) => row.grade, + }, + ] + + const options = { + key: (row) => row._id, + editor: (row, close) => {return ()}, + add: true, + maxHeight: '40rem', + keyHandler: (e, selected) => { + if(selected && selected._id && e.key === "Delete") { + Meteor.call("students.remove", selected._id); + } + } + } + + return ( + <> + {setSite(e.target.value)}}> + {sites.map((next, i) => { + return {next.name} + })} + + + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/Assets.jsx b/imports/ui/pages/Assets.jsx new file mode 100644 index 0000000..c4c7309 --- /dev/null +++ b/imports/ui/pages/Assets.jsx @@ -0,0 +1,30 @@ +import { Meteor } from 'meteor/meteor'; +import React, {lazy, Suspense, useState} from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import TabNav from '../util/TabNav'; + +export default () => { + let tabs = [ + { + title: "Asset List", + getElement: () => { + const AssetList = lazy(()=>import('./Assets/AssetList')) + return + }, + path: '/assetList', + href: 'assetList' + }, + { + title: "Add Assets", + getElement: () => { + const AddAssets = lazy(()=>import('./Assets/AddAssets')) + return + }, + path: '/addAssets', + href: 'addAssets' + }, + ] + + return +} \ No newline at end of file diff --git a/imports/ui/pages/Assets/AddAssets.jsx b/imports/ui/pages/Assets/AddAssets.jsx new file mode 100644 index 0000000..8736d41 --- /dev/null +++ b/imports/ui/pages/Assets/AddAssets.jsx @@ -0,0 +1,134 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import { useTheme } from '@mui/material/styles'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import Chip from '@mui/material/Chip'; +import MenuItem from '@mui/material/MenuItem'; +import {InputLabel, List, ListItem, ListItemButton, ListItemText} from "@mui/material"; +import {Assets, conditions} from "/imports/api/assets"; +import {AssetTypes} from "/imports/api/asset-types"; +import Box from "@mui/material/Box"; +import OutlinedInput from '@mui/material/OutlinedInput'; +import FormControl from '@mui/material/FormControl'; + +const cssContainer = { + display: 'flex', + flexDirection: 'row', + marginTop: '2rem', + backgroundColor: '#DDD', + padding: '0.5rem', + border: '1px solid #999', + borderRadius: '0.2rem' +} +const cssComponent = { + width: '100%', + marginTop: '1rem', +} +const cssEditorField = { + margin: '0.6rem 1rem', + minWidth: '10rem' +} + +const AddAssets = ({assetTypes}) => { + const theme = useTheme(); + const [selectedAssetTypes, setSelectedAssetTypes] = useState([]) + const [selectedAssetType, setSelectedAssetType] = useState("") + const [assetId, setAssetId] = useState("") + const [serial, setSerial] = useState("") + const [condition, setCondition] = useState("New") + const [conditionDetails, setConditionDetails] = useState("") + + const getSelectItemStyles = (value) => { + return { + fontWeight: selectedAssetTypes.indexOf(value) === -1 ? theme.typography.fontWeightRegular : theme.typography.fontWeightBold + } + } + const getAssetTypeListItemStyle = (assetType) => { + return { + backgroundColor: selectedAssetType === assetType ? '#EECFA6' : 'white' + } + } + const addAsset = () => { + //TODO: Check the inputs. + Meteor.call("assets.add", selectedAssetType._id, assetId, serial, condition, conditionDetails); + setAssetId("") + setSerial("") + } + + return ( + <> + + + Available Asset Types + + + + +
+ + {selectedAssetTypes.map((next, i) => { + return ( + {setSelectedAssetType(next)}}> + + + ) + })} + +
+
+
+ {setAssetId(e.target.value)}}/> + {setSerial(e.target.value)}}/> +
+
+ {setCondition(e.target.value)}}> + {conditions.map((condition, i) => { + return {condition} + })} + +
+
+ {setConditionDetails(e.target.value)}}/> +
+
+
+
+ +
+ + ) +} + +export default () => { + Meteor.subscribe('assetTypes'); + + const {assetTypes} = useTracker(() => { + const assetTypes = AssetTypes.find({}, {sort: {year: -1}}).fetch(); + + return { + assetTypes + } + }); + + return ( + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/Assets/AssetList.jsx b/imports/ui/pages/Assets/AssetList.jsx new file mode 100644 index 0000000..286d6af --- /dev/null +++ b/imports/ui/pages/Assets/AssetList.jsx @@ -0,0 +1,135 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import MenuItem from '@mui/material/MenuItem'; +import {Assets, conditions} from "/imports/api/assets"; +import {AssetTypes} from "/imports/api/asset-types"; + +const cssEditorField = { + margin: '0.6rem 0', +} +const cssGridFieldContainer = { + display: 'grid', + gridTemplateColumns: "1fr 1fr", + columnGap: '1rem', + rowGap: '0.4rem', + marginBottom: '1.5rem' +} +const cssFieldContainer = { + display: 'flex', + flexDirection: 'column', + backgroundColor: '#DDD', + padding: '0.5rem', + border: '1px solid #999', + borderRadius: '0.2rem', +} +const cssButtonContainer = { + display: 'flex', + gap: '1rem', + justifyContent: 'flex-end' +} + +const AssetEditor = ({value, close}) => { + const [assetId, setAssetId] = useState(value.assetId || "") + const [serial, setSerial] = useState(value.serial || "") + const [condition, setCondition] = useState(value.condition || "") + const [conditionDetails, setConditionDetails] = useState(value.conditionDetails || "") + const [assetTypeId, setAssetTypeId] = useState(value.assetTypeId || "") + const assetTypes = AssetTypes.find({}, {sort: {year: -1}}); + + const applyChanges = () => { + close() + //TODO Should invert this and only close if there was success on the server. + if(value._id) + Meteor.call("assets.update", value._id, assetTypeId, assetId, serial, condition, conditionDetails); + else + Meteor.call("assets.add", assetTypeId, assetId, serial, condition, conditionDetails); + } + const rejectChanges = () => { + close() + } + + return ( +
+

Asset Editor

+
+ {setAssetTypeId(e.target.value)}} label="Asset Type"> + {assetTypes.map((assetType, i) => { + return {assetType.name} + })} + + {setAssetId(e.target.value)}}/> + {setCondition(e.target.value)}}> + {conditions.map((condition, i) => { + return {condition} + })} + + {setSerial(e.target.value)}}/> + {setConditionDetails(e.target.value)}}/> +
+
+ + +
+
+ ) +} + +export default () => { + Meteor.subscribe('assetTypes'); + Meteor.subscribe('assets'); + + const {assets} = useTracker(() => { + const assets = Assets.find({}).fetch(); + const assetTypes = AssetTypes.find({}, {sort: {year: -1}}).fetch(); + const assetTypeNameMap = assetTypes.reduce((map, obj) => { + map[obj._id] = obj; + return map; + }, {}) + + for(let asset of assets) { + asset.assetType = assetTypeNameMap[asset.assetTypeId] + } + + return { + assets + } + }); + + const columns = [ + { + name: "Asset ID", + value: (row) => row.assetId, + }, + { + name: "Serial", + value: (row) => row.serial, + }, + { + name: "Condition", + value: (row) => row.condition, + }, + { + name: "AssetType", + value: (row) => row.assetType.name, + }, + ] + + const options = { + key: (row) => row._id, + editor: (row, close) => {return ()}, + add: true, + maxHeight: '40rem' + } + + return ( + <> + + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/Assignments.jsx b/imports/ui/pages/Assignments.jsx new file mode 100644 index 0000000..15d1bd0 --- /dev/null +++ b/imports/ui/pages/Assignments.jsx @@ -0,0 +1,30 @@ +import { Meteor } from 'meteor/meteor'; +import React, {lazy, Suspense, useState} from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import TabNav from '../util/TabNav'; + +export default () => { + let tabs = [ + { + title: "By Person", + getElement: () => { + const ByPerson = lazy(()=>import('./Assignments/ByPerson')) + return + }, + path: '/byPerson', + href: 'byPerson' + }, + { + title: "By Asset", + getElement: () => { + const ByAsset = lazy(()=>import('./Assignments/ByAsset')) + return + }, + path: '/byAsset', + href: 'byAsset' + }, + ] + + return +} \ No newline at end of file diff --git a/imports/ui/pages/Assignments/ByAsset.jsx b/imports/ui/pages/Assignments/ByAsset.jsx new file mode 100644 index 0000000..405b4f8 --- /dev/null +++ b/imports/ui/pages/Assignments/ByAsset.jsx @@ -0,0 +1,139 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState, useEffect } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import { useTheme } from '@mui/material/styles'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import Chip from '@mui/material/Chip'; +import MenuItem from '@mui/material/MenuItem'; +import {InputLabel, List, ListItem, ListItemButton, ListItemText} from "@mui/material"; +import Box from "@mui/material/Box"; +import OutlinedInput from '@mui/material/OutlinedInput'; +import FormControl from '@mui/material/FormControl'; +import ToggleButton from '@mui/material/ToggleButton'; +import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; +import Dialog from '@mui/material/Dialog'; +import DialogActions from '@mui/material/DialogActions'; +import DialogContent from '@mui/material/DialogContent'; +import DialogContentText from '@mui/material/DialogContentText'; +import DialogTitle from '@mui/material/DialogTitle'; +import {Assets, conditions} from "/imports/api/assets"; +import {AssetTypes} from "/imports/api/asset-types"; +import {Students} from "/imports/api/students"; +import {Staff} from "/imports/api/staff"; + +const cssTwoColumnContainer = { + display: 'grid', + gridTemplateColumns: "1fr 1fr", + columnGap: '1rem', + rowGap: '0.4rem', +} +const cssEditorField = { + minWidth: '10rem' +} + +const AssignmentsByAsset = () => { + const theme = useTheme(); + const [assetId, setAssetId] = useState("") + + //Dialog stuff. + const [openUnassignDialog, setOpenUnassignDialog] = useState(false) + const [unassignCondition, setUnassignCondition] = useState(conditions[2]) + const [unassignComment, setUnassignComment] = useState("") + const [unassignConditionDetails, setUnassignConditionDetails] = useState("") + + const [assetIdInput, setAssetIdInput] = useState(undefined) + + + const {foundAsset} = useTracker(() => { + let foundAsset = null; + + if(assetId) { + foundAsset = Assets.findOne({assetId: assetId}); + + if(foundAsset) { + foundAsset.assetType = AssetTypes.findOne({_id: foundAsset.assetTypeId}) + + if(foundAsset.assigneeId) + foundAsset.assignee = foundAsset.assigneeType === "Student" ? Students.findOne({_id: foundAsset.assigneeId}) : Staff.findOne({_id: foundAsset.assigneeId}) + } + } + + return {foundAsset} + }); + + useEffect(() => { + if(assetIdInput) assetIdInput.focus() + }) + + const unassign = () => { + // Open the dialog to get condition and comment. + setUnassignComment("") + setUnassignCondition(foundAsset.condition ? foundAsset.condition : conditions[2]) + setUnassignConditionDetails(foundAsset.conditionDetails || "") + setOpenUnassignDialog(true); + } + const unassignDialogClosed = (unassign) => { + setOpenUnassignDialog(false) + + if(unassign === true) { + // Call assets.unassign(assetId, comment, condition, conditionDetails, date) + Meteor.call('assets.unassign', foundAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails) + } + } + + return ( + <> + + Unassign Asset + +
+ {setUnassignCondition(e.target.value)}}> + {conditions.map((condition, i) => { + return {condition} + })} + +
+ {setUnassignComment(e.target.value)}}/> + {setUnassignConditionDetails(e.target.value)}}/> +
+ + + + +
+ + + setAssetIdInput(input)} value={assetId} onChange={(e) => {setAssetId(e.target.value)}}/> + + {foundAsset && ( +
+
Serial: {foundAsset.serial}
+
Condition: {foundAsset.condition}
+
Condition Details: {foundAsset.conditionDetails}
+ {foundAsset.assignee && ( + <> +
Assigned on: {foundAsset.assignmentDate.toString()}
+
Assigned to: {foundAsset.assignee.firstName} {foundAsset.assignee.lastName} {foundAsset.assignee.grade && foundAsset.assignee.grade} ({foundAsset.assignee.email})
+ + + )} +
+ )} + + ) +} + +export default () => { + Meteor.subscribe('students'); + Meteor.subscribe('staff'); + Meteor.subscribe('assetTypes'); + Meteor.subscribe('assets'); + + return ( + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/Assignments/ByPerson.jsx b/imports/ui/pages/Assignments/ByPerson.jsx new file mode 100644 index 0000000..d974a4c --- /dev/null +++ b/imports/ui/pages/Assignments/ByPerson.jsx @@ -0,0 +1,282 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState, useEffect } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import { useTheme } from '@mui/material/styles'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import Chip from '@mui/material/Chip'; +import MenuItem from '@mui/material/MenuItem'; +import {InputLabel, List, ListItem, ListItemButton, ListItemText} from "@mui/material"; +import Box from "@mui/material/Box"; +import OutlinedInput from '@mui/material/OutlinedInput'; +import FormControl from '@mui/material/FormControl'; +import ToggleButton from '@mui/material/ToggleButton'; +import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; +import Dialog from '@mui/material/Dialog'; +import DialogActions from '@mui/material/DialogActions'; +import DialogContent from '@mui/material/DialogContent'; +import DialogContentText from '@mui/material/DialogContentText'; +import DialogTitle from '@mui/material/DialogTitle'; +import {Assets, conditions} from "/imports/api/assets"; +import {AssetTypes} from "/imports/api/asset-types"; +import {Students} from "/imports/api/students"; +import {Staff} from "/imports/api/staff"; + +const cssTwoColumnContainer = { + display: 'grid', + gridTemplateColumns: "1fr 1fr", + columnGap: '1rem', + rowGap: '0.4rem', +} +const cssEditorField = { + minWidth: '10rem' +} + +const AssignmentsByPerson = () => { + const theme = useTheme(); + const [searchType, setSearchType] = useState("Email") + const [search, setSearch] = useState("") + const [selectedPerson, setSelectedPerson] = useState("") + const [assetId, setAssetId] = useState("") + const [openAssignDialog, setOpenAssignDialog] = useState(false) + const [assignCondition, setAssignCondition] = useState(conditions[2]) + const [assignConditionDetails, setAssignConditionDetails] = useState("") + + //Dialog stuff. + const [openUnassignDialog, setOpenUnassignDialog] = useState(false) + const [unassignCondition, setUnassignCondition] = useState(conditions[2]) + const [unassignComment, setUnassignComment] = useState("") + const [unassignConditionDetails, setUnassignConditionDetails] = useState("") + const [unassignAsset, setUnassignAsset] = useState(undefined) + + const [assetIdInput, setAssetIdInput] = useState(undefined) + + const {people} = useTracker(() => { + let people = []; + + if(search && search.length > 1) { + let query; + + if(searchType === "Email") { + query = {email: {$regex: search, $options: 'i'}}; + } else if(searchType === 'First Name') { + query = {firstName: {$regex: search, $options: 'i'}} + } else { + query = {lastName: {$regex: search, $options: 'i'}} + } + + const students = Students.find(query).fetch(); + const staff = Staff.find(query).fetch(); + + for(let next of students) next.type = "Student" + for(let next of staff) next.type = "Staff" + + people = [...staff, ...students] + } + + return {people} + }); + + const {assets} = useTracker(() => { + let assets = []; + + if(selectedPerson) { + assets = Assets.find({assigneeId: selectedPerson._id}).fetch(); + + for(let next of assets) { + next.assetType = AssetTypes.findOne({_id: next.assetTypeId}) + } + } + + return {assets} + }); + + const {foundAsset} = useTracker(() => { + let foundAsset = null; + + if(assetId) { + foundAsset = Assets.findOne({assetId: assetId}); + + if(foundAsset) { + foundAsset.assetType = AssetTypes.findOne({_id: foundAsset.assetTypeId}) + + if(foundAsset.assigneeId) + foundAsset.assignee = foundAsset.assigneeType === "Student" ? Students.findOne({_id: foundAsset.assigneeId}) : Staff.findOne({_id: foundAsset.assigneeId}) + } + } + + return {foundAsset} + }); + + const getListItemStyle = (item) => { + return { + backgroundColor: selectedPerson === item ? '#EECFA6' : 'white' + } + } + const assign = () => { + if(foundAsset) { + //Open the dialog to get condition. + setUnassignCondition(foundAsset.condition ? foundAsset.condition : conditions[2]) + setUnassignConditionDetails(foundAsset.conditionDetails || "") + setOpenAssignDialog(true) + } + } + const assignDialogClosed = (assign) => { + setOpenAssignDialog(false) + + if(assign === true) { + // Call assets.assign + Meteor.call('assets.assign', foundAsset.assetId, selectedPerson.type, selectedPerson._id, assignCondition, assignConditionDetails) + setAssetId("") + // Set the focus back to the asset id text field + // document.getElementById('assetIdInput').focus() + // useEffect(() => { + // if(assetIdInput) assetIdInput.focus() + // }) + } + } + + useEffect(() => { + if(assetIdInput) assetIdInput.focus() + }) + + const unassign = (asset) => { + // Open the dialog to get condition and comment. + setUnassignAsset(asset); + setUnassignComment("") + setUnassignCondition(asset.condition ? asset.condition : conditions[2]) + setUnassignConditionDetails(asset.conditionDetails || "") + setOpenUnassignDialog(true); + } + const unassignDialogClosed = (unassign) => { + setOpenUnassignDialog(false) + + if(unassign === true) { + // Call assets.unassign(assetId, comment, condition, conditionDetails, date) + Meteor.call('assets.unassign', unassignAsset.assetId, unassignComment, unassignCondition, unassignConditionDetails) + } + } + + const getAssetTileStyles = (index) => { + return index % 2 ? {backgroundColor: '#FFF'} : {backgroundColor: '#d2d2d2'} + } + const cssAssetTile = { + padding: '.8rem', + userSelect: 'none', + // '&:nthChild(even)': {backgroundColor: '#935e5e'} + } + + return ( + <> + + Assign Asset + +
+ {setAssignCondition(e.target.value)}}> + {conditions.map((condition, i) => { + return {condition} + })} + +
+ {setAssignConditionDetails(e.target.value)}}/> +
+ + + + +
+ + + Unassign Asset + +
+ {setUnassignCondition(e.target.value)}}> + {conditions.map((condition, i) => { + return {condition} + })} + +
+ {setUnassignComment(e.target.value)}}/> + {setUnassignConditionDetails(e.target.value)}}/> +
+ + + + +
+ + + setSearchType(type)} aria-label="Search Type"> + Email + First Name + Last Name + + {setSearch(e.target.value)}}/> + + +
+ + {people.map((next, i) => { + return ( + {setSelectedPerson(next)}}> + + + ) + })} + +
+
+ {selectedPerson && ( +
+
setAssetIdInput(input)} style={cssEditorField} variant="standard" label="Asset ID" value={assetId} onChange={(e) => {setAssetId(e.target.value)}}/>
+
{foundAsset && foundAsset.assetType.name}
+
{foundAsset && foundAsset.serial}
+ {foundAsset && foundAsset.assignee && ( +
Assigned To: {foundAsset.assignee.firstName} {foundAsset.assignee.lastName}
+ )} + +
+ )} + {assets.map((next, i) => { + return ( +
+
{next.assetType.name}
+
{next.assetId}
+
{next.serial}
+ +
+ ) + })} + {/*
*/} + {/* {setAssetId(e.target.value)}}/>*/} + {/* {setSerial(e.target.value)}}/>*/} + {/*
*/} + {/*
*/} + {/* {setCondition(e.target.value)}}>*/} + {/* {conditions.map((condition, i) => {*/} + {/* return {condition}*/} + {/* })}*/} + {/* */} + {/*
*/} + {/*
*/} + {/* {setConditionDetails(e.target.value)}}/>*/} + {/*
*/} +
+
+ + ) +} + +export default () => { + Meteor.subscribe('students'); + Meteor.subscribe('staff'); + Meteor.subscribe('assetTypes'); + Meteor.subscribe('assets'); + + return ( + + ) +} \ No newline at end of file diff --git a/imports/ui/pages/History.jsx b/imports/ui/pages/History.jsx new file mode 100644 index 0000000..3be07a3 --- /dev/null +++ b/imports/ui/pages/History.jsx @@ -0,0 +1,30 @@ +import { Meteor } from 'meteor/meteor'; +import React, {lazy, Suspense, useState} from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import TabNav from '../util/TabNav'; + +export default () => { + let tabs = [ + { + title: "Chromebook Usage", + getElement: () => { + const ChromebookUsage = lazy(()=>import('./History/ChromebookUsage')) + return + }, + path: '/chromebookUsage', + href: 'chromebookUsage' + }, + { + title: "Asset Assignments", + getElement: () => { + const AssetAssignments = lazy(()=>import('./History/AssetAssignments')) + return + }, + path: '/assetAssignments', + href: 'assetAssignments' + }, + ] + + return +} \ No newline at end of file diff --git a/imports/ui/pages/History/AssetAssignments.jsx b/imports/ui/pages/History/AssetAssignments.jsx new file mode 100644 index 0000000..7248c25 --- /dev/null +++ b/imports/ui/pages/History/AssetAssignments.jsx @@ -0,0 +1,17 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState, useEffect } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import { useTheme } from '@mui/material/styles'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import Chip from '@mui/material/Chip'; +import MenuItem from '@mui/material/MenuItem'; +import {InputLabel, List, ListItem, ListItemButton, ListItemText} from "@mui/material"; +import Box from "@mui/material/Box"; +import OutlinedInput from '@mui/material/OutlinedInput'; +import FormControl from '@mui/material/FormControl'; +import ToggleButton from '@mui/material/ToggleButton'; +import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; \ No newline at end of file diff --git a/imports/ui/pages/History/ChromebookUsage.jsx b/imports/ui/pages/History/ChromebookUsage.jsx new file mode 100644 index 0000000..e8987b9 --- /dev/null +++ b/imports/ui/pages/History/ChromebookUsage.jsx @@ -0,0 +1,38 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState, useEffect } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import { useTheme } from '@mui/material/styles'; +import _ from 'lodash'; +import SimpleTable from "/imports/ui/util/SimpleTable"; +import TextField from "@mui/material/TextField"; +import Button from "@mui/material/Button"; +import Select from '@mui/material/Select'; +import Chip from '@mui/material/Chip'; +import MenuItem from '@mui/material/MenuItem'; +import {InputLabel, List, ListItem, ListItemButton, ListItemText} from "@mui/material"; +import Paper from '@mui/material/Paper'; +import InputBase from '@mui/material/InputBase'; +import IconButton from '@mui/material/IconButton'; +import SearchIcon from '@mui/icons-material/Search'; +import Box from "@mui/material/Box"; +import OutlinedInput from '@mui/material/OutlinedInput'; +import FormControl from '@mui/material/FormControl'; +import ToggleButton from '@mui/material/ToggleButton'; +import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; + +export default () => { + return ( +
+ + + + + + +
+ ) +} \ No newline at end of file diff --git a/imports/ui/pages/Users.jsx b/imports/ui/pages/Users.jsx new file mode 100644 index 0000000..8c83cac --- /dev/null +++ b/imports/ui/pages/Users.jsx @@ -0,0 +1,122 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import Button from '@mui/material/Button'; +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; +import Paper from '@mui/material/Paper'; +import FormGroup from '@mui/material/FormGroup'; +import FormControlLabel from '@mui/material/FormControlLabel'; +import Checkbox from '@mui/material/Checkbox'; +import classNames from 'classnames'; + +Meteor.subscribe('allUsers'); +Meteor.subscribe('allRoleAssignments'); + +let UsersTable = ({rows}) => { + const [selected, setSelected] = useState(undefined); + + let selectRow = (e, row) => { + setSelected(row); + } + + const [edited, setEdited] = useState(undefined); + const [permissions, setPermissions] = useState(undefined); + + let editRow = (e, row) => { + if(row) { + setPermissions({ + isAdmin: Roles.userIsInRole(row, "admin", {anyScope: true}), + laptopManagement: Roles.userIsInRole(row, "laptop-management", {anyScope: true}), + }) + } else setPermissions(undefined) + setEdited(row); + } + + let togglePermission = (permission) => { + permissions[permission] = !permissions[permission] + setPermissions({...permissions}) + } + + let applyChanges = (e) => { + let roles = []; + + if(permissions.isAdmin) { + roles.push('admin'); + } + else { + if(permissions.laptopManagement) { + roles.push('laptop-management'); + } + } + + Meteor.call("users.setUserRoles", edited._id, roles); + setEdited(undefined); + } + + let rejectChanges = (e) => { + setEdited(undefined) + } + + return ( + + + + + Name + Email + Roles + + + + {rows.map((row)=>( + {editRow(e, row)}} onClick={(e) => selectRow(e, row)}> + {edited && edited._id === row._id ? + +
+ + togglePermission('isAdmin')}/>} label="Administrator"/> +
+ togglePermission('laptopManagement')}/>} label="Laptop Management"/> +
+ + +
+
+ : <> + {row.profile.name} + {row.services && row.services.google ? row.services.google.email : ""} + {row.roles} + + } +
+ ))} +
+
+
+ ) +} + +/* + * Separate the Meteor calls as much as possible to avoid them being run repeatedly unnecessarily (were being run on every selection in the table). + */ +export default () => { + const {rows} = useTracker(() => { + const rows = Meteor.users.find({}).fetch(); + + for(let row of rows) { + row.roles = Roles.getRolesForUser(row, {anyScope: true}) + } + + return { + rows + } + }); + + return +} \ No newline at end of file diff --git a/imports/ui/util/JsBarcode.min.js b/imports/ui/util/JsBarcode.min.js new file mode 100644 index 0000000..a5c0cbc --- /dev/null +++ b/imports/ui/util/JsBarcode.min.js @@ -0,0 +1,2 @@ +/*! JsBarcode v3.11.5 | (c) Johan Lindell | MIT license */ +!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=15)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.text=n.text||e,this.options=n}},function(t,e,n){"use strict";var r;function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var i=e.SET_A=0,a=e.SET_B=1,u=e.SET_C=2,f=(e.SHIFT=98,e.START_A=103),c=e.START_B=104,s=e.START_C=105;e.MODULO=103,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(o(r={},f,i),o(r,c,a),o(r,s,u),r),e.SWAP={101:i,100:a,99:u},e.A_START_CHAR=String.fromCharCode(208),e.B_START_CHAR=String.fromCharCode(209),e.C_START_CHAR=String.fromCharCode(210),e.A_CHARS="[\0-_È-Ï]",e.B_CHARS="[ -È-Ï]",e.C_CHARS="(Ï*[0-9]{2}Ï*)",e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.SIDE_BIN="101",e.MIDDLE_BIN="01010",e.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},e.EAN2_STRUCTURE=["LL","LG","GL","GG"],e.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],e.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);e.default=function(t,e,n){var o=t.split("").map((function(t,n){return r.BINARIES[e[n]]})).map((function(e,n){return e?e[t[n]]:""}));if(n){var i=t.length-1;o=o.map((function(t,e){return e=200){i=t.shift()-105;var a=u.SWAP[i];void 0!==a?o=e.next(t,n+1,a):(r!==u.SET_A&&r!==u.SET_B||i!==u.SHIFT||(t[0]=r===u.SET_A?t[0]>95?t[0]-96:t[0]:t[0]<32?t[0]+96:t[0]),o=e.next(t,n+1,r))}else i=e.correctIndex(t,r),o=e.next(t,n+1,r);var f=i*n;return{result:e.getBar(i)+o.result,checksum:f+o.checksum}}}]),e}(a.default);e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mod10=function(t){for(var e=0,n=0;n10*n.width?10*n.width:n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(t,e){return this.text.substr(t,e)}},{key:"leftEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"rightText",value:function(t,e){return this.text.substr(t,e)}},{key:"rightEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"encodeGuarded",value:function(){var t={fontSize:this.fontSize},e={height:this.guardHeight};return[{data:o.SIDE_BIN,options:e},{data:this.leftEncode(),text:this.leftText(),options:t},{data:o.MIDDLE_BIN,options:e},{data:this.rightEncode(),text:this.rightText(),options:t},{data:o.SIDE_BIN,options:e}]}},{key:"encodeFlat",value:function(){return{data:[o.SIDE_BIN,this.leftEncode(),o.MIDDLE_BIN,this.rightEncode(),o.SIDE_BIN].join(""),text:this.text}}}]),e}(a(n(0)).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return-1!==this.data.search(/^[0-9]{12}$/)&&this.data[11]==u(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=(0,o.default)(this.data.substr(0,6),"LLLLLL"),t+="01010",t+=(0,o.default)(this.data.substr(6,6),"RRRRRR"),{data:t+="101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101"+(0,o.default)(this.data[0],"L"),options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),t.push({data:"01010",options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),t.push({data:(0,o.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),t}}]),e}(i(n(0)).default);function u(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10}e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r=i(t);return e+String.fromCharCode(r?206:205)+u(t,r)}e.default=function(t){var e=void 0;if(a(t).length>=2)e=r.C_START_CHAR+f(t);else{var n=o(t)>i(t);e=(n?r.A_START_CHAR:r.B_START_CHAR)+u(t,n)}return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,(function(t,e){return String.fromCharCode(203)+e}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=this.encodeMiddleDigits(),{data:t+="010101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101",options:{height:this.guardHeight}}),t.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),t.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),t}},{key:"encodeMiddleDigits",value:function(){var t=this.upcA[0],e=this.upcA[this.upcA.length-1],n=s[parseInt(e)][parseInt(t)];return(0,o.default)(this.middleDigits,n)}}]),e}(i.default);function p(t,e){for(var n=parseInt(t[t.length-1]),r=c[n],o="",i=0,u=0;u=3&&this.number<=131070}}]),e}(((r=i)&&r.__esModule?r:{default:r}).default);e.pharmacode=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.codabar=void 0;var r,o=function(){function t(t,e){for(var n=0;n0?(n=0,o.textAlign="left"):"right"==t.textAlign?(n=e.width-1,o.textAlign="right"):(n=e.width/2,o.textAlign="center"),o.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&this.drawRect(a-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,o,i=this.document.createElementNS(f,"text");e.displayValue&&(i.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor","end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(this.document.createTextNode(n.text)),t.appendChild(i))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",f),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(f,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(f,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n row._id +// } +// ] +// +// let rows = [ +// { +// _id: 1234, +// name: "abc", +// value: 123 +// } +// ] +// +// let options = { +// key: (row) => row._id, +// editor: (row) => {return ()} +// } + +const cssTopControls = { + display: 'flex', + flexDirection: 'row-reverse', +} + +/* + * Separate the Meteor calls as much as possible to avoid them being run repeatedly unnecessarily (were being run on every selection in the table). + */ +export default ({columns, rows, options}) => { + const [selected, setSelected] = useState(undefined); + + let selectRow = (e, row) => { + setSelected(row); + } + + const [edited, setEdited] = useState(undefined); + + let editRow = (e, row) => { + setEdited(row); + } + + const closeEditor = () => { + setEdited(undefined) + } + + const addRow = () => { + setEdited({}); + } + + let containerStyle = options.maxHeight ? {maxHeight: options.maxHeight} : {} + let keyHandler = (e) => { + !edited && options.keyHandler && options.keyHandler(e, selected) + + // Close the editor if the user hits escape. + if(edited && e.key === 'Escape') { + setEdited(undefined) + e.stopPropagation() + } + + if(!edited && e.key === 'Insert') { + setEdited({}) + e.stopPropagation() + } + } + + return ( +
+ {options.add &&
} + + + + + {columns.map((column, i) => {return ( + {column.name} + )})} + {/*Name*/} + {/*Email*/} + {/*Roles*/} + + + + {edited && !options.key(edited) && ( + + + {options.editor(edited, closeEditor)} + + + )} + {rows.map((row, i)=>{ + // console.log("Rendering Row " + i) + // console.log(row); + return ( + {editRow(e, row)}} onClick={(e) => selectRow(e, row)}> + {edited && options.key(edited) === options.key(row) ? + + {options.editor(edited, closeEditor)} + + : + <> + {columns.map((column, ci) => { + // console.log("Rendering Cell") + // console.log(column); + // console.log(column.value(row)); + let value = column.value(row); + + if(_.isObject(value)) { + console.error("Cannot have an object returned as the value in a table.") + value = JSON.stringify(value) + } + + return ( + {value} + ) + })} + + } + + ) + })} + +
+
+
+ ) +} \ No newline at end of file diff --git a/imports/ui/util/TabNav.jsx b/imports/ui/util/TabNav.jsx new file mode 100644 index 0000000..38625be --- /dev/null +++ b/imports/ui/util/TabNav.jsx @@ -0,0 +1,74 @@ +import { Meteor } from 'meteor/meteor'; +import React, { useState, useEffect, lazy, Suspense } from 'react'; +import { useTracker } from 'meteor/react-meteor-data'; +import _ from 'lodash'; +import Tabs from '@mui/material/Tabs'; +import Tab from '@mui/material/Tab'; +import Box from '@mui/material/Box'; +import {Route, Routes, useNavigate} from "react-router-dom"; + +//Example Tabs: +// let tabs = [ +// { +// title: "Asset List", +// getElement: () => { +// const AssetList = lazy(()=>import('./Assets/AssetList')) +// return +// }, +// path: '/assetList', +// href: 'assetList' +// }, +// { +// title: "Add Assets", +// getElement: () => { +// const AddAssets = lazy(()=>import('./Assets/AddAssets')) +// return +// }, +// path: '/addAssets', +// href: 'addAssets' +// }, +// ] + +const LinkTab = (props) => { + let nav = useNavigate() + return { + e.preventDefault() + nav(props.href) + }} {...props}/> +} + +export default ({tabs}) => { + let pathName = location.pathname; + let initialTab = tabs.findIndex(tab => {return pathName.endsWith(tab.path)}) + let defaultTabPath = tabs[0].path.slice(0, tabs[0].path.lastIndexOf('/')) + + if(initialTab === -1) { + initialTab = 0 + } + + const [value, setValue] = useState(initialTab) + + const valueChanged = (e, newValue) => { + setValue(newValue) + } + // console.log(defaultTabPath) + return ( + <> + + + {tabs.map((tab, i) => {return ( + + )})} + + + }> + + + {tabs.map((tab, i) => {return ( + + )})} + + + + ) +} \ No newline at end of file diff --git a/imports/ui/util/qrious.js b/imports/ui/util/qrious.js new file mode 100644 index 0000000..8272ff6 --- /dev/null +++ b/imports/ui/util/qrious.js @@ -0,0 +1,2363 @@ +/* + * QRious v4.0.2 + * Copyright (C) 2017 Alasdair Mercer + * Copyright (C) 2010 Tom Zerucha + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.QRious = factory()); +}(this, (function () { 'use strict'; + + /* + * Copyright (C) 2017 Alasdair Mercer, !ninja + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + + /** + * A bare-bones constructor for surrogate prototype swapping. + * + * @private + * @constructor + */ + var Constructor = /* istanbul ignore next */ function() {}; + /** + * A reference to Object.prototype.hasOwnProperty. + * + * @private + * @type {Function} + */ + var hasOwnProperty = Object.prototype.hasOwnProperty; + /** + * A reference to Array.prototype.slice. + * + * @private + * @type {Function} + */ + var slice = Array.prototype.slice; + + /** + * Creates an object which inherits the given prototype. + * + * Optionally, the created object can be extended further with the specified properties. + * + * @param {Object} prototype - the prototype to be inherited by the created object + * @param {Object} [properties] - the optional properties to be extended by the created object + * @return {Object} The newly created object. + * @private + */ + function createObject(prototype, properties) { + var result; + /* istanbul ignore next */ + if (typeof Object.create === 'function') { + result = Object.create(prototype); + } else { + Constructor.prototype = prototype; + result = new Constructor(); + Constructor.prototype = null; + } + + if (properties) { + extendObject(true, result, properties); + } + + return result; + } + + /** + * Extends the constructor to which this method is associated with the prototype and/or + * statics provided. + * + * If name is provided, it will be used as the class name and can be accessed via a special + * class_ property on the child constructor, otherwise the class name of the super constructor will be used + * instead. The class name may also be used string representation for instances of the child constructor (via + * toString), but this is not applicable to the lite version of Nevis. + * + * If constructor is provided, it will be used as the constructor for the child, otherwise a simple + * constructor which only calls the super constructor will be used instead. + * + * The super constructor can be accessed via a special super_ property on the child constructor. + * + * @param {string} [name=this.class_] - the class name to be used for the child constructor + * @param {Function} [constructor] - the constructor for the child + * @param {Object} [prototype] - the prototype properties to be defined for the child + * @param {Object} [statics] - the static properties to be defined for the child + * @return {Function} The child constructor provided or the one created if none was given. + * @public + */ + function extend(name, constructor, prototype, statics) { + var superConstructor = this; + + if (typeof name !== 'string') { + statics = prototype; + prototype = constructor; + constructor = name; + name = null; + } + + if (typeof constructor !== 'function') { + statics = prototype; + prototype = constructor; + constructor = function() { + return superConstructor.apply(this, arguments); + }; + } + + extendObject(false, constructor, superConstructor, statics); + + constructor.prototype = createObject(superConstructor.prototype, prototype); + constructor.prototype.constructor = constructor; + + constructor.class_ = name || superConstructor.class_; + constructor.super_ = superConstructor; + + return constructor; + } + + /** + * Extends the specified target object with the properties in each of the sources provided. + * + * if any source is null it will be ignored. + * + * @param {boolean} own - true to only copy own properties from sources onto + * target; otherwise false + * @param {Object} target - the target object which should be extended + * @param {...Object} [sources] - the source objects whose properties are to be copied onto target + * @return {void} + * @private + */ + function extendObject(own, target, sources) { + sources = slice.call(arguments, 2); + + var property; + var source; + + for (var i = 0, length = sources.length; i < length; i++) { + source = sources[i]; + + for (property in source) { + if (!own || hasOwnProperty.call(source, property)) { + target[property] = source[property]; + } + } + } + } + + var extend_1 = extend; + + /** + * The base class from which all others should extend. + * + * @public + * @constructor + */ + function Nevis() {} + Nevis.class_ = 'Nevis'; + Nevis.super_ = Object; + + /** + * Extends the constructor to which this method is associated with the prototype and/or + * statics provided. + * + * If name is provided, it will be used as the class name and can be accessed via a special + * class_ property on the child constructor, otherwise the class name of the super constructor will be used + * instead. The class name may also be used string representation for instances of the child constructor (via + * toString), but this is not applicable to the lite version of Nevis. + * + * If constructor is provided, it will be used as the constructor for the child, otherwise a simple + * constructor which only calls the super constructor will be used instead. + * + * The super constructor can be accessed via a special super_ property on the child constructor. + * + * @param {string} [name=this.class_] - the class name to be used for the child constructor + * @param {Function} [constructor] - the constructor for the child + * @param {Object} [prototype] - the prototype properties to be defined for the child + * @param {Object} [statics] - the static properties to be defined for the child + * @return {Function} The child constructor provided or the one created if none was given. + * @public + * @static + * @memberof Nevis + */ + Nevis.extend = extend_1; + + var nevis = Nevis; + + var lite = nevis; + + /** + * Responsible for rendering a QR code {@link Frame} on a specific type of element. + * + * A renderer may be dependant on the rendering of another element, so the ordering of their execution is important. + * + * The rendering of a element can be deferred by disabling the renderer initially, however, any attempt get the element + * from the renderer will result in it being immediately enabled and the element being rendered. + * + * @param {QRious} qrious - the {@link QRious} instance to be used + * @param {*} element - the element onto which the QR code is to be rendered + * @param {boolean} [enabled] - true this {@link Renderer} is enabled; otherwise false. + * @public + * @class + * @extends Nevis + */ + var Renderer = lite.extend(function(qrious, element, enabled) { + /** + * The {@link QRious} instance. + * + * @protected + * @type {QRious} + * @memberof Renderer# + */ + this.qrious = qrious; + + /** + * The element onto which this {@link Renderer} is rendering the QR code. + * + * @protected + * @type {*} + * @memberof Renderer# + */ + this.element = element; + this.element.qrious = qrious; + + /** + * Whether this {@link Renderer} is enabled. + * + * @protected + * @type {boolean} + * @memberof Renderer# + */ + this.enabled = Boolean(enabled); + }, { + + /** + * Draws the specified QR code frame on the underlying element. + * + * Implementations of {@link Renderer} must override this method with their own specific logic. + * + * @param {Frame} frame - the {@link Frame} to be drawn + * @return {void} + * @protected + * @abstract + * @memberof Renderer# + */ + draw: function(frame) {}, + + /** + * Returns the element onto which this {@link Renderer} is rendering the QR code. + * + * If this method is called while this {@link Renderer} is disabled, it will be immediately enabled and rendered + * before the element is returned. + * + * @return {*} The element. + * @public + * @memberof Renderer# + */ + getElement: function() { + if (!this.enabled) { + this.enabled = true; + this.render(); + } + + return this.element; + }, + + /** + * Calculates the size (in pixel units) to represent an individual module within the QR code based on the + * frame provided. + * + * Any configured padding will be excluded from the returned size. + * + * The returned value will be at least one, even in cases where the size of the QR code does not fit its contents. + * This is done so that the inevitable clipping is handled more gracefully since this way at least something is + * displayed instead of just a blank space filled by the background color. + * + * @param {Frame} frame - the {@link Frame} from which the module size is to be derived + * @return {number} The pixel size for each module in the QR code which will be no less than one. + * @protected + * @memberof Renderer# + */ + getModuleSize: function(frame) { + var qrious = this.qrious; + var padding = qrious.padding || 0; + var pixels = Math.floor((qrious.size - (padding * 2)) / frame.width); + + return Math.max(1, pixels); + }, + + /** + * Calculates the offset/padding (in pixel units) to be inserted before the QR code based on the frame + * provided. + * + * The returned value will be zero if there is no available offset or if the size of the QR code does not fit its + * contents. It will never be a negative value. This is done so that the inevitable clipping appears more naturally + * and it is not clipped from all directions. + * + * @param {Frame} frame - the {@link Frame} from which the offset is to be derived + * @return {number} The pixel offset for the QR code which will be no less than zero. + * @protected + * @memberof Renderer# + */ + getOffset: function(frame) { + var qrious = this.qrious; + var padding = qrious.padding; + + if (padding != null) { + return padding; + } + + var moduleSize = this.getModuleSize(frame); + var offset = Math.floor((qrious.size - (moduleSize * frame.width)) / 2); + + return Math.max(0, offset); + }, + + /** + * Renders a QR code on the underlying element based on the frame provided. + * + * @param {Frame} frame - the {@link Frame} to be rendered + * @return {void} + * @public + * @memberof Renderer# + */ + render: function(frame) { + if (this.enabled) { + this.resize(); + this.reset(); + this.draw(frame); + } + }, + + /** + * Resets the underlying element, effectively clearing any previously rendered QR code. + * + * Implementations of {@link Renderer} must override this method with their own specific logic. + * + * @return {void} + * @protected + * @abstract + * @memberof Renderer# + */ + reset: function() {}, + + /** + * Ensures that the size of the underlying element matches that defined on the associated {@link QRious} instance. + * + * Implementations of {@link Renderer} must override this method with their own specific logic. + * + * @return {void} + * @protected + * @abstract + * @memberof Renderer# + */ + resize: function() {} + + }); + + var Renderer_1 = Renderer; + + /** + * An implementation of {@link Renderer} for working with canvas elements. + * + * @public + * @class + * @extends Renderer + */ + var CanvasRenderer = Renderer_1.extend({ + + /** + * @override + */ + draw: function(frame) { + var i, j; + var qrious = this.qrious; + var moduleSize = this.getModuleSize(frame); + var offset = this.getOffset(frame); + var context = this.element.getContext('2d'); + + context.fillStyle = qrious.foreground; + context.globalAlpha = qrious.foregroundAlpha; + + for (i = 0; i < frame.width; i++) { + for (j = 0; j < frame.width; j++) { + if (frame.buffer[(j * frame.width) + i]) { + context.fillRect((moduleSize * i) + offset, (moduleSize * j) + offset, moduleSize, moduleSize); + } + } + } + }, + + /** + * @override + */ + reset: function() { + var qrious = this.qrious; + var context = this.element.getContext('2d'); + var size = qrious.size; + + context.lineWidth = 1; + context.clearRect(0, 0, size, size); + context.fillStyle = qrious.background; + context.globalAlpha = qrious.backgroundAlpha; + context.fillRect(0, 0, size, size); + }, + + /** + * @override + */ + resize: function() { + var element = this.element; + + element.width = element.height = this.qrious.size; + } + + }); + + var CanvasRenderer_1 = CanvasRenderer; + + /* eslint no-multi-spaces: "off" */ + + + + /** + * Contains alignment pattern information. + * + * @public + * @class + * @extends Nevis + */ + var Alignment = lite.extend(null, { + + /** + * The alignment pattern block. + * + * @public + * @static + * @type {number[]} + * @memberof Alignment + */ + BLOCK: [ + 0, 11, 15, 19, 23, 27, 31, + 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, + 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28 + ] + + }); + + var Alignment_1 = Alignment; + + /* eslint no-multi-spaces: "off" */ + + + + /** + * Contains error correction information. + * + * @public + * @class + * @extends Nevis + */ + var ErrorCorrection = lite.extend(null, { + + /** + * The error correction blocks. + * + * There are four elements per version. The first two indicate the number of blocks, then the data width, and finally + * the ECC width. + * + * @public + * @static + * @type {number[]} + * @memberof ErrorCorrection + */ + BLOCKS: [ + 1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, + 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, + 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, + 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, + 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, + 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, + 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, + 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, + 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, + 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, + 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, + 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, + 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, + 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, + 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, + 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, + 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, + 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, + 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, + 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, + 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, + 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, + 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, + 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, + 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, + 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, + 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, + 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, + 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, + 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, + 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, + 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, + 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, + 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, + 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, + 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, + 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, + 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, + 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, + 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30 + ], + + /** + * The final format bits with mask (level << 3 | mask). + * + * @public + * @static + * @type {number[]} + * @memberof ErrorCorrection + */ + FINAL_FORMAT: [ + // L + 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, + // M + 0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, + // Q + 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, + // H + 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b + ], + + /** + * A map of human-readable ECC levels. + * + * @public + * @static + * @type {Object.} + * @memberof ErrorCorrection + */ + LEVELS: { + L: 1, + M: 2, + Q: 3, + H: 4 + } + + }); + + var ErrorCorrection_1 = ErrorCorrection; + + /** + * Contains Galois field information. + * + * @public + * @class + * @extends Nevis + */ + var Galois = lite.extend(null, { + + /** + * The Galois field exponent table. + * + * @public + * @static + * @type {number[]} + * @memberof Galois + */ + EXPONENT: [ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, + 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0x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7, 0x53, 0xa6, + 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09, + 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16, + 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00 + ], + + /** + * The Galois field log table. + * + * @public + * @static + * @type {number[]} + * @memberof Galois + */ + LOG: [ + 0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, + 0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71, + 0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45, + 0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6, + 0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88, + 0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40, + 0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d, + 0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57, + 0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18, + 0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e, + 0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61, + 0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2, + 0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6, + 0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a, + 0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7, + 0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf + ] + + }); + + var Galois_1 = Galois; + + /** + * Contains version pattern information. + * + * @public + * @class + * @extends Nevis + */ + var Version = lite.extend(null, { + + /** + * The version pattern block. + * + * @public + * @static + * @type {number[]} + * @memberof Version + */ + BLOCK: [ + 0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, 0x928, 0xb78, 0x45d, 0xa17, 0x532, + 0x9a6, 0x683, 0x8c9, 0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, 0x250, 0x9d5, + 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, 0x541, 0xc69 + ] + + }); + + var Version_1 = Version; + + /** + * Generates information for a QR code frame based on a specific value to be encoded. + * + * @param {Frame~Options} options - the options to be used + * @public + * @class + * @extends Nevis + */ + var Frame = lite.extend(function(options) { + var dataBlock, eccBlock, index, neccBlock1, neccBlock2; + var valueLength = options.value.length; + + this._badness = []; + this._level = ErrorCorrection_1.LEVELS[options.level]; + this._polynomial = []; + this._value = options.value; + this._version = 0; + this._stringBuffer = []; + + while (this._version < 40) { + this._version++; + + index = ((this._level - 1) * 4) + ((this._version - 1) * 16); + + neccBlock1 = ErrorCorrection_1.BLOCKS[index++]; + neccBlock2 = ErrorCorrection_1.BLOCKS[index++]; + dataBlock = ErrorCorrection_1.BLOCKS[index++]; + eccBlock = ErrorCorrection_1.BLOCKS[index]; + + index = (dataBlock * (neccBlock1 + neccBlock2)) + neccBlock2 - 3 + (this._version <= 9); + + if (valueLength <= index) { + break; + } + } + + this._dataBlock = dataBlock; + this._eccBlock = eccBlock; + this._neccBlock1 = neccBlock1; + this._neccBlock2 = neccBlock2; + + /** + * The data width is based on version. + * + * @public + * @type {number} + * @memberof Frame# + */ + // FIXME: Ensure that it fits instead of being truncated. + var width = this.width = 17 + (4 * this._version); + + /** + * The image buffer. + * + * @public + * @type {number[]} + * @memberof Frame# + */ + this.buffer = Frame._createArray(width * width); + + this._ecc = Frame._createArray(dataBlock + ((dataBlock + eccBlock) * (neccBlock1 + neccBlock2)) + neccBlock2); + this._mask = Frame._createArray(((width * (width + 1)) + 1) / 2); + + this._insertFinders(); + this._insertAlignments(); + + // Insert single foreground cell. + this.buffer[8 + (width * (width - 8))] = 1; + + this._insertTimingGap(); + this._reverseMask(); + this._insertTimingRowAndColumn(); + this._insertVersion(); + this._syncMask(); + this._convertBitStream(valueLength); + this._calculatePolynomial(); + this._appendEccToData(); + this._interleaveBlocks(); + this._pack(); + this._finish(); + }, { + + _addAlignment: function(x, y) { + var i; + var buffer = this.buffer; + var width = this.width; + + buffer[x + (width * y)] = 1; + + for (i = -2; i < 2; i++) { + buffer[x + i + (width * (y - 2))] = 1; + buffer[x - 2 + (width * (y + i + 1))] = 1; + buffer[x + 2 + (width * (y + i))] = 1; + buffer[x + i + 1 + (width * (y + 2))] = 1; + } + + for (i = 0; i < 2; i++) { + this._setMask(x - 1, y + i); + this._setMask(x + 1, y - i); + this._setMask(x - i, y - 1); + this._setMask(x + i, y + 1); + } + }, + + _appendData: function(data, dataLength, ecc, eccLength) { + var bit, i, j; + var polynomial = this._polynomial; + var stringBuffer = this._stringBuffer; + + for (i = 0; i < eccLength; i++) { + stringBuffer[ecc + i] = 0; + } + + for (i = 0; i < dataLength; i++) { + bit = Galois_1.LOG[stringBuffer[data + i] ^ stringBuffer[ecc]]; + + if (bit !== 255) { + for (j = 1; j < eccLength; j++) { + stringBuffer[ecc + j - 1] = stringBuffer[ecc + j] ^ + Galois_1.EXPONENT[Frame._modN(bit + polynomial[eccLength - j])]; + } + } else { + for (j = ecc; j < ecc + eccLength; j++) { + stringBuffer[j] = stringBuffer[j + 1]; + } + } + + stringBuffer[ecc + eccLength - 1] = bit === 255 ? 0 : Galois_1.EXPONENT[Frame._modN(bit + polynomial[0])]; + } + }, + + _appendEccToData: function() { + var i; + var data = 0; + var dataBlock = this._dataBlock; + var ecc = this._calculateMaxLength(); + var eccBlock = this._eccBlock; + + for (i = 0; i < this._neccBlock1; i++) { + this._appendData(data, dataBlock, ecc, eccBlock); + + data += dataBlock; + ecc += eccBlock; + } + + for (i = 0; i < this._neccBlock2; i++) { + this._appendData(data, dataBlock + 1, ecc, eccBlock); + + data += dataBlock + 1; + ecc += eccBlock; + } + }, + + _applyMask: function(mask) { + var r3x, r3y, x, y; + var buffer = this.buffer; + var width = this.width; + + switch (mask) { + case 0: + for (y = 0; y < width; y++) { + for (x = 0; x < width; x++) { + if (!((x + y) & 1) && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + case 1: + for (y = 0; y < width; y++) { + for (x = 0; x < width; x++) { + if (!(y & 1) && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + case 2: + for (y = 0; y < width; y++) { + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x === 3) { + r3x = 0; + } + + if (!r3x && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + case 3: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y === 3) { + r3y = 0; + } + + for (r3x = r3y, x = 0; x < width; x++, r3x++) { + if (r3x === 3) { + r3x = 0; + } + + if (!r3x && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + case 4: + for (y = 0; y < width; y++) { + for (r3x = 0, r3y = (y >> 1) & 1, x = 0; x < width; x++, r3x++) { + if (r3x === 3) { + r3x = 0; + r3y = !r3y; + } + + if (!r3y && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + case 5: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y === 3) { + r3y = 0; + } + + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x === 3) { + r3x = 0; + } + + if (!((x & y & 1) + !(!r3x | !r3y)) && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + case 6: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y === 3) { + r3y = 0; + } + + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x === 3) { + r3x = 0; + } + + if (!((x & y & 1) + (r3x && r3x === r3y) & 1) && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + case 7: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y === 3) { + r3y = 0; + } + + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x === 3) { + r3x = 0; + } + + if (!((r3x && r3x === r3y) + (x + y & 1) & 1) && !this._isMasked(x, y)) { + buffer[x + (y * width)] ^= 1; + } + } + } + + break; + } + }, + + _calculateMaxLength: function() { + return (this._dataBlock * (this._neccBlock1 + this._neccBlock2)) + this._neccBlock2; + }, + + _calculatePolynomial: function() { + var i, j; + var eccBlock = this._eccBlock; + var polynomial = this._polynomial; + + polynomial[0] = 1; + + for (i = 0; i < eccBlock; i++) { + polynomial[i + 1] = 1; + + for (j = i; j > 0; j--) { + polynomial[j] = polynomial[j] ? polynomial[j - 1] ^ + Galois_1.EXPONENT[Frame._modN(Galois_1.LOG[polynomial[j]] + i)] : polynomial[j - 1]; + } + + polynomial[0] = Galois_1.EXPONENT[Frame._modN(Galois_1.LOG[polynomial[0]] + i)]; + } + + // Use logs for generator polynomial to save calculation step. + for (i = 0; i <= eccBlock; i++) { + polynomial[i] = Galois_1.LOG[polynomial[i]]; + } + }, + + _checkBadness: function() { + var b, b1, h, x, y; + var bad = 0; + var badness = this._badness; + var buffer = this.buffer; + var width = this.width; + + // Blocks of same colour. + for (y = 0; y < width - 1; y++) { + for (x = 0; x < width - 1; x++) { + // All foreground colour. + if ((buffer[x + (width * y)] && + buffer[x + 1 + (width * y)] && + buffer[x + (width * (y + 1))] && + buffer[x + 1 + (width * (y + 1))]) || + // All background colour. + !(buffer[x + (width * y)] || + buffer[x + 1 + (width * y)] || + buffer[x + (width * (y + 1))] || + buffer[x + 1 + (width * (y + 1))])) { + bad += Frame.N2; + } + } + } + + var bw = 0; + + // X runs. + for (y = 0; y < width; y++) { + h = 0; + + badness[0] = 0; + + for (b = 0, x = 0; x < width; x++) { + b1 = buffer[x + (width * y)]; + + if (b === b1) { + badness[h]++; + } else { + badness[++h] = 1; + } + + b = b1; + bw += b ? 1 : -1; + } + + bad += this._getBadness(h); + } + + if (bw < 0) { + bw = -bw; + } + + var count = 0; + var big = bw; + big += big << 2; + big <<= 1; + + while (big > width * width) { + big -= width * width; + count++; + } + + bad += count * Frame.N4; + + // Y runs. + for (x = 0; x < width; x++) { + h = 0; + + badness[0] = 0; + + for (b = 0, y = 0; y < width; y++) { + b1 = buffer[x + (width * y)]; + + if (b === b1) { + badness[h]++; + } else { + badness[++h] = 1; + } + + b = b1; + } + + bad += this._getBadness(h); + } + + return bad; + }, + + _convertBitStream: function(length) { + var bit, i; + var ecc = this._ecc; + var version = this._version; + + // Convert string to bit stream. 8-bit data to QR-coded 8-bit data (numeric, alphanumeric, or kanji not supported). + for (i = 0; i < length; i++) { + ecc[i] = this._value.charCodeAt(i); + } + + var stringBuffer = this._stringBuffer = ecc.slice(); + var maxLength = this._calculateMaxLength(); + + if (length >= maxLength - 2) { + length = maxLength - 2; + + if (version > 9) { + length--; + } + } + + // Shift and re-pack to insert length prefix. + var index = length; + + if (version > 9) { + stringBuffer[index + 2] = 0; + stringBuffer[index + 3] = 0; + + while (index--) { + bit = stringBuffer[index]; + + stringBuffer[index + 3] |= 255 & (bit << 4); + stringBuffer[index + 2] = bit >> 4; + } + + stringBuffer[2] |= 255 & (length << 4); + stringBuffer[1] = length >> 4; + stringBuffer[0] = 0x40 | (length >> 12); + } else { + stringBuffer[index + 1] = 0; + stringBuffer[index + 2] = 0; + + while (index--) { + bit = stringBuffer[index]; + + stringBuffer[index + 2] |= 255 & (bit << 4); + stringBuffer[index + 1] = bit >> 4; + } + + stringBuffer[1] |= 255 & (length << 4); + stringBuffer[0] = 0x40 | (length >> 4); + } + + // Fill to end with pad pattern. + index = length + 3 - (version < 10); + + while (index < maxLength) { + stringBuffer[index++] = 0xec; + stringBuffer[index++] = 0x11; + } + }, + + _getBadness: function(length) { + var i; + var badRuns = 0; + var badness = this._badness; + + for (i = 0; i <= length; i++) { + if (badness[i] >= 5) { + badRuns += Frame.N1 + badness[i] - 5; + } + } + + // FBFFFBF as in finder. + for (i = 3; i < length - 1; i += 2) { + if (badness[i - 2] === badness[i + 2] && + badness[i + 2] === badness[i - 1] && + badness[i - 1] === badness[i + 1] && + badness[i - 1] * 3 === badness[i] && + // Background around the foreground pattern? Not part of the specs. + (badness[i - 3] === 0 || i + 3 > length || + badness[i - 3] * 3 >= badness[i] * 4 || + badness[i + 3] * 3 >= badness[i] * 4)) { + badRuns += Frame.N3; + } + } + + return badRuns; + }, + + _finish: function() { + // Save pre-mask copy of frame. + this._stringBuffer = this.buffer.slice(); + + var currentMask, i; + var bit = 0; + var mask = 30000; + + /* + * Using for instead of while since in original Arduino code if an early mask was "good enough" it wouldn't try for + * a better one since they get more complex and take longer. + */ + for (i = 0; i < 8; i++) { + // Returns foreground-background imbalance. + this._applyMask(i); + + currentMask = this._checkBadness(); + + // Is current mask better than previous best? + if (currentMask < mask) { + mask = currentMask; + bit = i; + } + + // Don't increment "i" to a void redoing mask. + if (bit === 7) { + break; + } + + // Reset for next pass. + this.buffer = this._stringBuffer.slice(); + } + + // Redo best mask as none were "good enough" (i.e. last wasn't bit). + if (bit !== i) { + this._applyMask(bit); + } + + // Add in final mask/ECC level bytes. + mask = ErrorCorrection_1.FINAL_FORMAT[bit + (this._level - 1 << 3)]; + + var buffer = this.buffer; + var width = this.width; + + // Low byte. + for (i = 0; i < 8; i++, mask >>= 1) { + if (mask & 1) { + buffer[width - 1 - i + (width * 8)] = 1; + + if (i < 6) { + buffer[8 + (width * i)] = 1; + } else { + buffer[8 + (width * (i + 1))] = 1; + } + } + } + + // High byte. + for (i = 0; i < 7; i++, mask >>= 1) { + if (mask & 1) { + buffer[8 + (width * (width - 7 + i))] = 1; + + if (i) { + buffer[6 - i + (width * 8)] = 1; + } else { + buffer[7 + (width * 8)] = 1; + } + } + } + }, + + _interleaveBlocks: function() { + var i, j; + var dataBlock = this._dataBlock; + var ecc = this._ecc; + var eccBlock = this._eccBlock; + var k = 0; + var maxLength = this._calculateMaxLength(); + var neccBlock1 = this._neccBlock1; + var neccBlock2 = this._neccBlock2; + var stringBuffer = this._stringBuffer; + + for (i = 0; i < dataBlock; i++) { + for (j = 0; j < neccBlock1; j++) { + ecc[k++] = stringBuffer[i + (j * dataBlock)]; + } + + for (j = 0; j < neccBlock2; j++) { + ecc[k++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))]; + } + } + + for (j = 0; j < neccBlock2; j++) { + ecc[k++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))]; + } + + for (i = 0; i < eccBlock; i++) { + for (j = 0; j < neccBlock1 + neccBlock2; j++) { + ecc[k++] = stringBuffer[maxLength + i + (j * eccBlock)]; + } + } + + this._stringBuffer = ecc; + }, + + _insertAlignments: function() { + var i, x, y; + var version = this._version; + var width = this.width; + + if (version > 1) { + i = Alignment_1.BLOCK[version]; + y = width - 7; + + for (;;) { + x = width - 7; + + while (x > i - 3) { + this._addAlignment(x, y); + + if (x < i) { + break; + } + + x -= i; + } + + if (y <= i + 9) { + break; + } + + y -= i; + + this._addAlignment(6, y); + this._addAlignment(y, 6); + } + } + }, + + _insertFinders: function() { + var i, j, x, y; + var buffer = this.buffer; + var width = this.width; + + for (i = 0; i < 3; i++) { + j = 0; + y = 0; + + if (i === 1) { + j = width - 7; + } + if (i === 2) { + y = width - 7; + } + + buffer[y + 3 + (width * (j + 3))] = 1; + + for (x = 0; x < 6; x++) { + buffer[y + x + (width * j)] = 1; + buffer[y + (width * (j + x + 1))] = 1; + buffer[y + 6 + (width * (j + x))] = 1; + buffer[y + x + 1 + (width * (j + 6))] = 1; + } + + for (x = 1; x < 5; x++) { + this._setMask(y + x, j + 1); + this._setMask(y + 1, j + x + 1); + this._setMask(y + 5, j + x); + this._setMask(y + x + 1, j + 5); + } + + for (x = 2; x < 4; x++) { + buffer[y + x + (width * (j + 2))] = 1; + buffer[y + 2 + (width * (j + x + 1))] = 1; + buffer[y + 4 + (width * (j + x))] = 1; + buffer[y + x + 1 + (width * (j + 4))] = 1; + } + } + }, + + _insertTimingGap: function() { + var x, y; + var width = this.width; + + for (y = 0; y < 7; y++) { + this._setMask(7, y); + this._setMask(width - 8, y); + this._setMask(7, y + width - 7); + } + + for (x = 0; x < 8; x++) { + this._setMask(x, 7); + this._setMask(x + width - 8, 7); + this._setMask(x, width - 8); + } + }, + + _insertTimingRowAndColumn: function() { + var x; + var buffer = this.buffer; + var width = this.width; + + for (x = 0; x < width - 14; x++) { + if (x & 1) { + this._setMask(8 + x, 6); + this._setMask(6, 8 + x); + } else { + buffer[8 + x + (width * 6)] = 1; + buffer[6 + (width * (8 + x))] = 1; + } + } + }, + + _insertVersion: function() { + var i, j, x, y; + var buffer = this.buffer; + var version = this._version; + var width = this.width; + + if (version > 6) { + i = Version_1.BLOCK[version - 7]; + j = 17; + + for (x = 0; x < 6; x++) { + for (y = 0; y < 3; y++, j--) { + if (1 & (j > 11 ? version >> j - 12 : i >> j)) { + buffer[5 - x + (width * (2 - y + width - 11))] = 1; + buffer[2 - y + width - 11 + (width * (5 - x))] = 1; + } else { + this._setMask(5 - x, 2 - y + width - 11); + this._setMask(2 - y + width - 11, 5 - x); + } + } + } + } + }, + + _isMasked: function(x, y) { + var bit = Frame._getMaskBit(x, y); + + return this._mask[bit] === 1; + }, + + _pack: function() { + var bit, i, j; + var k = 1; + var v = 1; + var width = this.width; + var x = width - 1; + var y = width - 1; + + // Interleaved data and ECC codes. + var length = ((this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2)) + this._neccBlock2; + + for (i = 0; i < length; i++) { + bit = this._stringBuffer[i]; + + for (j = 0; j < 8; j++, bit <<= 1) { + if (0x80 & bit) { + this.buffer[x + (width * y)] = 1; + } + + // Find next fill position. + do { + if (v) { + x--; + } else { + x++; + + if (k) { + if (y !== 0) { + y--; + } else { + x -= 2; + k = !k; + + if (x === 6) { + x--; + y = 9; + } + } + } else if (y !== width - 1) { + y++; + } else { + x -= 2; + k = !k; + + if (x === 6) { + x--; + y -= 8; + } + } + } + + v = !v; + } while (this._isMasked(x, y)); + } + } + }, + + _reverseMask: function() { + var x, y; + var width = this.width; + + for (x = 0; x < 9; x++) { + this._setMask(x, 8); + } + + for (x = 0; x < 8; x++) { + this._setMask(x + width - 8, 8); + this._setMask(8, x); + } + + for (y = 0; y < 7; y++) { + this._setMask(8, y + width - 7); + } + }, + + _setMask: function(x, y) { + var bit = Frame._getMaskBit(x, y); + + this._mask[bit] = 1; + }, + + _syncMask: function() { + var x, y; + var width = this.width; + + for (y = 0; y < width; y++) { + for (x = 0; x <= y; x++) { + if (this.buffer[x + (width * y)]) { + this._setMask(x, y); + } + } + } + } + + }, { + + _createArray: function(length) { + var i; + var array = []; + + for (i = 0; i < length; i++) { + array[i] = 0; + } + + return array; + }, + + _getMaskBit: function(x, y) { + var bit; + + if (x > y) { + bit = x; + x = y; + y = bit; + } + + bit = y; + bit += y * y; + bit >>= 1; + bit += x; + + return bit; + }, + + _modN: function(x) { + while (x >= 255) { + x -= 255; + x = (x >> 8) + (x & 255); + } + + return x; + }, + + // *Badness* coefficients. + N1: 3, + N2: 3, + N3: 40, + N4: 10 + + }); + + var Frame_1 = Frame; + + /** + * The options used by {@link Frame}. + * + * @typedef {Object} Frame~Options + * @property {string} level - The ECC level to be used. + * @property {string} value - The value to be encoded. + */ + + /** + * An implementation of {@link Renderer} for working with img elements. + * + * This depends on {@link CanvasRenderer} being executed first as this implementation simply applies the data URL from + * the rendered canvas element as the src for the img element being rendered. + * + * @public + * @class + * @extends Renderer + */ + var ImageRenderer = Renderer_1.extend({ + + /** + * @override + */ + draw: function() { + this.element.src = this.qrious.toDataURL(); + }, + + /** + * @override + */ + reset: function() { + this.element.src = ''; + }, + + /** + * @override + */ + resize: function() { + var element = this.element; + + element.width = element.height = this.qrious.size; + } + + }); + + var ImageRenderer_1 = ImageRenderer; + + /** + * Defines an available option while also configuring how values are applied to the target object. + * + * Optionally, a default value can be specified as well a value transformer for greater control over how the option + * value is applied. + * + * If no value transformer is specified, then any specified option will be applied directly. All values are maintained + * on the target object itself as a field using the option name prefixed with a single underscore. + * + * When an option is specified as modifiable, the {@link OptionManager} will be required to include a setter for the + * property that is defined on the target object that uses the option name. + * + * @param {string} name - the name to be used + * @param {boolean} [modifiable] - true if the property defined on target objects should include a setter; + * otherwise false + * @param {*} [defaultValue] - the default value to be used + * @param {Option~ValueTransformer} [valueTransformer] - the value transformer to be used + * @public + * @class + * @extends Nevis + */ + var Option = lite.extend(function(name, modifiable, defaultValue, valueTransformer) { + /** + * The name for this {@link Option}. + * + * @public + * @type {string} + * @memberof Option# + */ + this.name = name; + + /** + * Whether a setter should be included on the property defined on target objects for this {@link Option}. + * + * @public + * @type {boolean} + * @memberof Option# + */ + this.modifiable = Boolean(modifiable); + + /** + * The default value for this {@link Option}. + * + * @public + * @type {*} + * @memberof Option# + */ + this.defaultValue = defaultValue; + + this._valueTransformer = valueTransformer; + }, { + + /** + * Transforms the specified value so that it can be applied for this {@link Option}. + * + * If a value transformer has been specified for this {@link Option}, it will be called upon to transform + * value. Otherwise, value will be returned directly. + * + * @param {*} value - the value to be transformed + * @return {*} The transformed value or value if no value transformer is specified. + * @public + * @memberof Option# + */ + transform: function(value) { + var transformer = this._valueTransformer; + if (typeof transformer === 'function') { + return transformer(value, this); + } + + return value; + } + + }); + + var Option_1 = Option; + + /** + * Returns a transformed value for the specified value to be applied for the option provided. + * + * @callback Option~ValueTransformer + * @param {*} value - the value to be transformed + * @param {Option} option - the {@link Option} for which value is being transformed + * @return {*} The transform value. + */ + + /** + * Contains utility methods that are useful throughout the library. + * + * @public + * @class + * @extends Nevis + */ + var Utilities = lite.extend(null, { + + /** + * Returns the absolute value of a given number. + * + * This method is simply a convenient shorthand for Math.abs while ensuring that nulls are returned as + * null instead of zero. + * + * @param {number} value - the number whose absolute value is to be returned + * @return {number} The absolute value of value or null if value is + * null. + * @public + * @static + * @memberof Utilities + */ + abs: function(value) { + return value != null ? Math.abs(value) : null; + }, + + /** + * Returns whether the specified object has a property with the specified name as an own + * (not inherited) property. + * + * @param {Object} object - the object on which the property is to be checked + * @param {string} name - the name of the property to be checked + * @return {boolean} true if object has an own property with name. + * @public + * @static + * @memberof Utilities + */ + hasOwn: function(object, name) { + return Object.prototype.hasOwnProperty.call(object, name); + }, + + /** + * A non-operation method that does absolutely nothing. + * + * @return {void} + * @public + * @static + * @memberof Utilities + */ + noop: function() {}, + + /** + * Transforms the specified string to upper case while remaining null-safe. + * + * @param {string} string - the string to be transformed to upper case + * @return {string} string transformed to upper case if string is not null. + * @public + * @static + * @memberof Utilities + */ + toUpperCase: function(string) { + return string != null ? string.toUpperCase() : null; + } + + }); + + var Utilities_1 = Utilities; + + /** + * Manages multiple {@link Option} instances that are intended to be used by multiple implementations. + * + * Although the option definitions are shared between targets, the values are maintained on the targets themselves. + * + * @param {Option[]} options - the options to be used + * @public + * @class + * @extends Nevis + */ + var OptionManager = lite.extend(function(options) { + /** + * The available options for this {@link OptionManager}. + * + * @public + * @type {Object.} + * @memberof OptionManager# + */ + this.options = {}; + + options.forEach(function(option) { + this.options[option.name] = option; + }, this); + }, { + + /** + * Returns whether an option with the specified name is available. + * + * @param {string} name - the name of the {@link Option} whose existence is to be checked + * @return {boolean} true if an {@link Option} exists with name; otherwise + * false. + * @public + * @memberof OptionManager# + */ + exists: function(name) { + return this.options[name] != null; + }, + + /** + * Returns the value of the option with the specified name on the target object provided. + * + * @param {string} name - the name of the {@link Option} whose value on target is to be returned + * @param {Object} target - the object from which the value of the named {@link Option} is to be returned + * @return {*} The value of the {@link Option} with name on target. + * @public + * @memberof OptionManager# + */ + get: function(name, target) { + return OptionManager._get(this.options[name], target); + }, + + /** + * Returns a copy of all of the available options on the target object provided. + * + * @param {Object} target - the object from which the option name/value pairs are to be returned + * @return {Object.} A hash containing the name/value pairs of all options on target. + * @public + * @memberof OptionManager# + */ + getAll: function(target) { + var name; + var options = this.options; + var result = {}; + + for (name in options) { + if (Utilities_1.hasOwn(options, name)) { + result[name] = OptionManager._get(options[name], target); + } + } + + return result; + }, + + /** + * Initializes the available options for the target object provided and then applies the initial values + * within the speciifed options. + * + * This method will throw an error if any of the names within options does not match an available option. + * + * This involves setting the default values and defining properties for all of the available options on + * target before finally calling {@link OptionMananger#setAll} with options and + * target. Any options that are configured to be modifiable will have a setter included in their defined + * property that will allow its corresponding value to be modified. + * + * If a change handler is specified, it will be called whenever the value changes on target for a + * modifiable option, but only when done so via the defined property's setter. + * + * @param {Object.} options - the name/value pairs of the initial options to be set + * @param {Object} target - the object on which the options are to be initialized + * @param {Function} [changeHandler] - the function to be called whenever the value of an modifiable option changes on + * target + * @return {void} + * @throws {Error} If options contains an invalid option name. + * @public + * @memberof OptionManager# + */ + init: function(options, target, changeHandler) { + if (typeof changeHandler !== 'function') { + changeHandler = Utilities_1.noop; + } + + var name, option; + + for (name in this.options) { + if (Utilities_1.hasOwn(this.options, name)) { + option = this.options[name]; + + OptionManager._set(option, option.defaultValue, target); + OptionManager._createAccessor(option, target, changeHandler); + } + } + + this._setAll(options, target, true); + }, + + /** + * Sets the value of the option with the specified name on the target object provided to + * value. + * + * This method will throw an error if name does not match an available option or matches an option that + * cannot be modified. + * + * If value is null and the {@link Option} has a default value configured, then that default + * value will be used instead. If the {@link Option} also has a value transformer configured, it will be used to + * transform whichever value was determined to be used. + * + * This method returns whether the value of the underlying field on target was changed as a result. + * + * @param {string} name - the name of the {@link Option} whose value is to be set + * @param {*} value - the value to be set for the named {@link Option} on target + * @param {Object} target - the object on which value is to be set for the named {@link Option} + * @return {boolean} true if the underlying field on target was changed; otherwise + * false. + * @throws {Error} If name is invalid or is for an option that cannot be modified. + * @public + * @memberof OptionManager# + */ + set: function(name, value, target) { + return this._set(name, value, target); + }, + + /** + * Sets all of the specified options on the target object provided to their corresponding + * values. + * + * This method will throw an error if any of the names within options does not match an available option + * or matches an option that cannot be modified. + * + * If any value within options is null and the corresponding {@link Option} has a default + * value configured, then that default value will be used instead. If an {@link Option} also has a value transformer + * configured, it will be used to transform whichever value was determined to be used. + * + * This method returns whether the value for any of the underlying fields on target were changed as a + * result. + * + * @param {Object.} options - the name/value pairs of options to be set + * @param {Object} target - the object on which the options are to be set + * @return {boolean} true if any of the underlying fields on target were changed; otherwise + * false. + * @throws {Error} If options contains an invalid option name or an option that cannot be modiifed. + * @public + * @memberof OptionManager# + */ + setAll: function(options, target) { + return this._setAll(options, target); + }, + + _set: function(name, value, target, allowUnmodifiable) { + var option = this.options[name]; + if (!option) { + throw new Error('Invalid option: ' + name); + } + if (!option.modifiable && !allowUnmodifiable) { + throw new Error('Option cannot be modified: ' + name); + } + + return OptionManager._set(option, value, target); + }, + + _setAll: function(options, target, allowUnmodifiable) { + if (!options) { + return false; + } + + var name; + var changed = false; + + for (name in options) { + if (Utilities_1.hasOwn(options, name) && this._set(name, options[name], target, allowUnmodifiable)) { + changed = true; + } + } + + return changed; + } + + }, { + + _createAccessor: function(option, target, changeHandler) { + var descriptor = { + get: function() { + return OptionManager._get(option, target); + } + }; + + if (option.modifiable) { + descriptor.set = function(value) { + if (OptionManager._set(option, value, target)) { + changeHandler(value, option); + } + }; + } + + Object.defineProperty(target, option.name, descriptor); + }, + + _get: function(option, target) { + return target['_' + option.name]; + }, + + _set: function(option, value, target) { + var fieldName = '_' + option.name; + var oldValue = target[fieldName]; + var newValue = option.transform(value != null ? value : option.defaultValue); + + target[fieldName] = newValue; + + return newValue !== oldValue; + } + + }); + + var OptionManager_1 = OptionManager; + + /** + * Called whenever the value of a modifiable {@link Option} is changed on a target object via the defined property's + * setter. + * + * @callback OptionManager~ChangeHandler + * @param {*} value - the new value for option on the target object + * @param {Option} option - the modifable {@link Option} whose value has changed on the target object. + * @return {void} + */ + + /** + * A basic manager for {@link Service} implementations that are mapped to simple names. + * + * @public + * @class + * @extends Nevis + */ + var ServiceManager = lite.extend(function() { + this._services = {}; + }, { + + /** + * Returns the {@link Service} being managed with the specified name. + * + * @param {string} name - the name of the {@link Service} to be returned + * @return {Service} The {@link Service} is being managed with name. + * @throws {Error} If no {@link Service} is being managed with name. + * @public + * @memberof ServiceManager# + */ + getService: function(name) { + var service = this._services[name]; + if (!service) { + throw new Error('Service is not being managed with name: ' + name); + } + + return service; + }, + + /** + * Sets the {@link Service} implementation to be managed for the specified name to the + * service provided. + * + * @param {string} name - the name of the {@link Service} to be managed with name + * @param {Service} service - the {@link Service} implementation to be managed + * @return {void} + * @throws {Error} If a {@link Service} is already being managed with the same name. + * @public + * @memberof ServiceManager# + */ + setService: function(name, service) { + if (this._services[name]) { + throw new Error('Service is already managed with name: ' + name); + } + + if (service) { + this._services[name] = service; + } + } + + }); + + var ServiceManager_1 = ServiceManager; + + var optionManager = new OptionManager_1([ + new Option_1('background', true, 'white'), + new Option_1('backgroundAlpha', true, 1, Utilities_1.abs), + new Option_1('element'), + new Option_1('foreground', true, 'black'), + new Option_1('foregroundAlpha', true, 1, Utilities_1.abs), + new Option_1('level', true, 'L', Utilities_1.toUpperCase), + new Option_1('mime', true, 'image/png'), + new Option_1('padding', true, null, Utilities_1.abs), + new Option_1('size', true, 100, Utilities_1.abs), + new Option_1('value', true, '') + ]); + var serviceManager = new ServiceManager_1(); + + /** + * Enables configuration of a QR code generator which uses HTML5 canvas for rendering. + * + * @param {QRious~Options} [options] - the options to be used + * @throws {Error} If any options are invalid. + * @public + * @class + * @extends Nevis + */ + var QRious = lite.extend(function(options) { + optionManager.init(options, this, this.update.bind(this)); + + var element = optionManager.get('element', this); + var elementService = serviceManager.getService('element'); + var canvas = element && elementService.isCanvas(element) ? element : elementService.createCanvas(); + var image = element && elementService.isImage(element) ? element : elementService.createImage(); + + this._canvasRenderer = new CanvasRenderer_1(this, canvas, true); + this._imageRenderer = new ImageRenderer_1(this, image, image === element); + + this.update(); + }, { + + /** + * Returns all of the options configured for this {@link QRious}. + * + * Any changes made to the returned object will not be reflected in the options themselves or their corresponding + * underlying fields. + * + * @return {Object.} A copy of the applied options. + * @public + * @memberof QRious# + */ + get: function() { + return optionManager.getAll(this); + }, + + /** + * Sets all of the specified options and automatically updates this {@link QRious} if any of the + * underlying fields are changed as a result. + * + * This is the preferred method for updating multiple options at one time to avoid unnecessary updates between + * changes. + * + * @param {QRious~Options} options - the options to be set + * @return {void} + * @throws {Error} If any options are invalid or cannot be modified. + * @public + * @memberof QRious# + */ + set: function(options) { + if (optionManager.setAll(options, this)) { + this.update(); + } + }, + + /** + * Returns the image data URI for the generated QR code using the mime provided. + * + * @param {string} [mime] - the MIME type for the image + * @return {string} The image data URI for the QR code. + * @public + * @memberof QRious# + */ + toDataURL: function(mime) { + return this.canvas.toDataURL(mime || this.mime); + }, + + /** + * Updates this {@link QRious} by generating a new {@link Frame} and re-rendering the QR code. + * + * @return {void} + * @protected + * @memberof QRious# + */ + update: function() { + var frame = new Frame_1({ + level: this.level, + value: this.value + }); + + this._canvasRenderer.render(frame); + this._imageRenderer.render(frame); + } + + }, { + + /** + * Configures the service provided to be used by all {@link QRious} instances. + * + * @param {Service} service - the {@link Service} to be configured + * @return {void} + * @throws {Error} If a {@link Service} has already been configured with the same name. + * @public + * @static + * @memberof QRious + */ + use: function(service) { + serviceManager.setService(service.getName(), service); + } + + }); + + Object.defineProperties(QRious.prototype, { + + canvas: { + /** + * Returns the canvas element being used to render the QR code for this {@link QRious}. + * + * @return {*} The canvas element. + * @public + * @memberof QRious# + * @alias canvas + */ + get: function() { + return this._canvasRenderer.getElement(); + } + }, + + image: { + /** + * Returns the img element being used to render the QR code for this {@link QRious}. + * + * @return {*} The img element. + * @public + * @memberof QRious# + * @alias image + */ + get: function() { + return this._imageRenderer.getElement(); + } + } + + }); + + var QRious_1$2 = QRious; + + /** + * The options used by {@link QRious}. + * + * @typedef {Object} QRious~Options + * @property {string} [background="white"] - The background color to be applied to the QR code. + * @property {number} [backgroundAlpha=1] - The background alpha to be applied to the QR code. + * @property {*} [element] - The element to be used to render the QR code which may either be an canvas or + * img. The element(s) will be created if needed. + * @property {string} [foreground="black"] - The foreground color to be applied to the QR code. + * @property {number} [foregroundAlpha=1] - The foreground alpha to be applied to the QR code. + * @property {string} [level="L"] - The error correction level to be applied to the QR code. + * @property {string} [mime="image/png"] - The MIME type to be used to render the image for the QR code. + * @property {number} [padding] - The padding for the QR code in pixels. + * @property {number} [size=100] - The size of the QR code in pixels. + * @property {string} [value=""] - The value to be encoded within the QR code. + */ + + var index = QRious_1$2; + + /** + * Defines a service contract that must be met by all implementations. + * + * @public + * @class + * @extends Nevis + */ + var Service = lite.extend({ + + /** + * Returns the name of this {@link Service}. + * + * @return {string} The service name. + * @public + * @abstract + * @memberof Service# + */ + getName: function() {} + + }); + + var Service_1 = Service; + + /** + * A service for working with elements. + * + * @public + * @class + * @extends Service + */ + var ElementService = Service_1.extend({ + + /** + * Creates an instance of a canvas element. + * + * Implementations of {@link ElementService} must override this method with their own specific logic. + * + * @return {*} The newly created canvas element. + * @public + * @abstract + * @memberof ElementService# + */ + createCanvas: function() {}, + + /** + * Creates an instance of a image element. + * + * Implementations of {@link ElementService} must override this method with their own specific logic. + * + * @return {*} The newly created image element. + * @public + * @abstract + * @memberof ElementService# + */ + createImage: function() {}, + + /** + * @override + */ + getName: function() { + return 'element'; + }, + + /** + * Returns whether the specified element is a canvas. + * + * Implementations of {@link ElementService} must override this method with their own specific logic. + * + * @param {*} element - the element to be checked + * @return {boolean} true if element is a canvas; otherwise false. + * @public + * @abstract + * @memberof ElementService# + */ + isCanvas: function(element) {}, + + /** + * Returns whether the specified element is an image. + * + * Implementations of {@link ElementService} must override this method with their own specific logic. + * + * @param {*} element - the element to be checked + * @return {boolean} true if element is an image; otherwise false. + * @public + * @abstract + * @memberof ElementService# + */ + isImage: function(element) {} + + }); + + var ElementService_1 = ElementService; + + /** + * An implementation of {@link ElementService} intended for use within a browser environment. + * + * @public + * @class + * @extends ElementService + */ + var BrowserElementService = ElementService_1.extend({ + + /** + * @override + */ + createCanvas: function() { + return document.createElement('canvas'); + }, + + /** + * @override + */ + createImage: function() { + return document.createElement('img'); + }, + + /** + * @override + */ + isCanvas: function(element) { + return element instanceof HTMLCanvasElement; + }, + + /** + * @override + */ + isImage: function(element) { + return element instanceof HTMLImageElement; + } + + }); + + var BrowserElementService_1 = BrowserElementService; + + index.use(new BrowserElementService_1()); + + var QRious_1 = index; + + return QRious_1; + +}))); + +//# sourceMappingURL=qrious.js.map diff --git a/imports/ui/util/qrious.js.map b/imports/ui/util/qrious.js.map new file mode 100644 index 0000000..c1aaf2c --- /dev/null +++ b/imports/ui/util/qrious.js.map @@ -0,0 +1 @@ +{"version":3,"file":"qrious.js","sources":["../node_modules/nevis/src/extend.js","../node_modules/nevis/src/nevis.js","../node_modules/nevis/lite.js","../node_modules/qrious-core/src/renderer/Renderer.js","../node_modules/qrious-core/src/renderer/CanvasRenderer.js","../node_modules/qrious-core/src/Alignment.js","../node_modules/qrious-core/src/ErrorCorrection.js","../node_modules/qrious-core/src/Galois.js","../node_modules/qrious-core/src/Version.js","../node_modules/qrious-core/src/Frame.js","../node_modules/qrious-core/src/renderer/ImageRenderer.js","../node_modules/qrious-core/src/option/Option.js","../node_modules/qrious-core/src/util/Utilities.js","../node_modules/qrious-core/src/option/OptionManager.js","../node_modules/qrious-core/src/service/ServiceManager.js","../node_modules/qrious-core/src/QRious.js","../node_modules/qrious-core/index.js","../node_modules/qrious-core/src/service/Service.js","../node_modules/qrious-core/src/service/element/ElementService.js","../src/service/element/BrowserElementService.js","../src/QRious.js"],"sourcesContent":["/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * A bare-bones constructor for surrogate prototype swapping.\n *\n * @private\n * @constructor\n */\nvar Constructor = /* istanbul ignore next */ function() {};\n/**\n * A reference to Object.prototype.hasOwnProperty.\n *\n * @private\n * @type {Function}\n */\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * A reference to Array.prototype.slice.\n *\n * @private\n * @type {Function}\n */\nvar slice = Array.prototype.slice;\n\n/**\n * Creates an object which inherits the given prototype.\n *\n * Optionally, the created object can be extended further with the specified properties.\n *\n * @param {Object} prototype - the prototype to be inherited by the created object\n * @param {Object} [properties] - the optional properties to be extended by the created object\n * @return {Object} The newly created object.\n * @private\n */\nfunction createObject(prototype, properties) {\n var result;\n /* istanbul ignore next */\n if (typeof Object.create === 'function') {\n result = Object.create(prototype);\n } else {\n Constructor.prototype = prototype;\n result = new Constructor();\n Constructor.prototype = null;\n }\n\n if (properties) {\n extendObject(true, result, properties);\n }\n\n return result;\n}\n\n/**\n * Extends the constructor to which this method is associated with the prototype and/or\n * statics provided.\n *\n * If name is provided, it will be used as the class name and can be accessed via a special\n * class_ property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString), but this is not applicable to the lite version of Nevis.\n *\n * If constructor is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_ property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor provided or the one created if none was given.\n * @public\n */\nfunction extend(name, constructor, prototype, statics) {\n var superConstructor = this;\n\n if (typeof name !== 'string') {\n statics = prototype;\n prototype = constructor;\n constructor = name;\n name = null;\n }\n\n if (typeof constructor !== 'function') {\n statics = prototype;\n prototype = constructor;\n constructor = function() {\n return superConstructor.apply(this, arguments);\n };\n }\n\n extendObject(false, constructor, superConstructor, statics);\n\n constructor.prototype = createObject(superConstructor.prototype, prototype);\n constructor.prototype.constructor = constructor;\n\n constructor.class_ = name || superConstructor.class_;\n constructor.super_ = superConstructor;\n\n return constructor;\n}\n\n/**\n * Extends the specified target object with the properties in each of the sources provided.\n *\n * if any source is null it will be ignored.\n *\n * @param {boolean} own - true to only copy own properties from sources onto\n * target; otherwise false\n * @param {Object} target - the target object which should be extended\n * @param {...Object} [sources] - the source objects whose properties are to be copied onto target\n * @return {void}\n * @private\n */\nfunction extendObject(own, target, sources) {\n sources = slice.call(arguments, 2);\n\n var property;\n var source;\n\n for (var i = 0, length = sources.length; i < length; i++) {\n source = sources[i];\n\n for (property in source) {\n if (!own || hasOwnProperty.call(source, property)) {\n target[property] = source[property];\n }\n }\n }\n}\n\nmodule.exports = extend;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar extend = require('./extend');\n\n/**\n * The base class from which all others should extend.\n *\n * @public\n * @constructor\n */\nfunction Nevis() {}\nNevis.class_ = 'Nevis';\nNevis.super_ = Object;\n\n/**\n * Extends the constructor to which this method is associated with the prototype and/or\n * statics provided.\n *\n * If name is provided, it will be used as the class name and can be accessed via a special\n * class_ property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString), but this is not applicable to the lite version of Nevis.\n *\n * If constructor is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_ property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor provided or the one created if none was given.\n * @public\n * @static\n * @memberof Nevis\n */\nNevis.extend = extend;\n\nmodule.exports = Nevis;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nmodule.exports = require('./src/nevis');\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Responsible for rendering a QR code {@link Frame} on a specific type of element.\n *\n * A renderer may be dependant on the rendering of another element, so the ordering of their execution is important.\n *\n * The rendering of a element can be deferred by disabling the renderer initially, however, any attempt get the element\n * from the renderer will result in it being immediately enabled and the element being rendered.\n *\n * @param {QRious} qrious - the {@link QRious} instance to be used\n * @param {*} element - the element onto which the QR code is to be rendered\n * @param {boolean} [enabled] - true this {@link Renderer} is enabled; otherwise false.\n * @public\n * @class\n * @extends Nevis\n */\nvar Renderer = Nevis.extend(function(qrious, element, enabled) {\n /**\n * The {@link QRious} instance.\n *\n * @protected\n * @type {QRious}\n * @memberof Renderer#\n */\n this.qrious = qrious;\n\n /**\n * The element onto which this {@link Renderer} is rendering the QR code.\n *\n * @protected\n * @type {*}\n * @memberof Renderer#\n */\n this.element = element;\n this.element.qrious = qrious;\n\n /**\n * Whether this {@link Renderer} is enabled.\n *\n * @protected\n * @type {boolean}\n * @memberof Renderer#\n */\n this.enabled = Boolean(enabled);\n}, {\n\n /**\n * Draws the specified QR code frame on the underlying element.\n *\n * Implementations of {@link Renderer} must override this method with their own specific logic.\n *\n * @param {Frame} frame - the {@link Frame} to be drawn\n * @return {void}\n * @protected\n * @abstract\n * @memberof Renderer#\n */\n draw: function(frame) {},\n\n /**\n * Returns the element onto which this {@link Renderer} is rendering the QR code.\n *\n * If this method is called while this {@link Renderer} is disabled, it will be immediately enabled and rendered\n * before the element is returned.\n *\n * @return {*} The element.\n * @public\n * @memberof Renderer#\n */\n getElement: function() {\n if (!this.enabled) {\n this.enabled = true;\n this.render();\n }\n\n return this.element;\n },\n\n /**\n * Calculates the size (in pixel units) to represent an individual module within the QR code based on the\n * frame provided.\n *\n * Any configured padding will be excluded from the returned size.\n *\n * The returned value will be at least one, even in cases where the size of the QR code does not fit its contents.\n * This is done so that the inevitable clipping is handled more gracefully since this way at least something is\n * displayed instead of just a blank space filled by the background color.\n *\n * @param {Frame} frame - the {@link Frame} from which the module size is to be derived\n * @return {number} The pixel size for each module in the QR code which will be no less than one.\n * @protected\n * @memberof Renderer#\n */\n getModuleSize: function(frame) {\n var qrious = this.qrious;\n var padding = qrious.padding || 0;\n var pixels = Math.floor((qrious.size - (padding * 2)) / frame.width);\n\n return Math.max(1, pixels);\n },\n\n /**\n * Calculates the offset/padding (in pixel units) to be inserted before the QR code based on the frame\n * provided.\n *\n * The returned value will be zero if there is no available offset or if the size of the QR code does not fit its\n * contents. It will never be a negative value. This is done so that the inevitable clipping appears more naturally\n * and it is not clipped from all directions.\n *\n * @param {Frame} frame - the {@link Frame} from which the offset is to be derived\n * @return {number} The pixel offset for the QR code which will be no less than zero.\n * @protected\n * @memberof Renderer#\n */\n getOffset: function(frame) {\n var qrious = this.qrious;\n var padding = qrious.padding;\n\n if (padding != null) {\n return padding;\n }\n\n var moduleSize = this.getModuleSize(frame);\n var offset = Math.floor((qrious.size - (moduleSize * frame.width)) / 2);\n\n return Math.max(0, offset);\n },\n\n /**\n * Renders a QR code on the underlying element based on the frame provided.\n *\n * @param {Frame} frame - the {@link Frame} to be rendered\n * @return {void}\n * @public\n * @memberof Renderer#\n */\n render: function(frame) {\n if (this.enabled) {\n this.resize();\n this.reset();\n this.draw(frame);\n }\n },\n\n /**\n * Resets the underlying element, effectively clearing any previously rendered QR code.\n *\n * Implementations of {@link Renderer} must override this method with their own specific logic.\n *\n * @return {void}\n * @protected\n * @abstract\n * @memberof Renderer#\n */\n reset: function() {},\n\n /**\n * Ensures that the size of the underlying element matches that defined on the associated {@link QRious} instance.\n *\n * Implementations of {@link Renderer} must override this method with their own specific logic.\n *\n * @return {void}\n * @protected\n * @abstract\n * @memberof Renderer#\n */\n resize: function() {}\n\n});\n\nmodule.exports = Renderer;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Renderer = require('./Renderer');\n\n/**\n * An implementation of {@link Renderer} for working with canvas elements.\n *\n * @public\n * @class\n * @extends Renderer\n */\nvar CanvasRenderer = Renderer.extend({\n\n /**\n * @override\n */\n draw: function(frame) {\n var i, j;\n var qrious = this.qrious;\n var moduleSize = this.getModuleSize(frame);\n var offset = this.getOffset(frame);\n var context = this.element.getContext('2d');\n\n context.fillStyle = qrious.foreground;\n context.globalAlpha = qrious.foregroundAlpha;\n\n for (i = 0; i < frame.width; i++) {\n for (j = 0; j < frame.width; j++) {\n if (frame.buffer[(j * frame.width) + i]) {\n context.fillRect((moduleSize * i) + offset, (moduleSize * j) + offset, moduleSize, moduleSize);\n }\n }\n }\n },\n\n /**\n * @override\n */\n reset: function() {\n var qrious = this.qrious;\n var context = this.element.getContext('2d');\n var size = qrious.size;\n\n context.lineWidth = 1;\n context.clearRect(0, 0, size, size);\n context.fillStyle = qrious.background;\n context.globalAlpha = qrious.backgroundAlpha;\n context.fillRect(0, 0, size, size);\n },\n\n /**\n * @override\n */\n resize: function() {\n var element = this.element;\n\n element.width = element.height = this.qrious.size;\n }\n\n});\n\nmodule.exports = CanvasRenderer;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\n/* eslint no-multi-spaces: \"off\" */\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains alignment pattern information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Alignment = Nevis.extend(null, {\n\n /**\n * The alignment pattern block.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof Alignment\n */\n BLOCK: [\n 0, 11, 15, 19, 23, 27, 31,\n 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24,\n 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28\n ]\n\n});\n\nmodule.exports = Alignment;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\n/* eslint no-multi-spaces: \"off\" */\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains error correction information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar ErrorCorrection = Nevis.extend(null, {\n\n /**\n * The error correction blocks.\n *\n * There are four elements per version. The first two indicate the number of blocks, then the data width, and finally\n * the ECC width.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof ErrorCorrection\n */\n BLOCKS: [\n 1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17,\n 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28,\n 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22,\n 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16,\n 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22,\n 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28,\n 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26,\n 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26,\n 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24,\n 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28,\n 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24,\n 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28,\n 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22,\n 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24,\n 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24,\n 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30,\n 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28,\n 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28,\n 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26,\n 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28,\n 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30,\n 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24,\n 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30,\n 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30,\n 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30,\n 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30,\n 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30,\n 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30,\n 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30,\n 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30,\n 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30,\n 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30,\n 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30,\n 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30,\n 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30,\n 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30,\n 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,\n 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30,\n 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30,\n 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30\n ],\n\n /**\n * The final format bits with mask (level << 3 | mask).\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof ErrorCorrection\n */\n FINAL_FORMAT: [\n // L\n 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976,\n // M\n 0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0,\n // Q\n 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed,\n // H\n 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b\n ],\n\n /**\n * A map of human-readable ECC levels.\n *\n * @public\n * @static\n * @type {Object.}\n * @memberof ErrorCorrection\n */\n LEVELS: {\n L: 1,\n M: 2,\n Q: 3,\n H: 4\n }\n\n});\n\nmodule.exports = ErrorCorrection;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains Galois field information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Galois = Nevis.extend(null, {\n\n /**\n * The Galois field exponent table.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof Galois\n */\n EXPONENT: [\n 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,\n 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,\n 0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,\n 0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,\n 0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,\n 0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,\n 0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,\n 0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,\n 0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,\n 0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,\n 0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,\n 0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,\n 0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,\n 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,\n 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,\n 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00\n ],\n\n /**\n * The Galois field log table.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof Galois\n */\n LOG: [\n 0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b,\n 0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71,\n 0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45,\n 0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6,\n 0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88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= Galois;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains version pattern information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Version = Nevis.extend(null, {\n\n /**\n * The version pattern block.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof Version\n */\n BLOCK: [\n 0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, 0x928, 0xb78, 0x45d, 0xa17, 0x532,\n 0x9a6, 0x683, 0x8c9, 0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, 0x250, 0x9d5,\n 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, 0x541, 0xc69\n ]\n\n});\n\nmodule.exports = Version;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar Alignment = require('./Alignment');\nvar ErrorCorrection = require('./ErrorCorrection');\nvar Galois = require('./Galois');\nvar Version = require('./Version');\n\n/**\n * Generates information for a QR code frame based on a specific value to be encoded.\n *\n * @param {Frame~Options} options - the options to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar Frame = Nevis.extend(function(options) {\n var dataBlock, eccBlock, index, neccBlock1, neccBlock2;\n var valueLength = options.value.length;\n\n this._badness = [];\n this._level = ErrorCorrection.LEVELS[options.level];\n this._polynomial = [];\n this._value = options.value;\n this._version = 0;\n this._stringBuffer = [];\n\n while (this._version < 40) {\n this._version++;\n\n index = ((this._level - 1) * 4) + ((this._version - 1) * 16);\n\n neccBlock1 = ErrorCorrection.BLOCKS[index++];\n neccBlock2 = ErrorCorrection.BLOCKS[index++];\n dataBlock = ErrorCorrection.BLOCKS[index++];\n eccBlock = ErrorCorrection.BLOCKS[index];\n\n index = (dataBlock * (neccBlock1 + neccBlock2)) + neccBlock2 - 3 + (this._version <= 9);\n\n if (valueLength <= index) {\n break;\n }\n }\n\n this._dataBlock = dataBlock;\n this._eccBlock = eccBlock;\n this._neccBlock1 = neccBlock1;\n this._neccBlock2 = neccBlock2;\n\n /**\n * The data width is based on version.\n *\n * @public\n * @type {number}\n * @memberof Frame#\n */\n // FIXME: Ensure that it fits instead of being truncated.\n var width = this.width = 17 + (4 * this._version);\n\n /**\n * The image buffer.\n *\n * @public\n * @type {number[]}\n * @memberof Frame#\n */\n this.buffer = Frame._createArray(width * width);\n\n this._ecc = Frame._createArray(dataBlock + ((dataBlock + eccBlock) * (neccBlock1 + neccBlock2)) + neccBlock2);\n this._mask = Frame._createArray(((width * (width + 1)) + 1) / 2);\n\n this._insertFinders();\n this._insertAlignments();\n\n // Insert single foreground cell.\n this.buffer[8 + (width * (width - 8))] = 1;\n\n this._insertTimingGap();\n this._reverseMask();\n this._insertTimingRowAndColumn();\n this._insertVersion();\n this._syncMask();\n this._convertBitStream(valueLength);\n this._calculatePolynomial();\n this._appendEccToData();\n this._interleaveBlocks();\n this._pack();\n this._finish();\n}, {\n\n _addAlignment: function(x, y) {\n var i;\n var buffer = this.buffer;\n var width = this.width;\n\n buffer[x + (width * y)] = 1;\n\n for (i = -2; i < 2; i++) {\n buffer[x + i + (width * (y - 2))] = 1;\n buffer[x - 2 + (width * (y + i + 1))] = 1;\n buffer[x + 2 + (width * (y + i))] = 1;\n buffer[x + i + 1 + (width * (y + 2))] = 1;\n }\n\n for (i = 0; i < 2; i++) {\n this._setMask(x - 1, y + i);\n this._setMask(x + 1, y - i);\n this._setMask(x - i, y - 1);\n this._setMask(x + i, y + 1);\n }\n },\n\n _appendData: function(data, dataLength, ecc, eccLength) {\n var bit, i, j;\n var polynomial = this._polynomial;\n var stringBuffer = this._stringBuffer;\n\n for (i = 0; i < eccLength; i++) {\n stringBuffer[ecc + i] = 0;\n }\n\n for (i = 0; i < dataLength; i++) {\n bit = Galois.LOG[stringBuffer[data + i] ^ stringBuffer[ecc]];\n\n if (bit !== 255) {\n for (j = 1; j < eccLength; j++) {\n stringBuffer[ecc + j - 1] = stringBuffer[ecc + j] ^\n Galois.EXPONENT[Frame._modN(bit + polynomial[eccLength - j])];\n }\n } else {\n for (j = ecc; j < ecc + eccLength; j++) {\n stringBuffer[j] = stringBuffer[j + 1];\n }\n }\n\n stringBuffer[ecc + eccLength - 1] = bit === 255 ? 0 : Galois.EXPONENT[Frame._modN(bit + polynomial[0])];\n }\n },\n\n _appendEccToData: function() {\n var i;\n var data = 0;\n var dataBlock = this._dataBlock;\n var ecc = this._calculateMaxLength();\n var eccBlock = this._eccBlock;\n\n for (i = 0; i < this._neccBlock1; i++) {\n this._appendData(data, dataBlock, ecc, eccBlock);\n\n data += dataBlock;\n ecc += eccBlock;\n }\n\n for (i = 0; i < this._neccBlock2; i++) {\n this._appendData(data, dataBlock + 1, ecc, eccBlock);\n\n data += dataBlock + 1;\n ecc += eccBlock;\n }\n },\n\n _applyMask: function(mask) {\n var r3x, r3y, x, y;\n var buffer = this.buffer;\n var width = this.width;\n\n switch (mask) {\n case 0:\n for (y = 0; y < width; y++) {\n for (x = 0; x < width; x++) {\n if (!((x + y) & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 1:\n for (y = 0; y < width; y++) {\n for (x = 0; x < width; x++) {\n if (!(y & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 2:\n for (y = 0; y < width; y++) {\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!r3x && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 3:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = r3y, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!r3x && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 4:\n for (y = 0; y < width; y++) {\n for (r3x = 0, r3y = (y >> 1) & 1, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n r3y = !r3y;\n }\n\n if (!r3y && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 5:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!((x & y & 1) + !(!r3x | !r3y)) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 6:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!((x & y & 1) + (r3x && r3x === r3y) & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 7:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!((r3x && r3x === r3y) + (x + y & 1) & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n }\n },\n\n _calculateMaxLength: function() {\n return (this._dataBlock * (this._neccBlock1 + this._neccBlock2)) + this._neccBlock2;\n },\n\n _calculatePolynomial: function() {\n var i, j;\n var eccBlock = this._eccBlock;\n var polynomial = this._polynomial;\n\n polynomial[0] = 1;\n\n for (i = 0; i < eccBlock; i++) {\n polynomial[i + 1] = 1;\n\n for (j = i; j > 0; j--) {\n polynomial[j] = polynomial[j] ? polynomial[j - 1] ^\n Galois.EXPONENT[Frame._modN(Galois.LOG[polynomial[j]] + i)] : polynomial[j - 1];\n }\n\n polynomial[0] = Galois.EXPONENT[Frame._modN(Galois.LOG[polynomial[0]] + i)];\n }\n\n // Use logs for generator polynomial to save calculation step.\n for (i = 0; i <= eccBlock; i++) {\n polynomial[i] = Galois.LOG[polynomial[i]];\n }\n },\n\n _checkBadness: function() {\n var b, b1, h, x, y;\n var bad = 0;\n var badness = this._badness;\n var buffer = this.buffer;\n var width = this.width;\n\n // Blocks of same colour.\n for (y = 0; y < width - 1; y++) {\n for (x = 0; x < width - 1; x++) {\n // All foreground colour.\n if ((buffer[x + (width * y)] &&\n buffer[x + 1 + (width * y)] &&\n buffer[x + (width * (y + 1))] &&\n buffer[x + 1 + (width * (y + 1))]) ||\n // All background colour.\n !(buffer[x + (width * y)] ||\n buffer[x + 1 + (width * y)] ||\n buffer[x + (width * (y + 1))] ||\n buffer[x + 1 + (width * (y + 1))])) {\n bad += Frame.N2;\n }\n }\n }\n\n var bw = 0;\n\n // X runs.\n for (y = 0; y < width; y++) {\n h = 0;\n\n badness[0] = 0;\n\n for (b = 0, x = 0; x < width; x++) {\n b1 = buffer[x + (width * y)];\n\n if (b === b1) {\n badness[h]++;\n } else {\n badness[++h] = 1;\n }\n\n b = b1;\n bw += b ? 1 : -1;\n }\n\n bad += this._getBadness(h);\n }\n\n if (bw < 0) {\n bw = -bw;\n }\n\n var count = 0;\n var big = bw;\n big += big << 2;\n big <<= 1;\n\n while (big > width * width) {\n big -= width * width;\n count++;\n }\n\n bad += count * Frame.N4;\n\n // Y runs.\n for (x = 0; x < width; x++) {\n h = 0;\n\n badness[0] = 0;\n\n for (b = 0, y = 0; y < width; y++) {\n b1 = buffer[x + (width * y)];\n\n if (b === b1) {\n badness[h]++;\n } else {\n badness[++h] = 1;\n }\n\n b = b1;\n }\n\n bad += this._getBadness(h);\n }\n\n return bad;\n },\n\n _convertBitStream: function(length) {\n var bit, i;\n var ecc = this._ecc;\n var version = this._version;\n\n // Convert string to bit stream. 8-bit data to QR-coded 8-bit data (numeric, alphanumeric, or kanji not supported).\n for (i = 0; i < length; i++) {\n ecc[i] = this._value.charCodeAt(i);\n }\n\n var stringBuffer = this._stringBuffer = ecc.slice();\n var maxLength = this._calculateMaxLength();\n\n if (length >= maxLength - 2) {\n length = maxLength - 2;\n\n if (version > 9) {\n length--;\n }\n }\n\n // Shift and re-pack to insert length prefix.\n var index = length;\n\n if (version > 9) {\n stringBuffer[index + 2] = 0;\n stringBuffer[index + 3] = 0;\n\n while (index--) {\n bit = stringBuffer[index];\n\n stringBuffer[index + 3] |= 255 & (bit << 4);\n stringBuffer[index + 2] = bit >> 4;\n }\n\n stringBuffer[2] |= 255 & (length << 4);\n stringBuffer[1] = length >> 4;\n stringBuffer[0] = 0x40 | (length >> 12);\n } else {\n stringBuffer[index + 1] = 0;\n stringBuffer[index + 2] = 0;\n\n while (index--) {\n bit = stringBuffer[index];\n\n stringBuffer[index + 2] |= 255 & (bit << 4);\n stringBuffer[index + 1] = bit >> 4;\n }\n\n stringBuffer[1] |= 255 & (length << 4);\n stringBuffer[0] = 0x40 | (length >> 4);\n }\n\n // Fill to end with pad pattern.\n index = length + 3 - (version < 10);\n\n while (index < maxLength) {\n stringBuffer[index++] = 0xec;\n stringBuffer[index++] = 0x11;\n }\n },\n\n _getBadness: function(length) {\n var i;\n var badRuns = 0;\n var badness = this._badness;\n\n for (i = 0; i <= length; i++) {\n if (badness[i] >= 5) {\n badRuns += Frame.N1 + badness[i] - 5;\n }\n }\n\n // FBFFFBF as in finder.\n for (i = 3; i < length - 1; i += 2) {\n if (badness[i - 2] === badness[i + 2] &&\n badness[i + 2] === badness[i - 1] &&\n badness[i - 1] === badness[i + 1] &&\n badness[i - 1] * 3 === badness[i] &&\n // Background around the foreground pattern? Not part of the specs.\n (badness[i - 3] === 0 || i + 3 > length ||\n badness[i - 3] * 3 >= badness[i] * 4 ||\n badness[i + 3] * 3 >= badness[i] * 4)) {\n badRuns += Frame.N3;\n }\n }\n\n return badRuns;\n },\n\n _finish: function() {\n // Save pre-mask copy of frame.\n this._stringBuffer = this.buffer.slice();\n\n var currentMask, i;\n var bit = 0;\n var mask = 30000;\n\n /*\n * Using for instead of while since in original Arduino code if an early mask was \"good enough\" it wouldn't try for\n * a better one since they get more complex and take longer.\n */\n for (i = 0; i < 8; i++) {\n // Returns foreground-background imbalance.\n this._applyMask(i);\n\n currentMask = this._checkBadness();\n\n // Is current mask better than previous best?\n if (currentMask < mask) {\n mask = currentMask;\n bit = i;\n }\n\n // Don't increment \"i\" to a void redoing mask.\n if (bit === 7) {\n break;\n }\n\n // Reset for next pass.\n this.buffer = this._stringBuffer.slice();\n }\n\n // Redo best mask as none were \"good enough\" (i.e. last wasn't bit).\n if (bit !== i) {\n this._applyMask(bit);\n }\n\n // Add in final mask/ECC level bytes.\n mask = ErrorCorrection.FINAL_FORMAT[bit + (this._level - 1 << 3)];\n\n var buffer = this.buffer;\n var width = this.width;\n\n // Low byte.\n for (i = 0; i < 8; i++, mask >>= 1) {\n if (mask & 1) {\n buffer[width - 1 - i + (width * 8)] = 1;\n\n if (i < 6) {\n buffer[8 + (width * i)] = 1;\n } else {\n buffer[8 + (width * (i + 1))] = 1;\n }\n }\n }\n\n // High byte.\n for (i = 0; i < 7; i++, mask >>= 1) {\n if (mask & 1) {\n buffer[8 + (width * (width - 7 + i))] = 1;\n\n if (i) {\n buffer[6 - i + (width * 8)] = 1;\n } else {\n buffer[7 + (width * 8)] = 1;\n }\n }\n }\n },\n\n _interleaveBlocks: function() {\n var i, j;\n var dataBlock = this._dataBlock;\n var ecc = this._ecc;\n var eccBlock = this._eccBlock;\n var k = 0;\n var maxLength = this._calculateMaxLength();\n var neccBlock1 = this._neccBlock1;\n var neccBlock2 = this._neccBlock2;\n var stringBuffer = this._stringBuffer;\n\n for (i = 0; i < dataBlock; i++) {\n for (j = 0; j < neccBlock1; j++) {\n ecc[k++] = stringBuffer[i + (j * dataBlock)];\n }\n\n for (j = 0; j < neccBlock2; j++) {\n ecc[k++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))];\n }\n }\n\n for (j = 0; j < neccBlock2; j++) {\n ecc[k++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))];\n }\n\n for (i = 0; i < eccBlock; i++) {\n for (j = 0; j < neccBlock1 + neccBlock2; j++) {\n ecc[k++] = stringBuffer[maxLength + i + (j * eccBlock)];\n }\n }\n\n this._stringBuffer = ecc;\n },\n\n _insertAlignments: function() {\n var i, x, y;\n var version = this._version;\n var width = this.width;\n\n if (version > 1) {\n i = Alignment.BLOCK[version];\n y = width - 7;\n\n for (;;) {\n x = width - 7;\n\n while (x > i - 3) {\n this._addAlignment(x, y);\n\n if (x < i) {\n break;\n }\n\n x -= i;\n }\n\n if (y <= i + 9) {\n break;\n }\n\n y -= i;\n\n this._addAlignment(6, y);\n this._addAlignment(y, 6);\n }\n }\n },\n\n _insertFinders: function() {\n var i, j, x, y;\n var buffer = this.buffer;\n var width = this.width;\n\n for (i = 0; i < 3; i++) {\n j = 0;\n y = 0;\n\n if (i === 1) {\n j = width - 7;\n }\n if (i === 2) {\n y = width - 7;\n }\n\n buffer[y + 3 + (width * (j + 3))] = 1;\n\n for (x = 0; x < 6; x++) {\n buffer[y + x + (width * j)] = 1;\n buffer[y + (width * (j + x + 1))] = 1;\n buffer[y + 6 + (width * (j + x))] = 1;\n buffer[y + x + 1 + (width * (j + 6))] = 1;\n }\n\n for (x = 1; x < 5; x++) {\n this._setMask(y + x, j + 1);\n this._setMask(y + 1, j + x + 1);\n this._setMask(y + 5, j + x);\n this._setMask(y + x + 1, j + 5);\n }\n\n for (x = 2; x < 4; x++) {\n buffer[y + x + (width * (j + 2))] = 1;\n buffer[y + 2 + (width * (j + x + 1))] = 1;\n buffer[y + 4 + (width * (j + x))] = 1;\n buffer[y + x + 1 + (width * (j + 4))] = 1;\n }\n }\n },\n\n _insertTimingGap: function() {\n var x, y;\n var width = this.width;\n\n for (y = 0; y < 7; y++) {\n this._setMask(7, y);\n this._setMask(width - 8, y);\n this._setMask(7, y + width - 7);\n }\n\n for (x = 0; x < 8; x++) {\n this._setMask(x, 7);\n this._setMask(x + width - 8, 7);\n this._setMask(x, width - 8);\n }\n },\n\n _insertTimingRowAndColumn: function() {\n var x;\n var buffer = this.buffer;\n var width = this.width;\n\n for (x = 0; x < width - 14; x++) {\n if (x & 1) {\n this._setMask(8 + x, 6);\n this._setMask(6, 8 + x);\n } else {\n buffer[8 + x + (width * 6)] = 1;\n buffer[6 + (width * (8 + x))] = 1;\n }\n }\n },\n\n _insertVersion: function() {\n var i, j, x, y;\n var buffer = this.buffer;\n var version = this._version;\n var width = this.width;\n\n if (version > 6) {\n i = Version.BLOCK[version - 7];\n j = 17;\n\n for (x = 0; x < 6; x++) {\n for (y = 0; y < 3; y++, j--) {\n if (1 & (j > 11 ? version >> j - 12 : i >> j)) {\n buffer[5 - x + (width * (2 - y + width - 11))] = 1;\n buffer[2 - y + width - 11 + (width * (5 - x))] = 1;\n } else {\n this._setMask(5 - x, 2 - y + width - 11);\n this._setMask(2 - y + width - 11, 5 - x);\n }\n }\n }\n }\n },\n\n _isMasked: function(x, y) {\n var bit = Frame._getMaskBit(x, y);\n\n return this._mask[bit] === 1;\n },\n\n _pack: function() {\n var bit, i, j;\n var k = 1;\n var v = 1;\n var width = this.width;\n var x = width - 1;\n var y = width - 1;\n\n // Interleaved data and ECC codes.\n var length = ((this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2)) + this._neccBlock2;\n\n for (i = 0; i < length; i++) {\n bit = this._stringBuffer[i];\n\n for (j = 0; j < 8; j++, bit <<= 1) {\n if (0x80 & bit) {\n this.buffer[x + (width * y)] = 1;\n }\n\n // Find next fill position.\n do {\n if (v) {\n x--;\n } else {\n x++;\n\n if (k) {\n if (y !== 0) {\n y--;\n } else {\n x -= 2;\n k = !k;\n\n if (x === 6) {\n x--;\n y = 9;\n }\n }\n } else if (y !== width - 1) {\n y++;\n } else {\n x -= 2;\n k = !k;\n\n if (x === 6) {\n x--;\n y -= 8;\n }\n }\n }\n\n v = !v;\n } while (this._isMasked(x, y));\n }\n }\n },\n\n _reverseMask: function() {\n var x, y;\n var width = this.width;\n\n for (x = 0; x < 9; x++) {\n this._setMask(x, 8);\n }\n\n for (x = 0; x < 8; x++) {\n this._setMask(x + width - 8, 8);\n this._setMask(8, x);\n }\n\n for (y = 0; y < 7; y++) {\n this._setMask(8, y + width - 7);\n }\n },\n\n _setMask: function(x, y) {\n var bit = Frame._getMaskBit(x, y);\n\n this._mask[bit] = 1;\n },\n\n _syncMask: function() {\n var x, y;\n var width = this.width;\n\n for (y = 0; y < width; y++) {\n for (x = 0; x <= y; x++) {\n if (this.buffer[x + (width * y)]) {\n this._setMask(x, y);\n }\n }\n }\n }\n\n}, {\n\n _createArray: function(length) {\n var i;\n var array = [];\n\n for (i = 0; i < length; i++) {\n array[i] = 0;\n }\n\n return array;\n },\n\n _getMaskBit: function(x, y) {\n var bit;\n\n if (x > y) {\n bit = x;\n x = y;\n y = bit;\n }\n\n bit = y;\n bit += y * y;\n bit >>= 1;\n bit += x;\n\n return bit;\n },\n\n _modN: function(x) {\n while (x >= 255) {\n x -= 255;\n x = (x >> 8) + (x & 255);\n }\n\n return x;\n },\n\n // *Badness* coefficients.\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n\n});\n\nmodule.exports = Frame;\n\n/**\n * The options used by {@link Frame}.\n *\n * @typedef {Object} Frame~Options\n * @property {string} level - The ECC level to be used.\n * @property {string} value - The value to be encoded.\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Renderer = require('./Renderer');\n\n/**\n * An implementation of {@link Renderer} for working with img elements.\n *\n * This depends on {@link CanvasRenderer} being executed first as this implementation simply applies the data URL from\n * the rendered canvas element as the src for the img element being rendered.\n *\n * @public\n * @class\n * @extends Renderer\n */\nvar ImageRenderer = Renderer.extend({\n\n /**\n * @override\n */\n draw: function() {\n this.element.src = this.qrious.toDataURL();\n },\n\n /**\n * @override\n */\n reset: function() {\n this.element.src = '';\n },\n\n /**\n * @override\n */\n resize: function() {\n var element = this.element;\n\n element.width = element.height = this.qrious.size;\n }\n\n});\n\nmodule.exports = ImageRenderer;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Defines an available option while also configuring how values are applied to the target object.\n *\n * Optionally, a default value can be specified as well a value transformer for greater control over how the option\n * value is applied.\n *\n * If no value transformer is specified, then any specified option will be applied directly. All values are maintained\n * on the target object itself as a field using the option name prefixed with a single underscore.\n *\n * When an option is specified as modifiable, the {@link OptionManager} will be required to include a setter for the\n * property that is defined on the target object that uses the option name.\n *\n * @param {string} name - the name to be used\n * @param {boolean} [modifiable] - true if the property defined on target objects should include a setter;\n * otherwise false\n * @param {*} [defaultValue] - the default value to be used\n * @param {Option~ValueTransformer} [valueTransformer] - the value transformer to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar Option = Nevis.extend(function(name, modifiable, defaultValue, valueTransformer) {\n /**\n * The name for this {@link Option}.\n *\n * @public\n * @type {string}\n * @memberof Option#\n */\n this.name = name;\n\n /**\n * Whether a setter should be included on the property defined on target objects for this {@link Option}.\n *\n * @public\n * @type {boolean}\n * @memberof Option#\n */\n this.modifiable = Boolean(modifiable);\n\n /**\n * The default value for this {@link Option}.\n *\n * @public\n * @type {*}\n * @memberof Option#\n */\n this.defaultValue = defaultValue;\n\n this._valueTransformer = valueTransformer;\n}, {\n\n /**\n * Transforms the specified value so that it can be applied for this {@link Option}.\n *\n * If a value transformer has been specified for this {@link Option}, it will be called upon to transform\n * value. Otherwise, value will be returned directly.\n *\n * @param {*} value - the value to be transformed\n * @return {*} The transformed value or value if no value transformer is specified.\n * @public\n * @memberof Option#\n */\n transform: function(value) {\n var transformer = this._valueTransformer;\n if (typeof transformer === 'function') {\n return transformer(value, this);\n }\n\n return value;\n }\n\n});\n\nmodule.exports = Option;\n\n/**\n * Returns a transformed value for the specified value to be applied for the option provided.\n *\n * @callback Option~ValueTransformer\n * @param {*} value - the value to be transformed\n * @param {Option} option - the {@link Option} for which value is being transformed\n * @return {*} The transform value.\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains utility methods that are useful throughout the library.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Utilities = Nevis.extend(null, {\n\n /**\n * Returns the absolute value of a given number.\n *\n * This method is simply a convenient shorthand for Math.abs while ensuring that nulls are returned as\n * null instead of zero.\n *\n * @param {number} value - the number whose absolute value is to be returned\n * @return {number} The absolute value of value or null if value is\n * null.\n * @public\n * @static\n * @memberof Utilities\n */\n abs: function(value) {\n return value != null ? Math.abs(value) : null;\n },\n\n /**\n * Returns whether the specified object has a property with the specified name as an own\n * (not inherited) property.\n *\n * @param {Object} object - the object on which the property is to be checked\n * @param {string} name - the name of the property to be checked\n * @return {boolean} true if object has an own property with name.\n * @public\n * @static\n * @memberof Utilities\n */\n hasOwn: function(object, name) {\n return Object.prototype.hasOwnProperty.call(object, name);\n },\n\n /**\n * A non-operation method that does absolutely nothing.\n *\n * @return {void}\n * @public\n * @static\n * @memberof Utilities\n */\n noop: function() {},\n\n /**\n * Transforms the specified string to upper case while remaining null-safe.\n *\n * @param {string} string - the string to be transformed to upper case\n * @return {string} string transformed to upper case if string is not null.\n * @public\n * @static\n * @memberof Utilities\n */\n toUpperCase: function(string) {\n return string != null ? string.toUpperCase() : null;\n }\n\n});\n\nmodule.exports = Utilities;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar Utilities = require('../util/Utilities');\n\n/**\n * Manages multiple {@link Option} instances that are intended to be used by multiple implementations.\n *\n * Although the option definitions are shared between targets, the values are maintained on the targets themselves.\n *\n * @param {Option[]} options - the options to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar OptionManager = Nevis.extend(function(options) {\n /**\n * The available options for this {@link OptionManager}.\n *\n * @public\n * @type {Object.}\n * @memberof OptionManager#\n */\n this.options = {};\n\n options.forEach(function(option) {\n this.options[option.name] = option;\n }, this);\n}, {\n\n /**\n * Returns whether an option with the specified name is available.\n *\n * @param {string} name - the name of the {@link Option} whose existence is to be checked\n * @return {boolean} true if an {@link Option} exists with name; otherwise\n * false.\n * @public\n * @memberof OptionManager#\n */\n exists: function(name) {\n return this.options[name] != null;\n },\n\n /**\n * Returns the value of the option with the specified name on the target object provided.\n *\n * @param {string} name - the name of the {@link Option} whose value on target is to be returned\n * @param {Object} target - the object from which the value of the named {@link Option} is to be returned\n * @return {*} The value of the {@link Option} with name on target.\n * @public\n * @memberof OptionManager#\n */\n get: function(name, target) {\n return OptionManager._get(this.options[name], target);\n },\n\n /**\n * Returns a copy of all of the available options on the target object provided.\n *\n * @param {Object} target - the object from which the option name/value pairs are to be returned\n * @return {Object.} A hash containing the name/value pairs of all options on target.\n * @public\n * @memberof OptionManager#\n */\n getAll: function(target) {\n var name;\n var options = this.options;\n var result = {};\n\n for (name in options) {\n if (Utilities.hasOwn(options, name)) {\n result[name] = OptionManager._get(options[name], target);\n }\n }\n\n return result;\n },\n\n /**\n * Initializes the available options for the target object provided and then applies the initial values\n * within the speciifed options.\n *\n * This method will throw an error if any of the names within options does not match an available option.\n *\n * This involves setting the default values and defining properties for all of the available options on\n * target before finally calling {@link OptionMananger#setAll} with options and\n * target. Any options that are configured to be modifiable will have a setter included in their defined\n * property that will allow its corresponding value to be modified.\n *\n * If a change handler is specified, it will be called whenever the value changes on target for a\n * modifiable option, but only when done so via the defined property's setter.\n *\n * @param {Object.} options - the name/value pairs of the initial options to be set\n * @param {Object} target - the object on which the options are to be initialized\n * @param {Function} [changeHandler] - the function to be called whenever the value of an modifiable option changes on\n * target\n * @return {void}\n * @throws {Error} If options contains an invalid option name.\n * @public\n * @memberof OptionManager#\n */\n init: function(options, target, changeHandler) {\n if (typeof changeHandler !== 'function') {\n changeHandler = Utilities.noop;\n }\n\n var name, option;\n\n for (name in this.options) {\n if (Utilities.hasOwn(this.options, name)) {\n option = this.options[name];\n\n OptionManager._set(option, option.defaultValue, target);\n OptionManager._createAccessor(option, target, changeHandler);\n }\n }\n\n this._setAll(options, target, true);\n },\n\n /**\n * Sets the value of the option with the specified name on the target object provided to\n * value.\n *\n * This method will throw an error if name does not match an available option or matches an option that\n * cannot be modified.\n *\n * If value is null and the {@link Option} has a default value configured, then that default\n * value will be used instead. If the {@link Option} also has a value transformer configured, it will be used to\n * transform whichever value was determined to be used.\n *\n * This method returns whether the value of the underlying field on target was changed as a result.\n *\n * @param {string} name - the name of the {@link Option} whose value is to be set\n * @param {*} value - the value to be set for the named {@link Option} on target\n * @param {Object} target - the object on which value is to be set for the named {@link Option}\n * @return {boolean} true if the underlying field on target was changed; otherwise\n * false.\n * @throws {Error} If name is invalid or is for an option that cannot be modified.\n * @public\n * @memberof OptionManager#\n */\n set: function(name, value, target) {\n return this._set(name, value, target);\n },\n\n /**\n * Sets all of the specified options on the target object provided to their corresponding\n * values.\n *\n * This method will throw an error if any of the names within options does not match an available option\n * or matches an option that cannot be modified.\n *\n * If any value within options is null and the corresponding {@link Option} has a default\n * value configured, then that default value will be used instead. If an {@link Option} also has a value transformer\n * configured, it will be used to transform whichever value was determined to be used.\n *\n * This method returns whether the value for any of the underlying fields on target were changed as a\n * result.\n *\n * @param {Object.} options - the name/value pairs of options to be set\n * @param {Object} target - the object on which the options are to be set\n * @return {boolean} true if any of the underlying fields on target were changed; otherwise\n * false.\n * @throws {Error} If options contains an invalid option name or an option that cannot be modiifed.\n * @public\n * @memberof OptionManager#\n */\n setAll: function(options, target) {\n return this._setAll(options, target);\n },\n\n _set: function(name, value, target, allowUnmodifiable) {\n var option = this.options[name];\n if (!option) {\n throw new Error('Invalid option: ' + name);\n }\n if (!option.modifiable && !allowUnmodifiable) {\n throw new Error('Option cannot be modified: ' + name);\n }\n\n return OptionManager._set(option, value, target);\n },\n\n _setAll: function(options, target, allowUnmodifiable) {\n if (!options) {\n return false;\n }\n\n var name;\n var changed = false;\n\n for (name in options) {\n if (Utilities.hasOwn(options, name) && this._set(name, options[name], target, allowUnmodifiable)) {\n changed = true;\n }\n }\n\n return changed;\n }\n\n}, {\n\n _createAccessor: function(option, target, changeHandler) {\n var descriptor = {\n get: function() {\n return OptionManager._get(option, target);\n }\n };\n\n if (option.modifiable) {\n descriptor.set = function(value) {\n if (OptionManager._set(option, value, target)) {\n changeHandler(value, option);\n }\n };\n }\n\n Object.defineProperty(target, option.name, descriptor);\n },\n\n _get: function(option, target) {\n return target['_' + option.name];\n },\n\n _set: function(option, value, target) {\n var fieldName = '_' + option.name;\n var oldValue = target[fieldName];\n var newValue = option.transform(value != null ? value : option.defaultValue);\n\n target[fieldName] = newValue;\n\n return newValue !== oldValue;\n }\n\n});\n\nmodule.exports = OptionManager;\n\n/**\n * Called whenever the value of a modifiable {@link Option} is changed on a target object via the defined property's\n * setter.\n *\n * @callback OptionManager~ChangeHandler\n * @param {*} value - the new value for option on the target object\n * @param {Option} option - the modifable {@link Option} whose value has changed on the target object.\n * @return {void}\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * A basic manager for {@link Service} implementations that are mapped to simple names.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar ServiceManager = Nevis.extend(function() {\n this._services = {};\n}, {\n\n /**\n * Returns the {@link Service} being managed with the specified name.\n *\n * @param {string} name - the name of the {@link Service} to be returned\n * @return {Service} The {@link Service} is being managed with name.\n * @throws {Error} If no {@link Service} is being managed with name.\n * @public\n * @memberof ServiceManager#\n */\n getService: function(name) {\n var service = this._services[name];\n if (!service) {\n throw new Error('Service is not being managed with name: ' + name);\n }\n\n return service;\n },\n\n /**\n * Sets the {@link Service} implementation to be managed for the specified name to the\n * service provided.\n *\n * @param {string} name - the name of the {@link Service} to be managed with name\n * @param {Service} service - the {@link Service} implementation to be managed\n * @return {void}\n * @throws {Error} If a {@link Service} is already being managed with the same name.\n * @public\n * @memberof ServiceManager#\n */\n setService: function(name, service) {\n if (this._services[name]) {\n throw new Error('Service is already managed with name: ' + name);\n }\n\n if (service) {\n this._services[name] = service;\n }\n }\n\n});\n\nmodule.exports = ServiceManager;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar CanvasRenderer = require('./renderer/CanvasRenderer');\nvar Frame = require('./Frame');\nvar ImageRenderer = require('./renderer/ImageRenderer');\nvar Option = require('./option/Option');\nvar OptionManager = require('./option/OptionManager');\nvar ServiceManager = require('./service/ServiceManager');\nvar Utilities = require('./util/Utilities');\n\nvar optionManager = new OptionManager([\n new Option('background', true, 'white'),\n new Option('backgroundAlpha', true, 1, Utilities.abs),\n new Option('element'),\n new Option('foreground', true, 'black'),\n new Option('foregroundAlpha', true, 1, Utilities.abs),\n new Option('level', true, 'L', Utilities.toUpperCase),\n new Option('mime', true, 'image/png'),\n new Option('padding', true, null, Utilities.abs),\n new Option('size', true, 100, Utilities.abs),\n new Option('value', true, '')\n]);\nvar serviceManager = new ServiceManager();\n\n/**\n * Enables configuration of a QR code generator which uses HTML5 canvas for rendering.\n *\n * @param {QRious~Options} [options] - the options to be used\n * @throws {Error} If any options are invalid.\n * @public\n * @class\n * @extends Nevis\n */\nvar QRious = Nevis.extend(function(options) {\n optionManager.init(options, this, this.update.bind(this));\n\n var element = optionManager.get('element', this);\n var elementService = serviceManager.getService('element');\n var canvas = element && elementService.isCanvas(element) ? element : elementService.createCanvas();\n var image = element && elementService.isImage(element) ? element : elementService.createImage();\n\n this._canvasRenderer = new CanvasRenderer(this, canvas, true);\n this._imageRenderer = new ImageRenderer(this, image, image === element);\n\n this.update();\n}, {\n\n /**\n * Returns all of the options configured for this {@link QRious}.\n *\n * Any changes made to the returned object will not be reflected in the options themselves or their corresponding\n * underlying fields.\n *\n * @return {Object.} A copy of the applied options.\n * @public\n * @memberof QRious#\n */\n get: function() {\n return optionManager.getAll(this);\n },\n\n /**\n * Sets all of the specified options and automatically updates this {@link QRious} if any of the\n * underlying fields are changed as a result.\n *\n * This is the preferred method for updating multiple options at one time to avoid unnecessary updates between\n * changes.\n *\n * @param {QRious~Options} options - the options to be set\n * @return {void}\n * @throws {Error} If any options are invalid or cannot be modified.\n * @public\n * @memberof QRious#\n */\n set: function(options) {\n if (optionManager.setAll(options, this)) {\n this.update();\n }\n },\n\n /**\n * Returns the image data URI for the generated QR code using the mime provided.\n *\n * @param {string} [mime] - the MIME type for the image\n * @return {string} The image data URI for the QR code.\n * @public\n * @memberof QRious#\n */\n toDataURL: function(mime) {\n return this.canvas.toDataURL(mime || this.mime);\n },\n\n /**\n * Updates this {@link QRious} by generating a new {@link Frame} and re-rendering the QR code.\n *\n * @return {void}\n * @protected\n * @memberof QRious#\n */\n update: function() {\n var frame = new Frame({\n level: this.level,\n value: this.value\n });\n\n this._canvasRenderer.render(frame);\n this._imageRenderer.render(frame);\n }\n\n}, {\n\n /**\n * Configures the service provided to be used by all {@link QRious} instances.\n *\n * @param {Service} service - the {@link Service} to be configured\n * @return {void}\n * @throws {Error} If a {@link Service} has already been configured with the same name.\n * @public\n * @static\n * @memberof QRious\n */\n use: function(service) {\n serviceManager.setService(service.getName(), service);\n }\n\n});\n\nObject.defineProperties(QRious.prototype, {\n\n canvas: {\n /**\n * Returns the canvas element being used to render the QR code for this {@link QRious}.\n *\n * @return {*} The canvas element.\n * @public\n * @memberof QRious#\n * @alias canvas\n */\n get: function() {\n return this._canvasRenderer.getElement();\n }\n },\n\n image: {\n /**\n * Returns the img element being used to render the QR code for this {@link QRious}.\n *\n * @return {*} The img element.\n * @public\n * @memberof QRious#\n * @alias image\n */\n get: function() {\n return this._imageRenderer.getElement();\n }\n }\n\n});\n\nmodule.exports = QRious;\n\n/**\n * The options used by {@link QRious}.\n *\n * @typedef {Object} QRious~Options\n * @property {string} [background=\"white\"] - The background color to be applied to the QR code.\n * @property {number} [backgroundAlpha=1] - The background alpha to be applied to the QR code.\n * @property {*} [element] - The element to be used to render the QR code which may either be an canvas or\n * img. The element(s) will be created if needed.\n * @property {string} [foreground=\"black\"] - The foreground color to be applied to the QR code.\n * @property {number} [foregroundAlpha=1] - The foreground alpha to be applied to the QR code.\n * @property {string} [level=\"L\"] - The error correction level to be applied to the QR code.\n * @property {string} [mime=\"image/png\"] - The MIME type to be used to render the image for the QR code.\n * @property {number} [padding] - The padding for the QR code in pixels.\n * @property {number} [size=100] - The size of the QR code in pixels.\n * @property {string} [value=\"\"] - The value to be encoded within the QR code.\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nmodule.exports = require('./src/QRious');\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Defines a service contract that must be met by all implementations.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Service = Nevis.extend({\n\n /**\n * Returns the name of this {@link Service}.\n *\n * @return {string} The service name.\n * @public\n * @abstract\n * @memberof Service#\n */\n getName: function() {}\n\n});\n\nmodule.exports = Service;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Service = require('../Service');\n\n/**\n * A service for working with elements.\n *\n * @public\n * @class\n * @extends Service\n */\nvar ElementService = Service.extend({\n\n /**\n * Creates an instance of a canvas element.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @return {*} The newly created canvas element.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n createCanvas: function() {},\n\n /**\n * Creates an instance of a image element.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @return {*} The newly created image element.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n createImage: function() {},\n\n /**\n * @override\n */\n getName: function() {\n return 'element';\n },\n\n /**\n * Returns whether the specified element is a canvas.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @param {*} element - the element to be checked\n * @return {boolean} true if element is a canvas; otherwise false.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n isCanvas: function(element) {},\n\n /**\n * Returns whether the specified element is an image.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @param {*} element - the element to be checked\n * @return {boolean} true if element is an image; otherwise false.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n isImage: function(element) {}\n\n});\n\nmodule.exports = ElementService;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar ElementService = require('qrious-core/src/service/element/ElementService');\n\n/**\n * An implementation of {@link ElementService} intended for use within a browser environment.\n *\n * @public\n * @class\n * @extends ElementService\n */\nvar BrowserElementService = ElementService.extend({\n\n /**\n * @override\n */\n createCanvas: function() {\n return document.createElement('canvas');\n },\n\n /**\n * @override\n */\n createImage: function() {\n return document.createElement('img');\n },\n\n /**\n * @override\n */\n isCanvas: function(element) {\n return element instanceof HTMLCanvasElement;\n },\n\n /**\n * @override\n */\n isImage: function(element) {\n return element instanceof HTMLImageElement;\n }\n\n});\n\nmodule.exports = BrowserElementService;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar QRious = require('qrious-core');\n\nvar BrowserElementService = require('./service/element/BrowserElementService');\n\nQRious.use(new BrowserElementService());\n\nmodule.exports = QRious;\n"],"names":["extend","require$$0","Nevis","Renderer","ErrorCorrection","Galois","Alignment","Version","Utilities","OptionManager","Option","ServiceManager","CanvasRenderer","ImageRenderer","Frame","Service","ElementService","QRious","BrowserElementService"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;;;;;;;;AAsBA;;;;;;AAQA,MAAI,WAAW,8BAA8B,WAAW,EAAE,CAAC;;;;;;;AAO3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;IAaD,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE;;;;;;;;;;;;;IAa9B,OAAO,EAAE,SAAS,OAAO,EAAE,EAAE;;GAE9B,CAAC,CAAC;;AAEH,sBAAc,GAAG,cAAc,CAAC;;;;;;;;;AC7DhC,MAAI,qBAAqB,GAAGC,gBAAc,CAAC,MAAM,CAAC;;;;;IAKhD,YAAY,EAAE,WAAW;MACvB,OAAO,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;KACzC;;;;;IAKD,WAAW,EAAE,WAAW;MACtB,OAAO,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KACtC;;;;;IAKD,QAAQ,EAAE,SAAS,OAAO,EAAE;MAC1B,OAAO,OAAO,YAAY,iBAAiB,CAAC;KAC7C;;;;;IAKD,OAAO,EAAE,SAAS,OAAO,EAAE;MACzB,OAAO,OAAO,YAAY,gBAAgB,CAAC;KAC5C;;GAEF,CAAC,CAAC;;AAEH,6BAAc,GAAG,qBAAqB,CAAC;;ACrCvCC,OAAM,CAAC,GAAG,CAAC,IAAIC,uBAAqB,EAAE,CAAC,CAAC;;AAExC,cAAc,GAAGD,KAAM,CAAC;;;;"} \ No newline at end of file diff --git a/imports/ui/util/qrious.min.js b/imports/ui/util/qrious.min.js new file mode 100644 index 0000000..a53d712 --- /dev/null +++ b/imports/ui/util/qrious.min.js @@ -0,0 +1,6 @@ +/*! QRious v4.0.2 | (C) 2017 Alasdair Mercer | GPL v3 License +Based on jsqrencode | (C) 2010 tz@execpc.com | GPL v3 License +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.QRious=e()}(this,function(){"use strict";function t(t,e){var n;return"function"==typeof Object.create?n=Object.create(t):(s.prototype=t,n=new s,s.prototype=null),e&&i(!0,n,e),n}function e(e,n,s,r){var o=this;return"string"!=typeof e&&(r=s,s=n,n=e,e=null),"function"!=typeof n&&(r=s,s=n,n=function(){return o.apply(this,arguments)}),i(!1,n,o,r),n.prototype=t(o.prototype,s),n.prototype.constructor=n,n.class_=e||o.class_,n.super_=o,n}function i(t,e,i){for(var n,s,a=0,h=(i=o.call(arguments,2)).length;a>1&1,n=0;n0;e--)n[e]=n[e]?n[e-1]^_.EXPONENT[v._modN(_.LOG[n[e]]+t)]:n[e-1];n[0]=_.EXPONENT[v._modN(_.LOG[n[0]]+t)]}for(t=0;t<=i;t++)n[t]=_.LOG[n[t]]},_checkBadness:function(){var t,e,i,n,s,r=0,o=this._badness,a=this.buffer,h=this.width;for(s=0;sh*h;)u-=h*h,c++;for(r+=c*v.N4,n=0;n=o-2&&(t=o-2,s>9&&t--);var a=t;if(s>9){for(r[a+2]=0,r[a+3]=0;a--;)e=r[a],r[a+3]|=255&e<<4,r[a+2]=e>>4;r[2]|=255&t<<4,r[1]=t>>4,r[0]=64|t>>12}else{for(r[a+1]=0,r[a+2]=0;a--;)e=r[a],r[a+2]|=255&e<<4,r[a+1]=e>>4;r[1]|=255&t<<4,r[0]=64|t>>4}for(a=t+3-(s<10);a=5&&(i+=v.N1+n[e]-5);for(e=3;et||3*n[e-3]>=4*n[e]||3*n[e+3]>=4*n[e])&&(i+=v.N3);return i},_finish:function(){this._stringBuffer=this.buffer.slice();var t,e,i=0,n=3e4;for(e=0;e<8&&(this._applyMask(e),(t=this._checkBadness())>=1)1&n&&(s[r-1-e+8*r]=1,e<6?s[8+r*e]=1:s[8+r*(e+1)]=1);for(e=0;e<7;e++,n>>=1)1&n&&(s[8+r*(r-7+e)]=1,e?s[6-e+8*r]=1:s[7+8*r]=1)},_interleaveBlocks:function(){var t,e,i=this._dataBlock,n=this._ecc,s=this._eccBlock,r=0,o=this._calculateMaxLength(),a=this._neccBlock1,h=this._neccBlock2,f=this._stringBuffer;for(t=0;t1)for(t=u.BLOCK[n],i=s-7;;){for(e=s-7;e>t-3&&(this._addAlignment(e,i),!(e6)for(t=d.BLOCK[r-7],e=17,i=0;i<6;i++)for(n=0;n<3;n++,e--)1&(e>11?r>>e-12:t>>e)?(s[5-i+o*(2-n+o-11)]=1,s[2-n+o-11+o*(5-i)]=1):(this._setMask(5-i,2-n+o-11),this._setMask(2-n+o-11,5-i))},_isMasked:function(t,e){var i=v._getMaskBit(t,e);return 1===this._mask[i]},_pack:function(){var t,e,i,n=1,s=1,r=this.width,o=r-1,a=r-1,h=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(e=0;ee&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,i+=t},_modN:function(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t},N1:3,N2:3,N3:40,N4:10}),p=v,m=f.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var t=this.element;t.width=t.height=this.qrious.size}}),g=h.extend(function(t,e,i,n){this.name=t,this.modifiable=Boolean(e),this.defaultValue=i,this._valueTransformer=n},{transform:function(t){var e=this._valueTransformer;return"function"==typeof e?e(t,this):t}}),k=h.extend(null,{abs:function(t){return null!=t?Math.abs(t):null},hasOwn:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},noop:function(){},toUpperCase:function(t){return null!=t?t.toUpperCase():null}}),w=h.extend(function(t){this.options={},t.forEach(function(t){this.options[t.name]=t},this)},{exists:function(t){return null!=this.options[t]},get:function(t,e){return w._get(this.options[t],e)},getAll:function(t){var e,i=this.options,n={};for(e in i)k.hasOwn(i,e)&&(n[e]=w._get(i[e],t));return n},init:function(t,e,i){"function"!=typeof i&&(i=k.noop);var n,s;for(n in this.options)k.hasOwn(this.options,n)&&(s=this.options[n],w._set(s,s.defaultValue,e),w._createAccessor(s,e,i));this._setAll(t,e,!0)},set:function(t,e,i){return this._set(t,e,i)},setAll:function(t,e){return this._setAll(t,e)},_set:function(t,e,i,n){var s=this.options[t];if(!s)throw new Error("Invalid option: "+t);if(!s.modifiable&&!n)throw new Error("Option cannot be modified: "+t);return w._set(s,e,i)},_setAll:function(t,e,i){if(!t)return!1;var n,s=!1;for(n in t)k.hasOwn(t,n)&&this._set(n,t[n],e,i)&&(s=!0);return s}},{_createAccessor:function(t,e,i){var n={get:function(){return w._get(t,e)}};t.modifiable&&(n.set=function(n){w._set(t,n,e)&&i(n,t)}),Object.defineProperty(e,t.name,n)},_get:function(t,e){return e["_"+t.name]},_set:function(t,e,i){var n="_"+t.name,s=i[n],r=t.transform(null!=e?e:t.defaultValue);return i[n]=r,r!==s}}),M=w,b=h.extend(function(){this._services={}},{getService:function(t){var e=this._services[t];if(!e)throw new Error("Service is not being managed with name: "+t);return e},setService:function(t,e){if(this._services[t])throw new Error("Service is already managed with name: "+t);e&&(this._services[t]=e)}}),B=new M([new g("background",!0,"white"),new g("backgroundAlpha",!0,1,k.abs),new g("element"),new g("foreground",!0,"black"),new g("foregroundAlpha",!0,1,k.abs),new g("level",!0,"L",k.toUpperCase),new g("mime",!0,"image/png"),new g("padding",!0,null,k.abs),new g("size",!0,100,k.abs),new g("value",!0,"")]),y=new b,O=h.extend(function(t){B.init(t,this,this.update.bind(this));var e=B.get("element",this),i=y.getService("element"),n=e&&i.isCanvas(e)?e:i.createCanvas(),s=e&&i.isImage(e)?e:i.createImage();this._canvasRenderer=new c(this,n,!0),this._imageRenderer=new m(this,s,s===e),this.update()},{get:function(){return B.getAll(this)},set:function(t){B.setAll(t,this)&&this.update()},toDataURL:function(t){return this.canvas.toDataURL(t||this.mime)},update:function(){var t=new p({level:this.level,value:this.value});this._canvasRenderer.render(t),this._imageRenderer.render(t)}},{use:function(t){y.setService(t.getName(),t)}});Object.defineProperties(O.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var A=O,L=h.extend({getName:function(){}}).extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(t){},isImage:function(t){}}).extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(t){return t instanceof HTMLCanvasElement},isImage:function(t){return t instanceof HTMLImageElement}});return A.use(new L),A}); + +//# sourceMappingURL=qrious.min.js.map diff --git a/imports/ui/util/qrious.min.js.map b/imports/ui/util/qrious.min.js.map new file mode 100644 index 0000000..ff65e0b --- /dev/null +++ b/imports/ui/util/qrious.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"qrious.min.js","sources":["../node_modules/nevis/src/extend.js","../node_modules/nevis/src/nevis.js","../node_modules/qrious-core/src/renderer/Renderer.js","../node_modules/qrious-core/src/renderer/CanvasRenderer.js","../node_modules/qrious-core/src/Alignment.js","../node_modules/qrious-core/src/ErrorCorrection.js","../node_modules/qrious-core/src/Galois.js","../node_modules/qrious-core/src/Version.js","../node_modules/qrious-core/src/Frame.js","../node_modules/qrious-core/src/renderer/ImageRenderer.js","../node_modules/qrious-core/src/option/Option.js","../node_modules/qrious-core/src/util/Utilities.js","../node_modules/qrious-core/src/option/OptionManager.js","../node_modules/qrious-core/src/service/ServiceManager.js","../node_modules/qrious-core/src/QRious.js","../node_modules/qrious-core/src/service/Service.js","../node_modules/qrious-core/src/service/element/ElementService.js","../src/service/element/BrowserElementService.js","../src/QRious.js"],"sourcesContent":["/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * A bare-bones constructor for surrogate prototype swapping.\n *\n * @private\n * @constructor\n */\nvar Constructor = /* istanbul ignore next */ function() {};\n/**\n * A reference to Object.prototype.hasOwnProperty.\n *\n * @private\n * @type {Function}\n */\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * A reference to Array.prototype.slice.\n *\n * @private\n * @type {Function}\n */\nvar slice = Array.prototype.slice;\n\n/**\n * Creates an object which inherits the given prototype.\n *\n * Optionally, the created object can be extended further with the specified properties.\n *\n * @param {Object} prototype - the prototype to be inherited by the created object\n * @param {Object} [properties] - the optional properties to be extended by the created object\n * @return {Object} The newly created object.\n * @private\n */\nfunction createObject(prototype, properties) {\n var result;\n /* istanbul ignore next */\n if (typeof Object.create === 'function') {\n result = Object.create(prototype);\n } else {\n Constructor.prototype = prototype;\n result = new Constructor();\n Constructor.prototype = null;\n }\n\n if (properties) {\n extendObject(true, result, properties);\n }\n\n return result;\n}\n\n/**\n * Extends the constructor to which this method is associated with the prototype and/or\n * statics provided.\n *\n * If name is provided, it will be used as the class name and can be accessed via a special\n * class_ property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString), but this is not applicable to the lite version of Nevis.\n *\n * If constructor is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_ property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor provided or the one created if none was given.\n * @public\n */\nfunction extend(name, constructor, prototype, statics) {\n var superConstructor = this;\n\n if (typeof name !== 'string') {\n statics = prototype;\n prototype = constructor;\n constructor = name;\n name = null;\n }\n\n if (typeof constructor !== 'function') {\n statics = prototype;\n prototype = constructor;\n constructor = function() {\n return superConstructor.apply(this, arguments);\n };\n }\n\n extendObject(false, constructor, superConstructor, statics);\n\n constructor.prototype = createObject(superConstructor.prototype, prototype);\n constructor.prototype.constructor = constructor;\n\n constructor.class_ = name || superConstructor.class_;\n constructor.super_ = superConstructor;\n\n return constructor;\n}\n\n/**\n * Extends the specified target object with the properties in each of the sources provided.\n *\n * if any source is null it will be ignored.\n *\n * @param {boolean} own - true to only copy own properties from sources onto\n * target; otherwise false\n * @param {Object} target - the target object which should be extended\n * @param {...Object} [sources] - the source objects whose properties are to be copied onto target\n * @return {void}\n * @private\n */\nfunction extendObject(own, target, sources) {\n sources = slice.call(arguments, 2);\n\n var property;\n var source;\n\n for (var i = 0, length = sources.length; i < length; i++) {\n source = sources[i];\n\n for (property in source) {\n if (!own || hasOwnProperty.call(source, property)) {\n target[property] = source[property];\n }\n }\n }\n}\n\nmodule.exports = extend;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar extend = require('./extend');\n\n/**\n * The base class from which all others should extend.\n *\n * @public\n * @constructor\n */\nfunction Nevis() {}\nNevis.class_ = 'Nevis';\nNevis.super_ = Object;\n\n/**\n * Extends the constructor to which this method is associated with the prototype and/or\n * statics provided.\n *\n * If name is provided, it will be used as the class name and can be accessed via a special\n * class_ property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString), but this is not applicable to the lite version of Nevis.\n *\n * If constructor is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_ property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor provided or the one created if none was given.\n * @public\n * @static\n * @memberof Nevis\n */\nNevis.extend = extend;\n\nmodule.exports = Nevis;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Responsible for rendering a QR code {@link Frame} on a specific type of element.\n *\n * A renderer may be dependant on the rendering of another element, so the ordering of their execution is important.\n *\n * The rendering of a element can be deferred by disabling the renderer initially, however, any attempt get the element\n * from the renderer will result in it being immediately enabled and the element being rendered.\n *\n * @param {QRious} qrious - the {@link QRious} instance to be used\n * @param {*} element - the element onto which the QR code is to be rendered\n * @param {boolean} [enabled] - true this {@link Renderer} is enabled; otherwise false.\n * @public\n * @class\n * @extends Nevis\n */\nvar Renderer = Nevis.extend(function(qrious, element, enabled) {\n /**\n * The {@link QRious} instance.\n *\n * @protected\n * @type {QRious}\n * @memberof Renderer#\n */\n this.qrious = qrious;\n\n /**\n * The element onto which this {@link Renderer} is rendering the QR code.\n *\n * @protected\n * @type {*}\n * @memberof Renderer#\n */\n this.element = element;\n this.element.qrious = qrious;\n\n /**\n * Whether this {@link Renderer} is enabled.\n *\n * @protected\n * @type {boolean}\n * @memberof Renderer#\n */\n this.enabled = Boolean(enabled);\n}, {\n\n /**\n * Draws the specified QR code frame on the underlying element.\n *\n * Implementations of {@link Renderer} must override this method with their own specific logic.\n *\n * @param {Frame} frame - the {@link Frame} to be drawn\n * @return {void}\n * @protected\n * @abstract\n * @memberof Renderer#\n */\n draw: function(frame) {},\n\n /**\n * Returns the element onto which this {@link Renderer} is rendering the QR code.\n *\n * If this method is called while this {@link Renderer} is disabled, it will be immediately enabled and rendered\n * before the element is returned.\n *\n * @return {*} The element.\n * @public\n * @memberof Renderer#\n */\n getElement: function() {\n if (!this.enabled) {\n this.enabled = true;\n this.render();\n }\n\n return this.element;\n },\n\n /**\n * Calculates the size (in pixel units) to represent an individual module within the QR code based on the\n * frame provided.\n *\n * Any configured padding will be excluded from the returned size.\n *\n * The returned value will be at least one, even in cases where the size of the QR code does not fit its contents.\n * This is done so that the inevitable clipping is handled more gracefully since this way at least something is\n * displayed instead of just a blank space filled by the background color.\n *\n * @param {Frame} frame - the {@link Frame} from which the module size is to be derived\n * @return {number} The pixel size for each module in the QR code which will be no less than one.\n * @protected\n * @memberof Renderer#\n */\n getModuleSize: function(frame) {\n var qrious = this.qrious;\n var padding = qrious.padding || 0;\n var pixels = Math.floor((qrious.size - (padding * 2)) / frame.width);\n\n return Math.max(1, pixels);\n },\n\n /**\n * Calculates the offset/padding (in pixel units) to be inserted before the QR code based on the frame\n * provided.\n *\n * The returned value will be zero if there is no available offset or if the size of the QR code does not fit its\n * contents. It will never be a negative value. This is done so that the inevitable clipping appears more naturally\n * and it is not clipped from all directions.\n *\n * @param {Frame} frame - the {@link Frame} from which the offset is to be derived\n * @return {number} The pixel offset for the QR code which will be no less than zero.\n * @protected\n * @memberof Renderer#\n */\n getOffset: function(frame) {\n var qrious = this.qrious;\n var padding = qrious.padding;\n\n if (padding != null) {\n return padding;\n }\n\n var moduleSize = this.getModuleSize(frame);\n var offset = Math.floor((qrious.size - (moduleSize * frame.width)) / 2);\n\n return Math.max(0, offset);\n },\n\n /**\n * Renders a QR code on the underlying element based on the frame provided.\n *\n * @param {Frame} frame - the {@link Frame} to be rendered\n * @return {void}\n * @public\n * @memberof Renderer#\n */\n render: function(frame) {\n if (this.enabled) {\n this.resize();\n this.reset();\n this.draw(frame);\n }\n },\n\n /**\n * Resets the underlying element, effectively clearing any previously rendered QR code.\n *\n * Implementations of {@link Renderer} must override this method with their own specific logic.\n *\n * @return {void}\n * @protected\n * @abstract\n * @memberof Renderer#\n */\n reset: function() {},\n\n /**\n * Ensures that the size of the underlying element matches that defined on the associated {@link QRious} instance.\n *\n * Implementations of {@link Renderer} must override this method with their own specific logic.\n *\n * @return {void}\n * @protected\n * @abstract\n * @memberof Renderer#\n */\n resize: function() {}\n\n});\n\nmodule.exports = Renderer;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Renderer = require('./Renderer');\n\n/**\n * An implementation of {@link Renderer} for working with canvas elements.\n *\n * @public\n * @class\n * @extends Renderer\n */\nvar CanvasRenderer = Renderer.extend({\n\n /**\n * @override\n */\n draw: function(frame) {\n var i, j;\n var qrious = this.qrious;\n var moduleSize = this.getModuleSize(frame);\n var offset = this.getOffset(frame);\n var context = this.element.getContext('2d');\n\n context.fillStyle = qrious.foreground;\n context.globalAlpha = qrious.foregroundAlpha;\n\n for (i = 0; i < frame.width; i++) {\n for (j = 0; j < frame.width; j++) {\n if (frame.buffer[(j * frame.width) + i]) {\n context.fillRect((moduleSize * i) + offset, (moduleSize * j) + offset, moduleSize, moduleSize);\n }\n }\n }\n },\n\n /**\n * @override\n */\n reset: function() {\n var qrious = this.qrious;\n var context = this.element.getContext('2d');\n var size = qrious.size;\n\n context.lineWidth = 1;\n context.clearRect(0, 0, size, size);\n context.fillStyle = qrious.background;\n context.globalAlpha = qrious.backgroundAlpha;\n context.fillRect(0, 0, size, size);\n },\n\n /**\n * @override\n */\n resize: function() {\n var element = this.element;\n\n element.width = element.height = this.qrious.size;\n }\n\n});\n\nmodule.exports = CanvasRenderer;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\n/* eslint no-multi-spaces: \"off\" */\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains alignment pattern information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Alignment = Nevis.extend(null, {\n\n /**\n * The alignment pattern block.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof Alignment\n */\n BLOCK: [\n 0, 11, 15, 19, 23, 27, 31,\n 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24,\n 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28\n ]\n\n});\n\nmodule.exports = Alignment;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\n/* eslint no-multi-spaces: \"off\" */\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains error correction information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar ErrorCorrection = Nevis.extend(null, {\n\n /**\n * The error correction blocks.\n *\n * There are four elements per version. The first two indicate the number of blocks, then the data width, and finally\n * the ECC width.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof ErrorCorrection\n */\n BLOCKS: [\n 1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17,\n 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28,\n 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22,\n 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16,\n 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22,\n 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28,\n 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26,\n 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26,\n 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24,\n 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28,\n 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24,\n 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28,\n 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22,\n 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24,\n 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24,\n 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30,\n 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28,\n 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28,\n 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26,\n 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28,\n 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30,\n 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24,\n 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30,\n 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30,\n 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30,\n 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30,\n 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30,\n 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30,\n 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30,\n 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30,\n 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30,\n 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30,\n 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30,\n 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30,\n 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30,\n 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30,\n 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,\n 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30,\n 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30,\n 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30\n ],\n\n /**\n * The final format bits with mask (level << 3 | mask).\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof ErrorCorrection\n */\n FINAL_FORMAT: [\n // L\n 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976,\n // M\n 0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0,\n // Q\n 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed,\n // H\n 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b\n ],\n\n /**\n * A map of human-readable ECC levels.\n *\n * @public\n * @static\n * @type {Object.}\n * @memberof ErrorCorrection\n */\n LEVELS: {\n L: 1,\n M: 2,\n Q: 3,\n H: 4\n }\n\n});\n\nmodule.exports = ErrorCorrection;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains Galois field information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Galois = Nevis.extend(null, {\n\n /**\n * The Galois field exponent table.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof Galois\n */\n EXPONENT: [\n 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,\n 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,\n 0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,\n 0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,\n 0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,\n 0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,\n 0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,\n 0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,\n 0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,\n 0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,\n 0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,\n 0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,\n 0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,\n 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,\n 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,\n 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00\n ],\n\n /**\n * The Galois field log table.\n *\n * @public\n * @static\n * @type {number[]}\n *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d3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2,\n 0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6,\n 0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a,\n 0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7,\n 0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf\n ]\n\n});\n\nmodule.exports = Galois;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains version pattern information.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Version = Nevis.extend(null, {\n\n /**\n * The version pattern block.\n *\n * @public\n * @static\n * @type {number[]}\n * @memberof Version\n */\n BLOCK: [\n 0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, 0x928, 0xb78, 0x45d, 0xa17, 0x532,\n 0x9a6, 0x683, 0x8c9, 0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, 0x250, 0x9d5,\n 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, 0x541, 0xc69\n ]\n\n});\n\nmodule.exports = Version;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar Alignment = require('./Alignment');\nvar ErrorCorrection = require('./ErrorCorrection');\nvar Galois = require('./Galois');\nvar Version = require('./Version');\n\n/**\n * Generates information for a QR code frame based on a specific value to be encoded.\n *\n * @param {Frame~Options} options - the options to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar Frame = Nevis.extend(function(options) {\n var dataBlock, eccBlock, index, neccBlock1, neccBlock2;\n var valueLength = options.value.length;\n\n this._badness = [];\n this._level = ErrorCorrection.LEVELS[options.level];\n this._polynomial = [];\n this._value = options.value;\n this._version = 0;\n this._stringBuffer = [];\n\n while (this._version < 40) {\n this._version++;\n\n index = ((this._level - 1) * 4) + ((this._version - 1) * 16);\n\n neccBlock1 = ErrorCorrection.BLOCKS[index++];\n neccBlock2 = ErrorCorrection.BLOCKS[index++];\n dataBlock = ErrorCorrection.BLOCKS[index++];\n eccBlock = ErrorCorrection.BLOCKS[index];\n\n index = (dataBlock * (neccBlock1 + neccBlock2)) + neccBlock2 - 3 + (this._version <= 9);\n\n if (valueLength <= index) {\n break;\n }\n }\n\n this._dataBlock = dataBlock;\n this._eccBlock = eccBlock;\n this._neccBlock1 = neccBlock1;\n this._neccBlock2 = neccBlock2;\n\n /**\n * The data width is based on version.\n *\n * @public\n * @type {number}\n * @memberof Frame#\n */\n // FIXME: Ensure that it fits instead of being truncated.\n var width = this.width = 17 + (4 * this._version);\n\n /**\n * The image buffer.\n *\n * @public\n * @type {number[]}\n * @memberof Frame#\n */\n this.buffer = Frame._createArray(width * width);\n\n this._ecc = Frame._createArray(dataBlock + ((dataBlock + eccBlock) * (neccBlock1 + neccBlock2)) + neccBlock2);\n this._mask = Frame._createArray(((width * (width + 1)) + 1) / 2);\n\n this._insertFinders();\n this._insertAlignments();\n\n // Insert single foreground cell.\n this.buffer[8 + (width * (width - 8))] = 1;\n\n this._insertTimingGap();\n this._reverseMask();\n this._insertTimingRowAndColumn();\n this._insertVersion();\n this._syncMask();\n this._convertBitStream(valueLength);\n this._calculatePolynomial();\n this._appendEccToData();\n this._interleaveBlocks();\n this._pack();\n this._finish();\n}, {\n\n _addAlignment: function(x, y) {\n var i;\n var buffer = this.buffer;\n var width = this.width;\n\n buffer[x + (width * y)] = 1;\n\n for (i = -2; i < 2; i++) {\n buffer[x + i + (width * (y - 2))] = 1;\n buffer[x - 2 + (width * (y + i + 1))] = 1;\n buffer[x + 2 + (width * (y + i))] = 1;\n buffer[x + i + 1 + (width * (y + 2))] = 1;\n }\n\n for (i = 0; i < 2; i++) {\n this._setMask(x - 1, y + i);\n this._setMask(x + 1, y - i);\n this._setMask(x - i, y - 1);\n this._setMask(x + i, y + 1);\n }\n },\n\n _appendData: function(data, dataLength, ecc, eccLength) {\n var bit, i, j;\n var polynomial = this._polynomial;\n var stringBuffer = this._stringBuffer;\n\n for (i = 0; i < eccLength; i++) {\n stringBuffer[ecc + i] = 0;\n }\n\n for (i = 0; i < dataLength; i++) {\n bit = Galois.LOG[stringBuffer[data + i] ^ stringBuffer[ecc]];\n\n if (bit !== 255) {\n for (j = 1; j < eccLength; j++) {\n stringBuffer[ecc + j - 1] = stringBuffer[ecc + j] ^\n Galois.EXPONENT[Frame._modN(bit + polynomial[eccLength - j])];\n }\n } else {\n for (j = ecc; j < ecc + eccLength; j++) {\n stringBuffer[j] = stringBuffer[j + 1];\n }\n }\n\n stringBuffer[ecc + eccLength - 1] = bit === 255 ? 0 : Galois.EXPONENT[Frame._modN(bit + polynomial[0])];\n }\n },\n\n _appendEccToData: function() {\n var i;\n var data = 0;\n var dataBlock = this._dataBlock;\n var ecc = this._calculateMaxLength();\n var eccBlock = this._eccBlock;\n\n for (i = 0; i < this._neccBlock1; i++) {\n this._appendData(data, dataBlock, ecc, eccBlock);\n\n data += dataBlock;\n ecc += eccBlock;\n }\n\n for (i = 0; i < this._neccBlock2; i++) {\n this._appendData(data, dataBlock + 1, ecc, eccBlock);\n\n data += dataBlock + 1;\n ecc += eccBlock;\n }\n },\n\n _applyMask: function(mask) {\n var r3x, r3y, x, y;\n var buffer = this.buffer;\n var width = this.width;\n\n switch (mask) {\n case 0:\n for (y = 0; y < width; y++) {\n for (x = 0; x < width; x++) {\n if (!((x + y) & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 1:\n for (y = 0; y < width; y++) {\n for (x = 0; x < width; x++) {\n if (!(y & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 2:\n for (y = 0; y < width; y++) {\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!r3x && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 3:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = r3y, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!r3x && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 4:\n for (y = 0; y < width; y++) {\n for (r3x = 0, r3y = (y >> 1) & 1, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n r3y = !r3y;\n }\n\n if (!r3y && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 5:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!((x & y & 1) + !(!r3x | !r3y)) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 6:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!((x & y & 1) + (r3x && r3x === r3y) & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n case 7:\n for (r3y = 0, y = 0; y < width; y++, r3y++) {\n if (r3y === 3) {\n r3y = 0;\n }\n\n for (r3x = 0, x = 0; x < width; x++, r3x++) {\n if (r3x === 3) {\n r3x = 0;\n }\n\n if (!((r3x && r3x === r3y) + (x + y & 1) & 1) && !this._isMasked(x, y)) {\n buffer[x + (y * width)] ^= 1;\n }\n }\n }\n\n break;\n }\n },\n\n _calculateMaxLength: function() {\n return (this._dataBlock * (this._neccBlock1 + this._neccBlock2)) + this._neccBlock2;\n },\n\n _calculatePolynomial: function() {\n var i, j;\n var eccBlock = this._eccBlock;\n var polynomial = this._polynomial;\n\n polynomial[0] = 1;\n\n for (i = 0; i < eccBlock; i++) {\n polynomial[i + 1] = 1;\n\n for (j = i; j > 0; j--) {\n polynomial[j] = polynomial[j] ? polynomial[j - 1] ^\n Galois.EXPONENT[Frame._modN(Galois.LOG[polynomial[j]] + i)] : polynomial[j - 1];\n }\n\n polynomial[0] = Galois.EXPONENT[Frame._modN(Galois.LOG[polynomial[0]] + i)];\n }\n\n // Use logs for generator polynomial to save calculation step.\n for (i = 0; i <= eccBlock; i++) {\n polynomial[i] = Galois.LOG[polynomial[i]];\n }\n },\n\n _checkBadness: function() {\n var b, b1, h, x, y;\n var bad = 0;\n var badness = this._badness;\n var buffer = this.buffer;\n var width = this.width;\n\n // Blocks of same colour.\n for (y = 0; y < width - 1; y++) {\n for (x = 0; x < width - 1; x++) {\n // All foreground colour.\n if ((buffer[x + (width * y)] &&\n buffer[x + 1 + (width * y)] &&\n buffer[x + (width * (y + 1))] &&\n buffer[x + 1 + (width * (y + 1))]) ||\n // All background colour.\n !(buffer[x + (width * y)] ||\n buffer[x + 1 + (width * y)] ||\n buffer[x + (width * (y + 1))] ||\n buffer[x + 1 + (width * (y + 1))])) {\n bad += Frame.N2;\n }\n }\n }\n\n var bw = 0;\n\n // X runs.\n for (y = 0; y < width; y++) {\n h = 0;\n\n badness[0] = 0;\n\n for (b = 0, x = 0; x < width; x++) {\n b1 = buffer[x + (width * y)];\n\n if (b === b1) {\n badness[h]++;\n } else {\n badness[++h] = 1;\n }\n\n b = b1;\n bw += b ? 1 : -1;\n }\n\n bad += this._getBadness(h);\n }\n\n if (bw < 0) {\n bw = -bw;\n }\n\n var count = 0;\n var big = bw;\n big += big << 2;\n big <<= 1;\n\n while (big > width * width) {\n big -= width * width;\n count++;\n }\n\n bad += count * Frame.N4;\n\n // Y runs.\n for (x = 0; x < width; x++) {\n h = 0;\n\n badness[0] = 0;\n\n for (b = 0, y = 0; y < width; y++) {\n b1 = buffer[x + (width * y)];\n\n if (b === b1) {\n badness[h]++;\n } else {\n badness[++h] = 1;\n }\n\n b = b1;\n }\n\n bad += this._getBadness(h);\n }\n\n return bad;\n },\n\n _convertBitStream: function(length) {\n var bit, i;\n var ecc = this._ecc;\n var version = this._version;\n\n // Convert string to bit stream. 8-bit data to QR-coded 8-bit data (numeric, alphanumeric, or kanji not supported).\n for (i = 0; i < length; i++) {\n ecc[i] = this._value.charCodeAt(i);\n }\n\n var stringBuffer = this._stringBuffer = ecc.slice();\n var maxLength = this._calculateMaxLength();\n\n if (length >= maxLength - 2) {\n length = maxLength - 2;\n\n if (version > 9) {\n length--;\n }\n }\n\n // Shift and re-pack to insert length prefix.\n var index = length;\n\n if (version > 9) {\n stringBuffer[index + 2] = 0;\n stringBuffer[index + 3] = 0;\n\n while (index--) {\n bit = stringBuffer[index];\n\n stringBuffer[index + 3] |= 255 & (bit << 4);\n stringBuffer[index + 2] = bit >> 4;\n }\n\n stringBuffer[2] |= 255 & (length << 4);\n stringBuffer[1] = length >> 4;\n stringBuffer[0] = 0x40 | (length >> 12);\n } else {\n stringBuffer[index + 1] = 0;\n stringBuffer[index + 2] = 0;\n\n while (index--) {\n bit = stringBuffer[index];\n\n stringBuffer[index + 2] |= 255 & (bit << 4);\n stringBuffer[index + 1] = bit >> 4;\n }\n\n stringBuffer[1] |= 255 & (length << 4);\n stringBuffer[0] = 0x40 | (length >> 4);\n }\n\n // Fill to end with pad pattern.\n index = length + 3 - (version < 10);\n\n while (index < maxLength) {\n stringBuffer[index++] = 0xec;\n stringBuffer[index++] = 0x11;\n }\n },\n\n _getBadness: function(length) {\n var i;\n var badRuns = 0;\n var badness = this._badness;\n\n for (i = 0; i <= length; i++) {\n if (badness[i] >= 5) {\n badRuns += Frame.N1 + badness[i] - 5;\n }\n }\n\n // FBFFFBF as in finder.\n for (i = 3; i < length - 1; i += 2) {\n if (badness[i - 2] === badness[i + 2] &&\n badness[i + 2] === badness[i - 1] &&\n badness[i - 1] === badness[i + 1] &&\n badness[i - 1] * 3 === badness[i] &&\n // Background around the foreground pattern? Not part of the specs.\n (badness[i - 3] === 0 || i + 3 > length ||\n badness[i - 3] * 3 >= badness[i] * 4 ||\n badness[i + 3] * 3 >= badness[i] * 4)) {\n badRuns += Frame.N3;\n }\n }\n\n return badRuns;\n },\n\n _finish: function() {\n // Save pre-mask copy of frame.\n this._stringBuffer = this.buffer.slice();\n\n var currentMask, i;\n var bit = 0;\n var mask = 30000;\n\n /*\n * Using for instead of while since in original Arduino code if an early mask was \"good enough\" it wouldn't try for\n * a better one since they get more complex and take longer.\n */\n for (i = 0; i < 8; i++) {\n // Returns foreground-background imbalance.\n this._applyMask(i);\n\n currentMask = this._checkBadness();\n\n // Is current mask better than previous best?\n if (currentMask < mask) {\n mask = currentMask;\n bit = i;\n }\n\n // Don't increment \"i\" to a void redoing mask.\n if (bit === 7) {\n break;\n }\n\n // Reset for next pass.\n this.buffer = this._stringBuffer.slice();\n }\n\n // Redo best mask as none were \"good enough\" (i.e. last wasn't bit).\n if (bit !== i) {\n this._applyMask(bit);\n }\n\n // Add in final mask/ECC level bytes.\n mask = ErrorCorrection.FINAL_FORMAT[bit + (this._level - 1 << 3)];\n\n var buffer = this.buffer;\n var width = this.width;\n\n // Low byte.\n for (i = 0; i < 8; i++, mask >>= 1) {\n if (mask & 1) {\n buffer[width - 1 - i + (width * 8)] = 1;\n\n if (i < 6) {\n buffer[8 + (width * i)] = 1;\n } else {\n buffer[8 + (width * (i + 1))] = 1;\n }\n }\n }\n\n // High byte.\n for (i = 0; i < 7; i++, mask >>= 1) {\n if (mask & 1) {\n buffer[8 + (width * (width - 7 + i))] = 1;\n\n if (i) {\n buffer[6 - i + (width * 8)] = 1;\n } else {\n buffer[7 + (width * 8)] = 1;\n }\n }\n }\n },\n\n _interleaveBlocks: function() {\n var i, j;\n var dataBlock = this._dataBlock;\n var ecc = this._ecc;\n var eccBlock = this._eccBlock;\n var k = 0;\n var maxLength = this._calculateMaxLength();\n var neccBlock1 = this._neccBlock1;\n var neccBlock2 = this._neccBlock2;\n var stringBuffer = this._stringBuffer;\n\n for (i = 0; i < dataBlock; i++) {\n for (j = 0; j < neccBlock1; j++) {\n ecc[k++] = stringBuffer[i + (j * dataBlock)];\n }\n\n for (j = 0; j < neccBlock2; j++) {\n ecc[k++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))];\n }\n }\n\n for (j = 0; j < neccBlock2; j++) {\n ecc[k++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))];\n }\n\n for (i = 0; i < eccBlock; i++) {\n for (j = 0; j < neccBlock1 + neccBlock2; j++) {\n ecc[k++] = stringBuffer[maxLength + i + (j * eccBlock)];\n }\n }\n\n this._stringBuffer = ecc;\n },\n\n _insertAlignments: function() {\n var i, x, y;\n var version = this._version;\n var width = this.width;\n\n if (version > 1) {\n i = Alignment.BLOCK[version];\n y = width - 7;\n\n for (;;) {\n x = width - 7;\n\n while (x > i - 3) {\n this._addAlignment(x, y);\n\n if (x < i) {\n break;\n }\n\n x -= i;\n }\n\n if (y <= i + 9) {\n break;\n }\n\n y -= i;\n\n this._addAlignment(6, y);\n this._addAlignment(y, 6);\n }\n }\n },\n\n _insertFinders: function() {\n var i, j, x, y;\n var buffer = this.buffer;\n var width = this.width;\n\n for (i = 0; i < 3; i++) {\n j = 0;\n y = 0;\n\n if (i === 1) {\n j = width - 7;\n }\n if (i === 2) {\n y = width - 7;\n }\n\n buffer[y + 3 + (width * (j + 3))] = 1;\n\n for (x = 0; x < 6; x++) {\n buffer[y + x + (width * j)] = 1;\n buffer[y + (width * (j + x + 1))] = 1;\n buffer[y + 6 + (width * (j + x))] = 1;\n buffer[y + x + 1 + (width * (j + 6))] = 1;\n }\n\n for (x = 1; x < 5; x++) {\n this._setMask(y + x, j + 1);\n this._setMask(y + 1, j + x + 1);\n this._setMask(y + 5, j + x);\n this._setMask(y + x + 1, j + 5);\n }\n\n for (x = 2; x < 4; x++) {\n buffer[y + x + (width * (j + 2))] = 1;\n buffer[y + 2 + (width * (j + x + 1))] = 1;\n buffer[y + 4 + (width * (j + x))] = 1;\n buffer[y + x + 1 + (width * (j + 4))] = 1;\n }\n }\n },\n\n _insertTimingGap: function() {\n var x, y;\n var width = this.width;\n\n for (y = 0; y < 7; y++) {\n this._setMask(7, y);\n this._setMask(width - 8, y);\n this._setMask(7, y + width - 7);\n }\n\n for (x = 0; x < 8; x++) {\n this._setMask(x, 7);\n this._setMask(x + width - 8, 7);\n this._setMask(x, width - 8);\n }\n },\n\n _insertTimingRowAndColumn: function() {\n var x;\n var buffer = this.buffer;\n var width = this.width;\n\n for (x = 0; x < width - 14; x++) {\n if (x & 1) {\n this._setMask(8 + x, 6);\n this._setMask(6, 8 + x);\n } else {\n buffer[8 + x + (width * 6)] = 1;\n buffer[6 + (width * (8 + x))] = 1;\n }\n }\n },\n\n _insertVersion: function() {\n var i, j, x, y;\n var buffer = this.buffer;\n var version = this._version;\n var width = this.width;\n\n if (version > 6) {\n i = Version.BLOCK[version - 7];\n j = 17;\n\n for (x = 0; x < 6; x++) {\n for (y = 0; y < 3; y++, j--) {\n if (1 & (j > 11 ? version >> j - 12 : i >> j)) {\n buffer[5 - x + (width * (2 - y + width - 11))] = 1;\n buffer[2 - y + width - 11 + (width * (5 - x))] = 1;\n } else {\n this._setMask(5 - x, 2 - y + width - 11);\n this._setMask(2 - y + width - 11, 5 - x);\n }\n }\n }\n }\n },\n\n _isMasked: function(x, y) {\n var bit = Frame._getMaskBit(x, y);\n\n return this._mask[bit] === 1;\n },\n\n _pack: function() {\n var bit, i, j;\n var k = 1;\n var v = 1;\n var width = this.width;\n var x = width - 1;\n var y = width - 1;\n\n // Interleaved data and ECC codes.\n var length = ((this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2)) + this._neccBlock2;\n\n for (i = 0; i < length; i++) {\n bit = this._stringBuffer[i];\n\n for (j = 0; j < 8; j++, bit <<= 1) {\n if (0x80 & bit) {\n this.buffer[x + (width * y)] = 1;\n }\n\n // Find next fill position.\n do {\n if (v) {\n x--;\n } else {\n x++;\n\n if (k) {\n if (y !== 0) {\n y--;\n } else {\n x -= 2;\n k = !k;\n\n if (x === 6) {\n x--;\n y = 9;\n }\n }\n } else if (y !== width - 1) {\n y++;\n } else {\n x -= 2;\n k = !k;\n\n if (x === 6) {\n x--;\n y -= 8;\n }\n }\n }\n\n v = !v;\n } while (this._isMasked(x, y));\n }\n }\n },\n\n _reverseMask: function() {\n var x, y;\n var width = this.width;\n\n for (x = 0; x < 9; x++) {\n this._setMask(x, 8);\n }\n\n for (x = 0; x < 8; x++) {\n this._setMask(x + width - 8, 8);\n this._setMask(8, x);\n }\n\n for (y = 0; y < 7; y++) {\n this._setMask(8, y + width - 7);\n }\n },\n\n _setMask: function(x, y) {\n var bit = Frame._getMaskBit(x, y);\n\n this._mask[bit] = 1;\n },\n\n _syncMask: function() {\n var x, y;\n var width = this.width;\n\n for (y = 0; y < width; y++) {\n for (x = 0; x <= y; x++) {\n if (this.buffer[x + (width * y)]) {\n this._setMask(x, y);\n }\n }\n }\n }\n\n}, {\n\n _createArray: function(length) {\n var i;\n var array = [];\n\n for (i = 0; i < length; i++) {\n array[i] = 0;\n }\n\n return array;\n },\n\n _getMaskBit: function(x, y) {\n var bit;\n\n if (x > y) {\n bit = x;\n x = y;\n y = bit;\n }\n\n bit = y;\n bit += y * y;\n bit >>= 1;\n bit += x;\n\n return bit;\n },\n\n _modN: function(x) {\n while (x >= 255) {\n x -= 255;\n x = (x >> 8) + (x & 255);\n }\n\n return x;\n },\n\n // *Badness* coefficients.\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n\n});\n\nmodule.exports = Frame;\n\n/**\n * The options used by {@link Frame}.\n *\n * @typedef {Object} Frame~Options\n * @property {string} level - The ECC level to be used.\n * @property {string} value - The value to be encoded.\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Renderer = require('./Renderer');\n\n/**\n * An implementation of {@link Renderer} for working with img elements.\n *\n * This depends on {@link CanvasRenderer} being executed first as this implementation simply applies the data URL from\n * the rendered canvas element as the src for the img element being rendered.\n *\n * @public\n * @class\n * @extends Renderer\n */\nvar ImageRenderer = Renderer.extend({\n\n /**\n * @override\n */\n draw: function() {\n this.element.src = this.qrious.toDataURL();\n },\n\n /**\n * @override\n */\n reset: function() {\n this.element.src = '';\n },\n\n /**\n * @override\n */\n resize: function() {\n var element = this.element;\n\n element.width = element.height = this.qrious.size;\n }\n\n});\n\nmodule.exports = ImageRenderer;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Defines an available option while also configuring how values are applied to the target object.\n *\n * Optionally, a default value can be specified as well a value transformer for greater control over how the option\n * value is applied.\n *\n * If no value transformer is specified, then any specified option will be applied directly. All values are maintained\n * on the target object itself as a field using the option name prefixed with a single underscore.\n *\n * When an option is specified as modifiable, the {@link OptionManager} will be required to include a setter for the\n * property that is defined on the target object that uses the option name.\n *\n * @param {string} name - the name to be used\n * @param {boolean} [modifiable] - true if the property defined on target objects should include a setter;\n * otherwise false\n * @param {*} [defaultValue] - the default value to be used\n * @param {Option~ValueTransformer} [valueTransformer] - the value transformer to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar Option = Nevis.extend(function(name, modifiable, defaultValue, valueTransformer) {\n /**\n * The name for this {@link Option}.\n *\n * @public\n * @type {string}\n * @memberof Option#\n */\n this.name = name;\n\n /**\n * Whether a setter should be included on the property defined on target objects for this {@link Option}.\n *\n * @public\n * @type {boolean}\n * @memberof Option#\n */\n this.modifiable = Boolean(modifiable);\n\n /**\n * The default value for this {@link Option}.\n *\n * @public\n * @type {*}\n * @memberof Option#\n */\n this.defaultValue = defaultValue;\n\n this._valueTransformer = valueTransformer;\n}, {\n\n /**\n * Transforms the specified value so that it can be applied for this {@link Option}.\n *\n * If a value transformer has been specified for this {@link Option}, it will be called upon to transform\n * value. Otherwise, value will be returned directly.\n *\n * @param {*} value - the value to be transformed\n * @return {*} The transformed value or value if no value transformer is specified.\n * @public\n * @memberof Option#\n */\n transform: function(value) {\n var transformer = this._valueTransformer;\n if (typeof transformer === 'function') {\n return transformer(value, this);\n }\n\n return value;\n }\n\n});\n\nmodule.exports = Option;\n\n/**\n * Returns a transformed value for the specified value to be applied for the option provided.\n *\n * @callback Option~ValueTransformer\n * @param {*} value - the value to be transformed\n * @param {Option} option - the {@link Option} for which value is being transformed\n * @return {*} The transform value.\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains utility methods that are useful throughout the library.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Utilities = Nevis.extend(null, {\n\n /**\n * Returns the absolute value of a given number.\n *\n * This method is simply a convenient shorthand for Math.abs while ensuring that nulls are returned as\n * null instead of zero.\n *\n * @param {number} value - the number whose absolute value is to be returned\n * @return {number} The absolute value of value or null if value is\n * null.\n * @public\n * @static\n * @memberof Utilities\n */\n abs: function(value) {\n return value != null ? Math.abs(value) : null;\n },\n\n /**\n * Returns whether the specified object has a property with the specified name as an own\n * (not inherited) property.\n *\n * @param {Object} object - the object on which the property is to be checked\n * @param {string} name - the name of the property to be checked\n * @return {boolean} true if object has an own property with name.\n * @public\n * @static\n * @memberof Utilities\n */\n hasOwn: function(object, name) {\n return Object.prototype.hasOwnProperty.call(object, name);\n },\n\n /**\n * A non-operation method that does absolutely nothing.\n *\n * @return {void}\n * @public\n * @static\n * @memberof Utilities\n */\n noop: function() {},\n\n /**\n * Transforms the specified string to upper case while remaining null-safe.\n *\n * @param {string} string - the string to be transformed to upper case\n * @return {string} string transformed to upper case if string is not null.\n * @public\n * @static\n * @memberof Utilities\n */\n toUpperCase: function(string) {\n return string != null ? string.toUpperCase() : null;\n }\n\n});\n\nmodule.exports = Utilities;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar Utilities = require('../util/Utilities');\n\n/**\n * Manages multiple {@link Option} instances that are intended to be used by multiple implementations.\n *\n * Although the option definitions are shared between targets, the values are maintained on the targets themselves.\n *\n * @param {Option[]} options - the options to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar OptionManager = Nevis.extend(function(options) {\n /**\n * The available options for this {@link OptionManager}.\n *\n * @public\n * @type {Object.}\n * @memberof OptionManager#\n */\n this.options = {};\n\n options.forEach(function(option) {\n this.options[option.name] = option;\n }, this);\n}, {\n\n /**\n * Returns whether an option with the specified name is available.\n *\n * @param {string} name - the name of the {@link Option} whose existence is to be checked\n * @return {boolean} true if an {@link Option} exists with name; otherwise\n * false.\n * @public\n * @memberof OptionManager#\n */\n exists: function(name) {\n return this.options[name] != null;\n },\n\n /**\n * Returns the value of the option with the specified name on the target object provided.\n *\n * @param {string} name - the name of the {@link Option} whose value on target is to be returned\n * @param {Object} target - the object from which the value of the named {@link Option} is to be returned\n * @return {*} The value of the {@link Option} with name on target.\n * @public\n * @memberof OptionManager#\n */\n get: function(name, target) {\n return OptionManager._get(this.options[name], target);\n },\n\n /**\n * Returns a copy of all of the available options on the target object provided.\n *\n * @param {Object} target - the object from which the option name/value pairs are to be returned\n * @return {Object.} A hash containing the name/value pairs of all options on target.\n * @public\n * @memberof OptionManager#\n */\n getAll: function(target) {\n var name;\n var options = this.options;\n var result = {};\n\n for (name in options) {\n if (Utilities.hasOwn(options, name)) {\n result[name] = OptionManager._get(options[name], target);\n }\n }\n\n return result;\n },\n\n /**\n * Initializes the available options for the target object provided and then applies the initial values\n * within the speciifed options.\n *\n * This method will throw an error if any of the names within options does not match an available option.\n *\n * This involves setting the default values and defining properties for all of the available options on\n * target before finally calling {@link OptionMananger#setAll} with options and\n * target. Any options that are configured to be modifiable will have a setter included in their defined\n * property that will allow its corresponding value to be modified.\n *\n * If a change handler is specified, it will be called whenever the value changes on target for a\n * modifiable option, but only when done so via the defined property's setter.\n *\n * @param {Object.} options - the name/value pairs of the initial options to be set\n * @param {Object} target - the object on which the options are to be initialized\n * @param {Function} [changeHandler] - the function to be called whenever the value of an modifiable option changes on\n * target\n * @return {void}\n * @throws {Error} If options contains an invalid option name.\n * @public\n * @memberof OptionManager#\n */\n init: function(options, target, changeHandler) {\n if (typeof changeHandler !== 'function') {\n changeHandler = Utilities.noop;\n }\n\n var name, option;\n\n for (name in this.options) {\n if (Utilities.hasOwn(this.options, name)) {\n option = this.options[name];\n\n OptionManager._set(option, option.defaultValue, target);\n OptionManager._createAccessor(option, target, changeHandler);\n }\n }\n\n this._setAll(options, target, true);\n },\n\n /**\n * Sets the value of the option with the specified name on the target object provided to\n * value.\n *\n * This method will throw an error if name does not match an available option or matches an option that\n * cannot be modified.\n *\n * If value is null and the {@link Option} has a default value configured, then that default\n * value will be used instead. If the {@link Option} also has a value transformer configured, it will be used to\n * transform whichever value was determined to be used.\n *\n * This method returns whether the value of the underlying field on target was changed as a result.\n *\n * @param {string} name - the name of the {@link Option} whose value is to be set\n * @param {*} value - the value to be set for the named {@link Option} on target\n * @param {Object} target - the object on which value is to be set for the named {@link Option}\n * @return {boolean} true if the underlying field on target was changed; otherwise\n * false.\n * @throws {Error} If name is invalid or is for an option that cannot be modified.\n * @public\n * @memberof OptionManager#\n */\n set: function(name, value, target) {\n return this._set(name, value, target);\n },\n\n /**\n * Sets all of the specified options on the target object provided to their corresponding\n * values.\n *\n * This method will throw an error if any of the names within options does not match an available option\n * or matches an option that cannot be modified.\n *\n * If any value within options is null and the corresponding {@link Option} has a default\n * value configured, then that default value will be used instead. If an {@link Option} also has a value transformer\n * configured, it will be used to transform whichever value was determined to be used.\n *\n * This method returns whether the value for any of the underlying fields on target were changed as a\n * result.\n *\n * @param {Object.} options - the name/value pairs of options to be set\n * @param {Object} target - the object on which the options are to be set\n * @return {boolean} true if any of the underlying fields on target were changed; otherwise\n * false.\n * @throws {Error} If options contains an invalid option name or an option that cannot be modiifed.\n * @public\n * @memberof OptionManager#\n */\n setAll: function(options, target) {\n return this._setAll(options, target);\n },\n\n _set: function(name, value, target, allowUnmodifiable) {\n var option = this.options[name];\n if (!option) {\n throw new Error('Invalid option: ' + name);\n }\n if (!option.modifiable && !allowUnmodifiable) {\n throw new Error('Option cannot be modified: ' + name);\n }\n\n return OptionManager._set(option, value, target);\n },\n\n _setAll: function(options, target, allowUnmodifiable) {\n if (!options) {\n return false;\n }\n\n var name;\n var changed = false;\n\n for (name in options) {\n if (Utilities.hasOwn(options, name) && this._set(name, options[name], target, allowUnmodifiable)) {\n changed = true;\n }\n }\n\n return changed;\n }\n\n}, {\n\n _createAccessor: function(option, target, changeHandler) {\n var descriptor = {\n get: function() {\n return OptionManager._get(option, target);\n }\n };\n\n if (option.modifiable) {\n descriptor.set = function(value) {\n if (OptionManager._set(option, value, target)) {\n changeHandler(value, option);\n }\n };\n }\n\n Object.defineProperty(target, option.name, descriptor);\n },\n\n _get: function(option, target) {\n return target['_' + option.name];\n },\n\n _set: function(option, value, target) {\n var fieldName = '_' + option.name;\n var oldValue = target[fieldName];\n var newValue = option.transform(value != null ? value : option.defaultValue);\n\n target[fieldName] = newValue;\n\n return newValue !== oldValue;\n }\n\n});\n\nmodule.exports = OptionManager;\n\n/**\n * Called whenever the value of a modifiable {@link Option} is changed on a target object via the defined property's\n * setter.\n *\n * @callback OptionManager~ChangeHandler\n * @param {*} value - the new value for option on the target object\n * @param {Option} option - the modifable {@link Option} whose value has changed on the target object.\n * @return {void}\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * A basic manager for {@link Service} implementations that are mapped to simple names.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar ServiceManager = Nevis.extend(function() {\n this._services = {};\n}, {\n\n /**\n * Returns the {@link Service} being managed with the specified name.\n *\n * @param {string} name - the name of the {@link Service} to be returned\n * @return {Service} The {@link Service} is being managed with name.\n * @throws {Error} If no {@link Service} is being managed with name.\n * @public\n * @memberof ServiceManager#\n */\n getService: function(name) {\n var service = this._services[name];\n if (!service) {\n throw new Error('Service is not being managed with name: ' + name);\n }\n\n return service;\n },\n\n /**\n * Sets the {@link Service} implementation to be managed for the specified name to the\n * service provided.\n *\n * @param {string} name - the name of the {@link Service} to be managed with name\n * @param {Service} service - the {@link Service} implementation to be managed\n * @return {void}\n * @throws {Error} If a {@link Service} is already being managed with the same name.\n * @public\n * @memberof ServiceManager#\n */\n setService: function(name, service) {\n if (this._services[name]) {\n throw new Error('Service is already managed with name: ' + name);\n }\n\n if (service) {\n this._services[name] = service;\n }\n }\n\n});\n\nmodule.exports = ServiceManager;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar CanvasRenderer = require('./renderer/CanvasRenderer');\nvar Frame = require('./Frame');\nvar ImageRenderer = require('./renderer/ImageRenderer');\nvar Option = require('./option/Option');\nvar OptionManager = require('./option/OptionManager');\nvar ServiceManager = require('./service/ServiceManager');\nvar Utilities = require('./util/Utilities');\n\nvar optionManager = new OptionManager([\n new Option('background', true, 'white'),\n new Option('backgroundAlpha', true, 1, Utilities.abs),\n new Option('element'),\n new Option('foreground', true, 'black'),\n new Option('foregroundAlpha', true, 1, Utilities.abs),\n new Option('level', true, 'L', Utilities.toUpperCase),\n new Option('mime', true, 'image/png'),\n new Option('padding', true, null, Utilities.abs),\n new Option('size', true, 100, Utilities.abs),\n new Option('value', true, '')\n]);\nvar serviceManager = new ServiceManager();\n\n/**\n * Enables configuration of a QR code generator which uses HTML5 canvas for rendering.\n *\n * @param {QRious~Options} [options] - the options to be used\n * @throws {Error} If any options are invalid.\n * @public\n * @class\n * @extends Nevis\n */\nvar QRious = Nevis.extend(function(options) {\n optionManager.init(options, this, this.update.bind(this));\n\n var element = optionManager.get('element', this);\n var elementService = serviceManager.getService('element');\n var canvas = element && elementService.isCanvas(element) ? element : elementService.createCanvas();\n var image = element && elementService.isImage(element) ? element : elementService.createImage();\n\n this._canvasRenderer = new CanvasRenderer(this, canvas, true);\n this._imageRenderer = new ImageRenderer(this, image, image === element);\n\n this.update();\n}, {\n\n /**\n * Returns all of the options configured for this {@link QRious}.\n *\n * Any changes made to the returned object will not be reflected in the options themselves or their corresponding\n * underlying fields.\n *\n * @return {Object.} A copy of the applied options.\n * @public\n * @memberof QRious#\n */\n get: function() {\n return optionManager.getAll(this);\n },\n\n /**\n * Sets all of the specified options and automatically updates this {@link QRious} if any of the\n * underlying fields are changed as a result.\n *\n * This is the preferred method for updating multiple options at one time to avoid unnecessary updates between\n * changes.\n *\n * @param {QRious~Options} options - the options to be set\n * @return {void}\n * @throws {Error} If any options are invalid or cannot be modified.\n * @public\n * @memberof QRious#\n */\n set: function(options) {\n if (optionManager.setAll(options, this)) {\n this.update();\n }\n },\n\n /**\n * Returns the image data URI for the generated QR code using the mime provided.\n *\n * @param {string} [mime] - the MIME type for the image\n * @return {string} The image data URI for the QR code.\n * @public\n * @memberof QRious#\n */\n toDataURL: function(mime) {\n return this.canvas.toDataURL(mime || this.mime);\n },\n\n /**\n * Updates this {@link QRious} by generating a new {@link Frame} and re-rendering the QR code.\n *\n * @return {void}\n * @protected\n * @memberof QRious#\n */\n update: function() {\n var frame = new Frame({\n level: this.level,\n value: this.value\n });\n\n this._canvasRenderer.render(frame);\n this._imageRenderer.render(frame);\n }\n\n}, {\n\n /**\n * Configures the service provided to be used by all {@link QRious} instances.\n *\n * @param {Service} service - the {@link Service} to be configured\n * @return {void}\n * @throws {Error} If a {@link Service} has already been configured with the same name.\n * @public\n * @static\n * @memberof QRious\n */\n use: function(service) {\n serviceManager.setService(service.getName(), service);\n }\n\n});\n\nObject.defineProperties(QRious.prototype, {\n\n canvas: {\n /**\n * Returns the canvas element being used to render the QR code for this {@link QRious}.\n *\n * @return {*} The canvas element.\n * @public\n * @memberof QRious#\n * @alias canvas\n */\n get: function() {\n return this._canvasRenderer.getElement();\n }\n },\n\n image: {\n /**\n * Returns the img element being used to render the QR code for this {@link QRious}.\n *\n * @return {*} The img element.\n * @public\n * @memberof QRious#\n * @alias image\n */\n get: function() {\n return this._imageRenderer.getElement();\n }\n }\n\n});\n\nmodule.exports = QRious;\n\n/**\n * The options used by {@link QRious}.\n *\n * @typedef {Object} QRious~Options\n * @property {string} [background=\"white\"] - The background color to be applied to the QR code.\n * @property {number} [backgroundAlpha=1] - The background alpha to be applied to the QR code.\n * @property {*} [element] - The element to be used to render the QR code which may either be an canvas or\n * img. The element(s) will be created if needed.\n * @property {string} [foreground=\"black\"] - The foreground color to be applied to the QR code.\n * @property {number} [foregroundAlpha=1] - The foreground alpha to be applied to the QR code.\n * @property {string} [level=\"L\"] - The error correction level to be applied to the QR code.\n * @property {string} [mime=\"image/png\"] - The MIME type to be used to render the image for the QR code.\n * @property {number} [padding] - The padding for the QR code in pixels.\n * @property {number} [size=100] - The size of the QR code in pixels.\n * @property {string} [value=\"\"] - The value to be encoded within the QR code.\n */\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Defines a service contract that must be met by all implementations.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Service = Nevis.extend({\n\n /**\n * Returns the name of this {@link Service}.\n *\n * @return {string} The service name.\n * @public\n * @abstract\n * @memberof Service#\n */\n getName: function() {}\n\n});\n\nmodule.exports = Service;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar Service = require('../Service');\n\n/**\n * A service for working with elements.\n *\n * @public\n * @class\n * @extends Service\n */\nvar ElementService = Service.extend({\n\n /**\n * Creates an instance of a canvas element.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @return {*} The newly created canvas element.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n createCanvas: function() {},\n\n /**\n * Creates an instance of a image element.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @return {*} The newly created image element.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n createImage: function() {},\n\n /**\n * @override\n */\n getName: function() {\n return 'element';\n },\n\n /**\n * Returns whether the specified element is a canvas.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @param {*} element - the element to be checked\n * @return {boolean} true if element is a canvas; otherwise false.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n isCanvas: function(element) {},\n\n /**\n * Returns whether the specified element is an image.\n *\n * Implementations of {@link ElementService} must override this method with their own specific logic.\n *\n * @param {*} element - the element to be checked\n * @return {boolean} true if element is an image; otherwise false.\n * @public\n * @abstract\n * @memberof ElementService#\n */\n isImage: function(element) {}\n\n});\n\nmodule.exports = ElementService;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar ElementService = require('qrious-core/src/service/element/ElementService');\n\n/**\n * An implementation of {@link ElementService} intended for use within a browser environment.\n *\n * @public\n * @class\n * @extends ElementService\n */\nvar BrowserElementService = ElementService.extend({\n\n /**\n * @override\n */\n createCanvas: function() {\n return document.createElement('canvas');\n },\n\n /**\n * @override\n */\n createImage: function() {\n return document.createElement('img');\n },\n\n /**\n * @override\n */\n isCanvas: function(element) {\n return element instanceof HTMLCanvasElement;\n },\n\n /**\n * @override\n */\n isImage: function(element) {\n return element instanceof HTMLImageElement;\n }\n\n});\n\nmodule.exports = BrowserElementService;\n","/*\n * QRious\n * Copyright (C) 2017 Alasdair Mercer\n * Copyright (C) 2010 Tom Zerucha\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\n'use strict';\n\nvar QRious = require('qrious-core');\n\nvar BrowserElementService = require('./service/element/BrowserElementService');\n\nQRious.use(new BrowserElementService());\n\nmodule.exports = QRious;\n"],"names":["createObject","prototype","properties","result","Object","create","Constructor","extendObject","extend","name","constructor","statics","superConstructor","this","apply","arguments","class_","super_","own","target","sources","property","source","i","length","slice","call","hasOwnProperty","Nevis","Array","qrious","element","enabled","Boolean","draw","frame","getElement","render","getModuleSize","padding","pixels","Math","floor","size","width","max","getOffset","moduleSize","offset","resize","reset","Renderer","j","context","getContext","fillStyle","foreground","globalAlpha","foregroundAlpha","buffer","fillRect","lineWidth","clearRect","background","backgroundAlpha","height","BLOCK","BLOCKS","FINAL_FORMAT","LEVELS","L","M","Q","H","EXPONENT","LOG","Frame","options","dataBlock","eccBlock","index","neccBlock1","neccBlock2","valueLength","value","_badness","_level","ErrorCorrection","level","_polynomial","_value","_version","_stringBuffer","_dataBlock","_eccBlock","_neccBlock1","_neccBlock2","_createArray","_ecc","_mask","_insertFinders","_insertAlignments","_insertTimingGap","_reverseMask","_insertTimingRowAndColumn","_insertVersion","_syncMask","_convertBitStream","_calculatePolynomial","_appendEccToData","_interleaveBlocks","_pack","_finish","_addAlignment","x","y","_setMask","_appendData","data","dataLength","ecc","eccLength","bit","polynomial","stringBuffer","Galois","_modN","_calculateMaxLength","_applyMask","mask","r3x","r3y","_isMasked","_checkBadness","b","b1","h","bad","badness","N2","bw","_getBadness","count","big","N4","version","charCodeAt","maxLength","badRuns","N1","N3","currentMask","k","Alignment","Version","_getMaskBit","v","array","src","toDataURL","modifiable","defaultValue","valueTransformer","_valueTransformer","transform","transformer","abs","hasOwn","object","noop","toUpperCase","string","OptionManager","forEach","option","exists","get","_get","getAll","Utilities","init","changeHandler","_set","_createAccessor","_setAll","set","setAll","allowUnmodifiable","Error","changed","descriptor","defineProperty","fieldName","oldValue","newValue","_services","getService","service","setService","optionManager","Option","serviceManager","ServiceManager","QRious","update","bind","elementService","canvas","isCanvas","createCanvas","image","isImage","createImage","_canvasRenderer","CanvasRenderer","_imageRenderer","ImageRenderer","mime","use","getName","defineProperties","document","createElement","HTMLCanvasElement","HTMLImageElement","BrowserElementService"],"mappings":";;;kLAwDA,SAASA,EAAaC,EAAWC,GAC/B,IAAIC,EAcJ,MAZ6B,mBAAlB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AK,WACH,OAAOuB,EAAcrB,OAAOrK,OAgB9B4K,IAAK,SAAS5G,GACR0H,EAAcb,OAAO7G,EAAShE,OAChCA,KAAK+L,UAYT7C,UAAW,SAAS0D,GAClB,OAAO5M,KAAKkM,OAAOhD,UAAU0D,GAAQ5M,KAAK4M,OAU5Cb,OAAQ,WACN,IAAIzK,EAAQ,IAAIyC,GACdY,MAAO3E,KAAK2E,MACZJ,MAAOvE,KAAKuE,QAGdvE,KAAKwM,gBAAgBhL,OAAOF,GAC5BtB,KAAK0M,eAAelL,OAAOF,MAe7BuL,IAAK,SAASrB,GACZI,EAAeH,WAAWD,EAAQsB,UAAWtB,MAKjDjM,OAAOwN,iBAAiBjB,EAAO1M,WAE7B8M,QASE/B,IAAK,WACH,OAAOnK,KAAKwM,gBAAgBjL,eAIhC8K,OASElC,IAAK,WACH,OAAOnK,KAAK0M,eAAenL,uBAMhBuK,ICtJH/K,EAAMpB,QAUlBmN,QAAS,eCVkBnN,QAY3ByM,aAAc,aAYdG,YAAa,aAKbO,QAAS,WACP,MAAO,WAcTX,SAAU,SAASjL,KAanBoL,QAAS,SAASpL,OCzDuBvB,QAKzCyM,aAAc,WACZ,OAAOY,SAASC,cAAc,WAMhCV,YAAa,WACX,OAAOS,SAASC,cAAc,QAMhCd,SAAU,SAASjL,GACjB,OAAOA,aAAmBgM,mBAM5BZ,QAAS,SAASpL,GAChB,OAAOA,aAAmBiM,6BChCvBN,IAAI,IAAIO,GAEEtB"} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..f582900 --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "simple-todos-react", + "private": true, + "scripts": { + "start": "meteor run", + "build": "npm install --omit=dev && meteor build --architecture os.linux.x86_64 --server-only ../", + "test": "meteor test --once --driver-package meteortesting:mocha", + "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha", + "visualize": "meteor --production --extra-packages bundle-visualizer" + }, + "dependencies": { + "@babel/runtime": "^7.16.7", + "@emotion/react": "^11.10.0", + "@emotion/styled": "^11.10.0", + "@mui/icons-material": "^5.10.2", + "@mui/material": "^5.10.2", + "bcrypt": "^5.0.1", + "classnames": "^2.2.6", + "csv-parse": "^5.3.0", + "dayjs": "^1.11.3", + "html5-qrcode": "^2.2.0", + "jquery": "^3.6.0", + "lodash": "^4.17.15", + "meteor-node-stubs": "^1.0.0", + "moment": "^2.29.2", + "mongodb": "^4.4.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-router-dom": "^6.3.0", + "umbrellajs": "^3.3.1", + "underscore": "^1.13.2", + "winston": "^3.7.2", + "winston-daily-rotate-file": "^4.6.1", + "ws": "^8.4.2" + }, + "meteor": { + "mainModule": { + "client": "client/main.jsx", + "server": "server/main.js" + }, + "testModule": "tests/main.js" + }, + "devDependencies": { + "chai": "^4.2.0" + } +} diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..7e6f5eb Binary files /dev/null and b/public/favicon.png differ diff --git a/public/fonts/Courgette-Regular.ttf b/public/fonts/Courgette-Regular.ttf new file mode 100644 index 0000000..ba095b5 Binary files /dev/null and b/public/fonts/Courgette-Regular.ttf differ diff --git a/public/fonts/KaushanScript-Regular.ttf b/public/fonts/KaushanScript-Regular.ttf new file mode 100644 index 0000000..bcda314 Binary files /dev/null and b/public/fonts/KaushanScript-Regular.ttf differ diff --git a/public/fonts/MaterialIcons-Regular.codepoints b/public/fonts/MaterialIcons-Regular.codepoints new file mode 100644 index 0000000..865f065 --- /dev/null +++ b/public/fonts/MaterialIcons-Regular.codepoints @@ -0,0 +1,2218 @@ +10k e951 +10mp e952 +11mp e953 +123 eb8d +12mp e954 +13mp e955 +14mp e956 +15mp e957 +16mp e958 +17mp e959 +18_up_rating f8fd +18mp e95a +19mp e95b +1k e95c +1k_plus e95d +1x_mobiledata efcd +20mp e95e +21mp e95f +22mp e960 +23mp e961 +24mp e962 +2k e963 +2k_plus e964 +2mp e965 +30fps efce +30fps_select efcf +360 e577 +3d_rotation e84d +3g_mobiledata efd0 +3k e966 +3k_plus e967 +3mp e968 +3p efd1 +4g_mobiledata efd2 +4g_plus_mobiledata efd3 +4k e072 +4k_plus e969 +4mp e96a +5g ef38 +5k e96b +5k_plus e96c +5mp e96d +60fps efd4 +60fps_select efd5 +6_ft_apart f21e +6k e96e +6k_plus e96f +6mp e970 +7k e971 +7k_plus e972 +7mp e973 +8k e974 +8k_plus e975 +8mp e976 +9k e977 +9k_plus e978 +9mp e979 +abc eb94 +ac_unit eb3b +access_alarm e190 +access_alarms e191 +access_time e192 +access_time_filled efd6 +accessibility e84e +accessibility_new e92c +accessible e914 +accessible_forward e934 +account_balance e84f +account_balance_wallet e850 +account_box e851 +account_circle e853 +account_tree e97a +ad_units ef39 +adb e60e +add e145 +add_a_photo e439 +add_alarm e193 +add_alert e003 +add_box e146 +add_business e729 +add_call e0e8 +add_card eb86 +add_chart e97b +add_circle e147 +add_circle_outline e148 +add_comment e266 +add_home f8eb +add_home_work f8ed +add_ic_call e97c +add_link e178 +add_location e567 +add_location_alt ef3a +add_moderator e97d +add_photo_alternate e43e +add_reaction e1d3 +add_road ef3b +add_shopping_cart e854 +add_task f23a +add_to_drive e65c +add_to_home_screen e1fe +add_to_photos e39d +add_to_queue e05c +addchart ef3c +adf_scanner eada +adjust e39e +admin_panel_settings ef3d +adobe ea96 +ads_click e762 +agriculture ea79 +air efd8 +airline_seat_flat e630 +airline_seat_flat_angled e631 +airline_seat_individual_suite e632 +airline_seat_legroom_extra e633 +airline_seat_legroom_normal e634 +airline_seat_legroom_reduced e635 +airline_seat_recline_extra e636 +airline_seat_recline_normal e637 +airline_stops e7d0 +airlines e7ca +airplane_ticket efd9 +airplanemode_active e195 +airplanemode_inactive e194 +airplanemode_off e194 +airplanemode_on e195 +airplay e055 +airport_shuttle eb3c +alarm e855 +alarm_add e856 +alarm_off e857 +alarm_on e858 +album e019 +align_horizontal_center e00f +align_horizontal_left e00d +align_horizontal_right e010 +align_vertical_bottom e015 +align_vertical_center e011 +align_vertical_top e00c +all_inbox e97f +all_inclusive eb3d +all_out e90b +alt_route f184 +alternate_email e0e6 +amp_stories ea13 +analytics ef3e +anchor f1cd +android e859 +animation e71c +announcement e85a +aod efda +apartment ea40 +api f1b7 +app_blocking ef3f +app_registration ef40 +app_settings_alt ef41 +app_shortcut eae4 +apple ea80 +approval e982 +apps e5c3 +apps_outage e7cc +architecture ea3b +archive e149 +area_chart e770 +arrow_back e5c4 +arrow_back_ios e5e0 +arrow_back_ios_new e2ea +arrow_circle_down f181 +arrow_circle_left eaa7 +arrow_circle_right eaaa +arrow_circle_up f182 +arrow_downward e5db +arrow_drop_down e5c5 +arrow_drop_down_circle e5c6 +arrow_drop_up e5c7 +arrow_forward e5c8 +arrow_forward_ios e5e1 +arrow_left e5de +arrow_outward f8ce +arrow_right e5df +arrow_right_alt e941 +arrow_upward e5d8 +art_track e060 +article ef42 +aspect_ratio e85b +assessment e85c +assignment e85d +assignment_ind e85e +assignment_late e85f +assignment_return e860 +assignment_returned e861 +assignment_turned_in e862 +assist_walker f8d5 +assistant e39f +assistant_direction e988 +assistant_navigation e989 +assistant_photo e3a0 +assured_workload eb6f +atm e573 +attach_email ea5e +attach_file e226 +attach_money e227 +attachment e2bc +attractions ea52 +attribution efdb +audio_file eb82 +audiotrack e3a1 +auto_awesome e65f +auto_awesome_mosaic e660 +auto_awesome_motion e661 +auto_delete ea4c +auto_fix_high e663 +auto_fix_normal e664 +auto_fix_off e665 +auto_graph e4fb +auto_mode ec20 +auto_stories e666 +autofps_select efdc +autorenew e863 +av_timer e01b +baby_changing_station f19b +back_hand e764 +backpack f19c +backspace e14a +backup e864 +backup_table ef43 +badge ea67 +bakery_dining ea53 +balance eaf6 +balcony e58f +ballot e172 +bar_chart e26b +batch_prediction f0f5 +bathroom efdd +bathtub ea41 +battery_0_bar ebdc +battery_1_bar ebd9 +battery_2_bar ebe0 +battery_3_bar ebdd +battery_4_bar ebe2 +battery_5_bar ebd4 +battery_6_bar ebd2 +battery_alert e19c +battery_charging_full e1a3 +battery_full e1a4 +battery_saver efde +battery_std e1a5 +battery_unknown e1a6 +beach_access eb3e +bed efdf +bedroom_baby efe0 +bedroom_child efe1 +bedroom_parent efe2 +bedtime ef44 +bedtime_off eb76 +beenhere e52d +bento f1f4 +bike_scooter ef45 +biotech ea3a +blender efe3 +blind f8d6 +blinds e286 +blinds_closed ec1f +block e14b +block_flipped ef46 +bloodtype efe4 +bluetooth e1a7 +bluetooth_audio e60f +bluetooth_connected e1a8 +bluetooth_disabled e1a9 +bluetooth_drive efe5 +bluetooth_searching e1aa +blur_circular e3a2 +blur_linear e3a3 +blur_off e3a4 +blur_on e3a5 +bolt ea0b +book e865 +book_online f217 +bookmark e866 +bookmark_add e598 +bookmark_added e599 +bookmark_border e867 +bookmark_outline e867 +bookmark_remove e59a +bookmarks e98b +border_all e228 +border_bottom e229 +border_clear e22a +border_color e22b +border_horizontal e22c +border_inner e22d +border_left e22e +border_outer e22f +border_right e230 +border_style e231 +border_top e232 +border_vertical e233 +boy eb67 +branding_watermark e06b +breakfast_dining ea54 +brightness_1 e3a6 +brightness_2 e3a7 +brightness_3 e3a8 +brightness_4 e3a9 +brightness_5 e3aa +brightness_6 e3ab +brightness_7 e3ac +brightness_auto e1ab +brightness_high e1ac +brightness_low e1ad +brightness_medium e1ae +broadcast_on_home f8f8 +broadcast_on_personal f8f9 +broken_image e3ad +browse_gallery ebd1 +browser_not_supported ef47 +browser_updated e7cf +brunch_dining ea73 +brush e3ae +bubble_chart e6dd +bug_report e868 +build e869 +build_circle ef48 +bungalow e591 +burst_mode e43c +bus_alert e98f +business e0af +business_center eb3f +cabin e589 +cable efe6 +cached e86a +cake e7e9 +calculate ea5f +calendar_month ebcc +calendar_today e935 +calendar_view_day e936 +calendar_view_month efe7 +calendar_view_week efe8 +call e0b0 +call_end e0b1 +call_made e0b2 +call_merge e0b3 +call_missed e0b4 +call_missed_outgoing e0e4 +call_received e0b5 +call_split e0b6 +call_to_action e06c +camera e3af +camera_alt e3b0 +camera_enhance e8fc +camera_front e3b1 +camera_indoor efe9 +camera_outdoor efea +camera_rear e3b2 +camera_roll e3b3 +cameraswitch efeb +campaign ef49 +cancel e5c9 +cancel_presentation e0e9 +cancel_schedule_send ea39 +candlestick_chart ead4 +car_crash ebf2 +car_rental ea55 +car_repair ea56 +card_giftcard e8f6 +card_membership e8f7 +card_travel e8f8 +carpenter f1f8 +cases e992 +casino eb40 +cast e307 +cast_connected e308 +cast_for_education efec +castle eab1 +catching_pokemon e508 +category e574 +celebration ea65 +cell_tower ebba +cell_wifi e0ec +center_focus_strong e3b4 +center_focus_weak e3b5 +chair efed +chair_alt efee +chalet e585 +change_circle e2e7 +change_history e86b +charging_station f19d +chat e0b7 +chat_bubble e0ca +chat_bubble_outline e0cb +check e5ca +check_box e834 +check_box_outline_blank e835 +check_circle e86c +check_circle_outline e92d +checklist e6b1 +checklist_rtl e6b3 +checkroom f19e +chevron_left e5cb +chevron_right e5cc +child_care eb41 +child_friendly eb42 +chrome_reader_mode e86d +church eaae +circle ef4a +circle_notifications e994 +class e86e +clean_hands f21f +cleaning_services f0ff +clear e14c +clear_all e0b8 +close e5cd +close_fullscreen f1cf +closed_caption e01c +closed_caption_disabled f1dc +closed_caption_off e996 +cloud e2bd +cloud_circle e2be +cloud_done e2bf +cloud_download e2c0 +cloud_off e2c1 +cloud_queue e2c2 +cloud_sync eb5a +cloud_upload e2c3 +cloudy_snowing e810 +co2 e7b0 +co_present eaf0 +code e86f +code_off e4f3 +coffee efef +coffee_maker eff0 +collections e3b6 +collections_bookmark e431 +color_lens e3b7 +colorize e3b8 +comment e0b9 +comment_bank ea4e +comments_disabled e7a2 +commit eaf5 +commute e940 +compare e3b9 +compare_arrows e915 +compass_calibration e57c +compost e761 +compress e94d +computer e30a +confirmation_num e638 +confirmation_number e638 +connect_without_contact f223 +connected_tv e998 +connecting_airports e7c9 +construction ea3c +contact_emergency f8d1 +contact_mail e0d0 +contact_page f22e +contact_phone e0cf +contact_support e94c +contactless ea71 +contacts e0ba +content_copy e14d +content_cut e14e +content_paste e14f +content_paste_go ea8e +content_paste_off e4f8 +content_paste_search ea9b +contrast eb37 +control_camera e074 +control_point e3ba +control_point_duplicate e3bb +cookie eaac +copy_all e2ec +copyright e90c +coronavirus f221 +corporate_fare f1d0 +cottage e587 +countertops f1f7 +create e150 +create_new_folder e2cc +credit_card e870 +credit_card_off e4f4 +credit_score eff1 +crib e588 +crisis_alert ebe9 +crop e3be +crop_16_9 e3bc +crop_3_2 e3bd +crop_5_4 e3bf +crop_7_5 e3c0 +crop_din e3c1 +crop_free e3c2 +crop_landscape e3c3 +crop_original e3c4 +crop_portrait e3c5 +crop_rotate e437 +crop_square e3c6 +cruelty_free e799 +css eb93 +currency_bitcoin ebc5 +currency_exchange eb70 +currency_franc eafa +currency_lira eaef +currency_pound eaf1 +currency_ruble eaec +currency_rupee eaf7 +currency_yen eafb +currency_yuan eaf9 +curtains ec1e +curtains_closed ec1d +cyclone ebd5 +dangerous e99a +dark_mode e51c +dashboard e871 +dashboard_customize e99b +data_array ead1 +data_exploration e76f +data_object ead3 +data_saver_off eff2 +data_saver_on eff3 +data_thresholding eb9f +data_usage e1af +dataset f8ee +dataset_linked f8ef +date_range e916 +deblur eb77 +deck ea42 +dehaze e3c7 +delete e872 +delete_forever e92b +delete_outline e92e +delete_sweep e16c +delivery_dining ea72 +density_large eba9 +density_medium eb9e +density_small eba8 +departure_board e576 +description e873 +deselect ebb6 +design_services f10a +desk f8f4 +desktop_access_disabled e99d +desktop_mac e30b +desktop_windows e30c +details e3c8 +developer_board e30d +developer_board_off e4ff +developer_mode e1b0 +device_hub e335 +device_thermostat e1ff +device_unknown e339 +devices e1b1 +devices_fold ebde +devices_other e337 +dialer_sip e0bb +dialpad e0bc +diamond ead5 +difference eb7d +dining eff4 +dinner_dining ea57 +directions e52e +directions_bike e52f +directions_boat e532 +directions_boat_filled eff5 +directions_bus e530 +directions_bus_filled eff6 +directions_car e531 +directions_car_filled eff7 +directions_ferry e532 +directions_off f10f +directions_railway e534 +directions_railway_filled eff8 +directions_run e566 +directions_subway e533 +directions_subway_filled eff9 +directions_train e534 +directions_transit e535 +directions_transit_filled effa +directions_walk e536 +dirty_lens ef4b +disabled_by_default f230 +disabled_visible e76e +disc_full e610 +discord ea6c +discount ebc9 +display_settings eb97 +diversity_1 f8d7 +diversity_2 f8d8 +diversity_3 f8d9 +dnd_forwardslash e611 +dns e875 +do_disturb f08c +do_disturb_alt f08d +do_disturb_off f08e +do_disturb_on f08f +do_not_disturb e612 +do_not_disturb_alt e611 +do_not_disturb_off e643 +do_not_disturb_on e644 +do_not_disturb_on_total_silence effb +do_not_step f19f +do_not_touch f1b0 +dock e30e +document_scanner e5fa +domain e7ee +domain_add eb62 +domain_disabled e0ef +domain_verification ef4c +done e876 +done_all e877 +done_outline e92f +donut_large e917 +donut_small e918 +door_back effc +door_front effd +door_sliding effe +doorbell efff +double_arrow ea50 +downhill_skiing e509 +download f090 +download_done f091 +download_for_offline f000 +downloading f001 +drafts e151 +drag_handle e25d +drag_indicator e945 +draw e746 +drive_eta e613 +drive_file_move e675 +drive_file_move_outline e9a1 +drive_file_move_rtl e76d +drive_file_rename_outline e9a2 +drive_folder_upload e9a3 +dry f1b3 +dry_cleaning ea58 +duo e9a5 +dvr e1b2 +dynamic_feed ea14 +dynamic_form f1bf +e_mobiledata f002 +earbuds f003 +earbuds_battery f004 +east f1df +eco ea35 +edgesensor_high f005 +edgesensor_low f006 +edit e3c9 +edit_attributes e578 +edit_calendar e742 +edit_location e568 +edit_location_alt e1c5 +edit_note e745 +edit_notifications e525 +edit_off e950 +edit_road ef4d +egg eacc +egg_alt eac8 +eject e8fb +elderly f21a +elderly_woman eb69 +electric_bike eb1b +electric_bolt ec1c +electric_car eb1c +electric_meter ec1b +electric_moped eb1d +electric_rickshaw eb1e +electric_scooter eb1f +electrical_services f102 +elevator f1a0 +email e0be +emergency e1eb +emergency_recording ebf4 +emergency_share ebf6 +emoji_emotions ea22 +emoji_events ea23 +emoji_flags ea1a +emoji_food_beverage ea1b +emoji_nature ea1c +emoji_objects ea24 +emoji_people ea1d +emoji_symbols ea1e +emoji_transportation ea1f +energy_savings_leaf ec1a +engineering ea3d +enhance_photo_translate e8fc +enhanced_encryption e63f +equalizer e01d +error e000 +error_outline e001 +escalator f1a1 +escalator_warning f1ac +euro ea15 +euro_symbol e926 +ev_station e56d +event e878 +event_available e614 +event_busy e615 +event_note e616 +event_repeat eb7b +event_seat e903 +exit_to_app e879 +expand e94f +expand_circle_down e7cd +expand_less e5ce +expand_more e5cf +explicit e01e +explore e87a +explore_off e9a8 +exposure e3ca +exposure_minus_1 e3cb +exposure_minus_2 e3cc +exposure_neg_1 e3cb +exposure_neg_2 e3cc +exposure_plus_1 e3cd +exposure_plus_2 e3ce +exposure_zero e3cf +extension e87b +extension_off e4f5 +face e87c +face_2 f8da +face_3 f8db +face_4 f8dc +face_5 f8dd +face_6 f8de +face_retouching_natural ef4e +face_retouching_off f007 +facebook f234 +fact_check f0c5 +factory ebbc +family_restroom f1a2 +fast_forward e01f +fast_rewind e020 +fastfood e57a +favorite e87d +favorite_border e87e +favorite_outline e87e +fax ead8 +featured_play_list e06d +featured_video e06e +feed f009 +feedback e87f +female e590 +fence f1f6 +festival ea68 +fiber_dvr e05d +fiber_manual_record e061 +fiber_new e05e +fiber_pin e06a +fiber_smart_record e062 +file_copy e173 +file_download e2c4 +file_download_done e9aa +file_download_off e4fe +file_open eaf3 +file_present ea0e +file_upload e2c6 +filter e3d3 +filter_1 e3d0 +filter_2 e3d1 +filter_3 e3d2 +filter_4 e3d4 +filter_5 e3d5 +filter_6 e3d6 +filter_7 e3d7 +filter_8 e3d8 +filter_9 e3d9 +filter_9_plus e3da +filter_alt ef4f +filter_alt_off eb32 +filter_b_and_w e3db +filter_center_focus e3dc +filter_drama e3dd +filter_frames e3de +filter_hdr e3df +filter_list e152 +filter_list_alt e94e +filter_list_off eb57 +filter_none e3e0 +filter_tilt_shift e3e2 +filter_vintage e3e3 +find_in_page e880 +find_replace e881 +fingerprint e90d +fire_extinguisher f1d8 +fire_hydrant f1a3 +fire_hydrant_alt f8f1 +fire_truck f8f2 +fireplace ea43 +first_page e5dc +fit_screen ea10 +fitbit e82b +fitness_center eb43 +flag e153 +flag_circle eaf8 +flaky ef50 +flare e3e4 +flash_auto e3e5 +flash_off e3e6 +flash_on e3e7 +flashlight_off f00a +flashlight_on f00b +flatware f00c +flight e539 +flight_class e7cb +flight_land e904 +flight_takeoff e905 +flip e3e8 +flip_camera_android ea37 +flip_camera_ios ea38 +flip_to_back e882 +flip_to_front e883 +flood ebe6 +flourescent f00d +flutter_dash e00b +fmd_bad f00e +fmd_good f00f +foggy e818 +folder e2c7 +folder_copy ebbd +folder_delete eb34 +folder_off eb83 +folder_open e2c8 +folder_shared e2c9 +folder_special e617 +folder_zip eb2c +follow_the_signs f222 +font_download e167 +font_download_off e4f9 +food_bank f1f2 +forest ea99 +fork_left eba0 +fork_right ebac +format_align_center e234 +format_align_justify e235 +format_align_left e236 +format_align_right e237 +format_bold e238 +format_clear e239 +format_color_fill e23a +format_color_reset e23b +format_color_text e23c +format_indent_decrease e23d +format_indent_increase e23e +format_italic e23f +format_line_spacing e240 +format_list_bulleted e241 +format_list_numbered e242 +format_list_numbered_rtl e267 +format_overline eb65 +format_paint e243 +format_quote e244 +format_shapes e25e +format_size e245 +format_strikethrough e246 +format_textdirection_l_to_r e247 +format_textdirection_r_to_l e248 +format_underline e249 +format_underlined e249 +fort eaad +forum e0bf +forward e154 +forward_10 e056 +forward_30 e057 +forward_5 e058 +forward_to_inbox f187 +foundation f200 +free_breakfast eb44 +free_cancellation e748 +front_hand e769 +fullscreen e5d0 +fullscreen_exit e5d1 +functions e24a +g_mobiledata f010 +g_translate e927 +gamepad e30f +games e021 +garage f011 +gas_meter ec19 +gavel e90e +generating_tokens e749 +gesture e155 +get_app e884 +gif e908 +gif_box e7a3 +girl eb68 +gite e58b +goat 10fffd +golf_course eb45 +gpp_bad f012 +gpp_good f013 +gpp_maybe f014 +gps_fixed e1b3 +gps_not_fixed e1b4 +gps_off e1b5 +grade e885 +gradient e3e9 +grading ea4f +grain e3ea +graphic_eq e1b8 +grass f205 +grid_3x3 f015 +grid_4x4 f016 +grid_goldenratio f017 +grid_off e3eb +grid_on e3ec +grid_view e9b0 +group e7ef +group_add e7f0 +group_off e747 +group_remove e7ad +group_work e886 +groups f233 +groups_2 f8df +groups_3 f8e0 +h_mobiledata f018 +h_plus_mobiledata f019 +hail e9b1 +handshake ebcb +handyman f10b +hardware ea59 +hd e052 +hdr_auto f01a +hdr_auto_select f01b +hdr_enhanced_select ef51 +hdr_off e3ed +hdr_off_select f01c +hdr_on e3ee +hdr_on_select f01d +hdr_plus f01e +hdr_strong e3f1 +hdr_weak e3f2 +headphones f01f +headphones_battery f020 +headset e310 +headset_mic e311 +headset_off e33a +healing e3f3 +health_and_safety e1d5 +hearing e023 +hearing_disabled f104 +heart_broken eac2 +heat_pump ec18 +height ea16 +help e887 +help_center f1c0 +help_outline e8fd +hevc f021 +hexagon eb39 +hide_image f022 +hide_source f023 +high_quality e024 +highlight e25f +highlight_alt ef52 +highlight_off e888 +highlight_remove e888 +hiking e50a +history e889 +history_edu ea3e +history_toggle_off f17d +hive eaa6 +hls eb8a +hls_off eb8c +holiday_village e58a +home e88a +home_filled e9b2 +home_max f024 +home_mini f025 +home_repair_service f100 +home_work ea09 +horizontal_distribute e014 +horizontal_rule f108 +horizontal_split e947 +hot_tub eb46 +hotel e53a +hotel_class e743 +hourglass_bottom ea5c +hourglass_disabled ef53 +hourglass_empty e88b +hourglass_full e88c +hourglass_top ea5b +house ea44 +house_siding f202 +houseboat e584 +how_to_reg e174 +how_to_vote e175 +html eb7e +http e902 +https e88d +hub e9f4 +hvac f10e +ice_skating e50b +icecream ea69 +image e3f4 +image_aspect_ratio e3f5 +image_not_supported f116 +image_search e43f +imagesearch_roller e9b4 +import_contacts e0e0 +import_export e0c3 +important_devices e912 +inbox e156 +incomplete_circle e79b +indeterminate_check_box e909 +info e88e +info_outline e88f +input e890 +insert_chart e24b +insert_chart_outlined e26a +insert_comment e24c +insert_drive_file e24d +insert_emoticon e24e +insert_invitation e24f +insert_link e250 +insert_page_break eaca +insert_photo e251 +insights f092 +install_desktop eb71 +install_mobile eb72 +integration_instructions ef54 +interests e7c8 +interpreter_mode e83b +inventory e179 +inventory_2 e1a1 +invert_colors e891 +invert_colors_off e0c4 +invert_colors_on e891 +ios_share e6b8 +iron e583 +iso e3f6 +javascript eb7c +join_full eaeb +join_inner eaf4 +join_left eaf2 +join_right eaea +kayaking e50c +kebab_dining e842 +key e73c +key_off eb84 +keyboard e312 +keyboard_alt f028 +keyboard_arrow_down e313 +keyboard_arrow_left e314 +keyboard_arrow_right e315 +keyboard_arrow_up e316 +keyboard_backspace e317 +keyboard_capslock e318 +keyboard_command eae0 +keyboard_command_key eae7 +keyboard_control e5d3 +keyboard_control_key eae6 +keyboard_double_arrow_down ead0 +keyboard_double_arrow_left eac3 +keyboard_double_arrow_right eac9 +keyboard_double_arrow_up eacf +keyboard_hide e31a +keyboard_option eadf +keyboard_option_key eae8 +keyboard_return e31b +keyboard_tab e31c +keyboard_voice e31d +king_bed ea45 +kitchen eb47 +kitesurfing e50d +label e892 +label_important e937 +label_important_outline e948 +label_off e9b6 +label_outline e893 +lan eb2f +landscape e3f7 +landslide ebd7 +language e894 +laptop e31e +laptop_chromebook e31f +laptop_mac e320 +laptop_windows e321 +last_page e5dd +launch e895 +layers e53b +layers_clear e53c +leaderboard f20c +leak_add e3f8 +leak_remove e3f9 +leave_bags_at_home f21b +legend_toggle f11b +lens e3fa +lens_blur f029 +library_add e02e +library_add_check e9b7 +library_books e02f +library_music e030 +light f02a +light_mode e518 +lightbulb e0f0 +lightbulb_circle ebfe +lightbulb_outline e90f +line_axis ea9a +line_style e919 +line_weight e91a +linear_scale e260 +link e157 +link_off e16f +linked_camera e438 +liquor ea60 +list e896 +list_alt e0ee +live_help e0c6 +live_tv e639 +living f02b +local_activity e53f +local_airport e53d +local_atm e53e +local_attraction e53f +local_bar e540 +local_cafe e541 +local_car_wash e542 +local_convenience_store e543 +local_dining e556 +local_drink e544 +local_fire_department ef55 +local_florist e545 +local_gas_station e546 +local_grocery_store e547 +local_hospital e548 +local_hotel e549 +local_laundry_service e54a +local_library e54b +local_mall e54c +local_movies e54d +local_offer e54e +local_parking e54f +local_pharmacy e550 +local_phone e551 +local_pizza e552 +local_play e553 +local_police ef56 +local_post_office e554 +local_print_shop e555 +local_printshop e555 +local_restaurant e556 +local_see e557 +local_shipping e558 +local_taxi e559 +location_city e7f1 +location_disabled e1b6 +location_history e55a +location_off e0c7 +location_on e0c8 +location_pin f1db +location_searching e1b7 +lock e897 +lock_clock ef57 +lock_open e898 +lock_outline e899 +lock_person f8f3 +lock_reset eade +login ea77 +logo_dev ead6 +logout e9ba +looks e3fc +looks_3 e3fb +looks_4 e3fd +looks_5 e3fe +looks_6 e3ff +looks_one e400 +looks_two e401 +loop e028 +loupe e402 +low_priority e16d +loyalty e89a +lte_mobiledata f02c +lte_plus_mobiledata f02d +luggage f235 +lunch_dining ea61 +lyrics ec0b +macro_off f8d2 +mail e158 +mail_lock ec0a +mail_outline e0e1 +male e58e +man e4eb +man_2 f8e1 +man_3 f8e2 +man_4 f8e3 +manage_accounts f02e +manage_history ebe7 +manage_search f02f +map e55b +maps_home_work f030 +maps_ugc ef58 +margin e9bb +mark_as_unread e9bc +mark_chat_read f18b +mark_chat_unread f189 +mark_email_read f18c +mark_email_unread f18a +mark_unread_chat_alt eb9d +markunread e159 +markunread_mailbox e89b +masks f218 +maximize e930 +media_bluetooth_off f031 +media_bluetooth_on f032 +mediation efa7 +medical_information ebed +medical_services f109 +medication f033 +medication_liquid ea87 +meeting_room eb4f +memory e322 +menu e5d2 +menu_book ea19 +menu_open e9bd +merge eb98 +merge_type e252 +message e0c9 +messenger e0ca +messenger_outline e0cb +mic e029 +mic_external_off ef59 +mic_external_on ef5a +mic_none e02a +mic_off e02b +microwave f204 +military_tech ea3f +minimize e931 +minor_crash ebf1 +miscellaneous_services f10c +missed_video_call e073 +mms e618 +mobile_friendly e200 +mobile_off e201 +mobile_screen_share e0e7 +mobiledata_off f034 +mode f097 +mode_comment e253 +mode_edit e254 +mode_edit_outline f035 +mode_fan_off ec17 +mode_night f036 +mode_of_travel e7ce +mode_standby f037 +model_training f0cf +monetization_on e263 +money e57d +money_off e25c +money_off_csred f038 +monitor ef5b +monitor_heart eaa2 +monitor_weight f039 +monochrome_photos e403 +mood e7f2 +mood_bad e7f3 +moped eb28 +more e619 +more_horiz e5d3 +more_time ea5d +more_vert e5d4 +mosque eab2 +motion_photos_auto f03a +motion_photos_off e9c0 +motion_photos_on e9c1 +motion_photos_pause f227 +motion_photos_paused e9c2 +motorcycle e91b +mouse e323 +move_down eb61 +move_to_inbox e168 +move_up eb64 +movie e02c +movie_creation e404 +movie_filter e43a +moving e501 +mp e9c3 +multiline_chart e6df +multiple_stop f1b9 +multitrack_audio e1b8 +museum ea36 +music_note e405 +music_off e440 +music_video e063 +my_library_add e02e +my_library_books e02f +my_library_music e030 +my_location e55c +nat ef5c +nature e406 +nature_people e407 +navigate_before e408 +navigate_next e409 +navigation e55d +near_me e569 +near_me_disabled f1ef +nearby_error f03b +nearby_off f03c +nest_cam_wired_stand ec16 +network_cell e1b9 +network_check e640 +network_locked e61a +network_ping ebca +network_wifi e1ba +network_wifi_1_bar ebe4 +network_wifi_2_bar ebd6 +network_wifi_3_bar ebe1 +new_label e609 +new_releases e031 +newspaper eb81 +next_plan ef5d +next_week e16a +nfc e1bb +night_shelter f1f1 +nightlife ea62 +nightlight f03d +nightlight_round ef5e +nights_stay ea46 +no_accounts f03e +no_adult_content f8fe +no_backpack f237 +no_cell f1a4 +no_crash ebf0 +no_drinks f1a5 +no_encryption e641 +no_encryption_gmailerrorred f03f +no_flash f1a6 +no_food f1a7 +no_luggage f23b +no_meals f1d6 +no_meals_ouline f229 +no_meeting_room eb4e +no_photography f1a8 +no_sim e0cc +no_stroller f1af +no_transfer f1d5 +noise_aware ebec +noise_control_off ebf3 +nordic_walking e50e +north f1e0 +north_east f1e1 +north_west f1e2 +not_accessible f0fe +not_interested e033 +not_listed_location e575 +not_started f0d1 +note e06f +note_add e89c +note_alt f040 +notes e26c +notification_add e399 +notification_important e004 +notifications e7f4 +notifications_active e7f7 +notifications_none e7f5 +notifications_off e7f6 +notifications_on e7f7 +notifications_paused e7f8 +now_wallpaper e1bc +now_widgets e1bd +numbers eac7 +offline_bolt e932 +offline_pin e90a +offline_share e9c5 +oil_barrel ec15 +on_device_training ebfd +ondemand_video e63a +online_prediction f0eb +opacity e91c +open_in_browser e89d +open_in_full f1ce +open_in_new e89e +open_in_new_off e4f6 +open_with e89f +other_houses e58c +outbond f228 +outbound e1ca +outbox ef5f +outdoor_grill ea47 +outgoing_mail f0d2 +outlet f1d4 +outlined_flag e16e +output ebbe +padding e9c8 +pages e7f9 +pageview e8a0 +paid f041 +palette e40a +pan_tool e925 +pan_tool_alt ebb9 +panorama e40b +panorama_fish_eye e40c +panorama_fisheye e40c +panorama_horizontal e40d +panorama_horizontal_select ef60 +panorama_photosphere e9c9 +panorama_photosphere_select e9ca +panorama_vertical e40e +panorama_vertical_select ef61 +panorama_wide_angle e40f +panorama_wide_angle_select ef62 +paragliding e50f +park ea63 +party_mode e7fa +password f042 +pattern f043 +pause e034 +pause_circle e1a2 +pause_circle_filled e035 +pause_circle_outline e036 +pause_presentation e0ea +payment e8a1 +payments ef63 +paypal ea8d +pedal_bike eb29 +pending ef64 +pending_actions f1bb +pentagon eb50 +people e7fb +people_alt ea21 +people_outline e7fc +percent eb58 +perm_camera_mic e8a2 +perm_contact_cal e8a3 +perm_contact_calendar e8a3 +perm_data_setting e8a4 +perm_device_info e8a5 +perm_device_information e8a5 +perm_identity e8a6 +perm_media e8a7 +perm_phone_msg e8a8 +perm_scan_wifi e8a9 +person e7fd +person_2 f8e4 +person_3 f8e5 +person_4 f8e6 +person_add e7fe +person_add_alt ea4d +person_add_alt_1 ef65 +person_add_disabled e9cb +person_off e510 +person_outline e7ff +person_pin e55a +person_pin_circle e56a +person_remove ef66 +person_remove_alt_1 ef67 +person_search f106 +personal_injury e6da +personal_video e63b +pest_control f0fa +pest_control_rodent f0fd +pets e91d +phishing ead7 +phone e0cd +phone_android e324 +phone_bluetooth_speaker e61b +phone_callback e649 +phone_disabled e9cc +phone_enabled e9cd +phone_forwarded e61c +phone_in_talk e61d +phone_iphone e325 +phone_locked e61e +phone_missed e61f +phone_paused e620 +phonelink e326 +phonelink_erase e0db +phonelink_lock e0dc +phonelink_off e327 +phonelink_ring e0dd +phonelink_setup e0de +photo e410 +photo_album e411 +photo_camera e412 +photo_camera_back ef68 +photo_camera_front ef69 +photo_filter e43b +photo_library e413 +photo_size_select_actual e432 +photo_size_select_large e433 +photo_size_select_small e434 +php eb8f +piano e521 +piano_off e520 +picture_as_pdf e415 +picture_in_picture e8aa +picture_in_picture_alt e911 +pie_chart e6c4 +pie_chart_outline f044 +pie_chart_outlined e6c5 +pin f045 +pin_drop e55e +pin_end e767 +pin_invoke e763 +pinch eb38 +pivot_table_chart e9ce +pix eaa3 +place e55f +plagiarism ea5a +play_arrow e037 +play_circle e1c4 +play_circle_fill e038 +play_circle_filled e038 +play_circle_outline e039 +play_disabled ef6a +play_for_work e906 +play_lesson f047 +playlist_add e03b +playlist_add_check e065 +playlist_add_check_circle e7e6 +playlist_add_circle e7e5 +playlist_play e05f +playlist_remove eb80 +plumbing f107 +plus_one e800 +podcasts f048 +point_of_sale f17e +policy ea17 +poll e801 +polyline ebbb +polymer e8ab +pool eb48 +portable_wifi_off e0ce +portrait e416 +post_add ea20 +power e63c +power_input e336 +power_off e646 +power_settings_new e8ac +precision_manufacturing f049 +pregnant_woman e91e +present_to_all e0df +preview f1c5 +price_change f04a +price_check f04b +print e8ad +print_disabled e9cf +priority_high e645 +privacy_tip f0dc +private_connectivity e744 +production_quantity_limits e1d1 +propane ec14 +propane_tank ec13 +psychology ea4a +psychology_alt f8ea +public e80b +public_off f1ca +publish e255 +published_with_changes f232 +punch_clock eaa8 +push_pin f10d +qr_code ef6b +qr_code_2 e00a +qr_code_scanner f206 +query_builder e8ae +query_stats e4fc +question_answer e8af +question_mark eb8b +queue e03c +queue_music e03d +queue_play_next e066 +quick_contacts_dialer e0cf +quick_contacts_mail e0d0 +quickreply ef6c +quiz f04c +quora ea98 +r_mobiledata f04d +radar f04e +radio e03e +radio_button_checked e837 +radio_button_off e836 +radio_button_on e837 +radio_button_unchecked e836 +railway_alert e9d1 +ramen_dining ea64 +ramp_left eb9c +ramp_right eb96 +rate_review e560 +raw_off f04f +raw_on f050 +read_more ef6d +real_estate_agent e73a +receipt e8b0 +receipt_long ef6e +recent_actors e03f +recommend e9d2 +record_voice_over e91f +rectangle eb54 +recycling e760 +reddit eaa0 +redeem e8b1 +redo e15a +reduce_capacity f21c +refresh e5d5 +remember_me f051 +remove e15b +remove_circle e15c +remove_circle_outline e15d +remove_done e9d3 +remove_from_queue e067 +remove_moderator e9d4 +remove_red_eye e417 +remove_road ebfc +remove_shopping_cart e928 +reorder e8fe +repartition f8e8 +repeat e040 +repeat_on e9d6 +repeat_one e041 +repeat_one_on e9d7 +replay e042 +replay_10 e059 +replay_30 e05a +replay_5 e05b +replay_circle_filled e9d8 +reply e15e +reply_all e15f +report e160 +report_gmailerrorred f052 +report_off e170 +report_problem e8b2 +request_page f22c +request_quote f1b6 +reset_tv e9d9 +restart_alt f053 +restaurant e56c +restaurant_menu e561 +restore e8b3 +restore_from_trash e938 +restore_page e929 +reviews f054 +rice_bowl f1f5 +ring_volume e0d1 +rocket eba5 +rocket_launch eb9b +roller_shades ec12 +roller_shades_closed ec11 +roller_skating ebcd +roofing f201 +room e8b4 +room_preferences f1b8 +room_service eb49 +rotate_90_degrees_ccw e418 +rotate_90_degrees_cw eaab +rotate_left e419 +rotate_right e41a +roundabout_left eb99 +roundabout_right eba3 +rounded_corner e920 +route eacd +router e328 +rowing e921 +rss_feed e0e5 +rsvp f055 +rtt e9ad +rule f1c2 +rule_folder f1c9 +run_circle ef6f +running_with_errors e51d +rv_hookup e642 +safety_check ebef +safety_divider e1cc +sailing e502 +sanitizer f21d +satellite e562 +satellite_alt eb3a +save e161 +save_alt e171 +save_as eb60 +saved_search ea11 +savings e2eb +scale eb5f +scanner e329 +scatter_plot e268 +schedule e8b5 +schedule_send ea0a +schema e4fd +school e80c +science ea4b +score e269 +scoreboard ebd0 +screen_lock_landscape e1be +screen_lock_portrait e1bf +screen_lock_rotation e1c0 +screen_rotation e1c1 +screen_rotation_alt ebee +screen_search_desktop ef70 +screen_share e0e2 +screenshot f056 +screenshot_monitor ec08 +scuba_diving ebce +sd e9dd +sd_card e623 +sd_card_alert f057 +sd_storage e1c2 +search e8b6 +search_off ea76 +security e32a +security_update f058 +security_update_good f059 +security_update_warning f05a +segment e94b +select_all e162 +self_improvement ea78 +sell f05b +send e163 +send_and_archive ea0c +send_time_extension eadb +send_to_mobile f05c +sensor_door f1b5 +sensor_occupied ec10 +sensor_window f1b4 +sensors e51e +sensors_off e51f +sentiment_dissatisfied e811 +sentiment_neutral e812 +sentiment_satisfied e813 +sentiment_satisfied_alt e0ed +sentiment_very_dissatisfied e814 +sentiment_very_satisfied e815 +set_meal f1ea +settings e8b8 +settings_accessibility f05d +settings_applications e8b9 +settings_backup_restore e8ba +settings_bluetooth e8bb +settings_brightness e8bd +settings_cell e8bc +settings_display e8bd +settings_ethernet e8be +settings_input_antenna e8bf +settings_input_component e8c0 +settings_input_composite e8c1 +settings_input_hdmi e8c2 +settings_input_svideo e8c3 +settings_overscan e8c4 +settings_phone e8c5 +settings_power e8c6 +settings_remote e8c7 +settings_suggest f05e +settings_system_daydream e1c3 +settings_voice e8c8 +severe_cold ebd3 +shape_line f8d3 +share e80d +share_arrival_time e524 +share_location f05f +shield e9e0 +shield_moon eaa9 +shop e8c9 +shop_2 e19e +shop_two e8ca +shopify ea9d +shopping_bag f1cc +shopping_basket e8cb +shopping_cart e8cc +shopping_cart_checkout eb88 +short_text e261 +shortcut f060 +show_chart e6e1 +shower f061 +shuffle e043 +shuffle_on e9e1 +shutter_speed e43d +sick f220 +sign_language ebe5 +signal_cellular_0_bar f0a8 +signal_cellular_4_bar e1c8 +signal_cellular_alt e202 +signal_cellular_alt_1_bar ebdf +signal_cellular_alt_2_bar ebe3 +signal_cellular_connected_no_internet_0_bar f0ac +signal_cellular_connected_no_internet_4_bar e1cd +signal_cellular_no_sim e1ce +signal_cellular_nodata f062 +signal_cellular_null e1cf +signal_cellular_off e1d0 +signal_wifi_0_bar f0b0 +signal_wifi_4_bar e1d8 +signal_wifi_4_bar_lock e1d9 +signal_wifi_bad f063 +signal_wifi_connected_no_internet_4 f064 +signal_wifi_off e1da +signal_wifi_statusbar_4_bar f065 +signal_wifi_statusbar_connected_no_internet_4 f066 +signal_wifi_statusbar_null f067 +signpost eb91 +sim_card e32b +sim_card_alert e624 +sim_card_download f068 +single_bed ea48 +sip f069 +skateboarding e511 +skip_next e044 +skip_previous e045 +sledding e512 +slideshow e41b +slow_motion_video e068 +smart_button f1c1 +smart_display f06a +smart_screen f06b +smart_toy f06c +smartphone e32c +smoke_free eb4a +smoking_rooms eb4b +sms e625 +sms_failed e626 +snapchat ea6e +snippet_folder f1c7 +snooze e046 +snowboarding e513 +snowing e80f +snowmobile e503 +snowshoeing e514 +soap f1b2 +social_distance e1cb +solar_power ec0f +sort e164 +sort_by_alpha e053 +sos ebf7 +soup_kitchen e7d3 +source f1c4 +south f1e3 +south_america e7e4 +south_east f1e4 +south_west f1e5 +spa eb4c +space_bar e256 +space_dashboard e66b +spatial_audio ebeb +spatial_audio_off ebe8 +spatial_tracking ebea +speaker e32d +speaker_group e32e +speaker_notes e8cd +speaker_notes_off e92a +speaker_phone e0d2 +speed e9e4 +spellcheck e8ce +splitscreen f06d +spoke e9a7 +sports ea30 +sports_bar f1f3 +sports_baseball ea51 +sports_basketball ea26 +sports_cricket ea27 +sports_esports ea28 +sports_football ea29 +sports_golf ea2a +sports_gymnastics ebc4 +sports_handball ea33 +sports_hockey ea2b +sports_kabaddi ea34 +sports_martial_arts eae9 +sports_mma ea2c +sports_motorsports ea2d +sports_rugby ea2e +sports_score f06e +sports_soccer ea2f +sports_tennis ea32 +sports_volleyball ea31 +square eb36 +square_foot ea49 +ssid_chart eb66 +stacked_bar_chart e9e6 +stacked_line_chart f22b +stadium eb90 +stairs f1a9 +star e838 +star_border e83a +star_border_purple500 f099 +star_half e839 +star_outline f06f +star_purple500 f09a +star_rate f0ec +stars e8d0 +start e089 +stay_current_landscape e0d3 +stay_current_portrait e0d4 +stay_primary_landscape e0d5 +stay_primary_portrait e0d6 +sticky_note_2 f1fc +stop e047 +stop_circle ef71 +stop_screen_share e0e3 +storage e1db +store e8d1 +store_mall_directory e563 +storefront ea12 +storm f070 +straight eb95 +straighten e41c +stream e9e9 +streetview e56e +strikethrough_s e257 +stroller f1ae +style e41d +subdirectory_arrow_left e5d9 +subdirectory_arrow_right e5da +subject e8d2 +subscript f111 +subscriptions e064 +subtitles e048 +subtitles_off ef72 +subway e56f +summarize f071 +sunny e81a +sunny_snowing e819 +superscript f112 +supervised_user_circle e939 +supervisor_account e8d3 +support ef73 +support_agent f0e2 +surfing e515 +surround_sound e049 +swap_calls e0d7 +swap_horiz e8d4 +swap_horizontal_circle e933 +swap_vert e8d5 +swap_vert_circle e8d6 +swap_vertical_circle e8d6 +swipe e9ec +swipe_down eb53 +swipe_down_alt eb30 +swipe_left eb59 +swipe_left_alt eb33 +swipe_right eb52 +swipe_right_alt eb56 +swipe_up eb2e +swipe_up_alt eb35 +swipe_vertical eb51 +switch_access_shortcut e7e1 +switch_access_shortcut_add e7e2 +switch_account e9ed +switch_camera e41e +switch_left f1d1 +switch_right f1d2 +switch_video e41f +synagogue eab0 +sync e627 +sync_alt ea18 +sync_disabled e628 +sync_lock eaee +sync_problem e629 +system_security_update f072 +system_security_update_good f073 +system_security_update_warning f074 +system_update e62a +system_update_alt e8d7 +system_update_tv e8d7 +tab e8d8 +tab_unselected e8d9 +table_bar ead2 +table_chart e265 +table_restaurant eac6 +table_rows f101 +table_view f1be +tablet e32f +tablet_android e330 +tablet_mac e331 +tag e9ef +tag_faces e420 +takeout_dining ea74 +tap_and_play e62b +tapas f1e9 +task f075 +task_alt e2e6 +taxi_alert ef74 +telegram ea6b +temple_buddhist eab3 +temple_hindu eaaf +terminal eb8e +terrain e564 +text_decrease eadd +text_fields e262 +text_format e165 +text_increase eae2 +text_rotate_up e93a +text_rotate_vertical e93b +text_rotation_angledown e93c +text_rotation_angleup e93d +text_rotation_down e93e +text_rotation_none e93f +text_snippet f1c6 +textsms e0d8 +texture e421 +theater_comedy ea66 +theaters e8da +thermostat f076 +thermostat_auto f077 +thumb_down e8db +thumb_down_alt e816 +thumb_down_off_alt e9f2 +thumb_up e8dc +thumb_up_alt e817 +thumb_up_off_alt e9f3 +thumbs_up_down e8dd +thunderstorm ebdb +tiktok ea7e +time_to_leave e62c +timelapse e422 +timeline e922 +timer e425 +timer_10 e423 +timer_10_select f07a +timer_3 e424 +timer_3_select f07b +timer_off e426 +tips_and_updates e79a +tire_repair ebc8 +title e264 +toc e8de +today e8df +toggle_off e9f5 +toggle_on e9f6 +token ea25 +toll e8e0 +tonality e427 +topic f1c8 +tornado e199 +touch_app e913 +tour ef75 +toys e332 +track_changes e8e1 +traffic e565 +train e570 +tram e571 +transcribe f8ec +transfer_within_a_station e572 +transform e428 +transgender e58d +transit_enterexit e579 +translate e8e2 +travel_explore e2db +trending_down e8e3 +trending_flat e8e4 +trending_neutral e8e4 +trending_up e8e5 +trip_origin e57b +troubleshoot e1d2 +try f07c +tsunami ebd8 +tty f1aa +tune e429 +tungsten f07d +turn_left eba6 +turn_right ebab +turn_sharp_left eba7 +turn_sharp_right ebaa +turn_slight_left eba4 +turn_slight_right eb9a +turned_in e8e6 +turned_in_not e8e7 +tv e333 +tv_off e647 +two_wheeler e9f9 +type_specimen f8f0 +u_turn_left eba1 +u_turn_right eba2 +umbrella f1ad +unarchive e169 +undo e166 +unfold_less e5d6 +unfold_less_double f8cf +unfold_more e5d7 +unfold_more_double f8d0 +unpublished f236 +unsubscribe e0eb +upcoming f07e +update e923 +update_disabled e075 +upgrade f0fb +upload f09b +upload_file e9fc +usb e1e0 +usb_off e4fa +vaccines e138 +vape_free ebc6 +vaping_rooms ebcf +verified ef76 +verified_user e8e8 +vertical_align_bottom e258 +vertical_align_center e259 +vertical_align_top e25a +vertical_distribute e076 +vertical_shades ec0e +vertical_shades_closed ec0d +vertical_split e949 +vibration e62d +video_call e070 +video_camera_back f07f +video_camera_front f080 +video_collection e04a +video_file eb87 +video_label e071 +video_library e04a +video_settings ea75 +video_stable f081 +videocam e04b +videocam_off e04c +videogame_asset e338 +videogame_asset_off e500 +view_agenda e8e9 +view_array e8ea +view_carousel e8eb +view_column e8ec +view_comfortable e42a +view_comfy e42a +view_comfy_alt eb73 +view_compact e42b +view_compact_alt eb74 +view_cozy eb75 +view_day e8ed +view_headline e8ee +view_in_ar e9fe +view_kanban eb7f +view_list e8ef +view_module e8f0 +view_quilt e8f1 +view_sidebar f114 +view_stream e8f2 +view_timeline eb85 +view_week e8f3 +vignette e435 +villa e586 +visibility e8f4 +visibility_off e8f5 +voice_chat e62e +voice_over_off e94a +voicemail e0d9 +volcano ebda +volume_down e04d +volume_down_alt e79c +volume_mute e04e +volume_off e04f +volume_up e050 +volunteer_activism ea70 +vpn_key e0da +vpn_key_off eb7a +vpn_lock e62f +vrpano f082 +wallet f8ff +wallet_giftcard e8f6 +wallet_membership e8f7 +wallet_travel e8f8 +wallpaper e1bc +warehouse ebb8 +warning e002 +warning_amber f083 +wash f1b1 +watch e334 +watch_later e924 +watch_off eae3 +water f084 +water_damage f203 +water_drop e798 +waterfall_chart ea00 +waves e176 +waving_hand e766 +wb_auto e42c +wb_cloudy e42d +wb_incandescent e42e +wb_iridescent e436 +wb_shade ea01 +wb_sunny e430 +wb_twighlight ea02 +wb_twilight e1c6 +wc e63d +web e051 +web_asset e069 +web_asset_off e4f7 +web_stories e595 +webhook eb92 +wechat ea81 +weekend e16b +west f1e6 +whatsapp ea9c +whatshot e80e +wheelchair_pickup f1ab +where_to_vote e177 +widgets e1bd +width_full f8f5 +width_normal f8f6 +width_wide f8f7 +wifi e63e +wifi_1_bar e4ca +wifi_2_bar e4d9 +wifi_calling ef77 +wifi_calling_3 f085 +wifi_channel eb6a +wifi_find eb31 +wifi_lock e1e1 +wifi_off e648 +wifi_password eb6b +wifi_protected_setup f0fc +wifi_tethering e1e2 +wifi_tethering_error ead9 +wifi_tethering_error_rounded f086 +wifi_tethering_off f087 +wind_power ec0c +window f088 +wine_bar f1e8 +woman e13e +woman_2 f8e7 +woo_commerce ea6d +wordpress ea9f +work e8f9 +work_history ec09 +work_off e942 +work_outline e943 +workspace_premium e7af +workspaces e1a0 +workspaces_filled ea0d +workspaces_outline ea0f +wrap_text e25b +wrong_location ef78 +wysiwyg f1c3 +yard f089 +youtube_searched_for e8fa +zoom_in e8ff +zoom_in_map eb2d +zoom_out e900 +zoom_out_map e56b diff --git a/public/fonts/MaterialIcons-Regular.ttf b/public/fonts/MaterialIcons-Regular.ttf new file mode 100644 index 0000000..0588628 Binary files /dev/null and b/public/fonts/MaterialIcons-Regular.ttf differ diff --git a/public/fonts/Merienda-Bold.ttf b/public/fonts/Merienda-Bold.ttf new file mode 100644 index 0000000..86703ad Binary files /dev/null and b/public/fonts/Merienda-Bold.ttf differ diff --git a/public/fonts/Merienda-Regular.ttf b/public/fonts/Merienda-Regular.ttf new file mode 100644 index 0000000..8621c38 Binary files /dev/null and b/public/fonts/Merienda-Regular.ttf differ diff --git a/public/fonts/Monoton-Regular.ttf b/public/fonts/Monoton-Regular.ttf new file mode 100644 index 0000000..0c32913 Binary files /dev/null and b/public/fonts/Monoton-Regular.ttf differ diff --git a/public/fonts/Roboto-Black.ttf b/public/fonts/Roboto-Black.ttf new file mode 100644 index 0000000..0112e7d Binary files /dev/null and b/public/fonts/Roboto-Black.ttf differ diff --git a/public/fonts/Roboto-BlackItalic.ttf b/public/fonts/Roboto-BlackItalic.ttf new file mode 100644 index 0000000..b2c6aca Binary files /dev/null and b/public/fonts/Roboto-BlackItalic.ttf differ diff --git a/public/fonts/Roboto-Bold.ttf b/public/fonts/Roboto-Bold.ttf new file mode 100644 index 0000000..43da14d Binary files /dev/null and b/public/fonts/Roboto-Bold.ttf differ diff --git a/public/fonts/Roboto-BoldItalic.ttf b/public/fonts/Roboto-BoldItalic.ttf new file mode 100644 index 0000000..bcfdab4 Binary files /dev/null and b/public/fonts/Roboto-BoldItalic.ttf differ diff --git a/public/fonts/Roboto-Italic.ttf b/public/fonts/Roboto-Italic.ttf new file mode 100644 index 0000000..1b5eaa3 Binary files /dev/null and b/public/fonts/Roboto-Italic.ttf differ diff --git a/public/fonts/Roboto-Light.ttf b/public/fonts/Roboto-Light.ttf new file mode 100644 index 0000000..e7307e7 Binary files /dev/null and b/public/fonts/Roboto-Light.ttf differ diff --git a/public/fonts/Roboto-LightItalic.ttf b/public/fonts/Roboto-LightItalic.ttf new file mode 100644 index 0000000..2d277af Binary files /dev/null and b/public/fonts/Roboto-LightItalic.ttf differ diff --git a/public/fonts/Roboto-Medium.ttf b/public/fonts/Roboto-Medium.ttf new file mode 100644 index 0000000..ac0f908 Binary files /dev/null and b/public/fonts/Roboto-Medium.ttf differ diff --git a/public/fonts/Roboto-MediumItalic.ttf b/public/fonts/Roboto-MediumItalic.ttf new file mode 100644 index 0000000..fc36a47 Binary files /dev/null and b/public/fonts/Roboto-MediumItalic.ttf differ diff --git a/public/fonts/Roboto-Regular.ttf b/public/fonts/Roboto-Regular.ttf new file mode 100644 index 0000000..ddf4bfa Binary files /dev/null and b/public/fonts/Roboto-Regular.ttf differ diff --git a/public/fonts/Roboto-Thin.ttf b/public/fonts/Roboto-Thin.ttf new file mode 100644 index 0000000..2e0dee6 Binary files /dev/null and b/public/fonts/Roboto-Thin.ttf differ diff --git a/public/fonts/Roboto-ThinItalic.ttf b/public/fonts/Roboto-ThinItalic.ttf new file mode 100644 index 0000000..084f9c0 Binary files /dev/null and b/public/fonts/Roboto-ThinItalic.ttf differ diff --git a/public/fonts/Spectral-Bold.ttf b/public/fonts/Spectral-Bold.ttf new file mode 100644 index 0000000..1a2852c Binary files /dev/null and b/public/fonts/Spectral-Bold.ttf differ diff --git a/public/fonts/Spectral-BoldItalic.ttf b/public/fonts/Spectral-BoldItalic.ttf new file mode 100644 index 0000000..48d3f0d Binary files /dev/null and b/public/fonts/Spectral-BoldItalic.ttf differ diff --git a/public/fonts/Spectral-ExtraBold.ttf b/public/fonts/Spectral-ExtraBold.ttf new file mode 100644 index 0000000..5fa1618 Binary files /dev/null and b/public/fonts/Spectral-ExtraBold.ttf differ diff --git a/public/fonts/Spectral-ExtraBoldItalic.ttf b/public/fonts/Spectral-ExtraBoldItalic.ttf new file mode 100644 index 0000000..c79829c Binary files /dev/null and b/public/fonts/Spectral-ExtraBoldItalic.ttf differ diff --git a/public/fonts/Spectral-ExtraLight.ttf b/public/fonts/Spectral-ExtraLight.ttf new file mode 100644 index 0000000..a4427ca Binary files /dev/null and b/public/fonts/Spectral-ExtraLight.ttf differ diff --git a/public/fonts/Spectral-ExtraLightItalic.ttf b/public/fonts/Spectral-ExtraLightItalic.ttf new file mode 100644 index 0000000..d15160c Binary files /dev/null and b/public/fonts/Spectral-ExtraLightItalic.ttf differ diff --git a/public/fonts/Spectral-Italic.ttf b/public/fonts/Spectral-Italic.ttf new file mode 100644 index 0000000..f706e13 Binary files /dev/null and b/public/fonts/Spectral-Italic.ttf differ diff --git a/public/fonts/Spectral-Light.ttf b/public/fonts/Spectral-Light.ttf new file mode 100644 index 0000000..70dbaa2 Binary files /dev/null and b/public/fonts/Spectral-Light.ttf differ diff --git a/public/fonts/Spectral-LightItalic.ttf b/public/fonts/Spectral-LightItalic.ttf new file mode 100644 index 0000000..cd04bc8 Binary files /dev/null and b/public/fonts/Spectral-LightItalic.ttf differ diff --git a/public/fonts/Spectral-Medium.ttf b/public/fonts/Spectral-Medium.ttf new file mode 100644 index 0000000..6180c94 Binary files /dev/null and b/public/fonts/Spectral-Medium.ttf differ diff --git a/public/fonts/Spectral-MediumItalic.ttf b/public/fonts/Spectral-MediumItalic.ttf new file mode 100644 index 0000000..a4bc4df Binary files /dev/null and b/public/fonts/Spectral-MediumItalic.ttf differ diff --git a/public/fonts/Spectral-Regular.ttf b/public/fonts/Spectral-Regular.ttf new file mode 100644 index 0000000..b67dca1 Binary files /dev/null and b/public/fonts/Spectral-Regular.ttf differ diff --git a/public/fonts/Spectral-SemiBold.ttf b/public/fonts/Spectral-SemiBold.ttf new file mode 100644 index 0000000..3414cab Binary files /dev/null and b/public/fonts/Spectral-SemiBold.ttf differ diff --git a/public/fonts/Spectral-SemiBoldItalic.ttf b/public/fonts/Spectral-SemiBoldItalic.ttf new file mode 100644 index 0000000..c84a43d Binary files /dev/null and b/public/fonts/Spectral-SemiBoldItalic.ttf differ diff --git a/public/images/forbidden/HauntedHouseForeground.png b/public/images/forbidden/HauntedHouseForeground.png new file mode 100644 index 0000000..73e4631 Binary files /dev/null and b/public/images/forbidden/HauntedHouseForeground.png differ diff --git a/public/images/forbidden/bat-body.png b/public/images/forbidden/bat-body.png new file mode 100644 index 0000000..2f126c5 Binary files /dev/null and b/public/images/forbidden/bat-body.png differ diff --git a/public/images/forbidden/bat-wing.png b/public/images/forbidden/bat-wing.png new file mode 100644 index 0000000..6c7f24e Binary files /dev/null and b/public/images/forbidden/bat-wing.png differ diff --git a/public/images/header.svg b/public/images/header.svg new file mode 100644 index 0000000..a0714a0 --- /dev/null +++ b/public/images/header.svg @@ -0,0 +1,2 @@ + + diff --git a/public/images/logo.svg b/public/images/logo.svg new file mode 100644 index 0000000..488e19d --- /dev/null +++ b/public/images/logo.svg @@ -0,0 +1,3922 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..a9a716d Binary files /dev/null and b/screenshot.png differ diff --git a/server/CheckEnvironment.js b/server/CheckEnvironment.js new file mode 100644 index 0000000..f356de4 --- /dev/null +++ b/server/CheckEnvironment.js @@ -0,0 +1,36 @@ +console.log("Checking Environment..."); + +if(!process.env.MONGO_URL) { + console.error("Must provide the MONGO_URL environment variable point to the district central's main database. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.") + process.exit(0); +} + +if(!process.env.MONGO_URL2) { + console.error("Must provide the MONGO_URL2 environment variable pointing to the chromebook data collection dataset. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.") + process.exit(0); +} + +try { + let settings = Assets.getText('settings.json'); +} +catch(e) { + console.error("Must have a /private/settings.json file with the following format:"); + console.error(` +{ + "google": { + "clientId": "xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", + "secret": "xxxxxxxxxxxxxxxxxxx", + "loginStyle": "redirect", + "scope": [ + "email", + "https://www.googleapis.com/auth/plus.login", + "https://www.googleapis.com/auth/contacts.readonly" + ] + } +} + + `); + process.exit(0); +} + +console.log("Environment Checking Complete.") \ No newline at end of file diff --git a/server/DataCollection.js b/server/DataCollection.js new file mode 100644 index 0000000..f3591be --- /dev/null +++ b/server/DataCollection.js @@ -0,0 +1,17 @@ +import {MongoInternals} from 'meteor/mongo'; +import {Meteor} from 'meteor/meteor'; + +console.log("Setting up data collection database connection..."); + +let uri = process.env.MONGO_URL2; //"mongodb://localhost:27017/avusd_data_collection"; +//uri = "mongodb://localhost:27017/avusd_data_collection"; +//console.log(uri); +let db2 = new MongoInternals.RemoteCollectionDriver(uri); +let collection = new Mongo.Collection("records", {_driver: db2}); +Meteor.Records = collection; + + +// let results = collection.find({deviceId: "1e3e99ef-adf4-4aa2-8784-205bc60f0ce3"}).fetch(); +// console.log(results); + +console.log("Database connection setup.") \ No newline at end of file diff --git a/server/google-oauth.js b/server/google-oauth.js new file mode 100644 index 0000000..9a75d12 --- /dev/null +++ b/server/google-oauth.js @@ -0,0 +1,54 @@ +/** + * Google cloud platform: https://console.developers.google.com/apis/dashboard + * Setup a OAuth consent screen, then setup OAuth credentials. + * Loads the information from the /private/settings.json file. + */ + +console.log("Setting up Google OAuth..."); + +try { + let settings = Assets.getText('settings.json'); + + if(settings) { + try { + settings = JSON.parse(settings); + } + catch(err) { + console.error("Failed to load the /private/settings.json file as a JSON object."); + console.error(err); + settings = null; + } + } + + if (settings) { + ServiceConfiguration.configurations.upsert({ + service: "google" + }, { + $set: { + loginStyle: settings.google.loginStyle, + clientId: settings.google.clientId, + secret: settings.google.secret + } + } + ); + } else { + console.log("Error: No settings file."); + } +} catch (err) { + console.log(err); +} + +/* +ServiceConfiguration.configurations.upsert( + { service: 'google' }, + { + $set: { + clientId: '651343079360-hm5vvji109lphnavft8vej5pp1ruek5q.apps.googleusercontent.com', + loginStyle: 'popup', + secret: 'VAQFr6UBkZ0ZMQJ7tb471BmW' + } + } +); +*/ + +console.log("Finished OAuth setup.") \ No newline at end of file diff --git a/server/logging.js b/server/logging.js new file mode 100644 index 0000000..e4ab080 --- /dev/null +++ b/server/logging.js @@ -0,0 +1,94 @@ +import FileRotateTransport from "winston-daily-rotate-file"; +import winston from "winston"; +import moment from "moment"; +import _ from 'underscore'; + +// console.log("Setting up logging...."); + +let production = (process.env.NODE_ENV === "production"); +let logPath = process.env.LOG_PATH; + +let fileTransport = logPath ? new FileRotateTransport({ + format: winston.format.combine( + winston.format.simple(), + winston.format.printf((info) => { + return moment(info.timestamp).format('YYYY-MM-DD hh:mm:ss SSSS') + " " + info.message; + }) + ), + auditFile: "audit.json", + maxSize: '1m', + maxFiles: 20, + dirname: logPath, + filename: 'DistrictCentral-%DATE%.log', + dateFormat: "YYYY-MM-DD" +}) : null; +let consoleColorTransport = new winston.transports.Console({ + format: winston.format.combine( + winston.format.cli() + ), +}); +let consoleTransport = new winston.transports.Console({ + format: winston.format.combine( + winston.format.simple() + ), +}); +let transports = production ? (logPath ? [fileTransport] : [consoleTransport]) : (logPath ? [fileTransport, consoleColorTransport] : [consoleColorTransport]); +//let transports = [fileTransport, consoleTransport]; + +//TODO: Use GrayLog or SysLog and interface with a log server. + +/* Use GrayLog2 Transport +const Graylog2 = require('winston-graylog2'); +logger.add(new Graylog2(options)); + */ + +/* Use Syslog Transport +npm install winston-syslog + const winston = require('winston'); + + // + // Requiring `winston-syslog` will expose + // `winston.transports.Syslog` + // + require('winston-syslog').Syslog; + + winston.add(new winston.transports.Syslog(options)); + */ + +// Setup the logger. +let logger = winston.createLogger({ + level: production ? 'info' : 'silly', + // format: winston.format.combine( + // winston.format.timestamp({format: 'YYYY-MM-DD hh:mm:ss SSSS'}) + // ), + format: winston.format(function(info) { + //Add a timestamp to the info structure. + info.timestamp = new Date(); + + return info; + })(), + defaultMeta: {app: 'DistrictCentral'}, + transports: transports +}); + +let consoleLogOriginal = console.log; + +// Override the log and error functions. +console.log = function(d) { + // For some reason Meteor requires the original console.log for the initial listening log output. If that isn't performed then Meteor never starts properly. + if(arguments.length === 1 && arguments[0] === 'LISTENING') { + return consoleLogOriginal.call(console, 'LISTENING'); + } + else logger.log("debug", _.isObject(d) ? JSON.stringify(d) : d); +} +console.info = function(d) { + logger.log("info", _.isObject(d) ? JSON.stringify(d) : d); +} +console.warn = function(d) { + logger.log("warn", _.isObject(d) ? JSON.stringify(d) : d); +} +console.error = function(e) { + logger.log("error", e.stack || e); +} + +// console.log("Logger setup."); \ No newline at end of file diff --git a/server/main.js b/server/main.js new file mode 100644 index 0000000..6d7214e --- /dev/null +++ b/server/main.js @@ -0,0 +1,35 @@ +import './CheckEnvironment.js'; +import './DataCollection.js'; +import '../imports/api/'; +import './google-oauth.js'; +import '/imports/startup/accounts-config.js'; +import './logging'; + + + + +//Some basic testing of detecting which mode the app is running under... +// +// if(process.env.NODE_ENV === "development") { +// console.log("In Dev Mode"); +// } +// else if(process.env.NODE_ENV === "production") { +// console.log("In Prod Mode"); +// } +// else { +// console.log("No idea what mode we are in!"); +// } + + +//TEST LOG OUTPUT... +// let obj = {test: 'abc'}; +// console.log("Test Output"); +// console.log(obj); +// +// try { +// throw Exception("Error!!"); +// } +// catch(err) { +// console.error(err); +// } + diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c406978 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,40 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "es2018", + "module": "esNext", + "lib": ["esnext", "dom"], + "allowJs": true, + "checkJs": false, + "jsx": "preserve", + "incremental": true, + "noEmit": true, + + /* Strict Type-Checking Options */ + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + + /* Additional Checks */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": false, + "noFallthroughCasesInSwitch": false, + + /* Module Resolution Options */ + "baseUrl": ".", + "paths": { + /* Support absolute /imports/* with a leading '/' */ + "/*": ["*"] + }, + "moduleResolution": "node", + "resolveJsonModule": true, + "types": ["node", "mocha"], + "esModuleInterop": true, + "preserveSymlinks": true + }, + "exclude": [ + "./.meteor/**", + "./packages/**" + ] +}