@grazziotin/react-components 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +34 -24
  2. package/dist/150.index.js +1 -0
  3. package/dist/815.index.js +1 -0
  4. package/dist/908.index.js +2 -0
  5. package/dist/908.index.js.LICENSE.txt +9 -0
  6. package/dist/988.index.js +1 -0
  7. package/dist/assets/fonts/Montserrat-Black.ttf +0 -0
  8. package/dist/assets/fonts/Montserrat-BlackItalic.ttf +0 -0
  9. package/dist/assets/fonts/Montserrat-Bold.ttf +0 -0
  10. package/dist/assets/fonts/Montserrat-BoldItalic.ttf +0 -0
  11. package/dist/assets/fonts/Montserrat-ExtraBold.ttf +0 -0
  12. package/dist/assets/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
  13. package/dist/assets/fonts/Montserrat-ExtraLight.ttf +0 -0
  14. package/dist/assets/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
  15. package/dist/assets/fonts/Montserrat-Italic.ttf +0 -0
  16. package/dist/assets/fonts/Montserrat-Light.ttf +0 -0
  17. package/dist/assets/fonts/Montserrat-LightItalic.ttf +0 -0
  18. package/dist/assets/fonts/Montserrat-Medium.ttf +0 -0
  19. package/dist/assets/fonts/Montserrat-MediumItalic.ttf +0 -0
  20. package/dist/assets/fonts/Montserrat-Regular.ttf +0 -0
  21. package/dist/assets/fonts/Montserrat-SemiBold.ttf +0 -0
  22. package/dist/assets/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
  23. package/dist/assets/fonts/Montserrat-Thin.ttf +0 -0
  24. package/dist/assets/fonts/Montserrat-ThinItalic.ttf +0 -0
  25. package/dist/components/Inputs/Input/index.d.ts +39 -18
  26. package/dist/components/Inputs/Input/index.js +122 -28
  27. package/dist/components/Inputs/Input/utils/input-styled.d.ts +4 -0
  28. package/dist/components/Inputs/Input/utils/input-styled.js +63 -0
  29. package/dist/components/Inputs/Input/utils/interface.d.ts +21 -0
  30. package/dist/components/Inputs/Input/utils/interface.js +1 -0
  31. package/dist/components/Inputs/Input/utils/mask-custom.d.ts +4 -0
  32. package/dist/components/Inputs/Input/utils/mask-custom.js +30 -0
  33. package/dist/components/Inputs/input-select/index.d.ts +42 -0
  34. package/dist/components/Inputs/input-select/index.js +84 -0
  35. package/dist/components/Inputs/input-select/utils/interface.d.ts +43 -0
  36. package/dist/components/Inputs/input-select/utils/interface.js +1 -0
  37. package/dist/components/Loader/index.d.ts +5 -0
  38. package/dist/components/Loader/index.js +7 -0
  39. package/dist/components/barcode/BarcodeScanner.d.ts +26 -0
  40. package/dist/components/barcode/barcode-scanner.d.ts +26 -0
  41. package/dist/components/barcode/barcode-scanner.js +433 -0
  42. package/dist/components/barcode/index.d.ts +36 -0
  43. package/dist/components/barcode/index.js +65 -0
  44. package/dist/components/barcode/utils/constants.d.ts +139 -0
  45. package/dist/components/barcode/utils/constants.js +224 -0
  46. package/dist/components/barcode/utils/interface.d.ts +50 -0
  47. package/dist/components/barcode/utils/interface.js +1 -0
  48. package/dist/components/button/button-excel/index.d.ts +32 -0
  49. package/dist/components/button/button-excel/index.js +143 -0
  50. package/dist/components/button/index.d.ts +21 -0
  51. package/dist/components/button/index.js +101 -0
  52. package/dist/components/card/index.d.ts +21 -0
  53. package/dist/components/card/index.js +48 -0
  54. package/dist/components/datatable/index.d.ts +8 -0
  55. package/dist/components/datatable/index.js +103 -0
  56. package/dist/components/datatable/utils/constants.d.ts +8 -0
  57. package/dist/components/datatable/utils/constants.js +42 -0
  58. package/dist/components/filtro/components/card.d.ts +24 -0
  59. package/dist/components/filtro/components/card.js +49 -0
  60. package/dist/components/filtro/components/filtros.d.ts +19 -0
  61. package/dist/components/filtro/components/filtros.js +77 -0
  62. package/dist/components/filtro/index.d.ts +28 -0
  63. package/dist/components/filtro/index.js +38 -0
  64. package/dist/components/filtro/utils/interface.d.ts +105 -0
  65. package/dist/components/filtro/utils/interface.js +1 -0
  66. package/dist/components/icons/index.d.ts +21 -0
  67. package/dist/components/icons/index.js +39 -0
  68. package/dist/components/tabs/index.d.ts +24 -0
  69. package/dist/components/tabs/index.js +39 -0
  70. package/dist/functions/mascaras/index.js +1 -1
  71. package/dist/index.d.ts +12 -8
  72. package/dist/index.js +1 -1
  73. package/dist/theme.css +1058 -99
  74. package/package.json +29 -16
package/README.md CHANGED
@@ -8,47 +8,57 @@ Biblioteca de componentes React em TypeScript para uso em projetos Grazziotin.
8
8
  npm install @grazziotin/react-components
9
9
  ```
10
10
 
11
- ### Dependências necessárias
11
+ ### Dependências (peer dependencies)
12
+
13
+ A biblioteca não inclui React nem MUI; o projeto que a consome deve tê-los instalados:
12
14
 
13
15
  ```bash
14
16
  npm @mui/material @mui/icons-material
15
17
  ```
16
18
 
17
19
  - `react` e `react-dom` >= 17
18
- - `@mui/material` e `@mui/icons-material` >= 7 (para Input, Dialog, Filtro, etc.)
20
+ - `@mui/material` e `@mui/icons-material` >= 7
19
21
 
20
- ## Uso
22
+ ### Importar o CSS do tema
21
23
 
22
- ### Input
24
+ Componentes que usam classes do tema (como `bg-grzprimary`, `text-system-900`) precisam do CSS da lib no seu app. No ponto de entrada da aplicação (ex.: `main.tsx`, `App.tsx` ou `_app.tsx`), adicione:
23
25
 
24
- Input baseado em MUI com suporte a máscaras (moeda, float), tecla Enter e tema padrão.
26
+ ```ts
27
+ import '@grazziotin/react-components/dist/theme.css'
28
+ ```
25
29
 
26
- ```tsx
27
- import { Input, InputProps } from '@grazziotin/react-components'
30
+ Sem essa importação, classes como `bg-grzprimary` e `bg-grzsecondary` não terão efeito no cliente.
28
31
 
29
- // Básico
30
- <Input label="Nome" value={name} onChange={(e) => setName(e.target.value)} />
32
+ ---
31
33
 
32
- // Com máscara de moeda
33
- <Input label="Valor" type="real" value={valor} onChange={...} />
34
+ ## Storybook
34
35
 
35
- // Com tecla Enter
36
- <Input label="Buscar" onKeyEnter={() => handleSearch()} />
37
- ```
36
+ Documentação visual dos componentes:
37
+
38
+ **[https://grazziotinsa.github.io/react-components/](https://grazziotinsa.github.io/react-components/)**
39
+
40
+ Lá você encontra Input, Dialog, InputSelectMultiple, Filtro, BarcodeDialog e demais componentes, com exemplos e controles para testar as props.
38
41
 
39
- **Props principais** (além das do MUI `TextField`):
42
+ ---
40
43
 
41
- | Prop | Tipo | Descrição |
42
- | ----------- | -------- | ------------------------------------------------------------ |
43
- | `type` | string | `'text' \| 'real' \| 'float' \| ...` — `real` aplica máscara de moeda |
44
- | `onKeyEnter`| function | Callback ao pressionar Enter |
45
- | `shrink` | boolean | Label shrink (Material UI) |
46
- | `readOnly` | boolean | Campo somente leitura |
44
+ ## Resumo dos exports (pacote npm)
47
45
 
48
- ## Componentes exportados
46
+ | Exportado | Descrição |
47
+ | ----------------- | ---------------------------------------------- |
48
+ | `Input` | Campo de texto com máscaras e Enter |
49
+ | `InputProps` | Tipo das props do Input |
50
+ | `Dialog` | Modal com título, conteúdo e ações |
51
+ | `DialogProps` | Tipo das props do Dialog |
52
+ | `Card` | Card com título opcional, bordas e ações |
53
+ | `CardProps` | Tipo das props do Card |
54
+ | `DataTable` | Tabela de dados (Data Grid) com filtros e paginação pt-BR |
55
+ | `DataTableProps` | Tipo das props do DataTable (DataGridProps) |
56
+ | `Tabs` | Abas de navegação baseadas no MUI Tabs (cor padrão #00b2a6) |
57
+ | `TabsProps` | Tipo das props do componente Tabs |
58
+ | `InputSelectMultiple` | Select (simples ou múltiplo, Autocomplete + Input) |
59
+ | `InputSelectProps` | Tipo das props do InputSelectMultiple |
49
60
 
50
- - **Input** Campo de texto (MUI) com máscaras e tema
51
- - **InputProps** — Tipo TypeScript das props do Input
61
+ **No repositório (Storybook):** **Filtro** e **BarcodeDialog** existem no código-fonte e aparecem no Storybook (veja a seção [Storybook](#storybook) acima). Eles não são publicados no npm por dependerem de Mantine, exceljs, etc.
52
62
 
53
63
  ## Licença
54
64
 
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkreact_components=self.webpackChunkreact_components||[]).push([[150],{150(e,t,n){n.r(t),n.d(t,{default:()=>s});var r=n(272),o=n(155),a=n.n(o),c=n(815),p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},p.apply(this,arguments)},f=a().forwardRef(function(e,t){var n=e.onChange,o=e.mask,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["onChange","mask"]);return(0,r.jsx)(c._g,p({},a,{overwrite:!0,mask:o,inputRef:t,onAccept:function(t){return n({target:{name:e.name,value:t}})}}))});const s=(0,o.memo)(f)}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkreact_components=self.webpackChunkreact_components||[]).push([[815],{694(t,e,s){"use strict";var i=s(925);function a(){}function n(){}n.resetWarningCache=a,t.exports=function(){function t(t,e,s,a,n,r){if(r!==i){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function e(){return t}t.isRequired=t;var s={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:n,resetWarningCache:a};return s.PropTypes=s,s}},556(t,e,s){t.exports=s(694)()},925(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},815(t,e,s){"use strict";function i(t){return"string"==typeof t||t instanceof String}function a(t){var e;return"object"==typeof t&&null!=t&&"Object"===(null==t||null==(e=t.constructor)?void 0:e.name)}function n(t,e){return Array.isArray(e)?n(t,(t,s)=>e.includes(s)):Object.entries(t).reduce((t,s)=>{let[i,a]=s;return e(a,i)&&(t[i]=a),t},{})}s.d(e,{_g:()=>H});const r="NONE",u="LEFT",o="FORCE_LEFT",h="RIGHT",l="FORCE_RIGHT";function p(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function d(t,e){if(e===t)return!0;const s=Array.isArray(e),i=Array.isArray(t);let a;if(s&&i){if(e.length!=t.length)return!1;for(a=0;a<e.length;a++)if(!d(e[a],t[a]))return!1;return!0}if(s!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){const s=e instanceof Date,i=t instanceof Date;if(s&&i)return e.getTime()==t.getTime();if(s!=i)return!1;const n=e instanceof RegExp,r=t instanceof RegExp;if(n&&r)return e.toString()==t.toString();if(n!=r)return!1;const u=Object.keys(e);for(a=0;a<u.length;a++)if(!Object.prototype.hasOwnProperty.call(t,u[a]))return!1;for(a=0;a<u.length;a++)if(!d(t[u[a]],e[u[a]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class c{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?r:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?u:h}}function m(t,e){return new m.InputMask(t,e)}function k(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?m.MaskedRegExp:i(t)?m.MaskedPattern:t===Date?m.MaskedDate:t===Number?m.MaskedNumber:Array.isArray(t)||t===Array?m.MaskedDynamic:m.Masked&&t.prototype instanceof m.Masked?t:m.Masked&&t instanceof m.Masked?t.constructor:t instanceof Function?m.MaskedFunction:(console.warn("Mask not found for mask",t),m.Masked)}function g(t){if(!t)throw new Error("Options in not defined");if(m.Masked){if(t.prototype instanceof m.Masked)return{mask:t};const{mask:e,...s}=t instanceof m.Masked?{mask:t}:a(t)&&t.mask instanceof m.Masked?t:{};if(e){const t=e.mask;return{...n(e,(t,e)=>!e.startsWith("_")),mask:e.constructor,_mask:t,...s}}}return a(t)?{...t}:{mask:t}}function f(t){if(m.Masked&&t instanceof m.Masked)return t;const e=g(t),s=k(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}m.createMask=f;class _{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}m.MaskElement=_;class v extends _{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,s;return null!=(t=null==(e=(s=this.input).getRootNode)?void 0:e.call(s))?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){return this._handlers.redo&&(90===t.keyCode&&t.shiftKey&&(t.metaKey||t.ctrlKey)||89===t.keyCode&&t.ctrlKey)?(t.preventDefault(),this._handlers.redo(t)):this._handlers.undo&&90===t.keyCode&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),this._handlers.undo(t)):void(t.isComposing||this._handlers.selectionChange(t))}_onBeforeinput(t){return"historyUndo"===t.inputType&&this._handlers.undo?(t.preventDefault(),this._handlers.undo(t)):"historyRedo"===t.inputType&&this._handlers.redo?(t.preventDefault(),this._handlers.redo(t)):void 0}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}m.HTMLMaskElement=v;class C extends v{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}m.HTMLMaskElement=v;class A extends v{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return null==i||null==s||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}m.HTMLContenteditableMaskElement=A;class E{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>E.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}E.MAX_LENGTH=100,m.InputMask=class{constructor(t,e){this.el=t instanceof _?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new A(t):new C(t),this.masked=f(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new E,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var e;return null==t||(null==(e=this.masked)?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof m.Masked)&&this.masked.constructor===k(t))return void this.masked.updateOptions({mask:t});const e=t instanceof m.Masked?t:f({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach(t=>t(e))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,n=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===t?this.alignCursor():null!=t&&(this.cursorPos=t),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,u))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new c({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,a=s===this.masked.rawInputValue?e.removeDirection:r;let n=this.masked.nearestInputPos(e.startChangePos+i,a);a!==r&&(n=this.masked.nearestInputPos(n,r)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};class F{static normalize(t){return Array.isArray(t)?t:[t,new F]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}m.ChangeDetails=F;class x{constructor(t,e,s){void 0===t&&(t=""),void 0===e&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class y{constructor(t){this._value="",this._update({...y.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){void 0===e&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new x(this.extractInput(t,e),t)}appendTail(t){return i(t)&&(t=new x(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new F({inserted:t,rawInserted:t})):new F}_appendChar(t,e,s){void 0===e&&(e={});const i=this.state;let a;if([t,a]=this.doPrepareChar(t,e),t&&(a=a.aggregate(this._appendCharRaw(t,e)),!a.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=i;let n=this.pad(e);const r=this._appendCharRaw(t,e);n=n.aggregate(r),r.rawInserted||n.equals(a)?a=n:this.state=s}if(a.inserted){let t,n=!1!==this.doValidate(e);if(n&&null!=s){const e=this.state;if(!0===this.overwrite){t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.unshift(this.displayValue.length-a.tailShift)}let i=this.appendTail(s);if(n=i.rawInserted.length===s.toString().length,!(n&&i.inserted||"shift"!==this.overwrite)){this.state=e,t=s.state;for(let t=0;t<a.rawInserted.length;++t)s.shift();i=this.appendTail(s),n=i.rawInserted.length===s.toString().length}n&&i.inserted&&(this.state=e)}n||(a=new F,this.state=i,s&&t&&(s.state=t))}return a}_appendPlaceholder(){return new F}_appendEager(){return new F}append(t,e,s){if(!i(t))throw new Error("value should be string");const a=i(s)?new x(String(s)):s;let n;null!=e&&e.tail&&(e._beforeTailState=this.state),[t,n]=this.doPrepare(t,e);for(let s=0;s<t.length;++s){const i=this._appendChar(t[s],e,a);if(!i.rawInserted&&!this.doSkipInvalid(t[s],e,a))break;n.aggregate(i)}return(!0===this.eager||"append"===this.eager)&&null!=e&&e.input&&t&&n.aggregate(this._appendEager()),null!=a&&(n.tailShift+=this.appendTail(a).tailShift),n}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new F}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return Boolean(this.skipInvalid)}doPrepare(t,e){return void 0===e&&(e={}),F.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return void 0===e&&(e={}),F.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,a){void 0===s&&(s=""),void 0===i&&(i=r),void 0===a&&(a={input:!0});const n=t+e,p=this.extractTail(n),d=!0===this.eager||"remove"===this.eager;let c;d&&(i=function(t){switch(t){case u:return o;case h:return l;default:return t}}(i),c=this.extractInput(0,n,{raw:!0}));let m=t;const k=new F;if(i!==r&&(m=this.nearestInputPos(t,e>1&&0!==t&&!d?r:i),k.tailShift=m-t),k.aggregate(this.remove(m)),d&&i!==r&&c===this.rawInputValue)if(i===o){let t;for(;c===this.rawInputValue&&(t=this.displayValue.length);)k.aggregate(new F({tailShift:-1})).aggregate(this.remove(t-1))}else i===l&&p.unshift();return k.aggregate(this.append(s,a,p))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!d(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||y.EMPTY_VALUES.includes(t)&&y.EMPTY_VALUES.includes(e)||!!this.format&&this.format(t,this)===this.format(this.typedValue,this)}pad(t){return new F}}y.DEFAULTS={skipInvalid:!0},y.EMPTY_VALUES=[void 0,null,""],m.Masked=y;class b{constructor(t,e){void 0===t&&(t=[]),void 0===e&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=i(t)?new x(String(t)):t;const e=this.chunks[this.chunks.length-1],s=e&&(e.stop===t.stop||null==t.stop)&&t.from===e.from+e.toString().length;if(t instanceof x)s?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof b){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof m.MaskedPattern))return new x(this.toString()).appendTo(t);const e=new F;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=t._mapPosToBlock(t.displayValue.length),n=i.stop;let r;if(null!=n&&(!a||a.index<=n)&&((i instanceof b||t._stops.indexOf(n)>=0)&&e.aggregate(t._appendPlaceholder(n)),r=i instanceof b&&t._blocks[n]),r){const s=r.appendTail(i);e.aggregate(s);const a=i.toString().slice(s.rawInserted.length);a&&e.aggregate(t.append(a,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map(t=>{const e="chunks"in t?new b:new x;return e.state=t,e})}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let s=0;for(;s<this.chunks.length;){const t=this.chunks[s],i=t.unshift(e);if(t.toString()){if(!i)break;++s}else this.chunks.splice(s,1);if(i)return i}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class S{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(e=this.block)?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,o),0!==this.offset||void 0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,u),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,u),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,l),this.offset!==this.block.value.length||void 0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,r),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,r),!0})}}class B{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new F}nearestInputPos(t,e){void 0===e&&(e=r);const s=this._value.length;switch(e){case u:case o:return 0;default:return s}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new F;const s=!0===this.eager||"append"===this.eager,i=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,a=new F({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(e.raw||e.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new F;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new x("")}appendTail(t){return i(t)&&(t=new x(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return null!=s&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=Boolean(t._rawInputValue)}pad(t){return this._appendPlaceholder()}}class D{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r,...u}=t;this.masked=f(u),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new F}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t,e){if(void 0===e&&(e={}),this.isFilled)return new F;const s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&!1===this.doValidate(e)&&(i=new F,this.masked.state=s),i.inserted||this.isOptional||this.lazy||e.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new F:(this.isFilled=!0,new F({inserted:this.placeholderChar}))}_appendEager(){return new F}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){void 0===e&&(e=r);const s=this.value.length,i=Math.min(Math.max(t,0),s);switch(e){case u:case o:return this.isComplete?i:0;case h:case l:return this.isComplete?i:s;default:return i}}totalInputPositions(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(null==t||null==(e=t._beforeTailState)?void 0:e.masked)||(null==t?void 0:t._beforeTailState)}}pad(t){return new F}}D.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./},m.MaskedRegExp=class extends y{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=t=>t.search(e)>=0),super._update(t)}};class V extends y{constructor(t){super({...V.DEFAULTS,...t,definitions:Object.assign({},D.DEFAULT_DEFINITIONS,null==t?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let a=0;a<e.length;++a){if(this.blocks){const t=e.slice(a),s=Object.keys(this.blocks).filter(e=>0===t.indexOf(e));s.sort((t,e)=>e.length-t.length);const i=s[0];if(i){const{expose:t,repeat:e,...s}=g(this.blocks[i]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:e,parent:this},r=null!=e?new m.RepeatBlock(n):f(n);r&&(this._blocks.push(r),t&&(this.exposeBlock=r),this._maskedBlocks[i]||(this._maskedBlocks[i]=[]),this._maskedBlocks[i].push(this._blocks.length-1)),a+=i.length-1;continue}}let n=e[a],r=n in t;if(n===V.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){i=!i;continue}if(n===V.ESCAPE_CHAR){if(++a,n=e[a],!n)break;r=!1}const u=r?new D({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...g(t[n]),parent:this}):new B({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t)return void this.reset();const{_blocks:e,...s}=t;this._blocks.forEach((t,s)=>t.state=e[s]),super.state=s}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,e)=>t+e.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,e)=>t+e.value,"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,e)=>t+e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new F;let s=null==(t=this._mapPosToBlock(this.displayValue.length))?void 0:t.index;if(null==s)return e;this._blocks[s].isFilled&&++s;for(let t=s;t<this._blocks.length;++t){const s=this._blocks[t]._appendEager();if(!s.inserted)break;e.aggregate(s)}return e}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new F;if(!s)return i;for(let n,r=s.index;n=this._blocks[r];++r){var a;const s=n._appendChar(t,{...e,_beforeTailState:null==(a=e._beforeTailState)||null==(a=a._blocks)?void 0:a[r]});if(i.aggregate(s),s.consumed)break}return i}extractTail(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=new b;return t===e||this._forEachBlocksInRange(t,e,(t,e,i,a)=>{const n=t.extractTail(i,a);n.stop=this._findStopBefore(e),n.from=this._blockStartPos(e),n instanceof b&&(n.blockIndex=e),s.extend(n)}),s}extractInput(t,e,s){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),void 0===s&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,(t,e,a,n)=>{i+=t.extractInput(a,n,s)}),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(!(i<=t))break;e=i}return e}_appendPlaceholder(t){const e=new F;if(this.lazy&&null==t)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,a=null!=t?t:this._blocks.length;return this._blocks.slice(i,a).forEach(s=>{var i;s.lazy&&null==t||e.aggregate(s._appendPlaceholder(null==(i=s._blocks)?void 0:i.length))}),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+e.displayValue.length,0)}_forEachBlocksInRange(t,e,s){void 0===e&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const t=this._mapPosToBlock(e),a=t&&i.index===t.index,n=i.offset,r=t&&a?t.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,n,r),t&&!a){for(let e=i.index+1;e<t.index;++e)s(this._blocks[e],e,0,this._blocks[e].displayValue.length);s(this._blocks[t.index],t.index,0,t.offset)}}}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,(t,e,i,a)=>{s.aggregate(t.remove(i,a))}),s}nearestInputPos(t,e){if(void 0===e&&(e=r),!this._blocks.length)return 0;const s=new S(this,t);if(e===r)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(e===u||e===o){if(e===u){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===u){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t)return s.pos;if(s.popState(),s.ok&&s.pos<=t)return s.pos;s.popState()}return s.ok?s.pos:e===o?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return e===h||e===l?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===l?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(t,u)))):t}totalInputPositions(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,(t,e,i,a)=>{s+=t.totalInputPositions(i,a)}),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(t=>this._blocks[t]):[]}pad(t){const e=new F;return this._forEachBlocksInRange(0,this.displayValue.length,s=>e.aggregate(s.pad(t))),e}}V.DEFAULTS={...y.DEFAULTS,lazy:!0,placeholderChar:"_"},V.STOP_CHAR="`",V.ESCAPE_CHAR="\\",V.InputDefinition=D,V.FixedDefinition=B,m.MaskedPattern=V;class M extends V{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...n}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;const r=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0");let o=0;for(;o<u.length&&u[o]===r[o];)++o;n.mask=u.slice(0,o).replace(/0/g,"\\0")+"0".repeat(this.maxLength-o),super._update(n)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",s="";const[,i,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(i.length)+a,s="9".repeat(i.length)+a),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){let s;return void 0===e&&(e={}),[t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(s.skip=!this.isComplete),[t,s]}_appendCharRaw(t,e){if(void 0===e&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,n]=this.boundaries(this.value+t);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(-1===e.search(/[^0]/)&&e.length<=this._matchFrom)return!0;const[s,i]=this.boundaries(e);return this.from<=Number(i)&&Number(s)<=this.to&&super.doValidate(t)}pad(t){const e=new F;if(this.value.length===this.maxLength)return e;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)e.aggregate(super._appendCharRaw("0",t));s.split("").forEach(t=>this._appendCharRaw(t))}return e}}m.MaskedRange=M;class w extends V{static extractPatternOptions(t){const{mask:e,pattern:s,...a}=t;return{...a,mask:i(e)?e:s}}constructor(t){super(w.extractPatternOptions({...w.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:e,pattern:s,blocks:a,...n}={...w.DEFAULTS,...t},r=Object.assign({},w.GET_DEFAULT_BLOCKS());t.min&&(r.Y.from=t.min.getFullYear()),t.max&&(r.Y.to=t.max.getFullYear()),t.min&&t.max&&r.Y.from===r.Y.to&&(r.m.from=t.min.getMonth()+1,r.m.to=t.max.getMonth()+1,r.m.from===r.m.to&&(r.d.from=t.min.getDate(),r.d.to=t.max.getDate())),Object.assign(r,this.blocks,a),super._update({...n,mask:i(e)?e:s,blocks:r})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&null!=e&&(null==this.min||this.min<=e)&&(null==this.max||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(w.extractPatternOptions(t))}}w.GET_DEFAULT_BLOCKS=()=>({d:{mask:M,from:1,to:31,maxLength:2},m:{mask:M,from:1,to:12,maxLength:2},Y:{mask:M,from:1900,to:9999}}),w.DEFAULTS={...V.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(t,e)=>t?[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join("."):"",parse:(t,e)=>{const[s,i,a]=t.split(".").map(Number);return new Date(a,i-1,s)}},m.MaskedDate=w;class I extends y{constructor(t){super({...I.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>{const{expose:e,...s}=g(t),i=f({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return e&&(this.exposeMask=i),i}):[])}_appendCharRaw(t,e){void 0===e&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){void 0===t&&(t=""),void 0===e&&(e={}),void 0===s&&(s="");const i=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,a=this.rawInputValue,n=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:a,r=a.slice(n.length),u=this.currentMask,o=new F,h=null==u?void 0:u.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),o.tailShift=this.currentMask.value.length-i.length),r&&(o.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):h&&(this.currentMask.state=h)),o}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new F;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:(null==(e=t._beforeTailState)?void 0:e.currentMaskRef)===this.currentMask&&(null==(s=t._beforeTailState)?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return void 0===e&&(e={}),void 0===s&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){void 0===e&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let t;[s,t]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}doPrepareChar(t,e){void 0===e&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let t;[s,t]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(t)}return[s,i]}reset(){var t;null==(t=this.currentMask)||t.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask)return this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,void this._applyDispatch();let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null==(t=this.currentMask)?void 0:t.isFilled)}remove(t,e){const s=new F;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:null==(t=this.currentMask)?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...a}=t;e&&this.compiledMasks.forEach((t,s)=>t.state=e[s]),null!=s&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((e,s)=>{if(!t[s])return;const{mask:i,...a}=t[s];return d(e,a)&&e.maskEquals(i)}):super.maskEquals(t)}typedValueEquals(t){var e;return Boolean(null==(e=this.currentMask)?void 0:e.typedValueEquals(t))}}I.DEFAULTS={...y.DEFAULTS,dispatch:(t,e,s,i)=>{if(!e.compiledMasks.length)return;const a=e.rawInputValue,n=e.compiledMasks.map((n,r)=>{const u=e.currentMask===n,h=u?n.displayValue.length:n.nearestInputPos(n.displayValue.length,o);return n.rawInputValue!==a?(n.reset(),n.append(a,{raw:!0})):u||n.remove(h),n.append(t,e.currentMaskFlags(s)),n.appendTail(i),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(h,n.nearestInputPos(n.displayValue.length,o)))}});return n.sort((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions),e.compiledMasks[n[0].index]}},m.MaskedDynamic=I;class T extends V{constructor(t){super({...T.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const t=e.map(t=>t.length),i=Math.min(...t),a=Math.max(...t)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=e}super._update(s)}_appendCharRaw(t,e){void 0===e&&(e={});const s=Math.min(this.nearestInputPos(0,l),this.value.length),i=this.enum.filter(e=>this.matchValue(e,this.unmaskedValue+t,s));if(i.length){1===i.length&&this._forEachBlocksInRange(0,this.value.length,(t,s)=>{const a=i[0][s];s>=this.value.length||a===t.value||(t.reset(),t._appendChar(a,e))});const t=super._appendCharRaw(i[0][this.value.length],e);return 1===i.length&&i[0].slice(this.unmaskedValue.length).split("").forEach(e=>t.aggregate(super._appendCharRaw(e))),t}return new F({skip:!this.isComplete})}extractTail(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),new x("",t)}remove(t,e){if(void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),t===e)return new F;const s=Math.min(super.nearestInputPos(0,l),this.value.length);let i;for(i=t;i>=0&&!(this.enum.filter(t=>this.matchValue(t,this.value.slice(s,i),s)).length>1);--i);const a=super.remove(i,e);return a.tailShift+=i-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}var R;T.DEFAULTS={...V.DEFAULTS,matchValue:(t,e,s)=>t.indexOf(e,s)===s},m.MaskedEnum=T,m.MaskedFunction=class extends y{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}};class P extends y{constructor(t){super({...P.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+p(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(p).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(p(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){void 0===e&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),!s||this.allowPositive||this.value||"-"===s||i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){void 0===e&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return void 0===t&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){void 0===e&&(e={});const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const n=this.number;let r,u=!isNaN(n),o=!1;if(u){let t;null!=this.min&&this.min<0&&this.number<this.min&&(t=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(t=this.max),null!=t&&(this.autofix?(this._value=this.format(t,this).replace(P.UNMASKED_RADIX,this.radix),o||(o=a===this._value&&!e.tail)):u=!1),u&&(u=Boolean(this._value.match(this._numberRegExp)))}u?r=new F({inserted:this._value.slice(a.length),rawInserted:o?"":t,skip:o}):(this._value=a,r=new F),this._value=this._insertThousandsSeparators(this._value);const h=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(h);return r.tailShift+=(l-i)*this.thousandsSeparator.length,r}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const n=this._separatorsCountFromSlice(s);return new F({tailShift:(n-a)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case r:case u:case o:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===o)return s}break}case h:case l:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,s,i)=>e+i),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){void 0===e&&(e={});const i=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===P.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,P.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(P.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||P.EMPTY_VALUES.includes(t)&&P.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}R=P,P.UNMASKED_RADIX=".",P.EMPTY_VALUES=[...y.EMPTY_VALUES,0],P.DEFAULTS={...y.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[R.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},m.MaskedNumber=P;const O={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function L(t,e,s){void 0===e&&(e=O.MASKED),void 0===s&&(s=O.MASKED);const i=f(t);return t=>i.runIsolated(i=>(i[e]=t,i[s]))}m.PIPE_TYPE=O,m.createPipe=L,m.pipe=function(t,e,s,i){return L(e,s,i)(t)},m.RepeatBlock=class extends V{get repeatFrom(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?t:0}get repeatTo(){var t;return null!=(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,s,i;const{repeat:a,...n}=g(t);this._blockOpts=Object.assign({},this._blockOpts,n);const r=f(this._blockOpts);this.repeat=null!=(e=null!=(s=null!=a?a:r.repeat)?s:this.repeat)?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(i=this._blocks)?void 0:i.length)||0,this.repeatFrom)),blocks:{m:r},eager:r.eager,overwrite:r.overwrite,skipInvalid:r.skipInvalid,lazy:r.lazy,placeholderChar:r.placeholderChar,displayChar:r.displayChar})}_allocateBlock(t){return t<this._blocks.length?this._blocks[t]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(f(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(t,e){void 0===e&&(e={});const s=new F;for(let u,o,h=null!=(i=null==(a=this._mapPosToBlock(this.displayValue.length))?void 0:a.index)?i:Math.max(this._blocks.length-1,0);u=null!=(n=this._blocks[h])?n:o=!o&&this._allocateBlock(h);++h){var i,a,n,r;const l=u._appendChar(t,{...e,_beforeTailState:null==(r=e._beforeTailState)||null==(r=r._blocks)?void 0:r[h]});if(l.skip&&o){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(l),l.consumed)break}return s}_trimEmptyTail(t,e){var s,i;void 0===t&&(t=0);const a=Math.max((null==(s=this._mapPosToBlock(t))?void 0:s.index)||0,this.repeatFrom,0);let n;null!=e&&(n=null==(i=this._mapPosToBlock(e))?void 0:i.index),null==n&&(n=this._blocks.length-1);let r=0;for(let t=n;a<=t&&!this._blocks[t].unmaskedValue;--t,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){void 0===t&&(t=0),void 0===e&&(e=this.displayValue.length);const s=super.remove(t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return void 0===t&&(t=0),null==e&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}};try{globalThis.IMask=m}catch{}var U=s(155),N=s(556);const j={mask:N.oneOfType([N.array,N.func,N.string,N.instanceOf(RegExp),N.oneOf([Date,Number,m.Masked]),N.instanceOf(m.Masked)]),value:N.any,unmask:N.oneOfType([N.bool,N.oneOf(["typed"])]),prepare:N.func,prepareChar:N.func,validate:N.func,commit:N.func,overwrite:N.oneOfType([N.bool,N.oneOf(["shift"])]),eager:N.oneOfType([N.bool,N.oneOf(["append","remove"])]),skipInvalid:N.bool,onAccept:N.func,onComplete:N.func,placeholderChar:N.string,displayChar:N.string,lazy:N.bool,definitions:N.object,blocks:N.object,enum:N.arrayOf(N.string),maxLength:N.number,from:N.number,to:N.number,pattern:N.string,format:N.func,parse:N.func,autofix:N.oneOfType([N.bool,N.oneOf(["pad"])]),radix:N.string,thousandsSeparator:N.string,mapToRadix:N.arrayOf(N.string),scale:N.number,normalizeZeros:N.bool,padFractionalZeros:N.bool,min:N.oneOfType([N.number,N.instanceOf(Date)]),max:N.oneOfType([N.number,N.instanceOf(Date)]),dispatch:N.func,inputRef:N.oneOfType([N.func,N.shape({current:N.object})])},z=Object.keys(j).filter(t=>"value"!==t),q=["value","unmask","onAccept","onComplete","inputRef"],K=z.filter(t=>q.indexOf(t)<0),Y=function(t){var e;const s=((e=class extends U.Component{constructor(t){super(t),this._inputRef=this._inputRef.bind(this)}componentDidMount(){this.props.mask&&this.initMask()}componentDidUpdate(){const t=this.props,e=this._extractMaskOptionsFromProps(t);var s;e.mask?this.maskRef?(this.maskRef.updateOptions(e),"value"in t&&void 0!==t.value&&(this.maskValue=t.value)):this.initMask(e):(this.destroyMask(),"value"in t&&void 0!==t.value&&(null!=(s=this.element)&&s.isContentEditable&&"INPUT"!==this.element.tagName&&"TEXTAREA"!==this.element.tagName?this.element.textContent=t.value:this.element.value=t.value))}componentWillUnmount(){this.destroyMask()}_inputRef(t){this.element=t,this.props.inputRef&&(Object.prototype.hasOwnProperty.call(this.props.inputRef,"current")?this.props.inputRef.current=t:this.props.inputRef(t))}initMask(t){void 0===t&&(t=this._extractMaskOptionsFromProps(this.props)),this.maskRef=m(this.element,t).on("accept",this._onAccept.bind(this)).on("complete",this._onComplete.bind(this)),"value"in this.props&&void 0!==this.props.value&&(this.maskValue=this.props.value)}destroyMask(){this.maskRef&&(this.maskRef.destroy(),delete this.maskRef)}_extractMaskOptionsFromProps(t){const{...e}=t;return Object.keys(e).filter(t=>K.indexOf(t)<0).forEach(t=>{delete e[t]}),e}_extractNonMaskProps(t){const{...e}=t;return z.forEach(t=>{"maxLength"!==t&&delete e[t]}),"defaultValue"in e||(e.defaultValue=t.mask?"":e.value),delete e.value,e}get maskValue(){return this.maskRef?"typed"===this.props.unmask?this.maskRef.typedValue:this.props.unmask?this.maskRef.unmaskedValue:this.maskRef.value:""}set maskValue(t){this.maskRef&&(t=null==t&&"typed"!==this.props.unmask?"":t,"typed"===this.props.unmask?this.maskRef.typedValue=t:this.props.unmask?this.maskRef.unmaskedValue=t:this.maskRef.value=t)}_onAccept(t){this.props.onAccept&&this.maskRef&&this.props.onAccept(this.maskValue,this.maskRef,t)}_onComplete(t){this.props.onComplete&&this.maskRef&&this.props.onComplete(this.maskValue,this.maskRef,t)}render(){return U.createElement(t,{...this._extractNonMaskProps(this.props),inputRef:this._inputRef})}}).displayName=void 0,e.propTypes=void 0,e),i=t.displayName||t.name||"Component";return s.displayName="IMask("+i+")",s.propTypes=j,U.forwardRef((t,e)=>U.createElement(s,{...t,ref:e}))}(t=>{let{inputRef:e,...s}=t;return U.createElement("input",{...s,ref:e})}),H=U.forwardRef((t,e)=>U.createElement(Y,{...t,ref:e}))}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 908.index.js.LICENSE.txt */
2
+ (self.webpackChunkreact_components=self.webpackChunkreact_components||[]).push([[908],{908(e){var t,r;t=function(e){var t,r,n,o;!function(e){var o,a,i,u,c={},s={},l={},f={},d=Object.prototype.hasOwnProperty,h=[].slice,p=/\.js$/;function g(e,t){return d.call(e,t)}function m(e,t){var r,n,o,a,i,u,c,s,f,d,h,g=t&&t.split("/"),m=l.map,v=m&&m["*"]||{};if(e&&"."===e.charAt(0))if(t){for(g=g.slice(0,g.length-1),i=(e=e.split("/")).length-1,l.nodeIdCompat&&p.test(e[i])&&(e[i]=e[i].replace(p,"")),e=g.concat(e),f=0;f<e.length;f+=1)if("."===(h=e[f]))e.splice(f,1),f-=1;else if(".."===h){if(1===f&&(".."===e[2]||".."===e[0]))break;f>0&&(e.splice(f-1,2),f-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((g||v)&&m){for(f=(r=e.split("/")).length;f>0;f-=1){if(n=r.slice(0,f).join("/"),g)for(d=g.length;d>0;d-=1)if((o=m[g.slice(0,d).join("/")])&&(o=o[n])){a=o,u=f;break}if(a)break;!c&&v&&v[n]&&(c=v[n],s=f)}!a&&c&&(a=c,u=s),a&&(r.splice(0,u,a),e=r.join("/"))}return e}function v(t,r){return function(){return a.apply(e,h.call(arguments,0).concat([t,r]))}}function y(e){return function(t){c[e]=t}}function _(t){if(g(s,t)){var r=s[t];delete s[t],f[t]=!0,o.apply(e,r)}if(!g(c,t)&&!g(f,t))throw new Error("No "+t);return c[t]}function x(e){var t,r=e?e.indexOf("!"):-1;return r>-1&&(t=e.substring(0,r),e=e.substring(r+1,e.length)),[t,e]}function w(e){return function(){return l&&l.config&&l.config[e]||{}}}i=function(e,t){var r,n=x(e),o=n[0];return e=n[1],o&&(r=_(o=m(o,t))),o?e=r&&r.normalize?r.normalize(e,function(e){return function(t){return m(t,e)}}(t)):m(e,t):(o=(n=x(e=m(e,t)))[0],e=n[1],o&&(r=_(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:r}},u={require:function(e){return v(e)},exports:function(e){var t=c[e];return void 0!==t?t:c[e]={}},module:function(e){return{id:e,uri:"",exports:c[e],config:w(e)}}},o=function(t,r,n,o){var a,l,d,h,p,m,x=[],w=typeof n;if(o=o||t,"undefined"===w||"function"===w){for(r=!r.length&&n.length?["require","exports","module"]:r,p=0;p<r.length;p+=1)if("require"===(l=(h=i(r[p],o)).f))x[p]=u.require(t);else if("exports"===l)x[p]=u.exports(t),m=!0;else if("module"===l)a=x[p]=u.module(t);else if(g(c,l)||g(s,l)||g(f,l))x[p]=_(l);else{if(!h.p)throw new Error(t+" missing "+l);h.p.load(h.n,v(o,!0),y(l),{}),x[p]=c[l]}d=n?n.apply(c[t],x):void 0,t&&(a&&a.exports!==e&&a.exports!==c[t]?c[t]=a.exports:d===e&&m||(c[t]=d))}else t&&(c[t]=n)},t=r=a=function(t,r,n,c,s){if("string"==typeof t)return u[t]?u[t](r):_(i(t,r).f);if(!t.splice){if((l=t).deps&&a(l.deps,l.callback),!r)return;r.splice?(t=r,r=n,n=null):t=e}return r=r||function(){},"function"==typeof n&&(n=c,c=s),c?o(e,t,r,n):setTimeout(function(){o(e,t,r,n)},4),a},a.config=function(e){return a(e)},t._defined=c,(n=function(e,t,r){t.splice||(r=t,t=[]),g(c,e)||g(s,e)||(s[e]=[e,t,r])}).amd={jQuery:!0}}(),n("almond",function(){}),n("image_loader",[],function(){"use strict";var e={};function t(e,t){e.onload=function(){t.loaded(this)}}return e.load=function(e,r,n,o,a){var i,u,c,s=new Array(o),l=new Array(s.length);if(!1===a)s[0]=e;else for(i=0;i<s.length;i++)c=n+i,s[i]=e+"image-"+("00"+c).slice(-3)+".jpg";for(l.notLoaded=[],l.addImage=function(e){l.notLoaded.push(e)},l.loaded=function(e){for(var t=l.notLoaded,n=0;n<t.length;n++)if(t[n]==e){t.splice(n,1);for(var o=0;o<s.length;o++){var a=s[o].substr(s[o].lastIndexOf("/"));if(-1!=e.src.lastIndexOf(a)){l[o]=e;break}}break}0===t.length&&(console.log("Images loaded"),r.apply(null,[l]))},i=0;i<s.length;i++)u=new Image,l.addImage(u),t(u,l),u.src=s[i]},e}),n("input_stream",["image_loader"],function(e){"use strict";var t={createVideoStream:function(e){var t,r,n={},o=null,a=["canrecord","ended"],i={},u={x:0,y:0},c={x:0,y:0};return n.getRealWidth=function(){return e.videoWidth},n.getRealHeight=function(){return e.videoHeight},n.getWidth=function(){return t},n.getHeight=function(){return r},n.setWidth=function(e){t=e},n.setHeight=function(e){r=e},n.setInputStream=function(t){o=t,e.src=void 0!==t.src?t.src:""},n.ended=function(){return e.ended},n.getConfig=function(){return o},n.setAttribute=function(t,r){e.setAttribute(t,r)},n.pause=function(){e.pause()},n.play=function(){e.play()},n.setCurrentTime=function(t){"LiveStream"!==o.type&&(e.currentTime=t)},n.addEventListener=function(t,r,n){-1!==a.indexOf(t)?(i[t]||(i[t]=[]),i[t].push(r)):e.addEventListener(t,r,n)},n.clearEventHandlers=function(){a.forEach(function(t){var r=i[t];r&&r.length>0&&r.forEach(function(r){e.removeEventListener(t,r)})})},n.trigger=function(a,u){var s,l,f,d=i[a];if("canrecord"===a&&(l=e.videoWidth,f=e.videoHeight,t=o.size?l/f>1?o.size:Math.floor(l/f*o.size):l,r=o.size?l/f>1?Math.floor(f/l*o.size):o.size:f,c.x=t,c.y=r),d&&d.length>0)for(s=0;s<d.length;s++)d[s].apply(n,u)},n.setTopRight=function(e){u.x=e.x,u.y=e.y},n.getTopRight=function(){return u},n.setCanvasSize=function(e){c.x=e.x,c.y=e.y},n.getCanvasSize=function(){return c},n.getFrame=function(){return e},n},createLiveStream:function(e){e.setAttribute("autoplay",!0);var r=t.createVideoStream(e);return r.ended=function(){return!1},r},createImageStream:function(){var t,r,n={},o=null,a=0,i=0,u=0,c=!0,s=!1,l=null,f=0,d=null,h=!1,p=["canrecord","ended"],g={},m={x:0,y:0},v={x:0,y:0};function y(e,t){var r,o=g[e];if(o&&o.length>0)for(r=0;r<o.length;r++)o[r].apply(n,t)}return n.trigger=y,n.getWidth=function(){return t},n.getHeight=function(){return r},n.setWidth=function(e){t=e},n.setHeight=function(e){r=e},n.getRealWidth=function(){return a},n.getRealHeight=function(){return i},n.setInputStream=function(n){o=n,!1===n.sequence?(d=n.src,f=1):(d=n.src,f=n.length),s=!1,e.load(d,function(e){l=e,a=e[0].width,i=e[0].height,t=o.size?a/i>1?o.size:Math.floor(a/i*o.size):a,r=o.size?a/i>1?Math.floor(i/a*o.size):o.size:i,v.x=t,v.y=r,s=!0,u=0,setTimeout(function(){y("canrecord",[])},0)},1,f,o.sequence)},n.ended=function(){return h},n.setAttribute=function(){},n.getConfig=function(){return o},n.pause=function(){c=!0},n.play=function(){c=!1},n.setCurrentTime=function(e){u=e},n.addEventListener=function(e,t){-1!==p.indexOf(e)&&(g[e]||(g[e]=[]),g[e].push(t))},n.setTopRight=function(e){m.x=e.x,m.y=e.y},n.getTopRight=function(){return m},n.setCanvasSize=function(e){v.x=e.x,v.y=e.y},n.getCanvasSize=function(){return v},n.getFrame=function(){var e;return s?(c||(e=l[u],u<f-1?u++:setTimeout(function(){h=!0,y("ended",[])},0)),e):null},n}};return t}),glMatrixArrayType=Float32Array,"undefined"!=typeof window&&(window.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)},navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL),Math.imul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},n("typedefs",(o=this,function(){return o.typedefs})),n("subImage",["typedefs"],function(){"use strict";function e(e,t,r){r||(r={data:null,size:t}),this.data=r.data,this.originalSize=r.size,this.I=r,this.from=e,this.size=t}return e.prototype.show=function(e,t){var r,n,o,a,i,u,c;for(t||(t=1),r=e.getContext("2d"),e.width=this.size.x,e.height=this.size.y,o=(n=r.getImageData(0,0,e.width,e.height)).data,a=0,i=0;i<this.size.y;i++)for(u=0;u<this.size.x;u++)c=i*this.size.x+u,a=this.get(u,i)*t,o[4*c+0]=a,o[4*c+1]=a,o[4*c+2]=a,o[4*c+3]=255;n.data=o,r.putImageData(n,0,0)},e.prototype.get=function(e,t){return this.data[(this.from.y+t)*this.originalSize.x+this.from.x+e]},e.prototype.updateData=function(e){this.originalSize=e.size,this.data=e.data},e.prototype.updateFrom=function(e){return this.from=e,this},e}),n("cluster",[],function(){"use strict";return{create:function(e,t){var r=[],n={rad:0,vec:s.create([0,0])},o={};function a(e){o[e.id]=e,r.push(e)}function i(){var e,t=0;for(e=0;e<r.length;e++)t+=r[e].rad;n.rad=t/r.length,n.vec=s.create([Math.cos(n.rad),Math.sin(n.rad)])}return a(e),i(),{add:function(e){o[e.id]||(a(e),i())},fits:function(e){return Math.abs(s.dot(e.point.vec,n.vec))>t},getPoints:function(){return r},getCenter:function(){return n}}},createPoint:function(e,t,r){return{rad:e[r],point:e,id:t}}}});var a={create:function(e){var t;return e?((t=new glMatrixArrayType(3))[0]=e[0],t[1]=e[1],t[2]=e[2]):t=glMatrixArrayType===Array?new glMatrixArrayType([0,0,0]):new glMatrixArrayType(3),t},set:function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},add:function(e,t,r){return r&&e!=r?(r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r):(e[0]+=t[0],e[1]+=t[1],e[2]+=t[2],e)},subtract:function(e,t,r){return r&&e!=r?(r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r):(e[0]-=t[0],e[1]-=t[1],e[2]-=t[2],e)},negate:function(e,t){return t||(t=e),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},scale:function(e,t,r){return r&&e!=r?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r):(e[0]*=t,e[1]*=t,e[2]*=t,e)},normalize:function(e,t){t||(t=e);var r=e[0],n=e[1],o=e[2],a=Math.sqrt(r*r+n*n+o*o);return a?1==a?(t[0]=r,t[1]=n,t[2]=o,t):(a=1/a,t[0]=r*a,t[1]=n*a,t[2]=o*a,t):(t[0]=0,t[1]=0,t[2]=0,t)},cross:function(e,t,r){r||(r=e);var n=e[0],o=e[1],a=e[2],i=t[0],u=t[1],c=t[2];return r[0]=o*c-a*u,r[1]=a*i-n*c,r[2]=n*u-o*i,r},length:function(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},direction:function(e,t,r){r||(r=e);var n=e[0]-t[0],o=e[1]-t[1],a=e[2]-t[2],i=Math.sqrt(n*n+o*o+a*a);return i?(i=1/i,r[0]=n*i,r[1]=o*i,r[2]=a*i,r):(r[0]=0,r[1]=0,r[2]=0,r)},lerp:function(e,t,r,n){return n||(n=e),n[0]=e[0]+r*(t[0]-e[0]),n[1]=e[1]+r*(t[1]-e[1]),n[2]=e[2]+r*(t[2]-e[2]),n},str:function(e){return"["+e[0]+", "+e[1]+", "+e[2]+"]"}},i={create:function(e){var t;return e?((t=new glMatrixArrayType(9))[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8]):t=glMatrixArrayType===Array?new glMatrixArrayType([0,0,0,0,0,0,0,0,0]):new glMatrixArrayType(9),t},set:function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},transpose:function(e,t){if(!t||e==t){var r=e[1],n=e[2],o=e[5];return e[1]=e[3],e[2]=e[6],e[3]=r,e[5]=e[7],e[6]=n,e[7]=o,e}return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t},toMat4:function(e,t){return t||(t=u.create()),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},str:function(e){return"["+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+"]"}},u={create:function(e){var t;return e?((t=new glMatrixArrayType(16))[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]):t=glMatrixArrayType===Array?new glMatrixArrayType([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]):new glMatrixArrayType(16),t},set:function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},transpose:function(e,t){if(!t||e==t){var r=e[1],n=e[2],o=e[3],a=e[6],i=e[7],u=e[11];return e[1]=e[4],e[2]=e[8],e[3]=e[12],e[4]=r,e[6]=e[9],e[7]=e[13],e[8]=n,e[9]=a,e[11]=e[14],e[12]=o,e[13]=i,e[14]=u,e}return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t},determinant:function(e){var t=e[0],r=e[1],n=e[2],o=e[3],a=e[4],i=e[5],u=e[6],c=e[7],s=e[8],l=e[9],f=e[10],d=e[11],h=e[12],p=e[13],g=e[14],m=e[15];return h*l*u*o-s*p*u*o-h*i*f*o+a*p*f*o+s*i*g*o-a*l*g*o-h*l*n*c+s*p*n*c+h*r*f*c-t*p*f*c-s*r*g*c+t*l*g*c+h*i*n*d-a*p*n*d-h*r*u*d+t*p*u*d+a*r*g*d-t*i*g*d-s*i*n*m+a*l*n*m+s*r*u*m-t*l*u*m-a*r*f*m+t*i*f*m},inverse:function(e,t){t||(t=e);var r=e[0],n=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=e[6],s=e[7],l=e[8],f=e[9],d=e[10],h=e[11],p=e[12],g=e[13],m=e[14],v=e[15],y=r*u-n*i,_=r*c-o*i,x=r*s-a*i,w=n*c-o*u,b=n*s-a*u,C=o*s-a*c,E=l*g-f*p,R=l*m-d*p,A=l*v-h*p,T=f*m-d*g,M=f*v-h*g,O=d*v-h*m,S=1/(y*O-_*M+x*T+w*A-b*R+C*E);return t[0]=(u*O-c*M+s*T)*S,t[1]=(-n*O+o*M-a*T)*S,t[2]=(g*C-m*b+v*w)*S,t[3]=(-f*C+d*b-h*w)*S,t[4]=(-i*O+c*A-s*R)*S,t[5]=(r*O-o*A+a*R)*S,t[6]=(-p*C+m*x-v*_)*S,t[7]=(l*C-d*x+h*_)*S,t[8]=(i*M-u*A+s*E)*S,t[9]=(-r*M+n*A-a*E)*S,t[10]=(p*b-g*x+v*y)*S,t[11]=(-l*b+f*x-h*y)*S,t[12]=(-i*T+u*R-c*E)*S,t[13]=(r*T-n*R+o*E)*S,t[14]=(-p*w+g*_-m*y)*S,t[15]=(l*w-f*_+d*y)*S,t},toRotationMat:function(e,t){return t||(t=u.create()),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},toMat3:function(e,t){return t||(t=i.create()),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},toInverseMat3:function(e,t){var r=e[0],n=e[1],o=e[2],a=e[4],u=e[5],c=e[6],s=e[8],l=e[9],f=e[10],d=f*u-c*l,h=-f*a+c*s,p=l*a-u*s,g=r*d+n*h+o*p;if(!g)return null;var m=1/g;return t||(t=i.create()),t[0]=d*m,t[1]=(-f*n+o*l)*m,t[2]=(c*n-o*u)*m,t[3]=h*m,t[4]=(f*r-o*s)*m,t[5]=(-c*r+o*a)*m,t[6]=p*m,t[7]=(-l*r+n*s)*m,t[8]=(u*r-n*a)*m,t},multiply:function(e,t,r){r||(r=e);var n=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],s=e[6],l=e[7],f=e[8],d=e[9],h=e[10],p=e[11],g=e[12],m=e[13],v=e[14],y=e[15],_=t[0],x=t[1],w=t[2],b=t[3],C=t[4],E=t[5],R=t[6],A=t[7],T=t[8],M=t[9],O=t[10],S=t[11],D=t[12],z=t[13],I=t[14],P=t[15];return r[0]=_*n+x*u+w*f+b*g,r[1]=_*o+x*c+w*d+b*m,r[2]=_*a+x*s+w*h+b*v,r[3]=_*i+x*l+w*p+b*y,r[4]=C*n+E*u+R*f+A*g,r[5]=C*o+E*c+R*d+A*m,r[6]=C*a+E*s+R*h+A*v,r[7]=C*i+E*l+R*p+A*y,r[8]=T*n+M*u+O*f+S*g,r[9]=T*o+M*c+O*d+S*m,r[10]=T*a+M*s+O*h+S*v,r[11]=T*i+M*l+O*p+S*y,r[12]=D*n+z*u+I*f+P*g,r[13]=D*o+z*c+I*d+P*m,r[14]=D*a+z*s+I*h+P*v,r[15]=D*i+z*l+I*p+P*y,r},multiplyVec3:function(e,t,r){r||(r=t);var n=t[0],o=t[1],a=t[2];return r[0]=e[0]*n+e[4]*o+e[8]*a+e[12],r[1]=e[1]*n+e[5]*o+e[9]*a+e[13],r[2]=e[2]*n+e[6]*o+e[10]*a+e[14],r},multiplyVec4:function(e,t,r){r||(r=t);var n=t[0],o=t[1],a=t[2],i=t[3];return r[0]=e[0]*n+e[4]*o+e[8]*a+e[12]*i,r[1]=e[1]*n+e[5]*o+e[9]*a+e[13]*i,r[2]=e[2]*n+e[6]*o+e[10]*a+e[14]*i,r[3]=e[3]*n+e[7]*o+e[11]*a+e[15]*i,r},translate:function(e,t,r){var n=t[0],o=t[1],a=t[2];if(!r||e==r)return e[12]=e[0]*n+e[4]*o+e[8]*a+e[12],e[13]=e[1]*n+e[5]*o+e[9]*a+e[13],e[14]=e[2]*n+e[6]*o+e[10]*a+e[14],e[15]=e[3]*n+e[7]*o+e[11]*a+e[15],e;var i=e[0],u=e[1],c=e[2],s=e[3],l=e[4],f=e[5],d=e[6],h=e[7],p=e[8],g=e[9],m=e[10],v=e[11];return r[0]=i,r[1]=u,r[2]=c,r[3]=s,r[4]=l,r[5]=f,r[6]=d,r[7]=h,r[8]=p,r[9]=g,r[10]=m,r[11]=v,r[12]=i*n+l*o+p*a+e[12],r[13]=u*n+f*o+g*a+e[13],r[14]=c*n+d*o+m*a+e[14],r[15]=s*n+h*o+v*a+e[15],r},scale:function(e,t,r){var n=t[0],o=t[1],a=t[2];return r&&e!=r?(r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*o,r[5]=e[5]*o,r[6]=e[6]*o,r[7]=e[7]*o,r[8]=e[8]*a,r[9]=e[9]*a,r[10]=e[10]*a,r[11]=e[11]*a,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r):(e[0]*=n,e[1]*=n,e[2]*=n,e[3]*=n,e[4]*=o,e[5]*=o,e[6]*=o,e[7]*=o,e[8]*=a,e[9]*=a,e[10]*=a,e[11]*=a,e)},rotate:function(e,t,r,n){var o=r[0],a=r[1],i=r[2],u=Math.sqrt(o*o+a*a+i*i);if(!u)return null;1!=u&&(o*=u=1/u,a*=u,i*=u);var c=Math.sin(t),s=Math.cos(t),l=1-s,f=e[0],d=e[1],h=e[2],p=e[3],g=e[4],m=e[5],v=e[6],y=e[7],_=e[8],x=e[9],w=e[10],b=e[11],C=o*o*l+s,E=a*o*l+i*c,R=i*o*l-a*c,A=o*a*l-i*c,T=a*a*l+s,M=i*a*l+o*c,O=o*i*l+a*c,S=a*i*l-o*c,D=i*i*l+s;return n?e!=n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]):n=e,n[0]=f*C+g*E+_*R,n[1]=d*C+m*E+x*R,n[2]=h*C+v*E+w*R,n[3]=p*C+y*E+b*R,n[4]=f*A+g*T+_*M,n[5]=d*A+m*T+x*M,n[6]=h*A+v*T+w*M,n[7]=p*A+y*T+b*M,n[8]=f*O+g*S+_*D,n[9]=d*O+m*S+x*D,n[10]=h*O+v*S+w*D,n[11]=p*O+y*S+b*D,n},rotateX:function(e,t,r){var n=Math.sin(t),o=Math.cos(t),a=e[4],i=e[5],u=e[6],c=e[7],s=e[8],l=e[9],f=e[10],d=e[11];return r?e!=r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]):r=e,r[4]=a*o+s*n,r[5]=i*o+l*n,r[6]=u*o+f*n,r[7]=c*o+d*n,r[8]=a*-n+s*o,r[9]=i*-n+l*o,r[10]=u*-n+f*o,r[11]=c*-n+d*o,r},rotateY:function(e,t,r){var n=Math.sin(t),o=Math.cos(t),a=e[0],i=e[1],u=e[2],c=e[3],s=e[8],l=e[9],f=e[10],d=e[11];return r?e!=r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]):r=e,r[0]=a*o+s*-n,r[1]=i*o+l*-n,r[2]=u*o+f*-n,r[3]=c*o+d*-n,r[8]=a*n+s*o,r[9]=i*n+l*o,r[10]=u*n+f*o,r[11]=c*n+d*o,r},rotateZ:function(e,t,r){var n=Math.sin(t),o=Math.cos(t),a=e[0],i=e[1],u=e[2],c=e[3],s=e[4],l=e[5],f=e[6],d=e[7];return r?e!=r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]):r=e,r[0]=a*o+s*n,r[1]=i*o+l*n,r[2]=u*o+f*n,r[3]=c*o+d*n,r[4]=a*-n+s*o,r[5]=i*-n+l*o,r[6]=u*-n+f*o,r[7]=c*-n+d*o,r},frustum:function(e,t,r,n,o,a,i){i||(i=u.create());var c=t-e,s=n-r,l=a-o;return i[0]=2*o/c,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2*o/s,i[6]=0,i[7]=0,i[8]=(t+e)/c,i[9]=(n+r)/s,i[10]=-(a+o)/l,i[11]=-1,i[12]=0,i[13]=0,i[14]=-a*o*2/l,i[15]=0,i},perspective:function(e,t,r,n,o){var a=r*Math.tan(e*Math.PI/360),i=a*t;return u.frustum(-i,i,-a,a,r,n,o)},ortho:function(e,t,r,n,o,a,i){i||(i=u.create());var c=t-e,s=n-r,l=a-o;return i[0]=2/c,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/s,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=-2/l,i[11]=0,i[12]=-(e+t)/c,i[13]=-(n+r)/s,i[14]=-(a+o)/l,i[15]=1,i},lookAt:function(e,t,r,n){n||(n=u.create());var o,a,i,c,s,l,f,d,h,p,g=e[0],m=e[1],v=e[2],y=r[0],_=r[1],x=r[2],w=t[0],b=t[1],C=t[2];return g==w&&m==b&&v==C?u.identity(n):(o=g-t[0],a=m-t[1],i=v-t[2],c=_*(i*=p=1/Math.sqrt(o*o+a*a+i*i))-x*(a*=p),s=x*(o*=p)-y*i,l=y*a-_*o,(p=Math.sqrt(c*c+s*s+l*l))?(c*=p=1/p,s*=p,l*=p):(c=0,s=0,l=0),f=a*l-i*s,d=i*c-o*l,h=o*s-a*c,(p=Math.sqrt(f*f+d*d+h*h))?(f*=p=1/p,d*=p,h*=p):(f=0,d=0,h=0),n[0]=c,n[1]=f,n[2]=o,n[3]=0,n[4]=s,n[5]=d,n[6]=a,n[7]=0,n[8]=l,n[9]=h,n[10]=i,n[11]=0,n[12]=-(c*g+s*m+l*v),n[13]=-(f*g+d*m+h*v),n[14]=-(o*g+a*m+i*v),n[15]=1,n)},str:function(e){return"["+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+",\n "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+",\n "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+",\n "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+"]"}};quat4={},quat4.create=function(e){var t;return e?((t=new glMatrixArrayType(4))[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3]):t=glMatrixArrayType===Array?new glMatrixArrayType([0,0,0,0]):new glMatrixArrayType(4),t},quat4.set=function(e,t){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},quat4.calculateW=function(e,t){var r=e[0],n=e[1],o=e[2];return t&&e!=t?(t[0]=r,t[1]=n,t[2]=o,t[3]=-Math.sqrt(Math.abs(1-r*r-n*n-o*o)),t):(e[3]=-Math.sqrt(Math.abs(1-r*r-n*n-o*o)),e)},quat4.inverse=function(e,t){return t&&e!=t?(t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t):(e[0]*=-1,e[1]*=-1,e[2]*=-1,e)},quat4.length=function(e){var t=e[0],r=e[1],n=e[2],o=e[3];return Math.sqrt(t*t+r*r+n*n+o*o)},quat4.normalize=function(e,t){t||(t=e);var r=e[0],n=e[1],o=e[2],a=e[3],i=Math.sqrt(r*r+n*n+o*o+a*a);return 0==i?(t[0]=0,t[1]=0,t[2]=0,t[3]=0,t):(i=1/i,t[0]=r*i,t[1]=n*i,t[2]=o*i,t[3]=a*i,t)},quat4.multiply=function(e,t,r){r||(r=e);var n=e[0],o=e[1],a=e[2],i=e[3],u=t[0],c=t[1],s=t[2],l=t[3];return r[0]=n*l+i*u+o*s-a*c,r[1]=o*l+i*c+a*u-n*s,r[2]=a*l+i*s+n*c-o*u,r[3]=i*l-n*u-o*c-a*s,r},quat4.multiplyVec3=function(e,t,r){r||(r=t);var n=t[0],o=t[1],a=t[2],i=e[0],u=e[1],c=e[2],s=e[3],l=s*n+u*a-c*o,f=s*o+c*n-i*a,d=s*a+i*o-u*n,h=-i*n-u*o-c*a;return r[0]=l*s+h*-i+f*-c-d*-u,r[1]=f*s+h*-u+d*-i-l*-c,r[2]=d*s+h*-c+l*-u-f*-i,r},quat4.toMat3=function(e,t){t||(t=i.create());var r=e[0],n=e[1],o=e[2],a=e[3],u=r+r,c=n+n,s=o+o,l=r*u,f=r*c,d=r*s,h=n*c,p=n*s,g=o*s,m=a*u,v=a*c,y=a*s;return t[0]=1-(h+g),t[1]=f-y,t[2]=d+v,t[3]=f+y,t[4]=1-(l+g),t[5]=p-m,t[6]=d-v,t[7]=p+m,t[8]=1-(l+h),t},quat4.toMat4=function(e,t){t||(t=u.create());var r=e[0],n=e[1],o=e[2],a=e[3],i=r+r,c=n+n,s=o+o,l=r*i,f=r*c,d=r*s,h=n*c,p=n*s,g=o*s,m=a*i,v=a*c,y=a*s;return t[0]=1-(h+g),t[1]=f-y,t[2]=d+v,t[3]=0,t[4]=f+y,t[5]=1-(l+g),t[6]=p-m,t[7]=0,t[8]=d-v,t[9]=p+m,t[10]=1-(l+h),t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},quat4.slerp=function(e,t,r,n){n||(n=e);var o=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3];if(Math.abs(o)>=1)return n!=e&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3]),n;var a=Math.acos(o),i=Math.sqrt(1-o*o);if(Math.abs(i)<.001)return n[0]=.5*e[0]+.5*t[0],n[1]=.5*e[1]+.5*t[1],n[2]=.5*e[2]+.5*t[2],n[3]=.5*e[3]+.5*t[3],n;var u=Math.sin((1-r)*a)/i,c=Math.sin(r*a)/i;return n[0]=e[0]*u+t[0]*c,n[1]=e[1]*u+t[1]*c,n[2]=e[2]*u+t[2]*c,n[3]=e[3]*u+t[3]*c,n},quat4.str=function(e){return"["+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+"]"},n("glMatrix",["typedefs"],function(e){return function(){return e.glMatrix}}(this)),u.xVec4=function(e,t,r){r||(r=t);var n=t[0],o=t[1],a=t[2],i=t[3];return r[0]=e[0]*n+e[1]*o+e[2]*a+e[3]*i,r[1]=e[4]*n+e[5]*o+e[6]*a+e[7]*i,r[2]=e[8]*n+e[9]*o+e[10]*a+e[11]*i,r[3]=e[12]*n+e[13]*o+e[14]*a+e[15]*i,r},i.scale=function(e,t,r){return r&&e!=r?((r=i.create())[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r):(e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t,e[8]*=t,e)},i.inverse=function(e,t){t||(t=e);var r=e[0],n=e[1],o=e[2],a=e[3],i=e[4],u=e[5],c=e[6],s=e[7],l=e[8],f=1/(r*i*l+n*u*c+o*a*s-o*i*c-n*a*l-r*u*s);return t[0]=(i*l-u*s)*f,t[1]=(o*s-n*l)*f,t[2]=(n*u-o*i)*f,t[3]=(u*c-a*l)*f,t[4]=(r*l-o*c)*f,t[5]=(o*a-r*u)*f,t[6]=(a*s-i*c)*f,t[7]=(n*c-r*s)*f,t[8]=(r*i-n*a)*f,t},i.multiply=function(e,t,r){r||(r=e);var n=e[0],o=e[1],a=e[2],i=e[3],u=e[4],c=e[5],s=e[6],l=e[7],f=e[8],d=t[0],h=t[1],p=t[2],g=t[3],m=t[4],v=t[5],y=t[6],_=t[7],x=t[8];return r[0]=n*d+o*g+a*y,r[1]=n*h+o*m+a*_,r[2]=n*p+o*v+a*x,r[3]=i*d+u*g+c*y,r[4]=i*h+u*m+c*_,r[5]=i*p+u*v+c*x,r[6]=s*d+l*g+f*y,r[7]=s*h+l*m+f*_,r[8]=s*p+l*v+f*x,r},i.xVec3=function(e,t,r){r||(r=t);var n=t[0],o=t[1],a=t[2];return r[0]=e[0]*n+e[1]*o+e[2]*a,r[1]=e[3]*n+e[4]*o+e[5]*a,r[2]=e[6]*n+e[7]*o+e[8]*a,r};var c={create:function(e){var t;return e?((t=new glMatrixArrayType(4))[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3]):t=glMatrixArrayType===Array?new glMatrixArrayType([0,0,0,0]):new glMatrixArrayType(4),t},xVec2:function(e,t,r){r||(r=t);var n=t[0],o=t[1];return r[0]=e[0]*n+e[1]*o,r[1]=e[2]*n+e[3]*o,r},scale:function(e,t,r){return r&&e!=r?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r):(e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e)},determinant:function(e){return e[0]*e[3]-e[1]*e[2]},inverse:function(e){var t=1/c.determinant(e),r=e[3]*t,n=-e[1]*t,o=-e[2]*t,a=e[0];return e[0]=r,e[1]=n,e[2]=o,e[3]=a,e}},s={create:function(e){var t;return e?((t=new glMatrixArrayType(2))[0]=e[0],t[1]=e[1]):t=glMatrixArrayType===Array?new glMatrixArrayType([0,0]):new glMatrixArrayType(2),t},subtract:function(e,t,r){return r&&e!=r?(r[0]=e[0]-t[0],r[1]=e[1]-t[1],r):(e[0]-=t[0],e[1]-=t[1],e)},add:function(e,t,r){return r&&e!=r?(r[0]=e[0]+t[0],r[1]=e[1]+t[1],r):(e[0]+=t[0],e[1]+=t[1],e)},scale:function(e,t,r){return r&&e!=r?(r[0]=e[0]*t,r[1]=e[1]*t,r):(e[0]*=t,e[1]*=t,e)},normalize:function(e,t){t||(t=e);var r=e[0],n=e[1],o=Math.sqrt(r*r+n*n);return o?1==o?(t[0]=r,t[1]=n,t):(o=1/o,t[0]=r*o,t[1]=n*o,t):(t[0]=0,t[1]=0,t)},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]},multiply:function(e,t,r){return r||(r=e),r[0]=e[0]*t[0],r[1]=e[1]*t[1],r},unproject:function(e){return a.create([e[0],e[1],1])},length:function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},perspectiveProject:function(e){var t=s.create(e);return s.scale(t,1/e[2])}};return a.project=function(e){return s.scale(s.create(e),1/e[2])},i.xVec3=function(e,t,r){r||(r=t);var n=t[0],o=t[1],a=t[2];return r[0]=e[0]*n+e[1]*o+e[2]*a,r[1]=e[3]*n+e[4]*o+e[5]*a,r[2]=e[6]*n+e[7]*o+e[8]*a,r},n("glMatrixAddon",["glMatrix"],function(e){return function(){return e.glMatrixAddon}}(this)),n("array_helper",[],function(){"use strict";return{init:function(e,t){for(var r=e.length;r--;)e[r]=t},shuffle:function(e){for(var t,r,n=e.length-1;n>=0;n--)t=Math.floor(Math.random()*n),r=e[n],e[n]=e[t],e[t]=r;return e},toPointList:function(e){var t,r,n=[],o=[];for(t=0;t<e.length;t++){for(n=[],r=0;r<e[t].length;r++)n[r]=e[t][r];o[t]="["+n.join(",")+"]"}return"["+o.join(",\r\n")+"]"},threshold:function(e,t,r){var n,o=[];for(n=0;n<e.length;n++)r.apply(e,[e[n]])>=t&&o.push(e[n]);return o},maxIndex:function(e){var t,r=0;for(t=0;t<e.length;t++)e[t]>e[r]&&(r=t);return r},max:function(e){var t,r=0;for(t=0;t<e.length;t++)e[t]>r&&(r=e[t]);return r},sum:function(e){for(var t=e.length,r=0;t--;)r+=e[t];return r}}}),n("cv_utils",["cluster","glMatrixAddon","array_helper"],function(e,t,r){"use strict";var n={imageRef:function(e,t){return{x:e,y:t,toVec2:function(){return s.create([this.x,this.y])},toVec3:function(){return a.create([this.x,this.y,1])},round:function(){return this.x=this.x>0?Math.floor(this.x+.5):Math.floor(this.x-.5),this.y=this.y>0?Math.floor(this.y+.5):Math.floor(this.y-.5),this}}},computeIntegralImage2:function(e,t){var r,n,o=e.data,a=e.size.x,i=e.size.y,u=t.data,c=0,s=0,l=0,f=0,d=0;for(l=a,c=0,n=1;n<i;n++)c+=o[s],u[l]+=c,s+=a,l+=a;for(s=0,l=1,c=0,r=1;r<a;r++)c+=o[s],u[l]+=c,s++,l++;for(n=1;n<i;n++)for(s=n*a+1,l=(n-1)*a+1,f=n*a,d=(n-1)*a,r=1;r<a;r++)u[s]+=o[s]+u[l]+u[f]-u[d],s++,l++,f++,d++},computeIntegralImage:function(e,t){for(var r=e.data,n=e.size.x,o=e.size.y,a=t.data,i=0,u=0;u<n;u++)i+=r[u],a[u]=i;for(var c=1;c<o;c++){i=0;for(var s=0;s<n;s++)i+=r[c*n+s],a[c*n+s]=i+a[(c-1)*n+s]}},thresholdImage:function(e,t,r){r||(r=e);for(var n=e.data,o=n.length,a=r.data;o--;)a[o]=n[o]<t?1:0},computeHistogram:function(e,t){t||(t=8);for(var r=e.data,n=r.length,o=8-t,a=new Int32Array(1<<t);n--;)a[r[n]>>o]++;return a},sharpenLine:function(e){var t,r,n=e.length,o=e[0],a=e[1];for(t=1;t<n-1;t++)r=e[t+1],e[t-1]=2*a-o-r&255,o=a,a=r;return e},determineOtsuThreshold:function(e,t){t||(t=8);var o,a=8-t;function i(e,t){var r,n=0;for(r=e;r<=t;r++)n+=o[r];return n}function u(e,t){var r,n=0;for(r=e;r<=t;r++)n+=r*o[r];return n}return function(){var a,c,s,l,f,d=[0],h=(1<<t)-1;for(o=n.computeHistogram(e,t),l=1;l<h;l++)0===(s=(a=i(0,l))*(c=i(l+1,h)))&&(s=1),f=u(0,l)*c-u(l+1,h)*a,d[l]=f*f/s;return r.maxIndex(d)}()<<a},otsuThreshold:function(e,t){var r=n.determineOtsuThreshold(e);return n.thresholdImage(e,r,t),r},computeBinaryImage:function(e,t,r){n.computeIntegralImage(e,t),r||(r=e);var o,a,i,u,c,s,l=e.data,f=r.data,d=e.size.x,h=e.size.y,p=t.data;for(o=0;o<=3;o++)for(a=0;a<d;a++)f[o*d+a]=0,f[(h-1-o)*d+a]=0;for(o=3;o<h-3;o++)for(a=0;a<=3;a++)f[o*d+a]=0,f[o*d+(d-1-a)]=0;for(o=4;o<h-3-1;o++)for(a=4;a<d-3;a++)i=p[(o-3-1)*d+(a-3-1)],u=p[(o-3-1)*d+(a+3)],c=p[(o+3)*d+(a-3-1)],s=(p[(o+3)*d+(a+3)]-c-u+i)/49,f[o*d+a]=l[o*d+a]>s+5?0:1},cluster:function(t,r,n){var o,a,i,u,c=[];function s(e){var t=!1;for(a=0;a<c.length;a++)(i=c[a]).fits(e)&&(i.add(e),t=!0);return t}for(n||(n="rad"),o=0;o<t.length;o++)s(u=e.createPoint(t[o],o,n))||c.push(e.create(u,r));return c}};return n.Tracer={trace:function(e,t){var r,n=[],o=[],a=0,i=0;function u(r,n){var o,a,i,u,c=Math.abs(t[1]/10),s=!1;function l(e,t){return e.x>t.x-1&&e.x<t.x+1&&e.y>t.y-c&&e.y<t.y+c}for(o=e[r],u=n?{x:o.x+t[0],y:o.y+t[1]}:{x:o.x-t[0],y:o.y-t[1]},a=e[i=n?r+1:r-1];a&&!0!==(s=l(a,u))&&Math.abs(a.y-o.y)<t[1];)a=e[i=n?i+1:i-1];return s?i:null}for(r=0;r<10;r++){for(i=a=Math.floor(Math.random()*e.length),(n=[]).push(e[i]);null!==(i=u(i,!0));)n.push(e[i]);if(a>0)for(i=a;null!==(i=u(i,!1));)n.push(e[i]);n.length>o.length&&(o=n)}return o}},n.DILATE=1,n.ERODE=2,n.dilate=function(e,t){var r,n,o,a,i,u,c,s=e.data,l=t.data,f=e.size.y,d=e.size.x;for(r=1;r<f-1;r++)for(n=1;n<d-1;n++)i=r+1,c=n+1,o=s[(a=r-1)*d+(u=n-1)]+s[a*d+c]+s[r*d+n]+s[i*d+u]+s[i*d+c],l[r*d+n]=o>0?1:0},n.erode=function(e,t){var r,n,o,a,i,u,c,s=e.data,l=t.data,f=e.size.y,d=e.size.x;for(r=1;r<f-1;r++)for(n=1;n<d-1;n++)i=r+1,c=n+1,o=s[(a=r-1)*d+(u=n-1)]+s[a*d+c]+s[r*d+n]+s[i*d+u]+s[i*d+c],l[r*d+n]=5===o?1:0},n.subtract=function(e,t,r){r||(r=e);for(var n=e.data.length,o=e.data,a=t.data,i=r.data;n--;)i[n]=o[n]-a[n]},n.bitwiseOr=function(e,t,r){r||(r=e);for(var n=e.data.length,o=e.data,a=t.data,i=r.data;n--;)i[n]=o[n]||a[n]},n.countNonZero=function(e){for(var t=e.data.length,r=e.data,n=0;t--;)n+=r[t];return n},n.topGeneric=function(e,t,r){var n,o,a,i,u=0,c=0,s=[];for(n=0;n<t;n++)s[n]={score:0,item:null};for(n=0;n<e.length;n++)if((o=r.apply(this,[e[n]]))>c)for((a=s[u]).score=o,a.item=e[n],c=Number.MAX_VALUE,i=0;i<t;i++)s[i].score<c&&(c=s[i].score,u=i);return s},n.grayArrayFromImage=function(e,t,r,o){r.drawImage(e,t,0,e.width,e.height);var a=r.getImageData(t,0,e.width,e.height).data;n.computeGray(a,o)},n.grayArrayFromContext=function(e,t,r,o){var a=e.getImageData(r.x,r.y,t.x,t.y).data;n.computeGray(a,o)},n.grayAndHalfSampleFromCanvasData=function(e,t,r){for(var n,o=0,a=t.x,i=Math.floor(e.length/4),u=t.x/2,c=0,s=t.x;a<i;){for(n=0;n<u;n++)r[c]=Math.floor((.299*e[4*o+0]+.587*e[4*o+1]+.114*e[4*o+2]+(.299*e[4*(o+1)+0]+.587*e[4*(o+1)+1]+.114*e[4*(o+1)+2])+(.299*e[4*a+0]+.587*e[4*a+1]+.114*e[4*a+2])+(.299*e[4*(a+1)+0]+.587*e[4*(a+1)+1]+.114*e[4*(a+1)+2]))/4),c++,o+=2,a+=2;o+=s,a+=s}},n.computeGray=function(e,t,r){var n,o=e.length/4|0;if(r&&!0===r.singleChannel)for(n=0;n<o;n++)t[n]=e[4*n+0];else for(n=0;n<o;n++)t[n]=Math.floor(.299*e[4*n+0]+.587*e[4*n+1]+.114*e[4*n+2])},n.loadImageArray=function(e,t,r){r||(r=document.createElement("canvas"));var o=new Image;o.callback=t,o.onload=function(){r.width=this.width,r.height=this.height;var e=r.getContext("2d");e.drawImage(this,0,0);var t=new Uint8Array(this.width*this.height);e.drawImage(this,0,0);var o=e.getImageData(0,0,this.width,this.height).data;n.computeGray(o,t),this.callback(t,{x:this.width,y:this.height},this)},o.src=e},n.halfSample=function(e,t){for(var r=e.data,n=e.size.x,o=t.data,a=0,i=n,u=r.length,c=n/2,s=0;i<u;){for(var l=0;l<c;l++)o[s]=Math.floor((r[a]+r[a+1]+r[i]+r[i+1])/4),s++,a+=2,i+=2;a+=n,i+=n}},n.hsv2rgb=function(e,t){var r=e[0],n=e[1],o=e[2],a=o*n,i=a*(1-Math.abs(r/60%2-1)),u=o-a,c=0,s=0,l=0;return r<60?(c=a,s=i):r<120?(c=i,s=a):r<180?(s=a,l=i):r<240?(s=i,l=a):r<300?(c=i,l=a):r<360&&(c=a,l=i),(t=t||[0,0,0])[0]=255*(c+u)|0,t[1]=255*(s+u)|0,t[2]=255*(l+u)|0,t},n._computeDivisors=function(e){var t,r=[],n=[];for(t=1;t<Math.sqrt(e)+1;t++)e%t===0&&(n.push(t),t!==e/t&&r.unshift(Math.floor(e/t)));return n.concat(r)},n._computeIntersection=function(e,t){for(var r=0,n=0,o=[];r<e.length&&n<t.length;)e[r]===t[n]?(o.push(e[r]),r++,n++):e[r]>t[n]?n++:r++;return o},n.calculatePatchSize=function(e,t){var r,n=this._computeDivisors(t.x),o=this._computeDivisors(t.y),a=Math.max(t.x,t.y),i=this._computeIntersection(n,o),u=[8,10,15,20,32,60,80],c={"x-small":5,small:4,medium:3,large:2,"x-large":1},s=c[e]||c.medium,l=u[s],f=Math.floor(a/l);function d(e){for(var t=0,r=e[Math.floor(e.length/2)];t<e.length-1&&e[t]<f;)t++;return t>0&&(r=Math.abs(e[t]-f)>Math.abs(e[t-1]-f)?e[t-1]:e[t]),f/r<u[s+1]/u[s]&&f/r>u[s-1]/u[s]?{x:r,y:r}:null}return(r=d(i))||(r=d(this._computeDivisors(a)))||(r=d(this._computeDivisors(f*l))),r},n._parseCSSDimensionValues=function(e){return{value:parseFloat(e),unit:(e.indexOf("%"),e.length,"%")}},n._dimensionsConverters={top:function(e,t){if("%"===e.unit)return Math.floor(t.height*(e.value/100))},right:function(e,t){if("%"===e.unit)return Math.floor(t.width-t.width*(e.value/100))},bottom:function(e,t){if("%"===e.unit)return Math.floor(t.height-t.height*(e.value/100))},left:function(e,t){if("%"===e.unit)return Math.floor(t.width*(e.value/100))}},n.computeImageArea=function(e,t,r){var o={width:e,height:t},a=Object.keys(r).reduce(function(e,t){var a=r[t],i=n._parseCSSDimensionValues(a),u=n._dimensionsConverters[t](i,o);return e[t]=u,e},{});return{sx:a.left,sy:a.top,sw:a.right-a.left,sh:a.bottom-a.top}},n}),n("image_wrapper",["subImage","cv_utils","array_helper"],function(e,t,r){"use strict";function n(e,t,n,o){t?this.data=t:n?(this.data=new n(e.x*e.y),n===Array&&o&&r.init(this.data,0)):(this.data=new Uint8Array(e.x*e.y),Uint8Array===Array&&o&&r.init(this.data,0)),this.size=e}return n.prototype.inImageWithBorder=function(e,t){return e.x>=t&&e.y>=t&&e.x<this.size.x-t&&e.y<this.size.y-t},n.transform=function(e,t,r,o,a){var i,u,l,f=t.size.x,d=t.size.y,h=e.size.x,p=e.size.y,g=s.create([r[0],r[2]]),m=s.create([r[1],r[3]]),v=s.subtract(o,c.xVec2(r,a,s.create()),s.create()),y=v[0],_=v[1],x=y,w=_,b=n.sample;g[0]<0?y+=f*g[0]:x+=f*g[0],m[0]<0?y+=d*m[0]:x+=d*m[0],g[1]<0?_+=f*g[1]:w+=f*g[1],m[1]<0?_+=d*m[1]:w+=d*m[1];var C=s.subtract(m,s.scale(g,f,s.create()),s.create());if(y>=0&&_>=0&&x<h-1&&w<p-1){for(i=v,u=0;u<d;++u,s.add(i,C))for(l=0;l<f;++l,s.add(i,g))t.set(l,u,b(e,i[0],i[1]));return 0}var E=h-1,R=p-1,A=0;for(i=v,u=0;u<d;++u,s.add(i,C))for(l=0;l<f;++l,s.add(i,g))0<=i[0]&&0<=i[1]&&i[0]<E&&i[1]<R?t.set(l,u,b(e,i[0],i[1])):(t.set(l,u,0),++A);return A},n.sample=function(e,t,r){var n=Math.floor(t),o=Math.floor(r),a=e.size.x,i=o*e.size.x+n,u=e.data[i+0],c=e.data[i+1],s=e.data[i+a],l=e.data[i+a+1],f=u-c;return t-=n,r-=o,Math.floor(t*(r*(f-s+l)-f)+r*(s-u)+u)},n.clearArray=function(e){for(var t=e.length;t--;)e[t]=0},n.prototype.subImage=function(t,r){return new e(t,r,this)},n.prototype.subImageAsCopy=function(e,t){var r,n,o=e.size.y,a=e.size.x;for(r=0;r<a;r++)for(n=0;n<o;n++)e.data[n*a+r]=this.data[(t.y+n)*this.size.x+t.x+r]},n.prototype.copyTo=function(e){for(var t=this.data.length,r=this.data,n=e.data;t--;)n[t]=r[t]},n.prototype.get=function(e,t){return this.data[t*this.size.x+e]},n.prototype.getSafe=function(e,t){var r;if(!this.indexMapping){for(this.indexMapping={x:[],y:[]},r=0;r<this.size.x;r++)this.indexMapping.x[r]=r,this.indexMapping.x[r+this.size.x]=r;for(r=0;r<this.size.y;r++)this.indexMapping.y[r]=r,this.indexMapping.y[r+this.size.y]=r}return this.data[this.indexMapping.y[t+this.size.y]*this.size.x+this.indexMapping.x[e+this.size.x]]},n.prototype.set=function(e,t,r){return this.data[t*this.size.x+e]=r,this},n.prototype.zeroBorder=function(){var e,t=this.size.x,r=this.size.y,n=this.data;for(e=0;e<t;e++)n[e]=n[(r-1)*t+e]=0;for(e=1;e<r-1;e++)n[e*t]=n[e*t+(t-1)]=0},n.prototype.invert=function(){for(var e=this.data,t=e.length;t--;)e[t]=e[t]?0:1},n.prototype.convolve=function(e){var t,r,n,o,a=e.length/2|0,i=0;for(r=0;r<this.size.y;r++)for(t=0;t<this.size.x;t++){for(i=0,o=-a;o<=a;o++)for(n=-a;n<=a;n++)i+=e[o+a][n+a]*this.getSafe(t+n,r+o);this.data[r*this.size.x+t]=i}},n.prototype.moments=function(e){var t,r,n,o,a,i,u,c,l,f,d=this.data,h=this.size.y,p=this.size.x,g=[],m=[],v=Math.PI,y=v/4;if(e<=0)return m;for(a=0;a<e;a++)g[a]={m00:0,m01:0,m10:0,m11:0,m02:0,m20:0,theta:0,rad:0};for(r=0;r<h;r++)for(o=r*r,t=0;t<p;t++)(n=d[r*p+t])>0&&((i=g[n-1]).m00+=1,i.m01+=r,i.m10+=t,i.m11+=t*r,i.m02+=o,i.m20+=t*t);for(a=0;a<e;a++)i=g[a],isNaN(i.m00)||0===i.m00||(c=i.m10/i.m00,l=i.m01/i.m00,u=i.m11/i.m00-c*l,f=(i.m02/i.m00-l*l-(i.m20/i.m00-c*c))/(2*u),f=.5*Math.atan(f)+(u>=0?y:-y)+v,i.theta=(180*f/v+90)%180-90,i.theta<0&&(i.theta+=180),i.rad=f>v?f-v:f,i.vec=s.create([Math.cos(f),Math.sin(f)]),m.push(i));return m},n.prototype.show=function(e,t){var r,n,o,a,i,u,c;for(t||(t=1),r=e.getContext("2d"),e.width=this.size.x,e.height=this.size.y,o=(n=r.getImageData(0,0,e.width,e.height)).data,a=0,c=0;c<this.size.y;c++)for(u=0;u<this.size.x;u++)i=c*this.size.x+u,a=this.get(u,c)*t,o[4*i+0]=a,o[4*i+1]=a,o[4*i+2]=a,o[4*i+3]=255;r.putImageData(n,0,0)},n.prototype.overlay=function(e,r,n){(!r||r<0||r>360)&&(r=360);for(var o=[0,1,1],a=[0,0,0],i=[255,255,255],u=[0,0,0],c=[],s=e.getContext("2d"),l=s.getImageData(n.x,n.y,this.size.x,this.size.y),f=l.data,d=this.data.length;d--;)o[0]=this.data[d]*r,c=o[0]<=0?i:o[0]>=360?u:t.hsv2rgb(o,a),f[4*d+0]=c[0],f[4*d+1]=c[1],f[4*d+2]=c[2],f[4*d+3]=255;s.putImageData(l,n.x,n.y)},n}),n("tracer",[],function(){"use strict";return{searchDirections:[[0,1],[1,1],[1,0],[1,-1],[0,-1],[-1,-1],[-1,0],[-1,1]],create:function(e,t){var r,n=e.data,o=t.data,a=this.searchDirections,i=e.size.x;function u(e,t,u,c){var s,l,f;for(s=0;s<7;s++){if(l=e.cy+a[e.dir][0],f=e.cx+a[e.dir][1],n[r=l*i+f]===t&&(0===o[r]||o[r]===u))return o[r]=u,e.cy=l,e.cx=f,!0;0===o[r]&&(o[r]=c),e.dir=(e.dir+1)%8}return!1}function c(e,t,r){return{dir:r,x:e,y:t,next:null,prev:null}}return{trace:function(e,t,r,n){return u(e,t,r,n)},contourTracing:function(e,t,r,n,o){return function(e,t,r,n,o){var a,i,s,l=null,f={cx:t,cy:e,dir:0};if(u(f,n,r,o)){a=l=c(t,e,f.dir),s=f.dir,(i=c(f.cx,f.cy,0)).prev=a,a.next=i,i.next=null,a=i;do{f.dir=(f.dir+6)%8,u(f,n,r,o),s!=f.dir?(a.dir=f.dir,(i=c(f.cx,f.cy,0)).prev=a,a.next=i,i.next=null,a=i):(a.dir=s,a.x=f.cx,a.y=f.cy),s=f.dir}while(f.cx!=t||f.cy!=e);l.prev=a.prev,a.prev.next=l}return l}(e,t,r,n,o)}}}}}),n("rasterizer",["tracer"],function(e){"use strict";var t={createContour2D:function(){return{dir:null,index:null,firstVertex:null,insideContours:null,nextpeer:null,prevpeer:null}},CONTOUR_DIR:{CW_DIR:0,CCW_DIR:1,UNKNOWN_DIR:2},DIR:{OUTSIDE_EDGE:-32767,INSIDE_EDGE:-32766},create:function(r,n){var o=r.data,a=n.data,i=r.size.x,u=r.size.y,c=e.create(r,n);return{rasterize:function(e){var r,n,s,l,f,d,h,p,g,m,v,y,_=[],x=0;for(y=0;y<400;y++)_[y]=0;for(_[0]=o[0],g=null,d=1;d<u-1;d++)for(l=0,n=_[0],f=1;f<i-1;f++)if(0===a[v=d*i+f])if((r=o[v])!==n){if(0===l)_[s=x+1]=r,n=r,null!==(h=c.contourTracing(d,f,s,r,t.DIR.OUTSIDE_EDGE))&&(x++,l=s,(p=t.createContour2D()).dir=t.CONTOUR_DIR.CW_DIR,p.index=l,p.firstVertex=h,p.nextpeer=g,p.insideContours=null,null!==g&&(g.prevpeer=p),g=p);else if(null!==(h=c.contourTracing(d,f,t.DIR.INSIDE_EDGE,r,l))){for((p=t.createContour2D()).firstVertex=h,p.insideContours=null,p.dir=0===e?t.CONTOUR_DIR.CCW_DIR:t.CONTOUR_DIR.CW_DIR,p.index=e,m=g;null!==m&&m.index!==l;)m=m.nextpeer;null!==m&&(p.nextpeer=m.insideContours,null!==m.insideContours&&(m.insideContours.prevpeer=p),m.insideContours=p)}}else a[v]=l;else a[v]===t.DIR.OUTSIDE_EDGE||a[v]===t.DIR.INSIDE_EDGE?(l=0,n=a[v]===t.DIR.INSIDE_EDGE?o[v]:_[0]):n=_[l=a[v]];for(m=g;null!==m;)m.index=e,m=m.nextpeer;return{cc:g,count:x}},debug:{drawContour:function(e,r){var n,o,a,i=e.getContext("2d"),u=r;for(i.strokeStyle="red",i.fillStyle="red",i.lineWidth=1,n=null!==u?u.insideContours:null;null!==u;){switch(null!==n?(o=n,n=n.nextpeer):(o=u,n=null!==(u=u.nextpeer)?u.insideContours:null),o.dir){case t.CONTOUR_DIR.CW_DIR:i.strokeStyle="red";break;case t.CONTOUR_DIR.CCW_DIR:i.strokeStyle="blue";break;case t.CONTOUR_DIR.UNKNOWN_DIR:i.strokeStyle="green"}a=o.firstVertex,i.beginPath(),i.moveTo(a.x,a.y);do{a=a.next,i.lineTo(a.x,a.y)}while(a!==o.firstVertex);i.stroke()}}}}}};return t}),n("skeletonizer",[],function(){"use strict";return function(e,t,r){"use asm";var n=new e.Uint8Array(r),o=t.size|0,a=e.Math.imul;function i(e,t){e=e|0;t=t|0;var r=0,a=0,i=0,u=0,c=0,s=0,l=0,f=0;for(r=1;(r|0)<(o-1|0);r=r+1|0){f=f+o|0;for(a=1;(a|0)<(o-1|0);a=a+1|0){u=f-o|0;c=f+o|0;s=a-1|0;l=a+1|0;i=(n[e+u+s|0]|0)+(n[e+u+l|0]|0)+(n[e+f+a|0]|0)+(n[e+c+s|0]|0)+(n[e+c+l|0]|0)|0;if((i|0)==(5|0)){n[t+f+a|0]=1}else{n[t+f+a|0]=0}}}return}function u(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;i=a(o,o)|0;while((i|0)>0){i=i-1|0;n[r+i|0]=(n[e+i|0]|0)-(n[t+i|0]|0)|0}}function c(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;i=a(o,o)|0;while((i|0)>0){i=i-1|0;n[r+i|0]=n[e+i|0]|0|(n[t+i|0]|0)|0}}function s(e){e=e|0;var t=0,r=0;r=a(o,o)|0;while((r|0)>0){r=r-1|0;t=(t|0)+(n[e+r|0]|0)|0}return t|0}function l(e,t){e=e|0;t=t|0;var r=0;r=a(o,o)|0;while((r|0)>0){r=r-1|0;n[e+r|0]=t}}function f(e,t){e=e|0;t=t|0;var r=0,a=0,i=0,u=0,c=0,s=0,l=0,f=0;for(r=1;(r|0)<(o-1|0);r=r+1|0){f=f+o|0;for(a=1;(a|0)<(o-1|0);a=a+1|0){u=f-o|0;c=f+o|0;s=a-1|0;l=a+1|0;i=(n[e+u+s|0]|0)+(n[e+u+l|0]|0)+(n[e+f+a|0]|0)+(n[e+c+s|0]|0)+(n[e+c+l|0]|0)|0;if((i|0)>(0|0)){n[t+f+a|0]=1}else{n[t+f+a|0]=0}}}return}function d(e,t){e=e|0;t=t|0;var r=0;r=a(o,o)|0;while((r|0)>0){r=r-1|0;n[t+r|0]=n[e+r|0]|0}}function h(e){e=e|0;var t=0,r=0;for(t=0;(t|0)<(o-1|0);t=t+1|0){n[e+t|0]=0;n[e+r|0]=0;r=r+o-1|0;n[e+r|0]=0;r=r+1|0}for(t=0;(t|0)<(o|0);t=t+1|0){n[e+r|0]=0;r=r+1|0}}function p(){var e=0,t=0,r=0,n=0,p=0,g=0;t=a(o,o)|0;r=t+t|0;n=r+t|0;l(n,0);h(e);do{i(e,t);f(t,r);u(e,r,r);c(n,r,n);d(t,e);p=s(e)|0;g=(p|0)==0|0}while(!g)}return{skeletonize:p}}}),n("image_debug",[],function(){"use strict";return{drawRect:function(e,t,r,n){r.strokeStyle=n.color,r.fillStyle=n.color,r.lineWidth=1,r.beginPath(),r.strokeRect(e.x,e.y,t.x,t.y)},drawPath:function(e,t,r,n){r.strokeStyle=n.color,r.fillStyle=n.color,r.lineWidth=n.lineWidth,r.beginPath(),r.moveTo(e[0][t.x],e[0][t.y]);for(var o=1;o<e.length;o++)r.lineTo(e[o][t.x],e[o][t.y]);r.closePath(),r.stroke()},drawImage:function(e,t,r){var n,o=r.getImageData(0,0,t.x,t.y),a=o.data,i=e.length,u=a.length;if(u/i!==4)return!1;for(;i--;)n=e[i],a[--u]=255,a[--u]=n,a[--u]=n,a[--u]=n;return r.putImageData(o,0,0),!0}}}),n("barcode_locator",["image_wrapper","cv_utils","rasterizer","tracer","skeletonizer","array_helper","image_debug"],function(e,t,r,n,o,a,i){var u,l,f,d,h,p,g,m,v,y,_,x,w={ctx:{binary:null},dom:{binary:null}},b={x:0,y:0},C=this;function E(e){var t,r,n,o,a,l,f,h=v.size.x,p=v.size.y,g=-v.size.x,m=-v.size.y;for(t=0,r=0;r<e.length;r++)t+=(o=e[r]).rad,u.showPatches&&i.drawRect(o.pos,d.size,w.ctx.binary,{color:"red"});for((t=(180*(t/=e.length)/Math.PI+90)%180-90)<0&&(t+=180),t=(180-t)*Math.PI/180,a=c.create([Math.cos(t),-Math.sin(t),Math.sin(t),Math.cos(t)]),r=0;r<e.length;r++){for(o=e[r],n=0;n<4;n++)c.xVec2(a,o.box[n]);u.boxFromPatches.showTransformed&&i.drawPath(o.box,{x:0,y:1},w.ctx.binary,{color:"#99ff00",lineWidth:2})}for(r=0;r<e.length;r++)for(o=e[r],n=0;n<4;n++)o.box[n][0]<h&&(h=o.box[n][0]),o.box[n][0]>g&&(g=o.box[n][0]),o.box[n][1]<p&&(p=o.box[n][1]),o.box[n][1]>m&&(m=o.box[n][1]);for(l=[[h,p],[g,p],[g,m],[h,m]],u.boxFromPatches.showTransformedBox&&i.drawPath(l,{x:0,y:1},w.ctx.binary,{color:"#ff0000",lineWidth:2}),f=u.halfSample?2:1,a=c.inverse(a),n=0;n<4;n++)c.xVec2(a,l[n]);for(u.boxFromPatches.showBB&&i.drawPath(l,{x:0,y:1},w.ctx.binary,{color:"#ff0000",lineWidth:2}),n=0;n<4;n++)s.scale(l[n],f);return l}function R(e,r){v.subImageAsCopy(d,t.imageRef(e,r)),x.skeletonize(),u.showSkeleton&&f.overlay(w.dom.binary,360,t.imageRef(e,r))}function A(e,r,n,o){var a,i,u,c,l=[],f=[],h=Math.ceil(y.x/3);if(e.length>=2){for(a=0;a<e.length;a++)e[a].m00>h&&l.push(e[a]);if(l.length>=2){for(l.length,u=function(e){var r=t.cluster(e,.9),n=t.topGeneric(r,1,function(e){return e.getPoints().length}),o=[],a=[];if(1===n.length){o=n[0].item.getPoints();for(var i=0;i<o.length;i++)a.push(o[i].point)}return a}(l),i=0,a=0;a<u.length;a++)i+=u[a].rad;u.length>1&&u.length>=l.length/4*3&&u.length>e.length/4&&(i/=u.length,c={index:r[1]*b.x+r[0],pos:{x:n,y:o},box:[s.create([n,o]),s.create([n+d.size.x,o]),s.create([n+d.size.x,o+d.size.y]),s.create([n,o+d.size.y])],moments:u,rad:i,vec:s.create([Math.cos(i),Math.sin(i)])},f.push(c))}}return f}return{init:function(r,n){var a;_=r,l=(u=n).halfSample?new e({x:_.size.x/2|0,y:_.size.y/2|0}):_,y=t.calculatePatchSize(u.patchSize,l.size),b.x=l.size.x/y.x|0,b.y=l.size.y/y.y|0,v=new e(l.size,void 0,Uint8Array,!1),h=new e(y,void 0,Array,!0),a=new ArrayBuffer(65536),d=new e(y,new Uint8Array(a,0,y.x*y.y)),f=new e(y,new Uint8Array(a,y.x*y.y*3,y.x*y.y),void 0,!0),x=o(C,{size:y.x},a),m=new e({x:l.size.x/d.size.x|0,y:l.size.y/d.size.y|0},void 0,Array,!0),p=new e(m.size,void 0,void 0,!0),g=new e(m.size,void 0,Int32Array,!0),u.useWorker||"undefined"==typeof document||(w.dom.binary=document.createElement("canvas"),w.dom.binary.className="binaryBuffer",!0===u.showCanvas&&document.querySelector("#debug").appendChild(w.dom.binary),w.ctx.binary=w.dom.binary.getContext("2d"),w.dom.binary.width=v.size.x,w.dom.binary.height=v.size.y)},locate:function(){var e,o,c;if(u.halfSample&&t.halfSample(_,l),t.otsuThreshold(l,v),v.zeroBorder(),u.showCanvas&&v.show(w.dom.binary,255),(e=function(){var e,t,n,o,c,s,l,p=[];for(e=0;e<b.x;e++)for(t=0;t<b.y;t++)R(n=d.size.x*e,o=d.size.y*t),f.zeroBorder(),a.init(h.data,0),s=r.create(f,h).rasterize(0),u.showLabels&&h.overlay(w.dom.binary,Math.floor(360/s.count),{x:n,y:o}),c=h.moments(s.count),p=p.concat(A(c,[e,t],n,o));if(u.showFoundPatches)for(e=0;e<p.length;e++)l=p[e],i.drawRect(l.pos,d.size,w.ctx.binary,{color:"#99ff00",lineWidth:2});return p}()).length<b.x*b.y*.05)return null;var y=function(e){var r,o,c=0,l=0,f=[0,1,1],h=[0,0,0];function v(){var e;for(e=0;e<g.data.length;e++)if(0===g.data[e]&&1===p.data[e])return e;return g.length}function y(e){var t,r,o,a,i,u,l=e%g.size.x,f=e/g.size.x|0;if(e<g.data.length)for(o=m.data[e],g.data[e]=c,u=0;u<n.searchDirections.length;u++)r=f+n.searchDirections[u][0],t=l+n.searchDirections[u][1],i=r*g.size.x+t,0!==p.data[i]?(a=m.data[i],0===g.data[i]&&Math.abs(s.dot(a.vec,o.vec))>.95&&y(i)):g.data[i]=Number.MAX_VALUE}for(a.init(p.data,0),a.init(g.data,0),a.init(m.data,null),r=0;r<e.length;r++)o=e[r],m.data[o.index]=o,p.data[o.index]=1;for(p.zeroBorder();(l=v())<g.data.length;)c++,y(l);if(u.showPatchLabels)for(r=0;r<g.data.length;r++)g.data[r]>0&&g.data[r]<=c&&(o=m.data[r],f[0]=g.data[r]/(c+1)*360,t.hsv2rgb(f,h),i.drawRect(o.pos,d.size,w.ctx.binary,{color:"rgb("+h.join(",")+")",lineWidth:2}));return c}(e);return y<1?null:(o=function(e){var t,r,n=[];for(t=0;t<e;t++)n.push(0);for(r=g.data.length;r--;)g.data[r]>0&&n[g.data[r]-1]++;return(n=n.map(function(e,t){return{val:e,label:t+1}})).sort(function(e,t){return t.val-e.val}),n.filter(function(e){return e.val>=5})}(y),0===o.length?null:(c=function(e,r){var n,o,a,c,s,l=[],f=[],h=[0,1,1],p=[0,0,0];for(n=0;n<e.length;n++){for(a=g.data.length,l.length=0;a--;)g.data[a]===e[n].label&&(c=m.data[a],l.push(c));if((s=E(l))&&(f.push(s),u.showRemainingPatchLabels))for(o=0;o<l.length;o++)c=l[o],h[0]=e[n].label/(r+1)*360,t.hsv2rgb(h,p),i.drawRect(c.pos,d.size,w.ctx.binary,{color:"rgb("+p.join(",")+")",lineWidth:2})}return f}(o,y),c))},checkImageConstraints:function(e,r){var n,o,a,i=e.getWidth(),u=e.getHeight(),c=r.halfSample?.5:1;if(e.getConfig().area&&(a=t.computeImageArea(i,u,e.getConfig().area),e.setTopRight({x:a.sx,y:a.sy}),e.setCanvasSize({x:i,y:u}),i=a.sw,u=a.sh),o={x:Math.floor(i*c),y:Math.floor(u*c)},n=t.calculatePatchSize(r.patchSize,o),console.log("Patch-Size: "+JSON.stringify(n)),e.setWidth(Math.floor(Math.floor(o.x/n.x)*(1/c)*n.x)),e.setHeight(Math.floor(Math.floor(o.y/n.y)*(1/c)*n.y)),e.getWidth()%n.x===0&&e.getHeight()%n.y===0)return!0;throw new Error("Image dimensions do not comply with the current settings: Width ("+i+" )and height ("+u+") must a multiple of "+n.x)}}}),n("bresenham",["cv_utils","image_wrapper"],function(e,t){"use strict";var r={},n=1,o=-1;return r.getBarcodeLine=function(e,t,r){var n,o,a,i,u,c,s,l,f=0|t.x,d=0|t.y,h=0|r.x,p=0|r.y,g=Math.abs(p-d)>Math.abs(h-f),m=[],v=e.data,y=e.size.x,_=255,x=0;function w(e,t){l=v[t*y+e],_=l<_?l:_,x=l>x?l:x,m.push(l)}for(g&&(c=f,f=d,d=c,c=h,h=p,p=c),f>h&&(c=f,f=h,h=c,c=d,d=p,p=c),n=h-f,o=Math.abs(p-d),a=n/2|0,u=d,i=d<p?1:-1,s=f;s<h;s++)g?w(u,s):w(s,u),(a-=o)<0&&(u+=i,a+=n);return{line:m,min:_,max:x}},r.toOtsuBinaryLine=function(r){var n=r.line,o=new t({x:n.length-1,y:1},n),a=e.determineOtsuThreshold(o,5);return n=e.sharpenLine(n),e.thresholdImage(o,a),{line:n,threshold:a}},r.toBinaryLine=function(e){var t,r,a,i,u,c,s=e.min,l=e.max,f=e.line,d=s+(l-s)/2,h=[],p=(l-s)/12,g=-p;for(a=f[0]>d?n:o,h.push({pos:0,val:f[0]}),u=0;u<f.length-2;u++)a!==(i=(t=f[u+1]-f[u])+(r=f[u+2]-f[u+1])<g&&f[u+1]<1.5*d?o:t+r>p&&f[u+1]>.5*d?n:a)&&(h.push({pos:u,val:f[u]}),a=i);for(h.push({pos:f.length,val:f[f.length-1]}),c=h[0].pos;c<h[1].pos;c++)f[c]=f[c]>d?0:1;for(u=1;u<h.length-1;u++)for(p=h[u+1].val>h[u].val?h[u].val+(h[u+1].val-h[u].val)/3*2|0:h[u+1].val+(h[u].val-h[u+1].val)/3|0,c=h[u].pos;c<h[u+1].pos;c++)f[c]=f[c]>p?0:1;return{line:f,threshold:p}},r.debug={printFrequency:function(e,t){var r,n=t.getContext("2d");for(t.width=e.length,t.height=256,n.beginPath(),n.strokeStyle="blue",r=0;r<e.length;r++)n.moveTo(r,255),n.lineTo(r,255-e[r]);n.stroke(),n.closePath()},printPattern:function(e,t){var r,n=t.getContext("2d");for(t.width=e.length,n.fillColor="black",r=0;r<e.length;r++)1===e[r]&&n.fillRect(r,0,1,100)}},r}),n("barcode_reader",[],function(){"use strict";function e(e){return this._row=[],this.config=e||{},this}return e.prototype._nextUnset=function(e,t){var r;for(void 0===t&&(t=0),r=t;r<e.length;r++)if(!e[r])return r;return e.length},e.prototype._matchPattern=function(e,t){var r,n=0,o=0,a=this.MODULO,i=this.SINGLE_CODE_ERROR||1;for(r=0;r<e.length;r++){if((o=Math.abs(t[r]-e[r]))>i)return Number.MAX_VALUE;n+=o}return n/a},e.prototype._nextSet=function(e,t){var r;for(r=t=t||0;r<e.length;r++)if(e[r])return r;return e.length},e.prototype._normalize=function(e,t){var r,n,o=0,a=0,i=[],u=0;for(t||(t=this.MODULO),r=0;r<e.length;r++)1===e[r]?a++:o+=e[r];if((n=o/(t-a))>1)for(r=0;r<e.length;r++)u=1===e[r]?e[r]:e[r]/n,i.push(u);else for(n=(o+a)/t,r=0;r<e.length;r++)u=e[r]/n,i.push(u);return i},e.prototype._matchTrace=function(e,t){var r,n=[],o=this,a=o._nextSet(o._row),i=!o._row[a],u=0,c={error:Number.MAX_VALUE,code:-1,start:0};if(e){for(r=0;r<e.length;r++)n.push(0);for(r=a;r<o._row.length;r++)if(o._row[r]^i)n[u]++;else{if(u===n.length-1)return o._matchPattern(n,e)<t?(c.start=r-a,c.end=r,c.counter=n,c):null;n[++u]=1,i=!i}}else for(n.push(0),r=a;r<o._row.length;r++)o._row[r]^i?n[u]++:(u++,n.push(0),n[u]=1,i=!i);return c.start=a,c.end=o._row.length-1,c.counter=n,c},e.prototype.decodePattern=function(t){var r,n=this;return n._row=t,null===(r=n._decode())?(n._row.reverse(),(r=n._decode())&&(r.direction=e.DIRECTION.REVERSE,r.start=n._row.length-r.start,r.end=n._row.length-r.end)):r.direction=e.DIRECTION.FORWARD,r&&(r.format=n.FORMAT),r},e.prototype._matchRange=function(e,t,r){var n;for(n=e=e<0?0:e;n<t;n++)if(this._row[n]!==r)return!1;return!0},e.prototype._fillCounters=function(e,t,r){var n,o=this,a=0,i=[];for(r=void 0===r||r,e=void 0!==e?e:o._nextUnset(o._row),t=t||o._row.length,i[a]=0,n=e;n<t;n++)o._row[n]^r?i[a]++:(i[++a]=1,r=!r);return i},Object.defineProperty(e.prototype,"FORMAT",{value:"unknown",writeable:!1}),e.DIRECTION={FORWARD:1,REVERSE:-1},e.Exception={StartNotFoundException:"Start-Info was not found!",CodeNotFoundException:"Code could not be found!",PatternNotFoundException:"Pattern could not be found!"},e.CONFIG_KEYS={},e}),n("code_128_reader",["./barcode_reader"],function(e){"use strict";function t(){e.call(this)}return t.prototype=Object.create(e.prototype,{CODE_SHIFT:{value:98},CODE_C:{value:99},CODE_B:{value:100},CODE_A:{value:101},START_CODE_A:{value:103},START_CODE_B:{value:104},START_CODE_C:{value:105},STOP_CODE:{value:106},MODULO:{value:11},CODE_PATTERN:{value:[[2,1,2,2,2,2],[2,2,2,1,2,2],[2,2,2,2,2,1],[1,2,1,2,2,3],[1,2,1,3,2,2],[1,3,1,2,2,2],[1,2,2,2,1,3],[1,2,2,3,1,2],[1,3,2,2,1,2],[2,2,1,2,1,3],[2,2,1,3,1,2],[2,3,1,2,1,2],[1,1,2,2,3,2],[1,2,2,1,3,2],[1,2,2,2,3,1],[1,1,3,2,2,2],[1,2,3,1,2,2],[1,2,3,2,2,1],[2,2,3,2,1,1],[2,2,1,1,3,2],[2,2,1,2,3,1],[2,1,3,2,1,2],[2,2,3,1,1,2],[3,1,2,1,3,1],[3,1,1,2,2,2],[3,2,1,1,2,2],[3,2,1,2,2,1],[3,1,2,2,1,2],[3,2,2,1,1,2],[3,2,2,2,1,1],[2,1,2,1,2,3],[2,1,2,3,2,1],[2,3,2,1,2,1],[1,1,1,3,2,3],[1,3,1,1,2,3],[1,3,1,3,2,1],[1,1,2,3,1,3],[1,3,2,1,1,3],[1,3,2,3,1,1],[2,1,1,3,1,3],[2,3,1,1,1,3],[2,3,1,3,1,1],[1,1,2,1,3,3],[1,1,2,3,3,1],[1,3,2,1,3,1],[1,1,3,1,2,3],[1,1,3,3,2,1],[1,3,3,1,2,1],[3,1,3,1,2,1],[2,1,1,3,3,1],[2,3,1,1,3,1],[2,1,3,1,1,3],[2,1,3,3,1,1],[2,1,3,1,3,1],[3,1,1,1,2,3],[3,1,1,3,2,1],[3,3,1,1,2,1],[3,1,2,1,1,3],[3,1,2,3,1,1],[3,3,2,1,1,1],[3,1,4,1,1,1],[2,2,1,4,1,1],[4,3,1,1,1,1],[1,1,1,2,2,4],[1,1,1,4,2,2],[1,2,1,1,2,4],[1,2,1,4,2,1],[1,4,1,1,2,2],[1,4,1,2,2,1],[1,1,2,2,1,4],[1,1,2,4,1,2],[1,2,2,1,1,4],[1,2,2,4,1,1],[1,4,2,1,1,2],[1,4,2,2,1,1],[2,4,1,2,1,1],[2,2,1,1,1,4],[4,1,3,1,1,1],[2,4,1,1,1,2],[1,3,4,1,1,1],[1,1,1,2,4,2],[1,2,1,1,4,2],[1,2,1,2,4,1],[1,1,4,2,1,2],[1,2,4,1,1,2],[1,2,4,2,1,1],[4,1,1,2,1,2],[4,2,1,1,1,2],[4,2,1,2,1,1],[2,1,2,1,4,1],[2,1,4,1,2,1],[4,1,2,1,2,1],[1,1,1,1,4,3],[1,1,1,3,4,1],[1,3,1,1,4,1],[1,1,4,1,1,3],[1,1,4,3,1,1],[4,1,1,1,1,3],[4,1,1,3,1,1],[1,1,3,1,4,1],[1,1,4,1,3,1],[3,1,1,1,4,1],[4,1,1,1,3,1],[2,1,1,4,1,2],[2,1,1,2,1,4],[2,1,1,2,3,2],[2,3,3,1,1,1,2]]},SINGLE_CODE_ERROR:{value:1},AVG_CODE_ERROR:{value:.5},FORMAT:{value:"code_128",writeable:!1}}),t.prototype.constructor=t,t.prototype._decodeCode=function(e){var t,r,n,o,a=[0,0,0,0,0,0],i=this,u=e,c=!i._row[u],s=0,l={error:Number.MAX_VALUE,code:-1,start:e,end:e};for(t=u;t<i._row.length;t++)if(i._row[t]^c)a[s]++;else{if(s===a.length-1){if(o=i._normalize(a)){for(r=0;r<i.CODE_PATTERN.length;r++)(n=i._matchPattern(o,i.CODE_PATTERN[r]))<l.error&&(l.code=r,l.error=n);return l.end=t,l}}else s++;a[s]=1,c=!c}return null},t.prototype._findStart=function(){var e,t,r,n,o,a,i=[0,0,0,0,0,0],u=this,c=u._nextSet(u._row),s=!1,l=0,f={error:Number.MAX_VALUE,code:-1,start:0,end:0};for(e=c;e<u._row.length;e++)if(u._row[e]^s)i[l]++;else{if(l===i.length-1){for(o=0,n=0;n<i.length;n++)o+=i[n];if(a=u._normalize(i)){for(t=u.START_CODE_A;t<=u.START_CODE_C;t++)(r=u._matchPattern(a,u.CODE_PATTERN[t]))<f.error&&(f.code=t,f.error=r);if(f.error<u.AVG_CODE_ERROR)return f.start=e-o,f.end=e,f}for(n=0;n<4;n++)i[n]=i[n+2];i[4]=0,i[5]=0,l--}else l++;i[l]=1,s=!s}return null},t.prototype._decode=function(){var e,t,r=this,n=r._findStart(),o=null,a=!1,i=[],u=0,c=0,s=[],l=[],f=!1;if(null===n)return null;switch(o={code:n.code,start:n.start,end:n.end},l.push(o),c=o.code,o.code){case r.START_CODE_A:e=r.CODE_A;break;case r.START_CODE_B:e=r.CODE_B;break;case r.START_CODE_C:e=r.CODE_C;break;default:return null}for(;!a;){if(t=f,f=!1,null!==(o=r._decodeCode(o.end)))switch(o.code!==r.STOP_CODE&&(s.push(o.code),c+=++u*o.code),l.push(o),e){case r.CODE_A:if(o.code<64)i.push(String.fromCharCode(32+o.code));else if(o.code<96)i.push(String.fromCharCode(o.code-64));else switch(o.code){case r.CODE_SHIFT:f=!0,e=r.CODE_B;break;case r.CODE_B:e=r.CODE_B;break;case r.CODE_C:e=r.CODE_C;break;case r.STOP_CODE:a=!0}break;case r.CODE_B:if(o.code<96)i.push(String.fromCharCode(32+o.code));else switch(o.code,r.STOP_CODE,o.code){case r.CODE_SHIFT:f=!0,e=r.CODE_A;break;case r.CODE_A:e=r.CODE_A;break;case r.CODE_C:e=r.CODE_C;break;case r.STOP_CODE:a=!0}break;case r.CODE_C:switch(o.code<100&&i.push(o.code<10?"0"+o.code:o.code),o.code){case r.CODE_A:e=r.CODE_A;break;case r.CODE_B:e=r.CODE_B;break;case r.STOP_CODE:a=!0}}else a=!0;t&&(e=e==r.CODE_A?r.CODE_B:r.CODE_A)}return null===o?null:(o.end=r._nextUnset(r._row,o.end),r._verifyTrailingWhitespace(o)?(c-=u*s[s.length-1])%103!=s[s.length-1]?null:i.length?(i.splice(i.length-1,1),{code:i.join(""),start:n.start,end:o.end,codeset:e,startInfo:n,decodedCodes:l,endInfo:o}):null:null)},e.prototype._verifyTrailingWhitespace=function(e){var t;return(t=e.end+(e.end-e.start)/2)<this._row.length&&this._matchRange(e.end,t,0)?e:null},t}),n("ean_reader",["./barcode_reader"],function(e){"use strict";function t(t){e.call(this,t)}return t.prototype=Object.create(e.prototype,{CODE_L_START:{value:0},MODULO:{value:7},CODE_G_START:{value:10},START_PATTERN:{value:[1/3*7,1/3*7,1/3*7]},STOP_PATTERN:{value:[1/3*7,1/3*7,1/3*7]},MIDDLE_PATTERN:{value:[.2*7,.2*7,.2*7,.2*7,.2*7]},CODE_PATTERN:{value:[[3,2,1,1],[2,2,2,1],[2,1,2,2],[1,4,1,1],[1,1,3,2],[1,2,3,1],[1,1,1,4],[1,3,1,2],[1,2,1,3],[3,1,1,2],[1,1,2,3],[1,2,2,2],[2,2,1,2],[1,1,4,1],[2,3,1,1],[1,3,2,1],[4,1,1,1],[2,1,3,1],[3,1,2,1],[2,1,1,3]]},CODE_FREQUENCY:{value:[0,11,13,14,19,25,28,21,22,26]},SINGLE_CODE_ERROR:{value:.67},AVG_CODE_ERROR:{value:.27},FORMAT:{value:"ean_13",writeable:!1}}),t.prototype.constructor=t,t.prototype._decodeCode=function(e,t){var r,n,o,a,i=[0,0,0,0],u=this,c=e,s=!u._row[c],l=0,f={error:Number.MAX_VALUE,code:-1,start:e,end:e};for(t||(t=u.CODE_PATTERN.length),r=c;r<u._row.length;r++)if(u._row[r]^s)i[l]++;else{if(l===i.length-1){if(a=u._normalize(i)){for(n=0;n<t;n++)(o=u._matchPattern(a,u.CODE_PATTERN[n]))<f.error&&(f.code=n,f.error=o);return f.end=r,f.error>u.AVG_CODE_ERROR?null:f}}else l++;i[l]=1,s=!s}return null},t.prototype._findPattern=function(e,t,r,n,o){var a,i,u,c,s,l=[],f=this,d=0,h={error:Number.MAX_VALUE,code:-1,start:0,end:0};for(t||(t=f._nextSet(f._row)),void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=f.AVG_CODE_ERROR),a=0;a<e.length;a++)l[a]=0;for(a=t;a<f._row.length;a++)if(f._row[a]^r)l[d]++;else{if(d===l.length-1){for(c=0,u=0;u<l.length;u++)c+=l[u];if((s=f._normalize(l))&&(i=f._matchPattern(s,e))<o)return h.error=i,h.start=a-c,h.end=a,h;if(!n)return null;for(u=0;u<l.length-2;u++)l[u]=l[u+2];l[l.length-2]=0,l[l.length-1]=0,d--}else d++;l[d]=1,r=!r}return null},t.prototype._findStart=function(){for(var e,t,r=this,n=r._nextSet(r._row);!t;){if(!(t=r._findPattern(r.START_PATTERN,n)))return null;if((e=t.start-(t.end-t.start))>=0&&r._matchRange(e,t.start,0))return t;n=t.end,t=null}},t.prototype._verifyTrailingWhitespace=function(e){var t;return(t=e.end+(e.end-e.start))<this._row.length&&this._matchRange(e.end,t,0)?e:null},t.prototype._findEnd=function(e,t){var r=this,n=r._findPattern(r.STOP_PATTERN,e,t,!1);return null!==n?r._verifyTrailingWhitespace(n):null},t.prototype._calculateFirstDigit=function(e){var t;for(t=0;t<this.CODE_FREQUENCY.length;t++)if(e===this.CODE_FREQUENCY[t])return t;return null},t.prototype._decodePayload=function(e,t,r){var n,o,a=this,i=0;for(n=0;n<6;n++){if(!(e=a._decodeCode(e.end)))return null;e.code>=a.CODE_G_START?(e.code=e.code-a.CODE_G_START,i|=1<<5-n):i|=0<<5-n,t.push(e.code),r.push(e)}if(null===(o=a._calculateFirstDigit(i)))return null;if(t.unshift(o),null===(e=a._findPattern(a.MIDDLE_PATTERN,e.end,!0,!1)))return null;for(r.push(e),n=0;n<6;n++){if(!(e=a._decodeCode(e.end,a.CODE_G_START)))return null;r.push(e),t.push(e.code)}return e},t.prototype._decode=function(){var e,t,r=this,n=[],o=[];return(e=r._findStart())?(t={code:e.code,start:e.start,end:e.end},o.push(t),(t=r._decodePayload(t,n,o))&&(t=r._findEnd(t.end,!1))?(o.push(t),r._checksum(n)?{code:n.join(""),start:e.start,end:t.end,codeset:"",startInfo:e,decodedCodes:o}:null):null):null},t.prototype._checksum=function(e){var t,r=0;for(t=e.length-2;t>=0;t-=2)r+=e[t];for(r*=3,t=e.length-1;t>=0;t-=2)r+=e[t];return r%10==0},t}),n("code_39_reader",["./barcode_reader","./array_helper"],function(e,t){"use strict";function r(){e.call(this)}return r.prototype=Object.create(e.prototype,{ALPHABETH_STRING:{value:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"},ALPHABET:{value:[48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,45,46,32,42,36,47,43,37]},CHARACTER_ENCODINGS:{value:[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,148,168,162,138,42]},ASTERISK:{value:148},FORMAT:{value:"code_39",writeable:!1}}),r.prototype.constructor=r,r.prototype._toCounters=function(e,r){var n,o=this,a=r.length,i=o._row.length,u=!o._row[e],c=0;for(t.init(r,0),n=e;n<i;n++)if(o._row[n]^u)r[c]++;else{if(++c===a)break;r[c]=1,u=!u}return r},r.prototype._decode=function(){var e,r,n,o,a=this,i=[0,0,0,0,0,0,0,0,0],u=[],c=a._findStart();if(!c)return null;o=a._nextSet(a._row,c.end);do{if(i=a._toCounters(o,i),(n=a._toPattern(i))<0)return null;if((e=a._patternToChar(n))<0)return null;u.push(e),r=o,o+=t.sum(i),o=a._nextSet(a._row,o)}while("*"!==e);return u.pop(),u.length&&a._verifyTrailingWhitespace(r,o,i)?{code:u.join(""),start:c.start,end:o,startInfo:c,decodedCodes:u}:null},r.prototype._verifyTrailingWhitespace=function(e,r,n){var o=t.sum(n);return 3*(r-e-o)>=o},r.prototype._patternToChar=function(e){var t,r=this;for(t=0;t<r.CHARACTER_ENCODINGS.length;t++)if(r.CHARACTER_ENCODINGS[t]===e)return String.fromCharCode(r.ALPHABET[t])},r.prototype._findNextWidth=function(e,t){var r,n=Number.MAX_VALUE;for(r=0;r<e.length;r++)e[r]<n&&e[r]>t&&(n=e[r]);return n},r.prototype._toPattern=function(e){for(var t,r,n=e.length,o=0,a=n,i=0;a>3;){for(o=this._findNextWidth(e,o),a=0,t=0,r=0;r<n;r++)e[r]>o&&(t|=1<<n-1-r,a++,i+=e[r]);if(3===a){for(r=0;r<n&&a>0;r++)if(e[r]>o&&(a--,2*e[r]>=i))return-1;return t}}return-1},r.prototype._findStart=function(){var e,t,r,n=this,o=n._nextSet(n._row),a=o,i=[0,0,0,0,0,0,0,0,0],u=0,c=!1;for(e=o;e<n._row.length;e++)if(n._row[e]^c)i[u]++;else{if(u===i.length-1){if(n._toPattern(i)===n.ASTERISK&&(r=Math.floor(Math.max(0,a-(e-a)/4)),n._matchRange(r,a,0)))return{start:a,end:e};for(a+=i[0]+i[1],t=0;t<7;t++)i[t]=i[t+2];i[7]=0,i[8]=0,u--}else u++;i[u]=1,c=!c}return null},r}),n("code_39_vin_reader",["./code_39_reader"],function(e){"use strict";function t(){e.call(this)}var r=/[IOQ]/g,n=/[A-Z0-9]{17}/;return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype._decode=function(){var t=e.prototype._decode.apply(this);if(!t)return null;var o=t.code;return o?(o=o.replace(r,"")).match(n)?this._checkChecksum(o)?(t.code=o,t):null:(console.log("Failed AZ09 pattern code:",o),null):void 0},t.prototype._checkChecksum=function(e){return!!e},t}),n("codabar_reader",["./barcode_reader"],function(e){"use strict";function t(){e.call(this),this._counters=[]}return t.prototype=Object.create(e.prototype,{ALPHABETH_STRING:{value:"0123456789-$:/.+ABCD"},ALPHABET:{value:[48,49,50,51,52,53,54,55,56,57,45,36,58,47,46,43,65,66,67,68]},CHARACTER_ENCODINGS:{value:[3,6,9,96,18,66,33,36,48,72,12,24,69,81,84,21,26,41,11,14]},START_END:{value:[26,41,11,14]},MIN_ENCODED_CHARS:{value:4},MAX_ACCEPTABLE:{value:2},PADDING:{value:1.5},FORMAT:{value:"codabar",writeable:!1}}),t.prototype.constructor=t,t.prototype._decode=function(){var e,t,r,n,o,a=this,i=[];if(this._counters=a._fillCounters(),!(e=a._findStart()))return null;n=e.startCounter;do{if((r=a._toPattern(n))<0)return null;if((t=a._patternToChar(r))<0)return null;if(i.push(t),n+=8,i.length>1&&a._isStartEnd(r))break}while(n<a._counters.length);return i.length-2<a.MIN_ENCODED_CHARS||!a._isStartEnd(r)?null:a._verifyWhitespace(e.startCounter,n-8)&&a._validateResult(i,e.startCounter)?(n=n>a._counters.length?a._counters.length:n,o=e.start+a._sumCounters(e.startCounter,n-8),{code:i.join(""),start:e.start,end:o,startInfo:e,decodedCodes:i}):null},t.prototype._verifyWhitespace=function(e,t){return(e-1<=0||this._counters[e-1]>=this._calculatePatternLength(e)/2)&&(t+8>=this._counters.length||this._counters[t+7]>=this._calculatePatternLength(t)/2)},t.prototype._calculatePatternLength=function(e){var t,r=0;for(t=e;t<e+7;t++)r+=this._counters[t];return r},t.prototype._thresholdResultPattern=function(e,t){var r,n,o,a,i,u=this,c={space:{narrow:{size:0,counts:0,min:0,max:Number.MAX_VALUE},wide:{size:0,counts:0,min:0,max:Number.MAX_VALUE}},bar:{narrow:{size:0,counts:0,min:0,max:Number.MAX_VALUE},wide:{size:0,counts:0,min:0,max:Number.MAX_VALUE}}},s=t;for(o=0;o<e.length;o++){for(i=u._charToPattern(e[o]),a=6;a>=0;a--)r=2==(1&a)?c.bar:c.space,(n=1&~i?r.narrow:r.wide).size+=u._counters[s+a],n.counts++,i>>=1;s+=8}return["space","bar"].forEach(function(e){var t=c[e];t.wide.min=Math.floor((t.narrow.size/t.narrow.counts+t.wide.size/t.wide.counts)/2),t.narrow.max=Math.ceil(t.wide.min),t.wide.max=Math.ceil((t.wide.size*u.MAX_ACCEPTABLE+u.PADDING)/t.wide.counts)}),c},t.prototype._charToPattern=function(e){var t,r=this,n=e.charCodeAt(0);for(t=0;t<r.ALPHABET.length;t++)if(r.ALPHABET[t]===n)return r.CHARACTER_ENCODINGS[t];return 0},t.prototype._validateResult=function(e,t){var r,n,o,a,i,u,c=this,s=c._thresholdResultPattern(e,t),l=t;for(r=0;r<e.length;r++){for(u=c._charToPattern(e[r]),n=6;n>=0;n--){if(o=1&n?s.space:s.bar,a=1&~u?o.narrow:o.wide,(i=c._counters[l+n])<a.min||i>a.max)return!1;u>>=1}l+=8}return!0},t.prototype._patternToChar=function(e){var t,r=this;for(t=0;t<r.CHARACTER_ENCODINGS.length;t++)if(r.CHARACTER_ENCODINGS[t]===e)return String.fromCharCode(r.ALPHABET[t]);return-1},t.prototype._computeAlternatingThreshold=function(e,t){var r,n,o=Number.MAX_VALUE,a=0;for(r=e;r<t;r+=2)(n=this._counters[r])>a&&(a=n),n<o&&(o=n);return(o+a)/2|0},t.prototype._toPattern=function(e){var t,r,n,o,a=e+7,i=64,u=0;if(a>this._counters.length)return-1;for(t=this._computeAlternatingThreshold(e,a),r=this._computeAlternatingThreshold(e+1,a),n=0;n<7;n++)o=1&n?r:t,this._counters[e+n]>o&&(u|=i),i>>=1;return u},t.prototype._isStartEnd=function(e){var t;for(t=0;t<this.START_END.length;t++)if(this.START_END[t]===e)return!0;return!1},t.prototype._sumCounters=function(e,t){var r,n=0;for(r=e;r<t;r++)n+=this._counters[r];return n},t.prototype._findStart=function(){var e,t,r=this,n=r._nextUnset(r._row);for(e=1;e<this._counters.length;e++)if(-1!==(t=r._toPattern(e))&&r._isStartEnd(t))return{start:n+=r._sumCounters(0,e),end:n+r._sumCounters(e,e+8),startCounter:e,endCounter:e+8}},t}),n("upc_reader",["./ean_reader"],function(e){"use strict";function t(){e.call(this)}return t.prototype=Object.create(e.prototype,{FORMAT:{value:"upc_a",writeable:!1}}),t.prototype.constructor=t,t.prototype._decode=function(){var t=e.prototype._decode.call(this);return t&&t.code&&13===t.code.length&&"0"===t.code.charAt(0)?(t.code=t.code.substring(1),t):null},t}),n("ean_8_reader",["./ean_reader"],function(e){"use strict";function t(){e.call(this)}return t.prototype=Object.create(e.prototype,{FORMAT:{value:"ean_8",writeable:!1}}),t.prototype.constructor=t,t.prototype._decodePayload=function(e,t,r){var n,o=this;for(n=0;n<4;n++){if(!(e=o._decodeCode(e.end,o.CODE_G_START)))return null;t.push(e.code),r.push(e)}if(null===(e=o._findPattern(o.MIDDLE_PATTERN,e.end,!0,!1)))return null;for(r.push(e),n=0;n<4;n++){if(!(e=o._decodeCode(e.end,o.CODE_G_START)))return null;r.push(e),t.push(e.code)}return e},t}),n("upc_e_reader",["./ean_reader"],function(e){"use strict";function t(){e.call(this)}return t.prototype=Object.create(e.prototype,{CODE_FREQUENCY:{value:[[56,52,50,49,44,38,35,42,41,37],[7,11,13,14,19,25,28,21,22,26]]},STOP_PATTERN:{value:[1/6*7,1/6*7,1/6*7,1/6*7,1/6*7,1/6*7]},FORMAT:{value:"upc_e",writeable:!1}}),t.prototype.constructor=t,t.prototype._decodePayload=function(e,t,r){var n,o=this,a=0;for(n=0;n<6;n++){if(!(e=o._decodeCode(e.end)))return null;e.code>=o.CODE_G_START&&(e.code=e.code-o.CODE_G_START,a|=1<<5-n),t.push(e.code),r.push(e)}return o._determineParity(a,t)?e:null},t.prototype._determineParity=function(e,t){var r,n,o=this;for(n=0;n<o.CODE_FREQUENCY.length;n++)for(r=0;r<o.CODE_FREQUENCY[n].length;r++)if(e===o.CODE_FREQUENCY[n][r])return t.unshift(n),t.push(r),!0;return!1},t.prototype._convertToUPCA=function(e){var t=[e[0]],r=e[e.length-2];return(t=r<=2?t.concat(e.slice(1,3)).concat([r,0,0,0,0]).concat(e.slice(3,6)):3===r?t.concat(e.slice(1,4)).concat([0,0,0,0,0]).concat(e.slice(4,6)):4===r?t.concat(e.slice(1,5)).concat([0,0,0,0,0,e[5]]):t.concat(e.slice(1,6)).concat([0,0,0,0,r])).push(e[e.length-1]),t},t.prototype._checksum=function(t){return e.prototype._checksum.call(this,this._convertToUPCA(t))},t.prototype._findEnd=function(t,r){return e.prototype._findEnd.call(this,t,!0)},t.prototype._verifyTrailingWhitespace=function(e){var t;if((t=e.end+(e.end-e.start)/2)<this._row.length&&this._matchRange(e.end,t,0))return e},t}),n("html_utils",[],function(){"use strict";function e(t,r){for(var n in r)try{r[n].constructor==Object?t[n]=e(t[n],r[n]):t[n]=r[n]}catch(e){t[n]=r[n]}return t}return{createNode:function(e){return function(e){var t=document.createElement("div");for(t.innerHTML=e;t.firstChild;)return t.firstChild}(e)},mergeObjects:function(t,r){return e(t,r)}}}),n("i2of5_reader",["./barcode_reader","./html_utils"],function(e,t){"use strict";function r(n){var o;n=t.mergeObjects((o={},Object.keys(r.CONFIG_KEYS).forEach(function(e){o[e]=r.CONFIG_KEYS[e].default}),o),n),e.call(this,n),this.barSpaceRatio=[1,1],n.normalizeBarSpaceWidth&&(this.SINGLE_CODE_ERROR=.38,this.AVG_CODE_ERROR=.09)}return r.prototype=Object.create(e.prototype,{MODULO:{value:10},START_PATTERN:{value:[2.5,2.5,2.5,2.5]},STOP_PATTERN:{value:[2,2,6]},CODE_PATTERN:{value:[[1,1,3,3,1],[3,1,1,1,3],[1,3,1,1,3],[3,3,1,1,1],[1,1,3,1,3],[3,1,3,1,1],[1,3,3,1,1],[1,1,1,3,3],[3,1,1,3,1],[1,3,1,3,1]]},SINGLE_CODE_ERROR:{value:.78,writable:!0},AVG_CODE_ERROR:{value:.38,writable:!0},MAX_CORRECTION_FACTOR:{value:5},FORMAT:{value:"i2of5"}}),r.prototype.constructor=r,r.prototype._matchPattern=function(t,r){if(this.config.normalizeBarSpaceWidth){var n,o=[0,0],a=[0,0],i=[0,0],u=this.MAX_CORRECTION_FACTOR,c=1/u;for(n=0;n<t.length;n++)o[n%2]+=t[n],a[n%2]+=r[n];for(i[0]=a[0]/o[0],i[1]=a[1]/o[1],i[0]=Math.max(Math.min(i[0],u),c),i[1]=Math.max(Math.min(i[1],u),c),this.barSpaceRatio=i,n=0;n<t.length;n++)t[n]*=this.barSpaceRatio[n%2]}return e.prototype._matchPattern.call(this,t,r)},r.prototype._findPattern=function(e,t,r,n){var o,a,i,u,c,s=[],l=this,f=0,d={error:Number.MAX_VALUE,code:-1,start:0,end:0},h=l.AVG_CODE_ERROR;for(r=r||!1,n=n||!1,t||(t=l._nextSet(l._row)),o=0;o<e.length;o++)s[o]=0;for(o=t;o<l._row.length;o++)if(l._row[o]^r)s[f]++;else{if(f===s.length-1){for(u=0,i=0;i<s.length;i++)u+=s[i];if((c=l._normalize(s))&&(a=l._matchPattern(c,e))<h)return d.error=a,d.start=o-u,d.end=o,d;if(!n)return null;for(i=0;i<s.length-2;i++)s[i]=s[i+2];s[s.length-2]=0,s[s.length-1]=0,f--}else f++;s[f]=1,r=!r}return null},r.prototype._findStart=function(){for(var e,t,r=this,n=r._nextSet(r._row),o=1;!t;){if(!(t=r._findPattern(r.START_PATTERN,n,!1,!0)))return null;if(o=Math.floor((t.end-t.start)/4),(e=t.start-10*o)>=0&&r._matchRange(e,t.start,0))return t;n=t.end,t=null}},r.prototype._verifyTrailingWhitespace=function(e){var t;return(t=e.end+(e.end-e.start)/2)<this._row.length&&this._matchRange(e.end,t,0)?e:null},r.prototype._findEnd=function(){var e,t,r=this;return r._row.reverse(),e=r._findPattern(r.STOP_PATTERN),r._row.reverse(),null===e?null:(t=e.start,e.start=r._row.length-e.end,e.end=r._row.length-t,null!==e?r._verifyTrailingWhitespace(e):null)},r.prototype._decodePair=function(e){var t,r,n=[];for(t=0;t<e.length;t++){if(!(r=this._decodeCode(e[t])))return null;n.push(r)}return n},r.prototype._decodeCode=function(e){var t,r,n,o,a=this,i=a.AVG_CODE_ERROR,u={error:Number.MAX_VALUE,code:-1,start:0,end:0};for(t=0;t<e.length;t++)e[t];if(r=a._normalize(e)){for(o=0;o<a.CODE_PATTERN.length;o++)(n=a._matchPattern(r,a.CODE_PATTERN[o]))<u.error&&(u.code=o,u.error=n);if(u.error<i)return u}return null},r.prototype._decodePayload=function(e,t,r){for(var n,o,a=0,i=e.length,u=[[0,0,0,0,0],[0,0,0,0,0]];a<i;){for(n=0;n<5;n++)u[0][n]=e[a]*this.barSpaceRatio[0],u[1][n]=e[a+1]*this.barSpaceRatio[1],a+=2;if(!(o=this._decodePair(u)))return null;for(n=0;n<o.length;n++)t.push(o[n].code+""),r.push(o[n])}return o},r.prototype._verifyCounterLength=function(e){return e.length%10==0},r.prototype._decode=function(){var e,t,r,n=this,o=[],a=[];return(e=n._findStart())?(a.push(e),(t=n._findEnd())?(r=n._fillCounters(e.end,t.start,!1),n._verifyCounterLength(r)&&n._decodePayload(r,o,a)?o.length%2!=0||o.length<6?null:(a.push(t),{code:o.join(""),start:e.start,end:t.end,startInfo:e,decodedCodes:a}):null):null):null},r.CONFIG_KEYS={normalizeBarSpaceWidth:{type:"boolean",default:!1,description:"If true, the reader tries to normalize thewidth-difference between bars and spaces"}},r}),n("barcode_decoder",["bresenham","image_debug","code_128_reader","ean_reader","code_39_reader","code_39_vin_reader","codabar_reader","upc_reader","ean_8_reader","upc_e_reader","i2of5_reader"],function(e,t,r,n,o,a,i,u,c,s,l){"use strict";var f={code_128_reader:r,ean_reader:n,ean_8_reader:c,code_39_reader:o,code_39_vin_reader:a,codabar_reader:i,upc_reader:u,upc_e_reader:s,i2of5_reader:l};return{create:function(r,n){var o={ctx:{frequency:null,pattern:null,overlay:null},dom:{frequency:null,pattern:null,overlay:null}},a=[];function i(){r.readers.forEach(function(e){var t,r={};"object"==typeof e?(t=e.format,r=e.config):"string"==typeof e&&(t=e),a.push(new f[t](r))}),console.log("Registered Readers: "+a.map(function(e){return JSON.stringify({format:e.FORMAT,config:e.config})}).join(", "))}function u(i){var u,c=null,s=e.getBarcodeLine(n,i[0],i[1]);for(r.showFrequency&&(t.drawPath(i,{x:"x",y:"y"},o.ctx.overlay,{color:"red",lineWidth:3}),e.debug.printFrequency(s.line,o.dom.frequency)),e.toBinaryLine(s),r.showPattern&&e.debug.printPattern(s.line,o.dom.pattern),u=0;u<a.length&&null===c;u++)c=a[u].decodePattern(s.line);return null===c?null:{codeResult:c,barcodeLine:s}}function c(e){var a,i,c,s,l=o.ctx.overlay;return r.drawBoundingBox&&l&&t.drawPath(e,{x:0,y:1},l,{color:"blue",lineWidth:2}),a=function(e){return[{x:(e[1][0]-e[0][0])/2+e[0][0],y:(e[1][1]-e[0][1])/2+e[0][1]},{x:(e[3][0]-e[2][0])/2+e[2][0],y:(e[3][1]-e[2][1])/2+e[2][1]}]}(e),s=function(e){return Math.sqrt(Math.pow(Math.abs(e[1].y-e[0].y),2)+Math.pow(Math.abs(e[1].x-e[0].x),2))}(a),null===(a=function(e,t,r){function o(r){var n=r*Math.sin(t),o=r*Math.cos(t);e[0].y-=n,e[0].x-=o,e[1].y+=n,e[1].x+=o}for(o(r);r>1&&(!n.inImageWithBorder(e[0],0)||!n.inImageWithBorder(e[1],0));)o(-(r-=Math.ceil(r/2)));return e}(a,i=Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x),Math.floor(.1*s)))?null:(null===(c=u(a))&&(c=function(e,t,r){var n,o,a,i=Math.sqrt(Math.pow(e[1][0]-e[0][0],2)+Math.pow(e[1][1]-e[0][1],2)),c=null,s=Math.sin(r),l=Math.cos(r);for(n=1;n<16&&null===c;n++)a={y:(o=i/16*n*(n%2==0?-1:1))*s,x:o*l},t[0].y+=a.x,t[0].x-=a.y,t[1].y+=a.x,t[1].x-=a.y,c=u(t);return c}(e,a,i)),null===c?null:(c&&r.drawScanline&&l&&t.drawPath(a,{x:"x",y:"y"},l,{color:"red",lineWidth:3}),{codeResult:c.codeResult,line:a,angle:i,pattern:c.barcodeLine.line,threshold:c.barcodeLine.threshold}))}return function(){if("undefined"!=typeof document){var e=document.querySelector("#debug.detection");o.dom.frequency=document.querySelector("canvas.frequency"),o.dom.frequency||(o.dom.frequency=document.createElement("canvas"),o.dom.frequency.className="frequency",e&&e.appendChild(o.dom.frequency)),o.ctx.frequency=o.dom.frequency.getContext("2d"),o.dom.pattern=document.querySelector("canvas.patternBuffer"),o.dom.pattern||(o.dom.pattern=document.createElement("canvas"),o.dom.pattern.className="patternBuffer",e&&e.appendChild(o.dom.pattern)),o.ctx.pattern=o.dom.pattern.getContext("2d"),o.dom.overlay=document.querySelector("canvas.drawingBuffer"),o.dom.overlay&&(o.ctx.overlay=o.dom.overlay.getContext("2d"))}}(),i(),function(){if("undefined"!=typeof document){var e,t=[{node:o.dom.frequency,prop:r.showFrequency},{node:o.dom.pattern,prop:r.showPattern}];for(e=0;e<t.length;e++)!0===t[e].prop?t[e].node.style.display="block":t[e].node.style.display="none"}}(),{decodeFromBoundingBox:function(e){return c(e)},decodeFromBoundingBoxes:function(e){var t,r;for(t=0;t<e.length;t++)if((r=c(e[t]))&&r.codeResult)return r.box=e[t],r},setReaders:function(e){r.readers=e,a.length=0,i()}}}}}),n("frame_grabber",["cv_utils"],function(e){"use strict";return{create:function(t,r){var n,o={},a=t.getConfig(),i=e.imageRef(t.getRealWidth(),t.getRealHeight()),u=t.getCanvasSize(),c=e.imageRef(t.getWidth(),t.getHeight()),s=t.getTopRight(),l=s.x,f=s.y,d=null,h=null;return(n=r||document.createElement("canvas")).width=u.x,n.height=u.y,d=n.getContext("2d"),h=new Uint8Array(c.x*c.y),console.log("FrameGrabber",JSON.stringify({size:c,topRight:s,videoSize:i,canvasSize:u})),o.attachData=function(e){h=e},o.getData=function(){return h},o.grab=function(){var r,n=a.halfSample,o=t.getFrame();return!!o&&(d.drawImage(o,0,0,u.x,u.y),r=d.getImageData(l,f,c.x,c.y).data,n?e.grayAndHalfSampleFromCanvasData(r,c,h):e.computeGray(r,h,a),!0)},o.getSize=function(){return c},o}}}),n("config",[],function(){return{inputStream:{name:"Live",type:"LiveStream",constraints:{width:640,height:480,minAspectRatio:0,maxAspectRatio:100,facing:"environment"},area:{top:"0%",right:"0%",left:"0%",bottom:"0%"},singleChannel:!1},tracking:!1,debug:!1,controls:!1,locate:!0,numOfWorkers:4,visual:{show:!0},decoder:{drawBoundingBox:!1,showFrequency:!1,drawScanline:!1,showPattern:!1,readers:["code_128_reader"]},locator:{halfSample:!0,patchSize:"medium",showCanvas:!1,showPatches:!1,showFoundPatches:!1,showSkeleton:!1,showLabels:!1,showPatchLabels:!1,showRemainingPatchLabels:!1,boxFromPatches:{showTransformed:!1,showTransformedBox:!1,showBB:!1}}}}),n("events",[],function(){"use strict";return function(){var e={};function t(t){return e[t]||(e[t]={subscribers:[]}),e[t]}function r(e,r,n){var o;if("function"==typeof r)o={callback:r,async:n};else if(!(o=r).callback)throw"Callback was not specified on options";t(e).subscribers.push(o)}return{subscribe:function(e,t,n){return r(e,t,n)},publish:function(e,r){var n=t(e),o=n.subscribers;n.subscribers=o.filter(function(e){return function(e,t){e.async?setTimeout(function(){e.callback(t)},4):e.callback(t)}(e,r),!e.once})},once:function(e,t,n){r(e,{callback:t,async:n,once:!0})},unsubscribe:function(r,n){var o;r?(o=t(r)).subscribers=o&&n?o.subscribers.filter(function(e){return e.callback!==n}):[]:e={}}}}()}),n("camera_access",["html_utils"],function(e){"use strict";var t,r;function n(e,t){var r=10;!function n(){r>0?e.videoWidth>0&&e.videoHeight>0?(console.log(e.videoWidth+"px x "+e.videoHeight+"px"),t()):window.setTimeout(n,500):t("Unable to play video stream. Is webcam working?"),r--}()}function o(e,o,a){!function(e,r,n){void 0!==navigator.getUserMedia?navigator.getUserMedia(e,function(e){t=e;var n=window.URL&&window.URL.createObjectURL(e)||e;r.apply(null,[n])},n):n(new TypeError("getUserMedia not available"))}(e,function(e){o.src=e,r&&o.removeEventListener("loadeddata",r,!1),r=n.bind(null,o,a),o.addEventListener("loadeddata",r,!1),o.play()},function(e){a(e)})}return{request:function(t,r,n){!function(t,r,n){!function(t,r){var n={audio:!1,video:!0},o=e.mergeObjects({width:640,height:480,minAspectRatio:0,maxAspectRatio:100,facing:"environment"},t);if("undefined"==typeof MediaStreamTrack||void 0===MediaStreamTrack.getSources)return n.video={mediaSource:"camera",width:{min:o.width,max:o.width},height:{min:o.height,max:o.height},require:["width","height"]},r(n);MediaStreamTrack.getSources(function(e){for(var t,a=0;a!=e.length;++a){var i=e[a];"video"==i.kind&&i.facing==o.facing&&(t=i.id)}return n.video={mandatory:{minWidth:o.width,minHeight:o.height,minAspectRatio:o.minAspectRatio,maxAspectRatio:o.maxAspectRatio},optional:[{sourceId:t}]},r(n)})}(r,function(e){o(e,t,n)})}(t,r,n)},release:function(){var e=t&&t.getVideoTracks();e.length&&e[0].stop(),t=null}}}),n("result_collector",["image_debug"],function(e){"use strict";return{create:function(t){var r=document.createElement("canvas"),n=r.getContext("2d"),o=[],a=t.capacity||20,i=!0===t.capture;return{addResult:function(u,c,s){var l={};(function(e){return a&&e&&!function(e,t){return!!t&&t.some(function(t){return Object.keys(t).every(function(r){return t[r]===e[r]})})}(e,t.blacklist)&&function(e,t){return"function"!=typeof t||t(e)}(e,t.filter)})(s)&&(a--,l.codeResult=s,i&&(r.width=c.x,r.height=c.y,e.drawImage(u,c,n),l.frame=r.toDataURL()),o.push(l))},getResults:function(){return o}}}}}),n("quagga",["input_stream","image_wrapper","barcode_locator","barcode_decoder","frame_grabber","html_utils","config","events","camera_access","image_debug","result_collector"],function(t,r,n,o,a,i,u,c,l,f,d){"use strict";var h,p,g,m,v,y,_,x={ctx:{image:null,overlay:null},dom:{image:null,overlay:null}},w=[],b=!0;function C(e){!function(e){m=e||new r({x:h.getWidth(),y:h.getHeight()}),console.log(m.size),v=[s.create([0,0]),s.create([0,m.size.y]),s.create([m.size.x,m.size.y]),s.create([m.size.x,0])],n.init(m,u.locator)}(e),y=o.create(u.decoder,m)}function E(e){var r;if("VideoStream"==u.inputStream.type)r=document.createElement("video"),h=t.createVideoStream(r);else if("ImageStream"==u.inputStream.type)h=t.createImageStream();else if("LiveStream"==u.inputStream.type){var n=document.querySelector("#interactive.viewport");n&&((r=n.querySelector("video"))||(r=document.createElement("video"),n.appendChild(r))),h=t.createLiveStream(r),l.request(r,u.inputStream.constraints,function(t){if(t)return e(t);h.trigger("canrecord")})}h.setAttribute("preload","auto"),h.setAttribute("autoplay",!0),h.setInputStream(u.inputStream),h.addEventListener("canrecord",R.bind(void 0,e))}function R(e){n.checkImageConstraints(h,u.locator),function(){if("undefined"!=typeof document){var e=document.querySelector("#interactive.viewport");if(x.dom.image=document.querySelector("canvas.imgBuffer"),x.dom.image||(x.dom.image=document.createElement("canvas"),x.dom.image.className="imgBuffer",e&&"ImageStream"==u.inputStream.type&&e.appendChild(x.dom.image)),x.ctx.image=x.dom.image.getContext("2d"),x.dom.image.width=h.getCanvasSize().x,x.dom.image.height=h.getCanvasSize().y,x.dom.overlay=document.querySelector("canvas.drawingBuffer"),!x.dom.overlay){x.dom.overlay=document.createElement("canvas"),x.dom.overlay.className="drawingBuffer",e&&e.appendChild(x.dom.overlay);var t=document.createElement("br");t.setAttribute("clear","all"),e&&e.appendChild(t)}x.ctx.overlay=x.dom.overlay.getContext("2d"),x.dom.overlay.width=h.getCanvasSize().x,x.dom.overlay.height=h.getCanvasSize().y}}(),p=a.create(h,x.dom.image),function(){if("undefined"!=typeof document)for(var e=[{node:document.querySelector("div[data-controls]"),prop:u.controls},{node:x.dom.overlay,prop:u.visual.show}],t=0;t<e.length;t++)e[t].node&&(!0===e[t].prop?e[t].node.style.display="block":e[t].node.style.display="none")}(),u.numOfWorkers>0?function(e){var t;for(w=[],t=0;t<u.numOfWorkers;t++)S(r);function r(t){w.push(t),w.length>=u.numOfWorkers&&e()}}(function(){console.log("Workers created"),A(e)}):(C(),A(e))}function A(e){h.play(),e()}function T(e,t){b&&(function(e){var t,r,n=h.getTopRight(),o=n.x,a=n.y;if(e&&(0!==o||0!==a)&&(e.line&&2===e.line.length&&((r=e.line)[0].x+=o,r[0].y+=a,r[1].x+=o,r[1].y+=a),e.boxes&&e.boxes.length>0))for(t=0;t<e.boxes.length;t++)i(e.boxes[t]);function i(e){for(var t=e.length;t--;)e[t][0]+=o,e[t][1]+=a}}(e),t&&e&&e.codeResult&&_&&_.addResult(t,h.getCanvasSize(),e.codeResult)),c.publish("processed",e),e&&e.codeResult&&c.publish("detected",e)}function M(){var e,t;(t=u.locate?n.locate():[[s.create(v[0]),s.create(v[1]),s.create(v[2]),s.create(v[3])]])?((e=(e=y.decodeFromBoundingBoxes(t))||{}).boxes=t,T(e,m.data)):T()}function O(){g=!1,function e(){g||(function(){var e;if(b){if(w.length>0){if(!(e=w.filter(function(e){return!e.busy})[0]))return;p.attachData(e.imageData)}else p.attachData(m.data);p.grab()&&(e?(e.busy=!0,e.worker.postMessage({cmd:"process",imageData:e.imageData},[e.imageData.buffer])):M())}else M()}(),b&&"LiveStream"==u.inputStream.type&&window.requestAnimFrame(e))}()}function S(t){var r,n={worker:void 0,imageData:new Uint8Array(h.getWidth()*h.getHeight()),busy:!0};r=function(){var t,r;return void 0!==e&&(r=e),t=new Blob(["("+D.toString()+")("+r+");"],{type:"text/javascript"}),window.URL.createObjectURL(t)}(),n.worker=new Worker(r),n.worker.onmessage=function(e){if("initialized"===e.data.event)return URL.revokeObjectURL(r),n.busy=!1,n.imageData=new Uint8Array(e.data.imageData),console.log("Worker initialized"),t(n);"processed"===e.data.event?(n.imageData=new Uint8Array(e.data.imageData),n.busy=!1,T(e.data.result,n.imageData)):"error"===e.data.event&&console.log("Worker error: "+e.data.message)},n.worker.postMessage({cmd:"init",size:{x:h.getWidth(),y:h.getHeight()},imageData:n.imageData,config:u},[n.imageData.buffer])}function D(e){if(e){var t=e();if(!t)return void self.postMessage({event:"error",message:"Quagga could not be created"})}var r;function n(e){self.postMessage({event:"processed",imageData:r.data,result:e},[r.data.buffer])}function o(){self.postMessage({event:"initialized",imageData:r.data},[r.data.buffer])}self.onmessage=function(e){if("init"===e.data.cmd){var a=e.data.config;a.numOfWorkers=0,r=new t.ImageWrapper({x:e.data.size.x,y:e.data.size.y},new Uint8Array(e.data.imageData)),t.init(a,o,r),t.onProcessed(n)}else"process"===e.data.cmd?(r.data=new Uint8Array(e.data.imageData),t.start()):"setReaders"===e.data.cmd&&t.setReaders(e.data.readers)}}return{init:function(e,t,r){if(u=i.mergeObjects(u,e),r)return b=!1,C(r),t();E(t)},start:function(){O()},stop:function(){g=!0,w.forEach(function(e){e.worker.terminate(),console.log("Worker terminated!")}),w.length=0,"LiveStream"===u.inputStream.type&&(l.release(),h.clearEventHandlers())},pause:function(){g=!0},onDetected:function(e){c.subscribe("detected",e)},offDetected:function(e){c.unsubscribe("detected",e)},onProcessed:function(e){c.subscribe("processed",e)},offProcessed:function(e){c.unsubscribe("processed",e)},setReaders:function(e){!function(e){y?y.setReaders(e):b&&w.length>0&&w.forEach(function(t){t.worker.postMessage({cmd:"setReaders",readers:e})})}(e)},registerResultCollector:function(e){e&&"function"==typeof e.addResult&&(_=e)},canvas:x,decodeSingle:function(e,t){e=i.mergeObjects({inputStream:{type:"ImageStream",sequence:!1,size:800,src:e.src},numOfWorkers:1,locator:{halfSample:!1}},e),this.init(e,function(){c.once("processed",function(e){g=!0,t.call(null,e)},!0),O()})},ImageWrapper:r,ImageDebug:f,ResultCollector:d}}),r("quagga")},r=t.toString(),e.exports=t(r)}}]);
@@ -0,0 +1,9 @@
1
+ /* @preserve ASM BEGIN */
2
+
3
+ /* @preserve ASM END */
4
+
5
+ /**
6
+ * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
7
+ * Available via the MIT or new BSD license.
8
+ * see: http://github.com/jrburke/almond for details
9
+ */
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkreact_components=self.webpackChunkreact_components||[]).push([[988],{988(o,r,t){t.r(r),t.d(r,{default:()=>l});var e=t(155),n=t(823),i=(0,n.styled)(n.TextField)({"& input":{fontFamily:"Montserrat !important",fontSize:"14px",color:"#333"},"& label":{fontFamily:"Montserrat !important",fontSize:"14px",color:"#333"},"& label.Mui-focused":{color:"#00B2A6"},"& .MuiInput-underline:after":{borderBottomColor:"#00B2A6"},"& .MuiOutlinedInput-root":{fontFamily:"Montserrat !important",borderRadius:"8px",backgroundColor:"#fff","& fieldset":{borderColor:"rgba(0, 178, 166, 0.5)",borderRadius:"8px"},"&:hover fieldset":{borderColor:"#00B2A6"},"&.Mui-focused fieldset":{borderColor:"#00B2A6",borderWidth:"1px"}},"& .MuiFilledInput-root":{fontFamily:"Montserrat !important",backgroundColor:"#f5f5f5","&:hover":{backgroundColor:"#e0e0e0"},"&:before":{borderBottomColor:"#00B2A6"},"&:hover:before":{borderBottomColor:"#00B2A6"},"&:after":{borderBottomColor:"#00B2A6"}},"& .MuiInputBase-input":{fontFamily:"Montserrat !important",fontSize:"14px",color:"#333"},"& .MuiFormHelperText-root":{fontFamily:"Montserrat !important",fontSize:"10px",marginLeft:2}});const l=(0,e.memo)(i)}}]);
@@ -1,20 +1,41 @@
1
- import { TextFieldProps } from '@mui/material';
2
- import { InputPropsCustomTypes } from './constants';
3
- export type InputProps = TextFieldProps & {
4
- shrink?: boolean;
5
- readOnly?: boolean;
6
- xs?: number;
7
- onKeyEnter?: () => void;
8
- order?: number;
9
- render?: boolean;
10
- qtdSolicitada?: number;
11
- qtdSeparada?: number;
12
- onQtdSeparadaChange?: (newValue: number) => void;
13
- type?: InputPropsCustomTypes;
14
- };
1
+ import { InputProps } from './utils/interface';
15
2
  /**
16
- * Input personalizado Mui
17
- * @version 2.0.1
18
- * @ViniciusCLoeblein
3
+ * Componente de entrada (Input) personalizado baseado no MUI (Material-UI) para uso específico no projeto.
4
+ * Ele inclui diversas funcionalidades como máscaras para formatos específicos (CPF, telefone, moeda) e suporte a captura de código de barras via câmera.
5
+ *
6
+ *
7
+ * @version 0.0.1
8
+ * @author Flaviasoz
9
+ * @date 2024-10-21
10
+ *
11
+ * @param {InputProps} props - As propriedades do componente Input.
12
+ * @param {string} [props.mask] - A máscara personalizada a ser aplicada ao campo de entrada, usada em conjunto com o componente `MaskCustom`. **Nota:** Versão beta, não utilizar em telas de produção.
13
+ * @param {boolean} [props.onCamera] - Função a ser executada após a captura de um código de barras pela câmera.
14
+ * @param {boolean} [props.openCamera] - Define se a câmera está aberta para captura de código de barras.
15
+ * @param {function} [props.onKeyEnter] - Callback executado quando a tecla "Enter" é pressionada.
16
+ * @param {string} [props.type='text'] - Define o tipo do campo de entrada. Pode ser 'text', 'real', 'float', 'cpf', 'celular', ou outros tipos de entrada aceitos pelo HTML.
17
+ * @param {function} [props.setOpenCamera] - Função para controlar a abertura/fechamento da câmera.
18
+ * @param {React.InputHTMLAttributes<HTMLInputElement>} [props.rest] - Qualquer outra propriedade HTML ou de entrada aceitas pelo componente Input.
19
+ *
20
+ * @returns {JSX.Element} Componente de entrada customizado.
21
+ *
22
+ * @example
23
+ * ```jsx
24
+ * const MyComponent = () => (
25
+ * <Input
26
+ * mask="cpf"
27
+ * type="cpf"
28
+ * onChange={(e) => console.log(e.target.value)}
29
+ * onCamera={(code) => console.log("Código de barras:", code)}
30
+ * openCamera={true}
31
+ * setOpenCamera={(open) => console.log("Câmera aberta:", open)}
32
+ * />
33
+ * );
34
+ * ```
19
35
  */
20
- export default function Input({ shrink, readOnly, onKeyEnter, size, type, ...rest }: Readonly<InputProps>): import("react/jsx-runtime").JSX.Element;
36
+ declare const Input: {
37
+ ({ mask, onCamera, openCamera, onKeyEnter, type, setOpenCamera, ...rest }: Readonly<InputProps>): import("react/jsx-runtime").JSX.Element;
38
+ displayName: string;
39
+ };
40
+ export default Input;
41
+ export type { InputProps } from './utils/interface';