Changeset 3346589
- Timestamp:
- 08/18/2025 05:30:55 PM (7 months ago)
- Location:
- vindi-pagamentos/trunk
- Files:
-
- 17 edited
-
app/Core/Config.php (modified) (1 diff)
-
app/Services/WooCommerce/Gateways/Blocks/AbstractBlockGateway.php (modified) (1 diff)
-
assets/blocks/components/PersonType/block.json (modified) (1 diff)
-
assets/blocks/gateways/credit/index.jsx (modified) (9 diffs)
-
assets/blocks/gateways/multipayment/index.jsx (modified) (3 diffs)
-
composer.json (modified) (1 diff)
-
dist/blocks/credit/index.asset.php (modified) (1 diff)
-
dist/blocks/credit/index.js (modified) (1 diff)
-
dist/blocks/multi-payment/index.asset.php (modified) (1 diff)
-
dist/blocks/multi-payment/index.js (modified) (1 diff)
-
package.json (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
-
vindi-pagamentos.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vindi-pagamentos/trunk/app/Core/Config.php
r3345266 r3346589 73 73 public function pluginVersion(): string 74 74 { 75 return '1.0. 1';75 return '1.0.2'; 76 76 } 77 77 } -
vindi-pagamentos/trunk/app/Services/WooCommerce/Gateways/Blocks/AbstractBlockGateway.php
r3344656 r3346589 10 10 { 11 11 protected $name; 12 protected AbstractGateway $gateway;12 protected ?AbstractGateway $gateway; 13 13 14 14 public function initialize(): void -
vindi-pagamentos/trunk/assets/blocks/components/PersonType/block.json
r3345266 r3346589 4 4 "name": "vindi-pagamentos/person-type", 5 5 "icon": "flag", 6 "version": "1.0. 1",6 "version": "1.0.2", 7 7 "title": "Woo - Tipo de Pessoa", 8 8 "description": "Definição de tipo de pessoa no checkout", -
vindi-pagamentos/trunk/assets/blocks/gateways/credit/index.jsx
r3345266 r3346589 4 4 import { getSetting } from "@woocommerce/settings"; 5 5 import { __ } from "@wordpress/i18n"; 6 import { useSelect } from "@wordpress/data"; 7 import { CART_STORE_KEY } from "@woocommerce/block-data"; 6 8 import { GatewayDescription } from "../../components/GatewayDescription"; 7 9 import { PaymentDocument } from "../../components/PaymentDocument"; … … 36 38 const [brandName, setBrandName] = useState("mono/generic"); 37 39 const [cpf, setCpf] = useState(""); 40 const [currentPrice, setCurrentPrice] = useState(price); 41 42 const currentCart = useSelect((select) => { 43 return select(CART_STORE_KEY).getCartData(); 44 }); 45 46 useEffect(() => { 47 if (currentCart?.totals?.total_price) { 48 const totalInReais = parseFloat(currentCart.totals.total_price) / 100; 49 setCurrentPrice(totalInReais.toString()); 50 } 51 }, [currentCart]); 38 52 39 53 const processPaymentDocumentProps = (attributes) => { … … 60 74 "wvp-brand": brand.toString(), 61 75 "wc-vindi-customer-document": cpf, 62 "vindi-pagamento_nonce": nonceCheckout 76 "vindi-pagamento_nonce": nonceCheckout, 63 77 }, 64 78 }, … … 168 182 data: JSON.stringify({ 169 183 brand: brand, 170 price: parseFloat( price).toFixed(2),184 price: parseFloat(currentPrice).toFixed(2), 171 185 _wpnonce: nonce, 172 // security: wc_checkout_params.update_order_review_nonce,173 186 }), 174 187 success: (data) => { … … 336 349 const [cpf, setCpf] = useState(""); 337 350 const [loader, setLoader] = useState(false); 338 339 340 351 const [currentPrice, setCurrentPrice] = useState(price); 352 353 const currentCart = useSelect((select) => { 354 return select(CART_STORE_KEY).getCartData(); 355 }); 356 357 useEffect(() => { 358 if (currentCart?.totals?.total_price) { 359 const totalInReais = parseFloat(currentCart.totals.total_price) / 100; 360 setCurrentPrice(totalInReais.toString()); 361 } 362 }, [currentCart]); 363 341 364 const processPaymentDocumentProps = (attributes) => { 342 365 setCpf(attributes.cpf); … … 359 382 data: JSON.stringify({ 360 383 token: token, 361 price: p rice,384 price: parseFloat(currentPrice).toFixed(2), 362 385 _wpnonce: nonce, 363 386 }), … … 366 389 setInstallmentsData(data.data.installments); 367 390 setInstallmentsError(data.data.message); 368 console.log(data.data.message)369 391 } else { 370 392 setInstallmentsError(data.data.message); … … 392 414 "wvp-installments": installments, 393 415 "wc-vindi-customer-document": cpf, 394 "vindi-pagamento_nonce": nonceCheckout 416 "vindi-pagamento_nonce": nonceCheckout, 395 417 }, 396 418 }, 397 419 }; 398 420 }); 399 400 421 401 422 return () => { … … 413 434 <> 414 435 <GatewayDescription sandbox={sandbox} description={description} /> 415 <div className={`wvp-credit-fields ${loader ? "wvp-request-loader" : ""}`}> 436 <div 437 className={`wvp-credit-fields ${loader ? "wvp-request-loader" : ""}`} 438 > 416 439 <div className="wvp-credit-field"> 417 440 <label htmlFor="wvp-card-code"> -
vindi-pagamentos/trunk/assets/blocks/gateways/multipayment/index.jsx
r3345266 r3346589 4 4 import { getSetting } from "@woocommerce/settings"; 5 5 import { __ } from "@wordpress/i18n"; 6 import { useSelect } from "@wordpress/data"; 7 import { CART_STORE_KEY } from "@woocommerce/block-data"; 6 8 import { GatewayDescription } from "../../components/GatewayDescription"; 7 9 import { PaymentDocument } from "../../components/PaymentDocument"; … … 64 66 65 67 const [cpf, setCpf] = useState(""); 68 const [currentPrice, setCurrentPrice] = useState(price); 69 70 const currentCart = useSelect((select) => { 71 return select(CART_STORE_KEY).getCartData(); 72 }); 73 74 useEffect(() => { 75 if (currentCart?.totals?.total_price) { 76 const totalInReais = parseFloat(currentCart.totals.total_price) / 100; 77 setCurrentPrice(totalInReais.toString()); 78 } 79 }, [currentCart]); 80 66 81 const processPaymentDocumentProps = (attributes) => { 67 82 setCpf(attributes.cpf); … … 69 84 70 85 useEffect(() => { 71 if ( price) {72 const totalPrice = parseFloat( price);86 if (currentPrice) { 87 const totalPrice = parseFloat(currentPrice); 73 88 const half = totalPrice / 2; 74 89 setFirstAmount(formatPrice(half)); 75 90 setSecondAmount(formatPrice(totalPrice - half)); 76 91 } 77 }, [ price]);92 }, [currentPrice]); 78 93 79 94 useEffect(() => { -
vindi-pagamentos/trunk/composer.json
r3345266 r3346589 1 1 { 2 2 "name": "vindi/vindi-pagamentos", 3 "version": "1.0. 1",3 "version": "1.0.2", 4 4 "description": "WooCommerce payment plugin using Vindi gateways", 5 5 "type": "wordpress-plugin", -
vindi-pagamentos/trunk/dist/blocks/credit/index.asset.php
r3345266 r3346589 1 <?php return array('dependencies' => array('react', 'wc-blocks- registry', 'wc-settings', 'wp-html-entities', 'wp-i18n'), 'version' => 'eb334244713a8f7e1ed9');1 <?php return array('dependencies' => array('react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wp-data', 'wp-html-entities', 'wp-i18n'), 'version' => 'fe6bf4c5f3b467e3f841'); -
vindi-pagamentos/trunk/dist/blocks/credit/index.js
r3345266 r3346589 1 (()=>{var e={703:(e,t,s)=>{"use strict";var i=s(414);function a(){}function n(){}n.resetWarningCache=a,e.exports=function(){function e(e,t,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 t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:a};return s.PropTypes=s,s}},697:(e,t,s)=>{e.exports=s(703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function s(i){var a=t[i];if(void 0!==a)return a.exports;var n=t[i]={exports:{}};return e[i](n,n.exports,s),n.exports}(()=>{"use strict";const e=window.React,t=window.wc.wcBlocksRegistry,i=window.wp.htmlEntities,a=window.wc.wcSettings,n=window.wp.i18n ;function r(t){const{sandbox:s,description:i}=t;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-description"},(0,e.createElement)("span",null,i),s&&(0,e.createElement)("div",{style:{lineHeight:1}},(0,e.createElement)("span",{style:{opacity:"80%",fontSize:"14px",fontStyle:"italic"}},s))))}function u(e){return"string"==typeof e||e instanceof String}function o(e){var t;return"object"==typeof e&&null!=e&&"Object"===(null==e||null==(t=e.constructor)?void 0:t.name)}function l(e,t){return Array.isArray(t)?l(e,((e,s)=>t.includes(s))):Object.entries(e).reduce(((e,s)=>{let[i,a]=s;return t(a,i)&&(e[i]=a),e}),{})}const h="NONE",p="LEFT",d="FORCE_LEFT",c="RIGHT",m="FORCE_RIGHT";function g(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function k(e,t){if(t===e)return!0;const s=Array.isArray(t),i=Array.isArray(e);let a;if(s&&i){if(t.length!=e.length)return!1;for(a=0;a<t.length;a++)if(!k(t[a],e[a]))return!1;return!0}if(s!=i)return!1;if(t&&e&&"object"==typeof t&&"object"==typeof e){const s=t instanceof Date,i=e instanceof Date;if(s&&i)return t.getTime()==e.getTime();if(s!=i)return!1;const n=t instanceof RegExp,r=e instanceof RegExp;if(n&&r)return t.toString()==e.toString();if(n!=r)return!1;const u=Object.keys(t);for(a=0;a<u.length;a++)if(!Object.prototype.hasOwnProperty.call(e,u[a]))return!1;for(a=0;a<u.length;a++)if(!k(e[u[a]],t[u[a]]))return!1;return!0}return!(!t||!e||"function"!=typeof t||"function"!=typeof e)&&t.toString()===e.toString()}class f{constructor(e){for(Object.assign(this,e);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?h:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?p:c}}function v(e,t){return new v.InputMask(e,t)}function _(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?v.MaskedRegExp:u(e)?v.MaskedPattern:e===Date?v.MaskedDate:e===Number?v.MaskedNumber:Array.isArray(e)||e===Array?v.MaskedDynamic:v.Masked&&e.prototype instanceof v.Masked?e:v.Masked&&e instanceof v.Masked?e.constructor:e instanceof Function?v.MaskedFunction:(console.warn("Mask not found for mask",e),v.Masked)}function E(e){if(!e)throw new Error("Options in not defined");if(v.Masked){if(e.prototype instanceof v.Masked)return{mask:e};const{mask:t,...s}=e instanceof v.Masked?{mask:e}:o(e)&&e.mask instanceof v.Masked?e:{};if(t){const e=t.mask;return{...l(t,((e,t)=>!t.startsWith("_"))),mask:t.constructor,_mask:e,...s}}}return o(e)?{...e}:{mask:e}}function C(e){if(v.Masked&&e instanceof v.Masked)return e;const t=E(e),s=_(t.mask);if(!s)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}v.createMask=C;class A{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return null!=e?e:this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return null!=e?e:this.value.length}select(e,t){if(null!=e&&null!=t&&(e!==this.selectionStart||t!==this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}v.MaskElement=A;class y extends A{constructor(e){super(),this.input=e,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 e,t,s;return null!=(e=null==(t=(s=this.input).getRootNode)?void 0:t.call(s))?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){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",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){return this._handlers.redo&&(90===e.keyCode&&e.shiftKey&&(e.metaKey||e.ctrlKey)||89===e.keyCode&&e.ctrlKey)?(e.preventDefault(),this._handlers.redo(e)):this._handlers.undo&&90===e.keyCode&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),this._handlers.undo(e)):void(e.isComposing||this._handlers.selectionChange(e))}_onBeforeinput(e){return"historyUndo"===e.inputType&&this._handlers.undo?(e.preventDefault(),this._handlers.undo(e)):"historyRedo"===e.inputType&&this._handlers.redo?(e.preventDefault(),this._handlers.redo(e)):void 0}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}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={}}}v.HTMLMaskElement=y;class F extends y{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}v.HTMLMaskElement=y;class x extends y{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,i=t&&t.focusOffset;return null==i||null==s||s<i?s:i}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,i=t&&t.focusOffset;return null==i||null==s||s>i?s:i}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}v.HTMLContenteditableMaskElement=x;class w{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>w.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,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}}w.MAX_LENGTH=100,v.InputMask=class{constructor(e,t){this.el=e instanceof A?e:e.isContentEditable&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?new x(e):new F(e),this.masked=C(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new w,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(e){var t;return null==e||(null==(t=this.masked)?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof v.Masked)&&this.masked.constructor===_(e))return void this.masked.updateOptions({mask:e});const t=e instanceof v.Masked?e:C({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,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(e,t){const s=this._listeners[e];s&&s.forEach((e=>e(t)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el&&this.el.isActive&&(this.el.select(e,e),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(e){const t=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,n=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=t,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===e?this.alignCursor():null!=e&&(this.cursorPos=e),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,i=!this.maskEquals(t),a=this.masked.optionsIsChanged(s);i&&(this.mask=t),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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,p))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new f({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,a=s===this.masked.rawInputValue?t.removeDirection:h;let n=this.masked.nearestInputPos(t.startChangePos+i,a);a!==h&&(n=this.masked.nearestInputPos(n,h)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};class b{static normalize(e){return Array.isArray(e)?e:[e,new b]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}v.ChangeDetails=b;class S{constructor(e,t,s){void 0===e&&(e=""),void 0===t&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||null!=e&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class B{constructor(e){this._value="",this._update({...B.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){void 0===t&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new S(this.extractInput(e,t),e)}appendTail(e){return u(e)&&(e=new S(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new b({inserted:e,rawInserted:e})):new b}_appendChar(e,t,s){void 0===t&&(t={});const i=this.state;let a;if([e,a]=this.doPrepareChar(e,t),e&&(a=a.aggregate(this._appendCharRaw(e,t)),!a.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=i;let n=this.pad(t);const r=this._appendCharRaw(e,t);n=n.aggregate(r),r.rawInserted||n.equals(a)?a=n:this.state=s}if(a.inserted){let e,n=!1!==this.doValidate(t);if(n&&null!=s){const t=this.state;if(!0===this.overwrite){e=s.state;for(let e=0;e<a.rawInserted.length;++e)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=t,e=s.state;for(let e=0;e<a.rawInserted.length;++e)s.shift();i=this.appendTail(s),n=i.rawInserted.length===s.toString().length}n&&i.inserted&&(this.state=t)}n||(a=new b,this.state=i,s&&e&&(s.state=e))}return a}_appendPlaceholder(){return new b}_appendEager(){return new b}append(e,t,s){if(!u(e))throw new Error("value should be string");const i=u(s)?new S(String(s)):s;let a;null!=t&&t.tail&&(t._beforeTailState=this.state),[e,a]=this.doPrepare(e,t);for(let s=0;s<e.length;++s){const n=this._appendChar(e[s],t,i);if(!n.rawInserted&&!this.doSkipInvalid(e[s],t,i))break;a.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=t&&t.input&&e&&a.aggregate(this._appendEager()),null!=i&&(a.tailShift+=this.appendTail(i).tailShift),a}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new b}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,i=e();return this.rawInputValue=t,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return Boolean(this.skipInvalid)}doPrepare(e,t){return void 0===t&&(t={}),b.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return void 0===t&&(t={}),b.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,i,a){void 0===s&&(s=""),void 0===i&&(i=h),void 0===a&&(a={input:!0});const n=e+t,r=this.extractTail(n),u=!0===this.eager||"remove"===this.eager;let o;u&&(i=function(e){switch(e){case p:return d;case c:return m;default:return e}}(i),o=this.extractInput(0,n,{raw:!0}));let l=e;const g=new b;if(i!==h&&(l=this.nearestInputPos(e,t>1&&0!==e&&!u?h:i),g.tailShift=l-e),g.aggregate(this.remove(l)),u&&i!==h&&o===this.rawInputValue)if(i===d){let e;for(;o===this.rawInputValue&&(e=this.displayValue.length);)g.aggregate(new b({tailShift:-1})).aggregate(this.remove(e-1))}else i===m&&r.unshift();return g.aggregate(this.append(s,a,r))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!k(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||B.EMPTY_VALUES.includes(e)&&B.EMPTY_VALUES.includes(t)||!!this.format&&this.format(e,this)===this.format(this.typedValue,this)}pad(e){return new b}}B.DEFAULTS={skipInvalid:!0},B.EMPTY_VALUES=[void 0,null,""],v.Masked=B;class D{constructor(e,t){void 0===e&&(e=[]),void 0===t&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=u(e)?new S(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||null==e.stop)&&e.from===t.from+t.toString().length;if(e instanceof S)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof D){if(null==e.stop){let t;for(;e.chunks.length&&null==e.chunks[0].stop;)t=e.chunks.shift(),t.from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof v.MaskedPattern))return new S(this.toString()).appendTo(e);const t=new b;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=e._mapPosToBlock(e.displayValue.length),n=i.stop;let r;if(null!=n&&(!a||a.index<=n)&&((i instanceof D||e._stops.indexOf(n)>=0)&&t.aggregate(e._appendPlaceholder(n)),r=i instanceof D&&e._blocks[n]),r){const s=r.appendTail(i);t.aggregate(s);const a=i.toString().slice(s.rawInserted.length);a&&t.aggregate(e.append(a,{tail:!0}))}else t.aggregate(e.append(i.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map((e=>e.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map((e=>{const t="chunks"in e?new D:new S;return t.state=e,t}))}unshift(e){if(!this.chunks.length||null!=e&&this.from>=e)return"";const t=null!=e?e-this.from:e;let s=0;for(;s<this.chunks.length;){const e=this.chunks[s],i=e.unshift(t);if(e.toString()){if(!i)break;++s}else this.chunks.splice(s,1);if(i)return i}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class V{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:i}=e._mapPosToBlock(t)||(t<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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}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(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(t=this.block)?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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,d),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,p),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,p),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,m),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h),!0}))}}class M{constructor(e){Object.assign(this,e),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(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new b}nearestInputPos(e,t){void 0===t&&(t=h);const s=this._value.length;switch(t){case p:case d:return 0;default:return s}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new b;const s=!0===this.eager||"append"===this.eager,i=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,a=new b({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(t.raw||t.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new b;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new S("")}appendTail(e){return u(e)&&(e=new S(String(e))),e.appendTo(this)}append(e,t,s){const i=this._appendChar(e[0],t);return null!=s&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=Boolean(e._rawInputValue)}pad(e){return this._appendPlaceholder()}}class I{constructor(e){const{parent:t,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r,...u}=e;this.masked=C(u),Object.assign(this,{parent:t,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),0===e&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new b}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(e,t){if(void 0===t&&(t={}),this.isFilled)return new b;const s=this.masked.state;let i=this.masked._appendChar(e,this.currentMaskFlags(t));return i.inserted&&!1===this.doValidate(t)&&(i=new b,this.masked.state=s),i.inserted||this.isOptional||this.lazy||t.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new b:(this.isFilled=!0,new b({inserted:this.placeholderChar}))}_appendEager(){return new b}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){void 0===t&&(t=h);const s=this.value.length,i=Math.min(Math.max(e,0),s);switch(t){case p:case d:return this.isComplete?i:0;case c:case m:return this.isComplete?i:s;default:return i}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(null==e||null==(t=e._beforeTailState)?void 0:t.masked)||(null==e?void 0:e._beforeTailState)}}pad(e){return new b}}I.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]/,"*":/./},v.MaskedRegExp=class extends B{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=e=>e.search(t)>=0),super._update(e)}};class T extends B{constructor(e){super({...T.DEFAULTS,...e,definitions:Object.assign({},I.DEFAULT_DEFINITIONS,null==e?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,i=!1;for(let a=0;a<t.length;++a){if(this.blocks){const e=t.slice(a),s=Object.keys(this.blocks).filter((t=>0===e.indexOf(t)));s.sort(((e,t)=>t.length-e.length));const i=s[0];if(i){const{expose:e,repeat:t,...s}=E(this.blocks[i]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:t,parent:this},r=null!=t?new v.RepeatBlock(n):C(n);r&&(this._blocks.push(r),e&&(this.exposeBlock=r),this._maskedBlocks[i]||(this._maskedBlocks[i]=[]),this._maskedBlocks[i].push(this._blocks.length-1)),a+=i.length-1;continue}}let n=t[a],r=n in e;if(n===T.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){i=!i;continue}if(n===T.ESCAPE_CHAR){if(++a,n=t[a],!n)break;r=!1}const u=r?new I({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...E(e[n]),parent:this}):new M({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map((e=>e.state))}}set state(e){if(!e)return void this.reset();const{_blocks:t,...s}=e;this._blocks.forEach(((e,s)=>e.state=t[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((e=>e.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((e=>e.isComplete))}get isFilled(){return this._blocks.every((e=>e.isFilled))}get isFixed(){return this._blocks.every((e=>e.isFixed))}get isOptional(){return this._blocks.every((e=>e.isOptional))}doCommit(){this._blocks.forEach((e=>e.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((e,t)=>e+t.unmaskedValue),"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((e,t)=>e+t.value),"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce(((e,t)=>e+t.displayValue),"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new b;let s=null==(e=this._mapPosToBlock(this.displayValue.length))?void 0:e.index;if(null==s)return t;this._blocks[s].isFilled&&++s;for(let e=s;e<this._blocks.length;++e){const s=this._blocks[e]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._mapPosToBlock(this.displayValue.length),i=new b;if(!s)return i;for(let n,r=s.index;n=this._blocks[r];++r){var a;const s=n._appendChar(e,{...t,_beforeTailState:null==(a=t._beforeTailState)||null==(a=a._blocks)?void 0:a[r]});if(i.aggregate(s),s.consumed)break}return i}extractTail(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=new D;return e===t||this._forEachBlocksInRange(e,t,((e,t,i,a)=>{const n=e.extractTail(i,a);n.stop=this._findStopBefore(t),n.from=this._blockStartPos(t),n instanceof D&&(n.blockIndex=t),s.extend(n)})),s}extractInput(e,t,s){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),void 0===s&&(s={}),e===t)return"";let i="";return this._forEachBlocksInRange(e,t,((e,t,a,n)=>{i+=e.extractInput(a,n,s)})),i}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(!(i<=e))break;t=i}return t}_appendPlaceholder(e){const t=new b;if(this.lazy&&null==e)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const i=s.index,a=null!=e?e:this._blocks.length;return this._blocks.slice(i,a).forEach((s=>{var i;s.lazy&&null==e||t.aggregate(s._appendPlaceholder(null==(i=s._blocks)?void 0:i.length))})),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=t.length;if(t+=i.displayValue,e<=t.length)return{index:s,offset:e-a}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce(((e,t)=>e+t.displayValue.length),0)}_forEachBlocksInRange(e,t,s){void 0===t&&(t=this.displayValue.length);const i=this._mapPosToBlock(e);if(i){const e=this._mapPosToBlock(t),a=e&&i.index===e.index,n=i.offset,r=e&&a?e.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,n,r),e&&!a){for(let t=i.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].displayValue.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,((e,t,i,a)=>{s.aggregate(e.remove(i,a))})),s}nearestInputPos(e,t){if(void 0===t&&(t=h),!this._blocks.length)return 0;const s=new V(this,e);if(t===h)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(t===p||t===d){if(t===p){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===p){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e)return s.pos;if(s.popState(),s.ok&&s.pos<=e)return s.pos;s.popState()}return s.ok?s.pos:t===d?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return t===c||t===m?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===m?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(e,p)))):e}totalInputPositions(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,((e,t,i,a)=>{s+=e.totalInputPositions(i,a)})),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map((e=>this._blocks[e])):[]}pad(e){const t=new b;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>t.aggregate(s.pad(e)))),t}}T.DEFAULTS={...B.DEFAULTS,lazy:!0,placeholderChar:"_"},T.STOP_CHAR="`",T.ESCAPE_CHAR="\\",T.InputDefinition=I,T.FixedDefinition=M,v.MaskedPattern=T;class P extends T{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...n}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).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(e){let t="",s="";const[,i,a]=e.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(t="0".repeat(i.length)+a,s="9".repeat(i.length)+a),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){let s;return void 0===t&&(t={}),[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(void 0===t&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,n]=this.boundaries(this.value+e);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],t):Number(a)>this.to?!t.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(i[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;const[s,i]=this.boundaries(t);return this.from<=Number(i)&&Number(s)<=this.to&&super.doValidate(e)}pad(e){const t=new b;if(this.value.length===this.maxLength)return t;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach((e=>this._appendCharRaw(e)))}return t}}v.MaskedRange=P;class R extends T{static extractPatternOptions(e){const{mask:t,pattern:s,...i}=e;return{...i,mask:u(t)?t:s}}constructor(e){super(R.extractPatternOptions({...R.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:i,...a}={...R.DEFAULTS,...e},n=Object.assign({},R.GET_DEFAULT_BLOCKS());e.min&&(n.Y.from=e.min.getFullYear()),e.max&&(n.Y.to=e.max.getFullYear()),e.min&&e.max&&n.Y.from===n.Y.to&&(n.m.from=e.min.getMonth()+1,n.m.to=e.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=e.min.getDate(),n.d.to=e.max.getDate())),Object.assign(n,this.blocks,i),super._update({...a,mask:u(t)?t:s,blocks:n})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(R.extractPatternOptions(e))}}R.GET_DEFAULT_BLOCKS=()=>({d:{mask:P,from:1,to:31,maxLength:2},m:{mask:P,from:1,to:12,maxLength:2},Y:{mask:P,from:1900,to:9999}}),R.DEFAULTS={...T.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(e,t)=>e?[String(e.getDate()).padStart(2,"0"),String(e.getMonth()+1).padStart(2,"0"),e.getFullYear()].join("."):"",parse:(e,t)=>{const[s,i,a]=e.split(".").map(Number);return new Date(a,i-1,s)}},v.MaskedDate=R;class O extends B{constructor(e){super({...O.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map((e=>{const{expose:t,...s}=E(e),i=C({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return t&&(this.exposeMask=i),i})):[])}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){void 0===e&&(e=""),void 0===t&&(t={}),void 0===s&&(s="");const i=t.tail&&null!=t._beforeTailState?t._beforeTailState._value:this.value,a=this.rawInputValue,n=t.tail&&null!=t._beforeTailState?t._beforeTailState._rawInputValue:a,r=a.slice(n.length),u=this.currentMask,o=new b,l=null==u?void 0:u.state;return this.currentMask=this.doDispatch(e,{...t},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)):l&&(this.currentMask.state=l)),o}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new b;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:(null==(t=e._beforeTailState)?void 0:t.currentMaskRef)===this.currentMask&&(null==(s=e._beforeTailState)?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return void 0===t&&(t={}),void 0===s&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){void 0===t&&(t={});let[s,i]=super.doPrepare(e,t);if(this.currentMask){let e;[s,e]=super.doPrepare(s,this.currentMaskFlags(t)),i=i.aggregate(e)}return[s,i]}doPrepareChar(e,t){void 0===t&&(t={});let[s,i]=super.doPrepareChar(e,t);if(this.currentMask){let e;[s,e]=super.doPrepareChar(s,this.currentMaskFlags(t)),i=i.aggregate(e)}return[s,i]}reset(){var e;null==(e=this.currentMask)||e.reset(),this.compiledMasks.forEach((e=>e.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask)return this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,void this._applyDispatch();let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isComplete)}get isFilled(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isFilled)}remove(e,t){const s=new b;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((e=>e.state)),currentMaskRef:this.currentMask,currentMask:null==(e=this.currentMask)?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:i,...a}=e;t&&this.compiledMasks.forEach(((e,s)=>e.state=t[s])),null!=s&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every(((t,s)=>{if(!e[s])return;const{mask:i,...a}=e[s];return k(t,a)&&t.maskEquals(i)})):super.maskEquals(e)}typedValueEquals(e){var t;return Boolean(null==(t=this.currentMask)?void 0:t.typedValueEquals(e))}}O.DEFAULTS={...B.DEFAULTS,dispatch:(e,t,s,i)=>{if(!t.compiledMasks.length)return;const a=t.rawInputValue,n=t.compiledMasks.map(((n,r)=>{const u=t.currentMask===n,o=u?n.displayValue.length:n.nearestInputPos(n.displayValue.length,d);return n.rawInputValue!==a?(n.reset(),n.append(a,{raw:!0})):u||n.remove(o),n.append(e,t.currentMaskFlags(s)),n.appendTail(i),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,d)))}}));return n.sort(((e,t)=>t.weight-e.weight||t.totalInputPositions-e.totalInputPositions)),t.compiledMasks[n[0].index]}},v.MaskedDynamic=O;class L extends T{constructor(e){super({...L.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const e=t.map((e=>e.length)),i=Math.min(...e),a=Math.max(...e)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){void 0===t&&(t={});const s=Math.min(this.nearestInputPos(0,m),this.value.length),i=this.enum.filter((t=>this.matchValue(t,this.unmaskedValue+e,s)));if(i.length){1===i.length&&this._forEachBlocksInRange(0,this.value.length,((e,s)=>{const a=i[0][s];s>=this.value.length||a===e.value||(e.reset(),e._appendChar(a,t))}));const e=super._appendCharRaw(i[0][this.value.length],t);return 1===i.length&&i[0].slice(this.unmaskedValue.length).split("").forEach((t=>e.aggregate(super._appendCharRaw(t)))),e}return new b({skip:!this.isComplete})}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new S("",e)}remove(e,t){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),e===t)return new b;const s=Math.min(super.nearestInputPos(0,m),this.value.length);let i;for(i=e;i>=0&&!(this.enum.filter((e=>this.matchValue(e,this.value.slice(s,i),s))).length>1);--i);const a=super.remove(i,t);return a.tailShift+=i-e,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}var N;L.DEFAULTS={...T.DEFAULTS,matchValue:(e,t,s)=>e.indexOf(t,s)===s},v.MaskedEnum=L,v.MaskedFunction=class extends B{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}};class U extends B{constructor(e){super({...U.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t=(this.scale?"("+g(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+"\\d*"+t),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(g).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(g(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){void 0===t&&(t={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(i.skip=!0),!s||this.allowPositive||this.value||"-"===s||i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(e,t){void 0===t&&(t=!1);let s=0;for(let i=0;i<e;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return void 0===e&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){void 0===t&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=e;const n=this.number;let r,u=!isNaN(n),o=!1;if(u){let e;null!=this.min&&this.min<0&&this.number<this.min&&(e=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(e=this.max),null!=e&&(this.autofix?(this._value=this.format(e,this).replace(U.UNMASKED_RADIX,this.radix),o||(o=a===this._value&&!t.tail)):u=!1),u&&(u=Boolean(this._value.match(this._numberRegExp)))}u?r=new b({inserted:this._value.slice(a.length),rawInserted:o?"":e,skip:o}):(this._value=a,r=new b),this._value=this._insertThousandsSeparators(this._value);const l=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(l);return r.tailShift+=(h-i)*this.thousandsSeparator.length,r}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const i=this._findSeparatorAround(t);return i>=0&&(t=i+this.thousandsSeparator.length),[e,t]}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),i=this.value.slice(t),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const n=this._separatorsCountFromSlice(s);return new b({tailShift:(n-a)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case h:case p:case d:{const s=this._findSeparatorAround(e-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(e<i||this.value.length<=i||t===d)return s}break}case c:case m:{const t=this._findSeparatorAround(e);if(t>=0)return t+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,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(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,((e,t,s,i)=>t+i)),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){void 0===t&&(t={});const i=0===this.scale&&e!==this.thousandsSeparator&&(e===this.radix||e===U.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,U.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(U.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}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(e){return(super.typedValueEquals(e)||U.EMPTY_VALUES.includes(e)&&U.EMPTY_VALUES.includes(this.typedValue))&&!(0===e&&""===this.value)}}N=U,U.UNMASKED_RADIX=".",U.EMPTY_VALUES=[...B.EMPTY_VALUES,0],U.DEFAULTS={...B.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[N.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},v.MaskedNumber=U;const j={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function z(e,t,s){void 0===t&&(t=j.MASKED),void 0===s&&(s=j.MASKED);const i=C(e);return e=>i.runIsolated((i=>(i[t]=e,i[s])))}v.PIPE_TYPE=j,v.createPipe=z,v.pipe=function(e,t,s,i){return z(t,s,i)(e)},v.RepeatBlock=class extends T{get repeatFrom(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?e:0}get repeatTo(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,i;const{repeat:a,...n}=E(e);this._blockOpts=Object.assign({},this._blockOpts,n);const r=C(this._blockOpts);this.repeat=null!=(t=null!=(s=null!=a?a:r.repeat)?s:this.repeat)?t: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(e){return e<this._blocks.length?this._blocks[e]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(C(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(e,t){void 0===t&&(t={});const s=new b;for(let u,o,l=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[l])?n:o=!o&&this._allocateBlock(l);++l){var i,a,n,r;const h=u._appendChar(e,{...t,_beforeTailState:null==(r=t._beforeTailState)||null==(r=r._blocks)?void 0:r[l]});if(h.skip&&o){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(h),h.consumed)break}return s}_trimEmptyTail(e,t){var s,i;void 0===e&&(e=0);const a=Math.max((null==(s=this._mapPosToBlock(e))?void 0:s.index)||0,this.repeatFrom,0);let n;null!=t&&(n=null==(i=this._mapPosToBlock(t))?void 0:i.index),null==n&&(n=this._blocks.length-1);let r=0;for(let e=n;a<=e&&!this._blocks[e].unmaskedValue;--e,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return void 0===e&&(e=0),null==t&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}};try{globalThis.IMask=v}catch{}var q=s(697);const K={mask:q.oneOfType([q.array,q.func,q.string,q.instanceOf(RegExp),q.oneOf([Date,Number,v.Masked]),q.instanceOf(v.Masked)]),value:q.any,unmask:q.oneOfType([q.bool,q.oneOf(["typed"])]),prepare:q.func,prepareChar:q.func,validate:q.func,commit:q.func,overwrite:q.oneOfType([q.bool,q.oneOf(["shift"])]),eager:q.oneOfType([q.bool,q.oneOf(["append","remove"])]),skipInvalid:q.bool,onAccept:q.func,onComplete:q.func,placeholderChar:q.string,displayChar:q.string,lazy:q.bool,definitions:q.object,blocks:q.object,enum:q.arrayOf(q.string),maxLength:q.number,from:q.number,to:q.number,pattern:q.string,format:q.func,parse:q.func,autofix:q.oneOfType([q.bool,q.oneOf(["pad"])]),radix:q.string,thousandsSeparator:q.string,mapToRadix:q.arrayOf(q.string),scale:q.number,normalizeZeros:q.bool,padFractionalZeros:q.bool,min:q.oneOfType([q.number,q.instanceOf(Date)]),max:q.oneOfType([q.number,q.instanceOf(Date)]),dispatch:q.func,inputRef:q.oneOfType([q.func,q.shape({current:q.object})])},Y=Object.keys(K).filter((e=>"value"!==e)),H=["value","unmask","onAccept","onComplete","inputRef"],$=Y.filter((e=>H.indexOf(e)<0)),Z=function(t){var s;const i=((s=class extends e.Component{constructor(e){super(e),this._inputRef=this._inputRef.bind(this)}componentDidMount(){this.props.mask&&this.initMask()}componentDidUpdate(){const e=this.props,t=this._extractMaskOptionsFromProps(e);var s;t.mask?this.maskRef?(this.maskRef.updateOptions(t),"value"in e&&void 0!==e.value&&(this.maskValue=e.value)):this.initMask(t):(this.destroyMask(),"value"in e&&void 0!==e.value&&(null!=(s=this.element)&&s.isContentEditable&&"INPUT"!==this.element.tagName&&"TEXTAREA"!==this.element.tagName?this.element.textContent=e.value:this.element.value=e.value))}componentWillUnmount(){this.destroyMask()}_inputRef(e){this.element=e,this.props.inputRef&&(Object.prototype.hasOwnProperty.call(this.props.inputRef,"current")?this.props.inputRef.current=e:this.props.inputRef(e))}initMask(e){void 0===e&&(e=this._extractMaskOptionsFromProps(this.props)),this.maskRef=v(this.element,e).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(e){const{...t}=e;return Object.keys(t).filter((e=>$.indexOf(e)<0)).forEach((e=>{delete t[e]})),t}_extractNonMaskProps(e){const{...t}=e;return Y.forEach((e=>{"maxLength"!==e&&delete t[e]})),"defaultValue"in t||(t.defaultValue=e.mask?"":t.value),delete t.value,t}get maskValue(){return this.maskRef?"typed"===this.props.unmask?this.maskRef.typedValue:this.props.unmask?this.maskRef.unmaskedValue:this.maskRef.value:""}set maskValue(e){this.maskRef&&(e=null==e&&"typed"!==this.props.unmask?"":e,"typed"===this.props.unmask?this.maskRef.typedValue=e:this.props.unmask?this.maskRef.unmaskedValue=e:this.maskRef.value=e)}_onAccept(e){this.props.onAccept&&this.maskRef&&this.props.onAccept(this.maskValue,this.maskRef,e)}_onComplete(e){this.props.onComplete&&this.maskRef&&this.props.onComplete(this.maskValue,this.maskRef,e)}render(){return e.createElement(t,{...this._extractNonMaskProps(this.props),inputRef:this._inputRef})}}).displayName=void 0,s.propTypes=void 0,s),a=t.displayName||t.name||"Component";return i.displayName="IMask("+a+")",i.propTypes=K,e.forwardRef(((t,s)=>e.createElement(i,{...t,ref:s})))}((t=>{let{inputRef:s,...i}=t;return e.createElement("input",{...i,ref:s})})),X=e.forwardRef(((t,s)=>e.createElement(Z,{...t,ref:s}))),G=({gateway:t,cpf:s,processProps:i})=>{const a=(0,n.__)("CPF do Comprador","vindi-pagamentos"),[r,u]=(0,e.useState)(s),[o,l]=(0,e.useState)(!1);return(0,e.useEffect)((()=>{const e=document.querySelector("#vindi-pagamentos__billing_persontype");e&&2==e.value?l(!0):l(!1)}),[l]),(0,e.useEffect)((()=>{i({gateway:t,cpf:r})}),[t,r,s,i]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-document "+(o?"":"vindi-pagamentos-document-hidden")},(0,e.createElement)("label",{htmlFor:`document-${t}`},a,(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(X,{mask:"000.000.000-00",type:"text","aria-label":a,id:`document-${t}`,value:r,onAccept:(e,t)=>u(e),className:"wc-vindi-customer-document wvp-block-field"}))))},W="vindi-pagamentos-credit",J=(0,a.getSetting)(`${W}_data`,{}),Q=(0,n.__)("Cartão de Crédito","vindi-pagamentos"),ee=(0,i.decodeEntities)(J.title)||Q,te=(0,i.decodeEntities)(J.sandbox||""),se=(0,i.decodeEntities)(J.description||""),ie=(0,i.decodeEntities)(J.gateway||""),ae=(0,i.decodeEntities)(J.showCpf||!1),ne=(0,i.decodeEntities)(J.price||""),re=(0,i.decodeEntities)(J.brand||""),ue=(0,i.decodeEntities)(J.nonceCheckout||""),oe=(0,i.decodeEntities)(J.nonce||""),le=t=>{const{eventRegistration:s,emitResponse:a}=t,{onPaymentProcessing:u}=s,[o,l]=(0,e.useState)(""),[h,p]=(0,e.useState)(""),[d,c]=(0,e.useState)(""),[m,g]=(0,e.useState)(""),[k,f]=(0,e.useState)("1"),[v,_]=(0,e.useState)({}),[E,C]=(0,e.useState)(""),[A,y]=(0,e.useState)(!1),[F,x]=(0,e.useState)(0),[w,b]=(0,e.useState)("mono/generic"),[S,B]=(0,e.useState)("");(0,e.useEffect)((()=>{0!==F&&V()}),[F]),(0,e.useEffect)((()=>{const e=u((async()=>({type:a.responseTypes.SUCCESS,meta:{paymentMethodData:{"wvp-owner":h.toUpperCase(),"wvp-number":o,"wvp-date":d,"wvp-code":m,"wvp-installments":k,"wvp-brand":F.toString(),"wc-vindi-customer-document":S,"vindi-pagamento_nonce":ue}}})));return()=>{e()}}),[a.responseTypes.ERROR,a.responseTypes.SUCCESS,u,h,o,m,d,k,F,S]);const D=(e,t=0)=>{b(e),t&&t!=F&&x(t)},V=()=>{C(),y(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({brand:F,price:parseFloat(ne).toFixed(2),_wpnonce:oe}),success:e=>{e.success&&(_(e.data.installments),C(e.data.message))},error:e=>{C(e.data.message)},complete:()=>{y(!1)}})};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(r,{sandbox:te,description:se}),(0,e.createElement)("div",{className:"wvp-credit-fields "+(A?"wvp-request-loader":"")},(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-owner"},(0,n.__)("Dono do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(X,{mask:/^[A-Za-z\s]*$/,type:"text",id:"wvp-card-owner",className:"wvp-block-field",value:h,onChange:e=>p(e.target.value)}))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-number"},(0,n.__)("Número do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:"wvp-brand-icon",src:`${re}/${w}.svg`,"data-img":w,alt:"Credit card brand"}),(0,e.createElement)(X,{mask:"0000 0000 0000 0000",type:"text",id:"wvp-card-number",className:"wvp-block-field",value:o,placeholder:"0000 0000 0000 0000",onAccept:(e,t)=>(e=>{const t=e.replace(/\s/g,""),s=[{code:16,name:"elo",regex:/^4011(78|79)|^43(1274|8935)|^45(1416|7393|763(1|2))|^50(4175|6699|67[0-6][0-9]|677[0-8]|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9])|^627780|^63(6297|6368|6369)|^65(0(0(3([1-3]|[5-9])|4([0-9])|5[0-1])|4(0[5-9]|[1-3][0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8]|4[1-9]|[5-8][0-9]|9[0-8])|7(0[0-9]|1[0-8]|2[0-7])|9(0[1-9]|[1-6][0-9]|7[0-8]))|16(5[2-9]|[6-7][0-9])|50(0[0-9]|1[0-9]|2[1-9]|[3-4][0-9]|5[0-8]))/},{code:3,name:"visa",regex:/^4/},{code:4,name:"mastercard",regex:/^5[1-5][0-9]{14}$|^2[2-7][0-9]{14}$/},{code:5,name:"amex",regex:/^3[47]/},{code:25,name:"hipercard",regex:/^(606282|3841)\d{10,15}$/},{code:20,name:"hiper",regex:/^(38|60|637095)\d{14}$/}];let i;l(t),s.forEach((s=>{s.regex.test(t)&&!i&&e.length>14&&t&&(i=s,C(""),D(s.name,s.code))})),i||(D("mono/generic",1),_({}),C((0,n.__)("Não foi possível acessar os dados de parcelamento para esta bandeira de cartão.","vindi-pagamentos")))})(e)}))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-split"},(0,e.createElement)("div",null,(0,e.createElement)("label",{htmlFor:"wvp-card-date"},(0,n.__)("Data de expiração","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(X,{mask:"00/00",type:"text",id:"wvp-card-date",className:"wvp-block-field",value:d,placeholder:"MM/YY",onAccept:(e,t)=>c(e)}))),(0,e.createElement)("div",null,(0,e.createElement)("label",{htmlFor:"wvp-card-code"},(0,n.__)("Código do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:"wvp-cvv-icon",src:(0,i.decodeEntities)(J.codeBrand||""),"data-img":"mono/cvv",alt:"Credit card CVV"}),(0,e.createElement)(X,{mask:"0000",type:"text",id:"wvp-card-code",className:"wvp-block-field",value:m,placeholder:"CVV",onAccept:(e,t)=>g(e)})))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-installments"},(0,n.__)("Parcelas","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)("select",{id:"wvp-card-installments",value:k,onChange:e=>f(e.target.value)},Object.keys(v).map((t=>(0,e.createElement)("option",{key:t,value:t},v[t])))),(0,e.createElement)("div",{id:"wvp-installments-error",className:E?"active":""},E&&(0,e.createElement)("span",null,E)))),(0,e.createElement)("div",null,(0,e.createElement)("input",{type:"hidden",id:"wvp-card-brand",value:F}),(0,e.createElement)("input",{type:"hidden",name:"_wpnonce",id:"wvp-card-nonce",value:oe}),(0,e.createElement)("input",{type:"hidden",id:"wvp-cart-total",name:"wvp-cart-total",value:ne}))),ae&&(0,e.createElement)(G,{gateway:ie,cpf:S,processProps:e=>{B(e.cpf)}}))},he=()=>{const t=(0,i.decodeEntities)(J.icon||"");return t?(0,e.createElement)("img",{src:t,style:{float:"right",marginRight:"20px"}}):""},pe={savedTokenComponent:(0,e.createElement)((t=>{const{eventRegistration:s,emitResponse:a,token:u}=t,{onPaymentProcessing:o}=s,[l,h]=(0,e.useState)(""),[p,d]=(0,e.useState)("1"),[c,m]=(0,e.useState)({}),[g,k]=(0,e.useState)(""),[f,v]=(0,e.useState)(""),[_,E]=(0,e.useState)(!1);(0,e.useEffect)((()=>{C()}),[u]);const C=()=>{k(),E(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({token:u,price:ne,_wpnonce:oe}),success:e=>{e.success?(m(e.data.installments),k(e.data.message),console.log(e.data.message)):(k(e.data.message),m({}))},error:e=>{m({}),k(e.data.message)},complete:()=>{E(!1)}})};return(0,e.useEffect)((()=>{const e=o((async()=>({type:a.responseTypes.SUCCESS,meta:{paymentMethodData:{[`wc-${W}-payment-token`]:u,"wvp-code":l,"wvp-installments":p,"wc-vindi-customer-document":f,"vindi-pagamento_nonce":ue}}})));return()=>{e()}}),[a.responseTypes.SUCCESS,o,l,p,f]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(r,{sandbox:te,description:se}),(0,e.createElement)("div",{className:"wvp-credit-fields "+(_?"wvp-request-loader":"")},(0,e.createElement)("div",{className:"wvp-credit-field"},(0,e.createElement)("label",{htmlFor:"wvp-card-code"},(0,n.__)("Código do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:"wvp-cvv-icon",src:(0,i.decodeEntities)(J.codeBrand||""),"data-img":"mono/cvv",alt:"Credit card CVV"}),(0,e.createElement)(X,{mask:"0000",type:"text",id:"wvp-card-code",className:"wvp-block-field",value:l,placeholder:"CVV",onAccept:e=>h(e)}))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-installments"},(0,n.__)("Parcelas","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)("select",{id:"wvp-card-installments",value:p,onChange:e=>d(e.target.value)},Object.keys(c).map((t=>(0,e.createElement)("option",{key:t,value:t},c[t])))),(0,e.createElement)("div",{id:"wvp-installments-error",className:g?"active":""},g&&(0,e.createElement)("span",null,g))))),ae&&(0,e.createElement)(G,{gateway:ie,cpf:f,processProps:e=>{v(e.cpf)}}))}),null),name:W,label:(0,e.createElement)((t=>(0,e.createElement)("span",{style:{width:"100%"}},ee,(0,e.createElement)(he,null))),null),content:(0,e.createElement)(le,null),edit:(0,e.createElement)(le,null),canMakePayment:()=>!0,ariaLabel:ee,supports:{features:J.supports,showSaveOption:!0}};(0,t.registerPaymentMethod)(pe)})()})();1 (()=>{var e={703:(e,t,s)=>{"use strict";var i=s(414);function a(){}function n(){}n.resetWarningCache=a,e.exports=function(){function e(e,t,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 t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:a};return s.PropTypes=s,s}},697:(e,t,s)=>{e.exports=s(703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function s(i){var a=t[i];if(void 0!==a)return a.exports;var n=t[i]={exports:{}};return e[i](n,n.exports,s),n.exports}(()=>{"use strict";const e=window.React,t=window.wc.wcBlocksRegistry,i=window.wp.htmlEntities,a=window.wc.wcSettings,n=window.wp.i18n,r=window.wp.data,u=window.wc.wcBlocksData;function o(t){const{sandbox:s,description:i}=t;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-description"},(0,e.createElement)("span",null,i),s&&(0,e.createElement)("div",{style:{lineHeight:1}},(0,e.createElement)("span",{style:{opacity:"80%",fontSize:"14px",fontStyle:"italic"}},s))))}function l(e){return"string"==typeof e||e instanceof String}function h(e){var t;return"object"==typeof e&&null!=e&&"Object"===(null==e||null==(t=e.constructor)?void 0:t.name)}function p(e,t){return Array.isArray(t)?p(e,((e,s)=>t.includes(s))):Object.entries(e).reduce(((e,s)=>{let[i,a]=s;return t(a,i)&&(e[i]=a),e}),{})}const d="NONE",c="LEFT",m="FORCE_LEFT",g="RIGHT",k="FORCE_RIGHT";function f(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function v(e,t){if(t===e)return!0;const s=Array.isArray(t),i=Array.isArray(e);let a;if(s&&i){if(t.length!=e.length)return!1;for(a=0;a<t.length;a++)if(!v(t[a],e[a]))return!1;return!0}if(s!=i)return!1;if(t&&e&&"object"==typeof t&&"object"==typeof e){const s=t instanceof Date,i=e instanceof Date;if(s&&i)return t.getTime()==e.getTime();if(s!=i)return!1;const n=t instanceof RegExp,r=e instanceof RegExp;if(n&&r)return t.toString()==e.toString();if(n!=r)return!1;const u=Object.keys(t);for(a=0;a<u.length;a++)if(!Object.prototype.hasOwnProperty.call(e,u[a]))return!1;for(a=0;a<u.length;a++)if(!v(e[u[a]],t[u[a]]))return!1;return!0}return!(!t||!e||"function"!=typeof t||"function"!=typeof e)&&t.toString()===e.toString()}class _{constructor(e){for(Object.assign(this,e);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?d:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?c:g}}function E(e,t){return new E.InputMask(e,t)}function C(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?E.MaskedRegExp:l(e)?E.MaskedPattern:e===Date?E.MaskedDate:e===Number?E.MaskedNumber:Array.isArray(e)||e===Array?E.MaskedDynamic:E.Masked&&e.prototype instanceof E.Masked?e:E.Masked&&e instanceof E.Masked?e.constructor:e instanceof Function?E.MaskedFunction:(console.warn("Mask not found for mask",e),E.Masked)}function A(e){if(!e)throw new Error("Options in not defined");if(E.Masked){if(e.prototype instanceof E.Masked)return{mask:e};const{mask:t,...s}=e instanceof E.Masked?{mask:e}:h(e)&&e.mask instanceof E.Masked?e:{};if(t){const e=t.mask;return{...p(t,((e,t)=>!t.startsWith("_"))),mask:t.constructor,_mask:e,...s}}}return h(e)?{...e}:{mask:e}}function F(e){if(E.Masked&&e instanceof E.Masked)return e;const t=A(e),s=C(t.mask);if(!s)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}E.createMask=F;class y{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return null!=e?e:this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return null!=e?e:this.value.length}select(e,t){if(null!=e&&null!=t&&(e!==this.selectionStart||t!==this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}E.MaskElement=y;class w extends y{constructor(e){super(),this.input=e,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 e,t,s;return null!=(e=null==(t=(s=this.input).getRootNode)?void 0:t.call(s))?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){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",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){return this._handlers.redo&&(90===e.keyCode&&e.shiftKey&&(e.metaKey||e.ctrlKey)||89===e.keyCode&&e.ctrlKey)?(e.preventDefault(),this._handlers.redo(e)):this._handlers.undo&&90===e.keyCode&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),this._handlers.undo(e)):void(e.isComposing||this._handlers.selectionChange(e))}_onBeforeinput(e){return"historyUndo"===e.inputType&&this._handlers.undo?(e.preventDefault(),this._handlers.undo(e)):"historyRedo"===e.inputType&&this._handlers.redo?(e.preventDefault(),this._handlers.redo(e)):void 0}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}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={}}}E.HTMLMaskElement=w;class x extends w{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}E.HTMLMaskElement=w;class S extends w{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,i=t&&t.focusOffset;return null==i||null==s||s<i?s:i}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,i=t&&t.focusOffset;return null==i||null==s||s>i?s:i}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}E.HTMLContenteditableMaskElement=S;class b{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>b.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,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}}b.MAX_LENGTH=100,E.InputMask=class{constructor(e,t){this.el=e instanceof y?e:e.isContentEditable&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?new S(e):new x(e),this.masked=F(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new b,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(e){var t;return null==e||(null==(t=this.masked)?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof E.Masked)&&this.masked.constructor===C(e))return void this.masked.updateOptions({mask:e});const t=e instanceof E.Masked?e:F({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,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(e,t){const s=this._listeners[e];s&&s.forEach((e=>e(t)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el&&this.el.isActive&&(this.el.select(e,e),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(e){const t=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,n=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=t,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),"auto"===e?this.alignCursor():null!=e&&(this.cursorPos=e),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,i=!this.maskEquals(t),a=this.masked.optionsIsChanged(s);i&&(this.mask=t),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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,c))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new _({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,a=s===this.masked.rawInputValue?t.removeDirection:d;let n=this.masked.nearestInputPos(t.startChangePos+i,a);a!==d&&(n=this.masked.nearestInputPos(n,d)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};class B{static normalize(e){return Array.isArray(e)?e:[e,new B]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}E.ChangeDetails=B;class D{constructor(e,t,s){void 0===e&&(e=""),void 0===t&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||null!=e&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class V{constructor(e){this._value="",this._update({...V.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){void 0===t&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new D(this.extractInput(e,t),e)}appendTail(e){return l(e)&&(e=new D(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new B({inserted:e,rawInserted:e})):new B}_appendChar(e,t,s){void 0===t&&(t={});const i=this.state;let a;if([e,a]=this.doPrepareChar(e,t),e&&(a=a.aggregate(this._appendCharRaw(e,t)),!a.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=i;let n=this.pad(t);const r=this._appendCharRaw(e,t);n=n.aggregate(r),r.rawInserted||n.equals(a)?a=n:this.state=s}if(a.inserted){let e,n=!1!==this.doValidate(t);if(n&&null!=s){const t=this.state;if(!0===this.overwrite){e=s.state;for(let e=0;e<a.rawInserted.length;++e)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=t,e=s.state;for(let e=0;e<a.rawInserted.length;++e)s.shift();i=this.appendTail(s),n=i.rawInserted.length===s.toString().length}n&&i.inserted&&(this.state=t)}n||(a=new B,this.state=i,s&&e&&(s.state=e))}return a}_appendPlaceholder(){return new B}_appendEager(){return new B}append(e,t,s){if(!l(e))throw new Error("value should be string");const i=l(s)?new D(String(s)):s;let a;null!=t&&t.tail&&(t._beforeTailState=this.state),[e,a]=this.doPrepare(e,t);for(let s=0;s<e.length;++s){const n=this._appendChar(e[s],t,i);if(!n.rawInserted&&!this.doSkipInvalid(e[s],t,i))break;a.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=t&&t.input&&e&&a.aggregate(this._appendEager()),null!=i&&(a.tailShift+=this.appendTail(i).tailShift),a}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new B}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,i=e();return this.rawInputValue=t,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return Boolean(this.skipInvalid)}doPrepare(e,t){return void 0===t&&(t={}),B.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return void 0===t&&(t={}),B.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,i,a){void 0===s&&(s=""),void 0===i&&(i=d),void 0===a&&(a={input:!0});const n=e+t,r=this.extractTail(n),u=!0===this.eager||"remove"===this.eager;let o;u&&(i=function(e){switch(e){case c:return m;case g:return k;default:return e}}(i),o=this.extractInput(0,n,{raw:!0}));let l=e;const h=new B;if(i!==d&&(l=this.nearestInputPos(e,t>1&&0!==e&&!u?d:i),h.tailShift=l-e),h.aggregate(this.remove(l)),u&&i!==d&&o===this.rawInputValue)if(i===m){let e;for(;o===this.rawInputValue&&(e=this.displayValue.length);)h.aggregate(new B({tailShift:-1})).aggregate(this.remove(e-1))}else i===k&&r.unshift();return h.aggregate(this.append(s,a,r))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!v(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||V.EMPTY_VALUES.includes(e)&&V.EMPTY_VALUES.includes(t)||!!this.format&&this.format(e,this)===this.format(this.typedValue,this)}pad(e){return new B}}V.DEFAULTS={skipInvalid:!0},V.EMPTY_VALUES=[void 0,null,""],E.Masked=V;class M{constructor(e,t){void 0===e&&(e=[]),void 0===t&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=l(e)?new D(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||null==e.stop)&&e.from===t.from+t.toString().length;if(e instanceof D)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof M){if(null==e.stop){let t;for(;e.chunks.length&&null==e.chunks[0].stop;)t=e.chunks.shift(),t.from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof E.MaskedPattern))return new D(this.toString()).appendTo(e);const t=new B;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=e._mapPosToBlock(e.displayValue.length),n=i.stop;let r;if(null!=n&&(!a||a.index<=n)&&((i instanceof M||e._stops.indexOf(n)>=0)&&t.aggregate(e._appendPlaceholder(n)),r=i instanceof M&&e._blocks[n]),r){const s=r.appendTail(i);t.aggregate(s);const a=i.toString().slice(s.rawInserted.length);a&&t.aggregate(e.append(a,{tail:!0}))}else t.aggregate(e.append(i.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map((e=>e.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map((e=>{const t="chunks"in e?new M:new D;return t.state=e,t}))}unshift(e){if(!this.chunks.length||null!=e&&this.from>=e)return"";const t=null!=e?e-this.from:e;let s=0;for(;s<this.chunks.length;){const e=this.chunks[s],i=e.unshift(t);if(e.toString()){if(!i)break;++s}else this.chunks.splice(s,1);if(i)return i}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class I{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:i}=e._mapPosToBlock(t)||(t<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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}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(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(t=this.block)?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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,m),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,c),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,c),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,k),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,d),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,d),!0}))}}class T{constructor(e){Object.assign(this,e),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(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new B}nearestInputPos(e,t){void 0===t&&(t=d);const s=this._value.length;switch(t){case c:case m:return 0;default:return s}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new B;const s=!0===this.eager||"append"===this.eager,i=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,a=new B({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(t.raw||t.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new B;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new D("")}appendTail(e){return l(e)&&(e=new D(String(e))),e.appendTo(this)}append(e,t,s){const i=this._appendChar(e[0],t);return null!=s&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=Boolean(e._rawInputValue)}pad(e){return this._appendPlaceholder()}}class R{constructor(e){const{parent:t,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r,...u}=e;this.masked=F(u),Object.assign(this,{parent:t,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),0===e&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new B}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(e,t){if(void 0===t&&(t={}),this.isFilled)return new B;const s=this.masked.state;let i=this.masked._appendChar(e,this.currentMaskFlags(t));return i.inserted&&!1===this.doValidate(t)&&(i=new B,this.masked.state=s),i.inserted||this.isOptional||this.lazy||t.input||(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=Boolean(i.inserted),i}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new B:(this.isFilled=!0,new B({inserted:this.placeholderChar}))}_appendEager(){return new B}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){void 0===t&&(t=d);const s=this.value.length,i=Math.min(Math.max(e,0),s);switch(t){case c:case m:return this.isComplete?i:0;case g:case k:return this.isComplete?i:s;default:return i}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(null==e||null==(t=e._beforeTailState)?void 0:t.masked)||(null==e?void 0:e._beforeTailState)}}pad(e){return new B}}R.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]/,"*":/./},E.MaskedRegExp=class extends V{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=e=>e.search(t)>=0),super._update(e)}};class P extends V{constructor(e){super({...P.DEFAULTS,...e,definitions:Object.assign({},R.DEFAULT_DEFINITIONS,null==e?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,i=!1;for(let a=0;a<t.length;++a){if(this.blocks){const e=t.slice(a),s=Object.keys(this.blocks).filter((t=>0===e.indexOf(t)));s.sort(((e,t)=>t.length-e.length));const i=s[0];if(i){const{expose:e,repeat:t,...s}=A(this.blocks[i]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:t,parent:this},r=null!=t?new E.RepeatBlock(n):F(n);r&&(this._blocks.push(r),e&&(this.exposeBlock=r),this._maskedBlocks[i]||(this._maskedBlocks[i]=[]),this._maskedBlocks[i].push(this._blocks.length-1)),a+=i.length-1;continue}}let n=t[a],r=n in e;if(n===P.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){i=!i;continue}if(n===P.ESCAPE_CHAR){if(++a,n=t[a],!n)break;r=!1}const u=r?new R({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...A(e[n]),parent:this}):new T({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map((e=>e.state))}}set state(e){if(!e)return void this.reset();const{_blocks:t,...s}=e;this._blocks.forEach(((e,s)=>e.state=t[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((e=>e.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((e=>e.isComplete))}get isFilled(){return this._blocks.every((e=>e.isFilled))}get isFixed(){return this._blocks.every((e=>e.isFixed))}get isOptional(){return this._blocks.every((e=>e.isOptional))}doCommit(){this._blocks.forEach((e=>e.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((e,t)=>e+t.unmaskedValue),"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((e,t)=>e+t.value),"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce(((e,t)=>e+t.displayValue),"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new B;let s=null==(e=this._mapPosToBlock(this.displayValue.length))?void 0:e.index;if(null==s)return t;this._blocks[s].isFilled&&++s;for(let e=s;e<this._blocks.length;++e){const s=this._blocks[e]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._mapPosToBlock(this.displayValue.length),i=new B;if(!s)return i;for(let n,r=s.index;n=this._blocks[r];++r){var a;const s=n._appendChar(e,{...t,_beforeTailState:null==(a=t._beforeTailState)||null==(a=a._blocks)?void 0:a[r]});if(i.aggregate(s),s.consumed)break}return i}extractTail(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=new M;return e===t||this._forEachBlocksInRange(e,t,((e,t,i,a)=>{const n=e.extractTail(i,a);n.stop=this._findStopBefore(t),n.from=this._blockStartPos(t),n instanceof M&&(n.blockIndex=t),s.extend(n)})),s}extractInput(e,t,s){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),void 0===s&&(s={}),e===t)return"";let i="";return this._forEachBlocksInRange(e,t,((e,t,a,n)=>{i+=e.extractInput(a,n,s)})),i}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(!(i<=e))break;t=i}return t}_appendPlaceholder(e){const t=new B;if(this.lazy&&null==e)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const i=s.index,a=null!=e?e:this._blocks.length;return this._blocks.slice(i,a).forEach((s=>{var i;s.lazy&&null==e||t.aggregate(s._appendPlaceholder(null==(i=s._blocks)?void 0:i.length))})),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=t.length;if(t+=i.displayValue,e<=t.length)return{index:s,offset:e-a}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce(((e,t)=>e+t.displayValue.length),0)}_forEachBlocksInRange(e,t,s){void 0===t&&(t=this.displayValue.length);const i=this._mapPosToBlock(e);if(i){const e=this._mapPosToBlock(t),a=e&&i.index===e.index,n=i.offset,r=e&&a?e.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,n,r),e&&!a){for(let t=i.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].displayValue.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,((e,t,i,a)=>{s.aggregate(e.remove(i,a))})),s}nearestInputPos(e,t){if(void 0===t&&(t=d),!this._blocks.length)return 0;const s=new I(this,e);if(t===d)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(t===c||t===m){if(t===c){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===c){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e)return s.pos;if(s.popState(),s.ok&&s.pos<=e)return s.pos;s.popState()}return s.ok?s.pos:t===m?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return t===g||t===k?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===k?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(e,c)))):e}totalInputPositions(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,((e,t,i,a)=>{s+=e.totalInputPositions(i,a)})),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map((e=>this._blocks[e])):[]}pad(e){const t=new B;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>t.aggregate(s.pad(e)))),t}}P.DEFAULTS={...V.DEFAULTS,lazy:!0,placeholderChar:"_"},P.STOP_CHAR="`",P.ESCAPE_CHAR="\\",P.InputDefinition=R,P.FixedDefinition=T,E.MaskedPattern=P;class O extends P{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...n}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).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(e){let t="",s="";const[,i,a]=e.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(t="0".repeat(i.length)+a,s="9".repeat(i.length)+a),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){let s;return void 0===t&&(t={}),[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(void 0===t&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,n]=this.boundaries(this.value+e);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],t):Number(a)>this.to?!t.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(i[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;const[s,i]=this.boundaries(t);return this.from<=Number(i)&&Number(s)<=this.to&&super.doValidate(e)}pad(e){const t=new B;if(this.value.length===this.maxLength)return t;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let s=0;s<i;++s)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach((e=>this._appendCharRaw(e)))}return t}}E.MaskedRange=O;class L extends P{static extractPatternOptions(e){const{mask:t,pattern:s,...i}=e;return{...i,mask:l(t)?t:s}}constructor(e){super(L.extractPatternOptions({...L.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:i,...a}={...L.DEFAULTS,...e},n=Object.assign({},L.GET_DEFAULT_BLOCKS());e.min&&(n.Y.from=e.min.getFullYear()),e.max&&(n.Y.to=e.max.getFullYear()),e.min&&e.max&&n.Y.from===n.Y.to&&(n.m.from=e.min.getMonth()+1,n.m.to=e.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=e.min.getDate(),n.d.to=e.max.getDate())),Object.assign(n,this.blocks,i),super._update({...a,mask:l(t)?t:s,blocks:n})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(L.extractPatternOptions(e))}}L.GET_DEFAULT_BLOCKS=()=>({d:{mask:O,from:1,to:31,maxLength:2},m:{mask:O,from:1,to:12,maxLength:2},Y:{mask:O,from:1900,to:9999}}),L.DEFAULTS={...P.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(e,t)=>e?[String(e.getDate()).padStart(2,"0"),String(e.getMonth()+1).padStart(2,"0"),e.getFullYear()].join("."):"",parse:(e,t)=>{const[s,i,a]=e.split(".").map(Number);return new Date(a,i-1,s)}},E.MaskedDate=L;class N extends V{constructor(e){super({...N.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map((e=>{const{expose:t,...s}=A(e),i=F({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return t&&(this.exposeMask=i),i})):[])}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){void 0===e&&(e=""),void 0===t&&(t={}),void 0===s&&(s="");const i=t.tail&&null!=t._beforeTailState?t._beforeTailState._value:this.value,a=this.rawInputValue,n=t.tail&&null!=t._beforeTailState?t._beforeTailState._rawInputValue:a,r=a.slice(n.length),u=this.currentMask,o=new B,l=null==u?void 0:u.state;return this.currentMask=this.doDispatch(e,{...t},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)):l&&(this.currentMask.state=l)),o}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new B;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:(null==(t=e._beforeTailState)?void 0:t.currentMaskRef)===this.currentMask&&(null==(s=e._beforeTailState)?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return void 0===t&&(t={}),void 0===s&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){void 0===t&&(t={});let[s,i]=super.doPrepare(e,t);if(this.currentMask){let e;[s,e]=super.doPrepare(s,this.currentMaskFlags(t)),i=i.aggregate(e)}return[s,i]}doPrepareChar(e,t){void 0===t&&(t={});let[s,i]=super.doPrepareChar(e,t);if(this.currentMask){let e;[s,e]=super.doPrepareChar(s,this.currentMaskFlags(t)),i=i.aggregate(e)}return[s,i]}reset(){var e;null==(e=this.currentMask)||e.reset(),this.compiledMasks.forEach((e=>e.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask)return this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,void this._applyDispatch();let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isComplete)}get isFilled(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isFilled)}remove(e,t){const s=new B;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((e=>e.state)),currentMaskRef:this.currentMask,currentMask:null==(e=this.currentMask)?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:i,...a}=e;t&&this.compiledMasks.forEach(((e,s)=>e.state=t[s])),null!=s&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every(((t,s)=>{if(!e[s])return;const{mask:i,...a}=e[s];return v(t,a)&&t.maskEquals(i)})):super.maskEquals(e)}typedValueEquals(e){var t;return Boolean(null==(t=this.currentMask)?void 0:t.typedValueEquals(e))}}N.DEFAULTS={...V.DEFAULTS,dispatch:(e,t,s,i)=>{if(!t.compiledMasks.length)return;const a=t.rawInputValue,n=t.compiledMasks.map(((n,r)=>{const u=t.currentMask===n,o=u?n.displayValue.length:n.nearestInputPos(n.displayValue.length,m);return n.rawInputValue!==a?(n.reset(),n.append(a,{raw:!0})):u||n.remove(o),n.append(e,t.currentMaskFlags(s)),n.appendTail(i),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,m)))}}));return n.sort(((e,t)=>t.weight-e.weight||t.totalInputPositions-e.totalInputPositions)),t.compiledMasks[n[0].index]}},E.MaskedDynamic=N;class U extends P{constructor(e){super({...U.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const e=t.map((e=>e.length)),i=Math.min(...e),a=Math.max(...e)-i;s.mask="*".repeat(i),a&&(s.mask+="["+"*".repeat(a)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){void 0===t&&(t={});const s=Math.min(this.nearestInputPos(0,k),this.value.length),i=this.enum.filter((t=>this.matchValue(t,this.unmaskedValue+e,s)));if(i.length){1===i.length&&this._forEachBlocksInRange(0,this.value.length,((e,s)=>{const a=i[0][s];s>=this.value.length||a===e.value||(e.reset(),e._appendChar(a,t))}));const e=super._appendCharRaw(i[0][this.value.length],t);return 1===i.length&&i[0].slice(this.unmaskedValue.length).split("").forEach((t=>e.aggregate(super._appendCharRaw(t)))),e}return new B({skip:!this.isComplete})}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new D("",e)}remove(e,t){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),e===t)return new B;const s=Math.min(super.nearestInputPos(0,k),this.value.length);let i;for(i=e;i>=0&&!(this.enum.filter((e=>this.matchValue(e,this.value.slice(s,i),s))).length>1);--i);const a=super.remove(i,t);return a.tailShift+=i-e,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}var j;U.DEFAULTS={...P.DEFAULTS,matchValue:(e,t,s)=>e.indexOf(t,s)===s},E.MaskedEnum=U,E.MaskedFunction=class extends V{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}};class z extends V{constructor(e){super({...z.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t=(this.scale?"("+f(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+"\\d*"+t),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(f).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(f(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){void 0===t&&(t={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(i.skip=!0),!s||this.allowPositive||this.value||"-"===s||i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(e,t){void 0===t&&(t=!1);let s=0;for(let i=0;i<e;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return void 0===e&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){void 0===t&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=e;const n=this.number;let r,u=!isNaN(n),o=!1;if(u){let e;null!=this.min&&this.min<0&&this.number<this.min&&(e=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(e=this.max),null!=e&&(this.autofix?(this._value=this.format(e,this).replace(z.UNMASKED_RADIX,this.radix),o||(o=a===this._value&&!t.tail)):u=!1),u&&(u=Boolean(this._value.match(this._numberRegExp)))}u?r=new B({inserted:this._value.slice(a.length),rawInserted:o?"":e,skip:o}):(this._value=a,r=new B),this._value=this._insertThousandsSeparators(this._value);const l=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(l);return r.tailShift+=(h-i)*this.thousandsSeparator.length,r}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const i=this._findSeparatorAround(t);return i>=0&&(t=i+this.thousandsSeparator.length),[e,t]}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),i=this.value.slice(t),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const n=this._separatorsCountFromSlice(s);return new B({tailShift:(n-a)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case d:case c:case m:{const s=this._findSeparatorAround(e-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(e<i||this.value.length<=i||t===m)return s}break}case g:case k:{const t=this._findSeparatorAround(e);if(t>=0)return t+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,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(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,((e,t,s,i)=>t+i)),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){void 0===t&&(t={});const i=0===this.scale&&e!==this.thousandsSeparator&&(e===this.radix||e===z.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,z.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(z.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}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(e){return(super.typedValueEquals(e)||z.EMPTY_VALUES.includes(e)&&z.EMPTY_VALUES.includes(this.typedValue))&&!(0===e&&""===this.value)}}j=z,z.UNMASKED_RADIX=".",z.EMPTY_VALUES=[...V.EMPTY_VALUES,0],z.DEFAULTS={...V.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[j.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},E.MaskedNumber=z;const q={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function K(e,t,s){void 0===t&&(t=q.MASKED),void 0===s&&(s=q.MASKED);const i=F(e);return e=>i.runIsolated((i=>(i[t]=e,i[s])))}E.PIPE_TYPE=q,E.createPipe=K,E.pipe=function(e,t,s,i){return K(t,s,i)(e)},E.RepeatBlock=class extends P{get repeatFrom(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?e:0}get repeatTo(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,i;const{repeat:a,...n}=A(e);this._blockOpts=Object.assign({},this._blockOpts,n);const r=F(this._blockOpts);this.repeat=null!=(t=null!=(s=null!=a?a:r.repeat)?s:this.repeat)?t: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(e){return e<this._blocks.length?this._blocks[e]: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(e,t){void 0===t&&(t={});const s=new B;for(let u,o,l=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[l])?n:o=!o&&this._allocateBlock(l);++l){var i,a,n,r;const h=u._appendChar(e,{...t,_beforeTailState:null==(r=t._beforeTailState)||null==(r=r._blocks)?void 0:r[l]});if(h.skip&&o){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(h),h.consumed)break}return s}_trimEmptyTail(e,t){var s,i;void 0===e&&(e=0);const a=Math.max((null==(s=this._mapPosToBlock(e))?void 0:s.index)||0,this.repeatFrom,0);let n;null!=t&&(n=null==(i=this._mapPosToBlock(t))?void 0:i.index),null==n&&(n=this._blocks.length-1);let r=0;for(let e=n;a<=e&&!this._blocks[e].unmaskedValue;--e,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return void 0===e&&(e=0),null==t&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}};try{globalThis.IMask=E}catch{}var Y=s(697);const H={mask:Y.oneOfType([Y.array,Y.func,Y.string,Y.instanceOf(RegExp),Y.oneOf([Date,Number,E.Masked]),Y.instanceOf(E.Masked)]),value:Y.any,unmask:Y.oneOfType([Y.bool,Y.oneOf(["typed"])]),prepare:Y.func,prepareChar:Y.func,validate:Y.func,commit:Y.func,overwrite:Y.oneOfType([Y.bool,Y.oneOf(["shift"])]),eager:Y.oneOfType([Y.bool,Y.oneOf(["append","remove"])]),skipInvalid:Y.bool,onAccept:Y.func,onComplete:Y.func,placeholderChar:Y.string,displayChar:Y.string,lazy:Y.bool,definitions:Y.object,blocks:Y.object,enum:Y.arrayOf(Y.string),maxLength:Y.number,from:Y.number,to:Y.number,pattern:Y.string,format:Y.func,parse:Y.func,autofix:Y.oneOfType([Y.bool,Y.oneOf(["pad"])]),radix:Y.string,thousandsSeparator:Y.string,mapToRadix:Y.arrayOf(Y.string),scale:Y.number,normalizeZeros:Y.bool,padFractionalZeros:Y.bool,min:Y.oneOfType([Y.number,Y.instanceOf(Date)]),max:Y.oneOfType([Y.number,Y.instanceOf(Date)]),dispatch:Y.func,inputRef:Y.oneOfType([Y.func,Y.shape({current:Y.object})])},$=Object.keys(H).filter((e=>"value"!==e)),Z=["value","unmask","onAccept","onComplete","inputRef"],X=$.filter((e=>Z.indexOf(e)<0)),G=function(t){var s;const i=((s=class extends e.Component{constructor(e){super(e),this._inputRef=this._inputRef.bind(this)}componentDidMount(){this.props.mask&&this.initMask()}componentDidUpdate(){const e=this.props,t=this._extractMaskOptionsFromProps(e);var s;t.mask?this.maskRef?(this.maskRef.updateOptions(t),"value"in e&&void 0!==e.value&&(this.maskValue=e.value)):this.initMask(t):(this.destroyMask(),"value"in e&&void 0!==e.value&&(null!=(s=this.element)&&s.isContentEditable&&"INPUT"!==this.element.tagName&&"TEXTAREA"!==this.element.tagName?this.element.textContent=e.value:this.element.value=e.value))}componentWillUnmount(){this.destroyMask()}_inputRef(e){this.element=e,this.props.inputRef&&(Object.prototype.hasOwnProperty.call(this.props.inputRef,"current")?this.props.inputRef.current=e:this.props.inputRef(e))}initMask(e){void 0===e&&(e=this._extractMaskOptionsFromProps(this.props)),this.maskRef=E(this.element,e).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(e){const{...t}=e;return Object.keys(t).filter((e=>X.indexOf(e)<0)).forEach((e=>{delete t[e]})),t}_extractNonMaskProps(e){const{...t}=e;return $.forEach((e=>{"maxLength"!==e&&delete t[e]})),"defaultValue"in t||(t.defaultValue=e.mask?"":t.value),delete t.value,t}get maskValue(){return this.maskRef?"typed"===this.props.unmask?this.maskRef.typedValue:this.props.unmask?this.maskRef.unmaskedValue:this.maskRef.value:""}set maskValue(e){this.maskRef&&(e=null==e&&"typed"!==this.props.unmask?"":e,"typed"===this.props.unmask?this.maskRef.typedValue=e:this.props.unmask?this.maskRef.unmaskedValue=e:this.maskRef.value=e)}_onAccept(e){this.props.onAccept&&this.maskRef&&this.props.onAccept(this.maskValue,this.maskRef,e)}_onComplete(e){this.props.onComplete&&this.maskRef&&this.props.onComplete(this.maskValue,this.maskRef,e)}render(){return e.createElement(t,{...this._extractNonMaskProps(this.props),inputRef:this._inputRef})}}).displayName=void 0,s.propTypes=void 0,s),a=t.displayName||t.name||"Component";return i.displayName="IMask("+a+")",i.propTypes=H,e.forwardRef(((t,s)=>e.createElement(i,{...t,ref:s})))}((t=>{let{inputRef:s,...i}=t;return e.createElement("input",{...i,ref:s})})),W=e.forwardRef(((t,s)=>e.createElement(G,{...t,ref:s}))),J=({gateway:t,cpf:s,processProps:i})=>{const a=(0,n.__)("CPF do Comprador","vindi-pagamentos"),[r,u]=(0,e.useState)(s),[o,l]=(0,e.useState)(!1);return(0,e.useEffect)((()=>{const e=document.querySelector("#vindi-pagamentos__billing_persontype");e&&2==e.value?l(!0):l(!1)}),[l]),(0,e.useEffect)((()=>{i({gateway:t,cpf:r})}),[t,r,s,i]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-document "+(o?"":"vindi-pagamentos-document-hidden")},(0,e.createElement)("label",{htmlFor:`document-${t}`},a,(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(W,{mask:"000.000.000-00",type:"text","aria-label":a,id:`document-${t}`,value:r,onAccept:(e,t)=>u(e),className:"wc-vindi-customer-document wvp-block-field"}))))},Q="vindi-pagamentos-credit",ee=(0,a.getSetting)(`${Q}_data`,{}),te=(0,n.__)("Cartão de Crédito","vindi-pagamentos"),se=(0,i.decodeEntities)(ee.title)||te,ie=(0,i.decodeEntities)(ee.sandbox||""),ae=(0,i.decodeEntities)(ee.description||""),ne=(0,i.decodeEntities)(ee.gateway||""),re=(0,i.decodeEntities)(ee.showCpf||!1),ue=(0,i.decodeEntities)(ee.price||""),oe=(0,i.decodeEntities)(ee.brand||""),le=(0,i.decodeEntities)(ee.nonceCheckout||""),he=(0,i.decodeEntities)(ee.nonce||""),pe=t=>{const{eventRegistration:s,emitResponse:a}=t,{onPaymentProcessing:l}=s,[h,p]=(0,e.useState)(""),[d,c]=(0,e.useState)(""),[m,g]=(0,e.useState)(""),[k,f]=(0,e.useState)(""),[v,_]=(0,e.useState)("1"),[E,C]=(0,e.useState)({}),[A,F]=(0,e.useState)(""),[y,w]=(0,e.useState)(!1),[x,S]=(0,e.useState)(0),[b,B]=(0,e.useState)("mono/generic"),[D,V]=(0,e.useState)(""),[M,I]=(0,e.useState)(ue),T=(0,r.useSelect)((e=>e(u.CART_STORE_KEY).getCartData()));(0,e.useEffect)((()=>{if(T?.totals?.total_price){const e=parseFloat(T.totals.total_price)/100;I(e.toString())}}),[T]),(0,e.useEffect)((()=>{0!==x&&P()}),[x]),(0,e.useEffect)((()=>{const e=l((async()=>({type:a.responseTypes.SUCCESS,meta:{paymentMethodData:{"wvp-owner":d.toUpperCase(),"wvp-number":h,"wvp-date":m,"wvp-code":k,"wvp-installments":v,"wvp-brand":x.toString(),"wc-vindi-customer-document":D,"vindi-pagamento_nonce":le}}})));return()=>{e()}}),[a.responseTypes.ERROR,a.responseTypes.SUCCESS,l,d,h,k,m,v,x,D]);const R=(e,t=0)=>{B(e),t&&t!=x&&S(t)},P=()=>{F(),w(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({brand:x,price:parseFloat(M).toFixed(2),_wpnonce:he}),success:e=>{e.success&&(C(e.data.installments),F(e.data.message))},error:e=>{F(e.data.message)},complete:()=>{w(!1)}})};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(o,{sandbox:ie,description:ae}),(0,e.createElement)("div",{className:"wvp-credit-fields "+(y?"wvp-request-loader":"")},(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-owner"},(0,n.__)("Dono do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(W,{mask:/^[A-Za-z\s]*$/,type:"text",id:"wvp-card-owner",className:"wvp-block-field",value:d,onChange:e=>c(e.target.value)}))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-number"},(0,n.__)("Número do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:"wvp-brand-icon",src:`${oe}/${b}.svg`,"data-img":b,alt:"Credit card brand"}),(0,e.createElement)(W,{mask:"0000 0000 0000 0000",type:"text",id:"wvp-card-number",className:"wvp-block-field",value:h,placeholder:"0000 0000 0000 0000",onAccept:(e,t)=>(e=>{const t=e.replace(/\s/g,""),s=[{code:16,name:"elo",regex:/^4011(78|79)|^43(1274|8935)|^45(1416|7393|763(1|2))|^50(4175|6699|67[0-6][0-9]|677[0-8]|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9])|^627780|^63(6297|6368|6369)|^65(0(0(3([1-3]|[5-9])|4([0-9])|5[0-1])|4(0[5-9]|[1-3][0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8]|4[1-9]|[5-8][0-9]|9[0-8])|7(0[0-9]|1[0-8]|2[0-7])|9(0[1-9]|[1-6][0-9]|7[0-8]))|16(5[2-9]|[6-7][0-9])|50(0[0-9]|1[0-9]|2[1-9]|[3-4][0-9]|5[0-8]))/},{code:3,name:"visa",regex:/^4/},{code:4,name:"mastercard",regex:/^5[1-5][0-9]{14}$|^2[2-7][0-9]{14}$/},{code:5,name:"amex",regex:/^3[47]/},{code:25,name:"hipercard",regex:/^(606282|3841)\d{10,15}$/},{code:20,name:"hiper",regex:/^(38|60|637095)\d{14}$/}];let i;p(t),s.forEach((s=>{s.regex.test(t)&&!i&&e.length>14&&t&&(i=s,F(""),R(s.name,s.code))})),i||(R("mono/generic",1),C({}),F((0,n.__)("Não foi possível acessar os dados de parcelamento para esta bandeira de cartão.","vindi-pagamentos")))})(e)}))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-split"},(0,e.createElement)("div",null,(0,e.createElement)("label",{htmlFor:"wvp-card-date"},(0,n.__)("Data de expiração","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(W,{mask:"00/00",type:"text",id:"wvp-card-date",className:"wvp-block-field",value:m,placeholder:"MM/YY",onAccept:(e,t)=>g(e)}))),(0,e.createElement)("div",null,(0,e.createElement)("label",{htmlFor:"wvp-card-code"},(0,n.__)("Código do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:"wvp-cvv-icon",src:(0,i.decodeEntities)(ee.codeBrand||""),"data-img":"mono/cvv",alt:"Credit card CVV"}),(0,e.createElement)(W,{mask:"0000",type:"text",id:"wvp-card-code",className:"wvp-block-field",value:k,placeholder:"CVV",onAccept:(e,t)=>f(e)})))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-installments"},(0,n.__)("Parcelas","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)("select",{id:"wvp-card-installments",value:v,onChange:e=>_(e.target.value)},Object.keys(E).map((t=>(0,e.createElement)("option",{key:t,value:t},E[t])))),(0,e.createElement)("div",{id:"wvp-installments-error",className:A?"active":""},A&&(0,e.createElement)("span",null,A)))),(0,e.createElement)("div",null,(0,e.createElement)("input",{type:"hidden",id:"wvp-card-brand",value:x}),(0,e.createElement)("input",{type:"hidden",name:"_wpnonce",id:"wvp-card-nonce",value:he}),(0,e.createElement)("input",{type:"hidden",id:"wvp-cart-total",name:"wvp-cart-total",value:ue}))),re&&(0,e.createElement)(J,{gateway:ne,cpf:D,processProps:e=>{V(e.cpf)}}))},de=()=>{const t=(0,i.decodeEntities)(ee.icon||"");return t?(0,e.createElement)("img",{src:t,style:{float:"right",marginRight:"20px"}}):""},ce={savedTokenComponent:(0,e.createElement)((t=>{const{eventRegistration:s,emitResponse:a,token:l}=t,{onPaymentProcessing:h}=s,[p,d]=(0,e.useState)(""),[c,m]=(0,e.useState)("1"),[g,k]=(0,e.useState)({}),[f,v]=(0,e.useState)(""),[_,E]=(0,e.useState)(""),[C,A]=(0,e.useState)(!1),[F,y]=(0,e.useState)(ue),w=(0,r.useSelect)((e=>e(u.CART_STORE_KEY).getCartData()));(0,e.useEffect)((()=>{if(w?.totals?.total_price){const e=parseFloat(w.totals.total_price)/100;y(e.toString())}}),[w]),(0,e.useEffect)((()=>{x()}),[l]);const x=()=>{v(),A(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({token:l,price:parseFloat(F).toFixed(2),_wpnonce:he}),success:e=>{e.success?(k(e.data.installments),v(e.data.message)):(v(e.data.message),k({}))},error:e=>{k({}),v(e.data.message)},complete:()=>{A(!1)}})};return(0,e.useEffect)((()=>{const e=h((async()=>({type:a.responseTypes.SUCCESS,meta:{paymentMethodData:{[`wc-${Q}-payment-token`]:l,"wvp-code":p,"wvp-installments":c,"wc-vindi-customer-document":_,"vindi-pagamento_nonce":le}}})));return()=>{e()}}),[a.responseTypes.SUCCESS,h,p,c,_]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(o,{sandbox:ie,description:ae}),(0,e.createElement)("div",{className:"wvp-credit-fields "+(C?"wvp-request-loader":"")},(0,e.createElement)("div",{className:"wvp-credit-field"},(0,e.createElement)("label",{htmlFor:"wvp-card-code"},(0,n.__)("Código do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:"wvp-cvv-icon",src:(0,i.decodeEntities)(ee.codeBrand||""),"data-img":"mono/cvv",alt:"Credit card CVV"}),(0,e.createElement)(W,{mask:"0000",type:"text",id:"wvp-card-code",className:"wvp-block-field",value:p,placeholder:"CVV",onAccept:e=>d(e)}))),(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:"wvp-card-installments"},(0,n.__)("Parcelas","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)("select",{id:"wvp-card-installments",value:c,onChange:e=>m(e.target.value)},Object.keys(g).map((t=>(0,e.createElement)("option",{key:t,value:t},g[t])))),(0,e.createElement)("div",{id:"wvp-installments-error",className:f?"active":""},f&&(0,e.createElement)("span",null,f))))),re&&(0,e.createElement)(J,{gateway:ne,cpf:_,processProps:e=>{E(e.cpf)}}))}),null),name:Q,label:(0,e.createElement)((t=>(0,e.createElement)("span",{style:{width:"100%"}},se,(0,e.createElement)(de,null))),null),content:(0,e.createElement)(pe,null),edit:(0,e.createElement)(pe,null),canMakePayment:()=>!0,ariaLabel:se,supports:{features:ee.supports,showSaveOption:!0}};(0,t.registerPaymentMethod)(ce)})()})(); -
vindi-pagamentos/trunk/dist/blocks/multi-payment/index.asset.php
r3345266 r3346589 1 <?php return array('dependencies' => array('react', 'wc-blocks- registry', 'wc-settings', 'wp-html-entities', 'wp-i18n'), 'version' => '45586d119537c385e510');1 <?php return array('dependencies' => array('react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wp-data', 'wp-html-entities', 'wp-i18n'), 'version' => 'd6ce5a3225e446b42c9a'); -
vindi-pagamentos/trunk/dist/blocks/multi-payment/index.js
r3345266 r3346589 1 (()=>{var e={703:(e,t,s)=>{"use strict";var a=s(414);function i(){}function n(){}n.resetWarningCache=i,e.exports=function(){function e(e,t,s,i,n,r){if(r!==a){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 t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:i};return s.PropTypes=s,s}},697:(e,t,s)=>{e.exports=s(703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function s(a){var i=t[a];if(void 0!==i)return i.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,s),n.exports}(()=>{"use strict";const e=window.React,t=window.wc.wcBlocksRegistry,a=window.wp.htmlEntities,i=window.wc.wcSettings,n=window.wp.i18n ;function r(t){const{sandbox:s,description:a}=t;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-description"},(0,e.createElement)("span",null,a),s&&(0,e.createElement)("div",{style:{lineHeight:1}},(0,e.createElement)("span",{style:{opacity:"80%",fontSize:"14px",fontStyle:"italic"}},s))))}function u(e){return"string"==typeof e||e instanceof String}function o(e){var t;return"object"==typeof e&&null!=e&&"Object"===(null==e||null==(t=e.constructor)?void 0:t.name)}function l(e,t){return Array.isArray(t)?l(e,((e,s)=>t.includes(s))):Object.entries(e).reduce(((e,s)=>{let[a,i]=s;return t(i,a)&&(e[a]=i),e}),{})}const h="NONE",d="LEFT",p="FORCE_LEFT",c="RIGHT",m="FORCE_RIGHT";function g(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function _(e,t){if(t===e)return!0;const s=Array.isArray(t),a=Array.isArray(e);let i;if(s&&a){if(t.length!=e.length)return!1;for(i=0;i<t.length;i++)if(!_(t[i],e[i]))return!1;return!0}if(s!=a)return!1;if(t&&e&&"object"==typeof t&&"object"==typeof e){const s=t instanceof Date,a=e instanceof Date;if(s&&a)return t.getTime()==e.getTime();if(s!=a)return!1;const n=t instanceof RegExp,r=e instanceof RegExp;if(n&&r)return t.toString()==e.toString();if(n!=r)return!1;const u=Object.keys(t);for(i=0;i<u.length;i++)if(!Object.prototype.hasOwnProperty.call(e,u[i]))return!1;for(i=0;i<u.length;i++)if(!_(e[u[i]],t[u[i]]))return!1;return!0}return!(!t||!e||"function"!=typeof t||"function"!=typeof e)&&t.toString()===e.toString()}class k{constructor(e){for(Object.assign(this,e);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?h:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?d:c}}function f(e,t){return new f.InputMask(e,t)}function v(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?f.MaskedRegExp:u(e)?f.MaskedPattern:e===Date?f.MaskedDate:e===Number?f.MaskedNumber:Array.isArray(e)||e===Array?f.MaskedDynamic:f.Masked&&e.prototype instanceof f.Masked?e:f.Masked&&e instanceof f.Masked?e.constructor:e instanceof Function?f.MaskedFunction:(console.warn("Mask not found for mask",e),f.Masked)}function E(e){if(!e)throw new Error("Options in not defined");if(f.Masked){if(e.prototype instanceof f.Masked)return{mask:e};const{mask:t,...s}=e instanceof f.Masked?{mask:e}:o(e)&&e.mask instanceof f.Masked?e:{};if(t){const e=t.mask;return{...l(t,((e,t)=>!t.startsWith("_"))),mask:t.constructor,_mask:e,...s}}}return o(e)?{...e}:{mask:e}}function y(e){if(f.Masked&&e instanceof f.Masked)return e;const t=E(e),s=v(t.mask);if(!s)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}f.createMask=y;class C{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return null!=e?e:this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return null!=e?e:this.value.length}select(e,t){if(null!=e&&null!=t&&(e!==this.selectionStart||t!==this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}f.MaskElement=C;class w extends C{constructor(e){super(),this.input=e,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 e,t,s;return null!=(e=null==(t=(s=this.input).getRootNode)?void 0:t.call(s))?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){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",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){return this._handlers.redo&&(90===e.keyCode&&e.shiftKey&&(e.metaKey||e.ctrlKey)||89===e.keyCode&&e.ctrlKey)?(e.preventDefault(),this._handlers.redo(e)):this._handlers.undo&&90===e.keyCode&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),this._handlers.undo(e)):void(e.isComposing||this._handlers.selectionChange(e))}_onBeforeinput(e){return"historyUndo"===e.inputType&&this._handlers.undo?(e.preventDefault(),this._handlers.undo(e)):"historyRedo"===e.inputType&&this._handlers.redo?(e.preventDefault(),this._handlers.redo(e)):void 0}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}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={}}}f.HTMLMaskElement=w;class A extends w{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}f.HTMLMaskElement=w;class S extends w{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s<a?s:a}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s>a?s:a}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const a=this.rootElement,i=a.getSelection&&a.getSelection();i&&(i.removeAllRanges(),i.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}f.HTMLContenteditableMaskElement=S;class x{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>x.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,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}}x.MAX_LENGTH=100,f.InputMask=class{constructor(e,t){this.el=e instanceof C?e:e.isContentEditable&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?new S(e):new A(e),this.masked=y(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new x,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(e){var t;return null==e||(null==(t=this.masked)?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof f.Masked)&&this.masked.constructor===v(e))return void this.masked.updateOptions({mask:e});const t=e instanceof f.Masked?e:y({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,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(e,t){const s=this._listeners[e];s&&s.forEach((e=>e(t)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el&&this.el.isActive&&(this.el.select(e,e),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(e){const t=this.masked.unmaskedValue,s=this.masked.value,a=this.masked.rawInputValue,i=this.displayValue,n=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==a;this._unmaskedValue=t,this._value=s,this._rawInputValue=a,this.el.value!==i&&(this.el.value=i),"auto"===e?this.alignCursor():null!=e&&(this.cursorPos=e),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,a=!this.maskEquals(t),i=this.masked.optionsIsChanged(s);a&&(this.mask=t),i&&this.masked.updateOptions(s),(a||i)&&this.updateControl()}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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,d))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new k({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,a=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,i=s===this.masked.rawInputValue?t.removeDirection:h;let n=this.masked.nearestInputPos(t.startChangePos+a,i);i!==h&&(n=this.masked.nearestInputPos(n,h)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};class b{static normalize(e){return Array.isArray(e)?e:[e,new b]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}f.ChangeDetails=b;class F{constructor(e,t,s){void 0===e&&(e=""),void 0===t&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||null!=e&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class B{constructor(e){this._value="",this._update({...B.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){void 0===t&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new F(this.extractInput(e,t),e)}appendTail(e){return u(e)&&(e=new F(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new b({inserted:e,rawInserted:e})):new b}_appendChar(e,t,s){void 0===t&&(t={});const a=this.state;let i;if([e,i]=this.doPrepareChar(e,t),e&&(i=i.aggregate(this._appendCharRaw(e,t)),!i.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=a;let n=this.pad(t);const r=this._appendCharRaw(e,t);n=n.aggregate(r),r.rawInserted||n.equals(i)?i=n:this.state=s}if(i.inserted){let e,n=!1!==this.doValidate(t);if(n&&null!=s){const t=this.state;if(!0===this.overwrite){e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.unshift(this.displayValue.length-i.tailShift)}let a=this.appendTail(s);if(n=a.rawInserted.length===s.toString().length,!(n&&a.inserted||"shift"!==this.overwrite)){this.state=t,e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.shift();a=this.appendTail(s),n=a.rawInserted.length===s.toString().length}n&&a.inserted&&(this.state=t)}n||(i=new b,this.state=a,s&&e&&(s.state=e))}return i}_appendPlaceholder(){return new b}_appendEager(){return new b}append(e,t,s){if(!u(e))throw new Error("value should be string");const a=u(s)?new F(String(s)):s;let i;null!=t&&t.tail&&(t._beforeTailState=this.state),[e,i]=this.doPrepare(e,t);for(let s=0;s<e.length;++s){const n=this._appendChar(e[s],t,a);if(!n.rawInserted&&!this.doSkipInvalid(e[s],t,a))break;i.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=t&&t.input&&e&&i.aggregate(this._appendEager()),null!=a&&(i.tailShift+=this.appendTail(a).tailShift),i}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new b}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,a=e();return this.rawInputValue=t,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,a}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return Boolean(this.skipInvalid)}doPrepare(e,t){return void 0===t&&(t={}),b.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return void 0===t&&(t={}),b.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,a,i){void 0===s&&(s=""),void 0===a&&(a=h),void 0===i&&(i={input:!0});const n=e+t,r=this.extractTail(n),u=!0===this.eager||"remove"===this.eager;let o;u&&(a=function(e){switch(e){case d:return p;case c:return m;default:return e}}(a),o=this.extractInput(0,n,{raw:!0}));let l=e;const g=new b;if(a!==h&&(l=this.nearestInputPos(e,t>1&&0!==e&&!u?h:a),g.tailShift=l-e),g.aggregate(this.remove(l)),u&&a!==h&&o===this.rawInputValue)if(a===p){let e;for(;o===this.rawInputValue&&(e=this.displayValue.length);)g.aggregate(new b({tailShift:-1})).aggregate(this.remove(e-1))}else a===m&&r.unshift();return g.aggregate(this.append(s,i,r))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!_(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||B.EMPTY_VALUES.includes(e)&&B.EMPTY_VALUES.includes(t)||!!this.format&&this.format(e,this)===this.format(this.typedValue,this)}pad(e){return new b}}B.DEFAULTS={skipInvalid:!0},B.EMPTY_VALUES=[void 0,null,""],f.Masked=B;class V{constructor(e,t){void 0===e&&(e=[]),void 0===t&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=u(e)?new F(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||null==e.stop)&&e.from===t.from+t.toString().length;if(e instanceof F)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof V){if(null==e.stop){let t;for(;e.chunks.length&&null==e.chunks[0].stop;)t=e.chunks.shift(),t.from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof f.MaskedPattern))return new F(this.toString()).appendTo(e);const t=new b;for(let s=0;s<this.chunks.length;++s){const a=this.chunks[s],i=e._mapPosToBlock(e.displayValue.length),n=a.stop;let r;if(null!=n&&(!i||i.index<=n)&&((a instanceof V||e._stops.indexOf(n)>=0)&&t.aggregate(e._appendPlaceholder(n)),r=a instanceof V&&e._blocks[n]),r){const s=r.appendTail(a);t.aggregate(s);const i=a.toString().slice(s.rawInserted.length);i&&t.aggregate(e.append(i,{tail:!0}))}else t.aggregate(e.append(a.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map((e=>e.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map((e=>{const t="chunks"in e?new V:new F;return t.state=e,t}))}unshift(e){if(!this.chunks.length||null!=e&&this.from>=e)return"";const t=null!=e?e-this.from:e;let s=0;for(;s<this.chunks.length;){const e=this.chunks[s],a=e.unshift(t);if(e.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class D{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:a}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=a,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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}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(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(t=this.block)?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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,p),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,d),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,d),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,m),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h),!0}))}}class M{constructor(e){Object.assign(this,e),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(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new b}nearestInputPos(e,t){void 0===t&&(t=h);const s=this._value.length;switch(t){case d:case p:return 0;default:return s}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new b;const s=!0===this.eager||"append"===this.eager,a=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,i=new b({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(t.raw||t.input),i}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new b;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new F("")}appendTail(e){return u(e)&&(e=new F(String(e))),e.appendTo(this)}append(e,t,s){const a=this._appendChar(e[0],t);return null!=s&&(a.tailShift+=this.appendTail(s).tailShift),a}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=Boolean(e._rawInputValue)}pad(e){return this._appendPlaceholder()}}class I{constructor(e){const{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:r,...u}=e;this.masked=y(u),Object.assign(this,{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),0===e&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new b}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(e,t){if(void 0===t&&(t={}),this.isFilled)return new b;const s=this.masked.state;let a=this.masked._appendChar(e,this.currentMaskFlags(t));return a.inserted&&!1===this.doValidate(t)&&(a=new b,this.masked.state=s),a.inserted||this.isOptional||this.lazy||t.input||(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=Boolean(a.inserted),a}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new b:(this.isFilled=!0,new b({inserted:this.placeholderChar}))}_appendEager(){return new b}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){void 0===t&&(t=h);const s=this.value.length,a=Math.min(Math.max(e,0),s);switch(t){case d:case p:return this.isComplete?a:0;case c:case m:return this.isComplete?a:s;default:return a}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(null==e||null==(t=e._beforeTailState)?void 0:t.masked)||(null==e?void 0:e._beforeTailState)}}pad(e){return new b}}I.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]/,"*":/./},f.MaskedRegExp=class extends B{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=e=>e.search(t)>=0),super._update(e)}};class T extends B{constructor(e){super({...T.DEFAULTS,...e,definitions:Object.assign({},I.DEFAULT_DEFINITIONS,null==e?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,a=!1;for(let i=0;i<t.length;++i){if(this.blocks){const e=t.slice(i),s=Object.keys(this.blocks).filter((t=>0===e.indexOf(t)));s.sort(((e,t)=>t.length-e.length));const a=s[0];if(a){const{expose:e,repeat:t,...s}=E(this.blocks[a]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:t,parent:this},r=null!=t?new f.RepeatBlock(n):y(n);r&&(this._blocks.push(r),e&&(this.exposeBlock=r),this._maskedBlocks[a]||(this._maskedBlocks[a]=[]),this._maskedBlocks[a].push(this._blocks.length-1)),i+=a.length-1;continue}}let n=t[i],r=n in e;if(n===T.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){a=!a;continue}if(n===T.ESCAPE_CHAR){if(++i,n=t[i],!n)break;r=!1}const u=r?new I({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...E(e[n]),parent:this}):new M({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map((e=>e.state))}}set state(e){if(!e)return void this.reset();const{_blocks:t,...s}=e;this._blocks.forEach(((e,s)=>e.state=t[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((e=>e.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((e=>e.isComplete))}get isFilled(){return this._blocks.every((e=>e.isFilled))}get isFixed(){return this._blocks.every((e=>e.isFixed))}get isOptional(){return this._blocks.every((e=>e.isOptional))}doCommit(){this._blocks.forEach((e=>e.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((e,t)=>e+t.unmaskedValue),"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((e,t)=>e+t.value),"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce(((e,t)=>e+t.displayValue),"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new b;let s=null==(e=this._mapPosToBlock(this.displayValue.length))?void 0:e.index;if(null==s)return t;this._blocks[s].isFilled&&++s;for(let e=s;e<this._blocks.length;++e){const s=this._blocks[e]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._mapPosToBlock(this.displayValue.length),a=new b;if(!s)return a;for(let n,r=s.index;n=this._blocks[r];++r){var i;const s=n._appendChar(e,{...t,_beforeTailState:null==(i=t._beforeTailState)||null==(i=i._blocks)?void 0:i[r]});if(a.aggregate(s),s.consumed)break}return a}extractTail(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=new V;return e===t||this._forEachBlocksInRange(e,t,((e,t,a,i)=>{const n=e.extractTail(a,i);n.stop=this._findStopBefore(t),n.from=this._blockStartPos(t),n instanceof V&&(n.blockIndex=t),s.extend(n)})),s}extractInput(e,t,s){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),void 0===s&&(s={}),e===t)return"";let a="";return this._forEachBlocksInRange(e,t,((e,t,i,n)=>{a+=e.extractInput(i,n,s)})),a}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const a=this._stops[s];if(!(a<=e))break;t=a}return t}_appendPlaceholder(e){const t=new b;if(this.lazy&&null==e)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const a=s.index,i=null!=e?e:this._blocks.length;return this._blocks.slice(a,i).forEach((s=>{var a;s.lazy&&null==e||t.aggregate(s._appendPlaceholder(null==(a=s._blocks)?void 0:a.length))})),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const a=this._blocks[s],i=t.length;if(t+=a.displayValue,e<=t.length)return{index:s,offset:e-i}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce(((e,t)=>e+t.displayValue.length),0)}_forEachBlocksInRange(e,t,s){void 0===t&&(t=this.displayValue.length);const a=this._mapPosToBlock(e);if(a){const e=this._mapPosToBlock(t),i=e&&a.index===e.index,n=a.offset,r=e&&i?e.offset:this._blocks[a.index].displayValue.length;if(s(this._blocks[a.index],a.index,n,r),e&&!i){for(let t=a.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].displayValue.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s.aggregate(e.remove(a,i))})),s}nearestInputPos(e,t){if(void 0===t&&(t=h),!this._blocks.length)return 0;const s=new D(this,e);if(t===h)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(t===d||t===p){if(t===d){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===d){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e)return s.pos;if(s.popState(),s.ok&&s.pos<=e)return s.pos;s.popState()}return s.ok?s.pos:t===p?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return t===c||t===m?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===m?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(e,d)))):e}totalInputPositions(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s+=e.totalInputPositions(a,i)})),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map((e=>this._blocks[e])):[]}pad(e){const t=new b;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>t.aggregate(s.pad(e)))),t}}T.DEFAULTS={...B.DEFAULTS,lazy:!0,placeholderChar:"_"},T.STOP_CHAR="`",T.ESCAPE_CHAR="\\",T.InputDefinition=I,T.FixedDefinition=M,f.MaskedPattern=T;class P extends T{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:a=this.maxLength||0,autofix:i=this.autofix,...n}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).length,a),this.autofix=i;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(e){let t="",s="";const[,a,i]=e.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(t="0".repeat(a.length)+i,s="9".repeat(a.length)+i),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){let s;return void 0===t&&(t={}),[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(void 0===t&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),a=String(this.to).padStart(this.maxLength,"0"),[i,n]=this.boundaries(this.value+e);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],t):Number(i)>this.to?!t.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(a[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;const[s,a]=this.boundaries(t);return this.from<=Number(a)&&Number(s)<=this.to&&super.doValidate(e)}pad(e){const t=new b;if(this.value.length===this.maxLength)return t;const s=this.value,a=this.maxLength-this.value.length;if(a){this.reset();for(let s=0;s<a;++s)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach((e=>this._appendCharRaw(e)))}return t}}f.MaskedRange=P;class R extends T{static extractPatternOptions(e){const{mask:t,pattern:s,...a}=e;return{...a,mask:u(t)?t:s}}constructor(e){super(R.extractPatternOptions({...R.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:a,...i}={...R.DEFAULTS,...e},n=Object.assign({},R.GET_DEFAULT_BLOCKS());e.min&&(n.Y.from=e.min.getFullYear()),e.max&&(n.Y.to=e.max.getFullYear()),e.min&&e.max&&n.Y.from===n.Y.to&&(n.m.from=e.min.getMonth()+1,n.m.to=e.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=e.min.getDate(),n.d.to=e.max.getDate())),Object.assign(n,this.blocks,a),super._update({...i,mask:u(t)?t:s,blocks:n})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(R.extractPatternOptions(e))}}R.GET_DEFAULT_BLOCKS=()=>({d:{mask:P,from:1,to:31,maxLength:2},m:{mask:P,from:1,to:12,maxLength:2},Y:{mask:P,from:1900,to:9999}}),R.DEFAULTS={...T.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(e,t)=>e?[String(e.getDate()).padStart(2,"0"),String(e.getMonth()+1).padStart(2,"0"),e.getFullYear()].join("."):"",parse:(e,t)=>{const[s,a,i]=e.split(".").map(Number);return new Date(i,a-1,s)}},f.MaskedDate=R;class O extends B{constructor(e){super({...O.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map((e=>{const{expose:t,...s}=E(e),a=y({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return t&&(this.exposeMask=a),a})):[])}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){void 0===e&&(e=""),void 0===t&&(t={}),void 0===s&&(s="");const a=t.tail&&null!=t._beforeTailState?t._beforeTailState._value:this.value,i=this.rawInputValue,n=t.tail&&null!=t._beforeTailState?t._beforeTailState._rawInputValue:i,r=i.slice(n.length),u=this.currentMask,o=new b,l=null==u?void 0:u.state;return this.currentMask=this.doDispatch(e,{...t},s),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),o.tailShift=this.currentMask.value.length-a.length),r&&(o.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):l&&(this.currentMask.state=l)),o}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new b;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:(null==(t=e._beforeTailState)?void 0:t.currentMaskRef)===this.currentMask&&(null==(s=e._beforeTailState)?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return void 0===t&&(t={}),void 0===s&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){void 0===t&&(t={});let[s,a]=super.doPrepare(e,t);if(this.currentMask){let e;[s,e]=super.doPrepare(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}doPrepareChar(e,t){void 0===t&&(t={});let[s,a]=super.doPrepareChar(e,t);if(this.currentMask){let e;[s,e]=super.doPrepareChar(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}reset(){var e;null==(e=this.currentMask)||e.reset(),this.compiledMasks.forEach((e=>e.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask)return this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,void this._applyDispatch();let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isComplete)}get isFilled(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isFilled)}remove(e,t){const s=new b;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((e=>e.state)),currentMaskRef:this.currentMask,currentMask:null==(e=this.currentMask)?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:a,...i}=e;t&&this.compiledMasks.forEach(((e,s)=>e.state=t[s])),null!=s&&(this.currentMask=s,this.currentMask.state=a),super.state=i}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every(((t,s)=>{if(!e[s])return;const{mask:a,...i}=e[s];return _(t,i)&&t.maskEquals(a)})):super.maskEquals(e)}typedValueEquals(e){var t;return Boolean(null==(t=this.currentMask)?void 0:t.typedValueEquals(e))}}O.DEFAULTS={...B.DEFAULTS,dispatch:(e,t,s,a)=>{if(!t.compiledMasks.length)return;const i=t.rawInputValue,n=t.compiledMasks.map(((n,r)=>{const u=t.currentMask===n,o=u?n.displayValue.length:n.nearestInputPos(n.displayValue.length,p);return n.rawInputValue!==i?(n.reset(),n.append(i,{raw:!0})):u||n.remove(o),n.append(e,t.currentMaskFlags(s)),n.appendTail(a),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,p)))}}));return n.sort(((e,t)=>t.weight-e.weight||t.totalInputPositions-e.totalInputPositions)),t.compiledMasks[n[0].index]}},f.MaskedDynamic=O;class N extends T{constructor(e){super({...N.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const e=t.map((e=>e.length)),a=Math.min(...e),i=Math.max(...e)-a;s.mask="*".repeat(a),i&&(s.mask+="["+"*".repeat(i)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){void 0===t&&(t={});const s=Math.min(this.nearestInputPos(0,m),this.value.length),a=this.enum.filter((t=>this.matchValue(t,this.unmaskedValue+e,s)));if(a.length){1===a.length&&this._forEachBlocksInRange(0,this.value.length,((e,s)=>{const i=a[0][s];s>=this.value.length||i===e.value||(e.reset(),e._appendChar(i,t))}));const e=super._appendCharRaw(a[0][this.value.length],t);return 1===a.length&&a[0].slice(this.unmaskedValue.length).split("").forEach((t=>e.aggregate(super._appendCharRaw(t)))),e}return new b({skip:!this.isComplete})}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new F("",e)}remove(e,t){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),e===t)return new b;const s=Math.min(super.nearestInputPos(0,m),this.value.length);let a;for(a=e;a>=0&&!(this.enum.filter((e=>this.matchValue(e,this.value.slice(s,a),s))).length>1);--a);const i=super.remove(a,t);return i.tailShift+=a-e,i}get isComplete(){return this.enum.indexOf(this.value)>=0}}var L;N.DEFAULTS={...T.DEFAULTS,matchValue:(e,t,s)=>e.indexOf(t,s)===s},f.MaskedEnum=N,f.MaskedFunction=class extends B{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}};class U extends B{constructor(e){super({...U.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t=(this.scale?"("+g(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+"\\d*"+t),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(g).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(g(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){void 0===t&&(t={});const[s,a]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(a.skip=!0),!s||this.allowPositive||this.value||"-"===s||a.aggregate(this._appendChar("-")),[s,a]}_separatorsCount(e,t){void 0===t&&(t=!1);let s=0;for(let a=0;a<e;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return void 0===e&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){void 0===t&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const i=this._value;this._value+=e;const n=this.number;let r,u=!isNaN(n),o=!1;if(u){let e;null!=this.min&&this.min<0&&this.number<this.min&&(e=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(e=this.max),null!=e&&(this.autofix?(this._value=this.format(e,this).replace(U.UNMASKED_RADIX,this.radix),o||(o=i===this._value&&!t.tail)):u=!1),u&&(u=Boolean(this._value.match(this._numberRegExp)))}u?r=new b({inserted:this._value.slice(i.length),rawInserted:o?"":e,skip:o}):(this._value=i,r=new b),this._value=this._insertThousandsSeparators(this._value);const l=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(l);return r.tailShift+=(h-a)*this.thousandsSeparator.length,r}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const a=this._findSeparatorAround(t);return a>=0&&(t=a+this.thousandsSeparator.length),[e,t]}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),a=this.value.slice(t),i=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+a));const n=this._separatorsCountFromSlice(s);return new b({tailShift:(n-i)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case h:case d:case p:{const s=this._findSeparatorAround(e-1);if(s>=0){const a=s+this.thousandsSeparator.length;if(e<a||this.value.length<=a||t===p)return s}break}case c:case m:{const t=this._findSeparatorAround(e);if(t>=0)return t+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,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(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,((e,t,s,a)=>t+a)),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){void 0===t&&(t={});const a=0===this.scale&&e!==this.thousandsSeparator&&(e===this.radix||e===U.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,U.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(U.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}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(e){return(super.typedValueEquals(e)||U.EMPTY_VALUES.includes(e)&&U.EMPTY_VALUES.includes(this.typedValue))&&!(0===e&&""===this.value)}}L=U,U.UNMASKED_RADIX=".",U.EMPTY_VALUES=[...B.EMPTY_VALUES,0],U.DEFAULTS={...B.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[L.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},f.MaskedNumber=U;const j={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function $(e,t,s){void 0===t&&(t=j.MASKED),void 0===s&&(s=j.MASKED);const a=y(e);return e=>a.runIsolated((a=>(a[t]=e,a[s])))}f.PIPE_TYPE=j,f.createPipe=$,f.pipe=function(e,t,s,a){return $(t,s,a)(e)},f.RepeatBlock=class extends T{get repeatFrom(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?e:0}get repeatTo(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,a;const{repeat:i,...n}=E(e);this._blockOpts=Object.assign({},this._blockOpts,n);const r=y(this._blockOpts);this.repeat=null!=(t=null!=(s=null!=i?i:r.repeat)?s:this.repeat)?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(a=this._blocks)?void 0:a.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(e){return e<this._blocks.length?this._blocks[e]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(y(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(e,t){void 0===t&&(t={});const s=new b;for(let u,o,l=null!=(a=null==(i=this._mapPosToBlock(this.displayValue.length))?void 0:i.index)?a:Math.max(this._blocks.length-1,0);u=null!=(n=this._blocks[l])?n:o=!o&&this._allocateBlock(l);++l){var a,i,n,r;const h=u._appendChar(e,{...t,_beforeTailState:null==(r=t._beforeTailState)||null==(r=r._blocks)?void 0:r[l]});if(h.skip&&o){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(h),h.consumed)break}return s}_trimEmptyTail(e,t){var s,a;void 0===e&&(e=0);const i=Math.max((null==(s=this._mapPosToBlock(e))?void 0:s.index)||0,this.repeatFrom,0);let n;null!=t&&(n=null==(a=this._mapPosToBlock(t))?void 0:a.index),null==n&&(n=this._blocks.length-1);let r=0;for(let e=n;i<=e&&!this._blocks[e].unmaskedValue;--e,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return void 0===e&&(e=0),null==t&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}};try{globalThis.IMask=f}catch{}var q=s(697);const z={mask:q.oneOfType([q.array,q.func,q.string,q.instanceOf(RegExp),q.oneOf([Date,Number,f.Masked]),q.instanceOf(f.Masked)]),value:q.any,unmask:q.oneOfType([q.bool,q.oneOf(["typed"])]),prepare:q.func,prepareChar:q.func,validate:q.func,commit:q.func,overwrite:q.oneOfType([q.bool,q.oneOf(["shift"])]),eager:q.oneOfType([q.bool,q.oneOf(["append","remove"])]),skipInvalid:q.bool,onAccept:q.func,onComplete:q.func,placeholderChar:q.string,displayChar:q.string,lazy:q.bool,definitions:q.object,blocks:q.object,enum:q.arrayOf(q.string),maxLength:q.number,from:q.number,to:q.number,pattern:q.string,format:q.func,parse:q.func,autofix:q.oneOfType([q.bool,q.oneOf(["pad"])]),radix:q.string,thousandsSeparator:q.string,mapToRadix:q.arrayOf(q.string),scale:q.number,normalizeZeros:q.bool,padFractionalZeros:q.bool,min:q.oneOfType([q.number,q.instanceOf(Date)]),max:q.oneOfType([q.number,q.instanceOf(Date)]),dispatch:q.func,inputRef:q.oneOfType([q.func,q.shape({current:q.object})])},K=Object.keys(z).filter((e=>"value"!==e)),Y=["value","unmask","onAccept","onComplete","inputRef"],H=K.filter((e=>Y.indexOf(e)<0)),X=function(t){var s;const a=((s=class extends e.Component{constructor(e){super(e),this._inputRef=this._inputRef.bind(this)}componentDidMount(){this.props.mask&&this.initMask()}componentDidUpdate(){const e=this.props,t=this._extractMaskOptionsFromProps(e);var s;t.mask?this.maskRef?(this.maskRef.updateOptions(t),"value"in e&&void 0!==e.value&&(this.maskValue=e.value)):this.initMask(t):(this.destroyMask(),"value"in e&&void 0!==e.value&&(null!=(s=this.element)&&s.isContentEditable&&"INPUT"!==this.element.tagName&&"TEXTAREA"!==this.element.tagName?this.element.textContent=e.value:this.element.value=e.value))}componentWillUnmount(){this.destroyMask()}_inputRef(e){this.element=e,this.props.inputRef&&(Object.prototype.hasOwnProperty.call(this.props.inputRef,"current")?this.props.inputRef.current=e:this.props.inputRef(e))}initMask(e){void 0===e&&(e=this._extractMaskOptionsFromProps(this.props)),this.maskRef=f(this.element,e).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(e){const{...t}=e;return Object.keys(t).filter((e=>H.indexOf(e)<0)).forEach((e=>{delete t[e]})),t}_extractNonMaskProps(e){const{...t}=e;return K.forEach((e=>{"maxLength"!==e&&delete t[e]})),"defaultValue"in t||(t.defaultValue=e.mask?"":t.value),delete t.value,t}get maskValue(){return this.maskRef?"typed"===this.props.unmask?this.maskRef.typedValue:this.props.unmask?this.maskRef.unmaskedValue:this.maskRef.value:""}set maskValue(e){this.maskRef&&(e=null==e&&"typed"!==this.props.unmask?"":e,"typed"===this.props.unmask?this.maskRef.typedValue=e:this.props.unmask?this.maskRef.unmaskedValue=e:this.maskRef.value=e)}_onAccept(e){this.props.onAccept&&this.maskRef&&this.props.onAccept(this.maskValue,this.maskRef,e)}_onComplete(e){this.props.onComplete&&this.maskRef&&this.props.onComplete(this.maskValue,this.maskRef,e)}render(){return e.createElement(t,{...this._extractNonMaskProps(this.props),inputRef:this._inputRef})}}).displayName=void 0,s.propTypes=void 0,s),i=t.displayName||t.name||"Component";return a.displayName="IMask("+i+")",a.propTypes=z,e.forwardRef(((t,s)=>e.createElement(a,{...t,ref:s})))}((t=>{let{inputRef:s,...a}=t;return e.createElement("input",{...a,ref:s})})),Z=e.forwardRef(((t,s)=>e.createElement(X,{...t,ref:s}))),G=({gateway:t,cpf:s,processProps:a})=>{const i=(0,n.__)("CPF do Comprador","vindi-pagamentos"),[r,u]=(0,e.useState)(s),[o,l]=(0,e.useState)(!1);return(0,e.useEffect)((()=>{const e=document.querySelector("#vindi-pagamentos__billing_persontype");e&&2==e.value?l(!0):l(!1)}),[l]),(0,e.useEffect)((()=>{a({gateway:t,cpf:r})}),[t,r,s,a]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-document "+(o?"":"vindi-pagamentos-document-hidden")},(0,e.createElement)("label",{htmlFor:`document-${t}`},i,(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(Z,{mask:"000.000.000-00",type:"text","aria-label":i,id:`document-${t}`,value:r,onAccept:(e,t)=>u(e),className:"wc-vindi-customer-document wvp-block-field"}))))},W="vindi-pagamentos-multi-payment",J=(0,i.getSetting)(`${W}_data`,{}),Q=(0,n.__)("Pagar com dois métodos","vindi-pagamentos"),ee=(0,a.decodeEntities)(J.title)||Q,te=(0,a.decodeEntities)(J.sandbox||""),se=(0,a.decodeEntities)(J.description||""),ae=(0,a.decodeEntities)(J.gateway||""),ie=(0,a.decodeEntities)(J.showCpf||!1),ne=(0,a.decodeEntities)(J.price||""),re=(0,a.decodeEntities)(J.brand||""),ue=(0,a.decodeEntities)(J.nonceCheckout||""),oe=(0,a.decodeEntities)(J.nonce||""),le=(0,a.decodeEntities)(J.availableMethods||{}),he=(0,a.decodeEntities)(J.savedTokens||[]),de=(0,a.decodeEntities)(J.enableSavedCards||!1),{currency:pe={}}=window.wcSettings||{},ce=(0,a.decodeEntities)(J.discountInfo||{}),me=t=>{const{eventRegistration:s,emitResponse:i}=t,{onPaymentProcessing:u}=s,[o,l]=(0,e.useState)("pix"),[h,d]=(0,e.useState)("credit_card"),[p,c]=(0,e.useState)(""),[m,g]=(0,e.useState)(""),[_,k]=(0,e.useState)(!1),[f,v]=(0,e.useState)(""),[E,y]=(0,e.useState)({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")}),[C,w]=(0,e.useState)(""),[A,S]=(0,e.useState)(""),[x,b]=(0,e.useState)(""),[F,B]=(0,e.useState)(""),[V,D]=(0,e.useState)("1"),[M,I]=(0,e.useState)({}),[T,P]=(0,e.useState)(0),[R,O]=(0,e.useState)("mono/generic"),[N,L]=(0,e.useState)("new"),[U,j]=(0,e.useState)(!0),[$,q]=(0,e.useState)(""),[z,K]=(0,e.useState)(""),[Y,H]=(0,e.useState)(""),[X,W]=(0,e.useState)(""),[Q,ee]=(0,e.useState)("1"),[me,ge]=(0,e.useState)({}),[_e,ke]=(0,e.useState)(0),[fe,ve]=(0,e.useState)("mono/generic"),[Ee,ye]=(0,e.useState)("new"),[Ce,we]=(0,e.useState)(!0),[Ae,Se]=(0,e.useState)(!1),[xe,be]=(0,e.useState)("");(0,e.useEffect)((()=>{if(ne){const e=parseFloat(ne),t=e/2;c(Te(t)),g(Te(e-t))}}),[ne]),(0,e.useEffect)((()=>{Object.keys(le).length>0?y(le):y({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")})}),[]),(0,e.useEffect)((()=>{o&&Fe(o)}),[o]),(0,e.useEffect)((()=>{"credit_card"===o&&("new"!==N&&he.length>0?Be(N,"first"):0!==T&&Ve())}),[T,p,N]),(0,e.useEffect)((()=>{"credit_card"===h&&("new"!==Ee&&he.length>0?Be(Ee,"second"):0!==_e&&De())}),[_e,m,Ee]),(0,e.useEffect)((()=>{const e=u((async()=>{const e=parseFloat(p),t=parseFloat(ne);if(e<=0||e>=t)return{type:i.responseTypes.ERROR,message:(0,n.__)("O valor do primeiro pagamento deve ser maior que zero e menor que o total.","vindi-pagamentos")};if("credit_card"===o&&"credit_card"===h&&C.replace(/\s/g,"")===$.replace(/\s/g,""))return{type:i.responseTypes.ERROR,message:(0,n.__)("Você não pode usar o mesmo cartão para ambos os métodos de pagamento.","vindi-pagamentos")};const s=String("object"==typeof N?N.id||"new":N),a=String("object"==typeof Ee?Ee.id||"new":Ee),r=T?String(T):"0",u=_e?String(_e):"0",l=String(V),d=String(Q);return{type:i.responseTypes.SUCCESS,meta:{paymentMethodData:{multi_payment_enabled:"1",vindi_multi_payment_active:"1",multi_payment:JSON.stringify({first_method:Me(o),second_method:Me(h),first_amount:p,second_amount:m}),"vindi-pagamento_nonce":ue,first_payment_method:Me(o),second_payment_method:Me(h),first_payment_amount:String(p),second_payment_amount:String(m),"wc-vindi-pagamentos-multi-payment-new-save-card":Ae?"true":"no",..."credit_card"===o&&"new"!==s?{"first_wc-vindi-pagamentos-credit-payment-token":s,"first_wvp-code":String(F),"first_wvp-installments":l}:{},..."credit_card"===o&&"new"===s?{"first_wc-vindi-pagamentos-credit-payment-token":"new","first_wvp-owner":String(A||"").toUpperCase(),"first_wvp-number":String(C||"").replace(/\s/g,""),"first_wvp-date":String(x||""),"first_wvp-code":String(F||""),"first_wvp-installments":l,"first_wvp-brand":r}:{},..."credit_card"===h&&"new"!==a?{"second_wc-vindi-pagamentos-credit-payment-token":a,"second_wvp-code":String(X||""),"second_wvp-installments":d}:{},..."credit_card"===h&&"new"===a?{"second_wc-vindi-pagamentos-credit-payment-token":"new","second_wvp-owner":String(z||"").toUpperCase(),"second_wvp-number":String($||"").replace(/\s/g,""),"second_wvp-date":String(Y||""),"second_wvp-code":String(X||""),"second_wvp-installments":d,"second_wvp-brand":u}:{},...ie?{"wc-vindi-customer-document":String(xe||"")}:{}}}}}));return()=>{e()}}),[i.responseTypes.ERROR,i.responseTypes.SUCCESS,u,o,h,p,m,A,C,x,F,V,T,N,z,$,Y,X,Q,_e,Ee,Ae,xe]);const Fe=e=>{k(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","vindi_get_compatible_methods"),method:"POST",data:{selected_method:e,target_field:"second",security:ue},success:e=>{if(e.success&&e.data){if(y(e.data),!e.data[h]){const t=Object.keys(e.data)[0];t&&d(t)}}else console.error("Error in getCompatibleMethods response:",e),y({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")})},error:(e,t,s)=>{console.error("AJAX error in getCompatibleMethods:",t,s),v((0,n.__)("Não foi possível carregar métodos de pagamento compatíveis.","vindi-pagamentos")),y({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")})},complete:()=>{k(!1)}})},Be=(e,t)=>{k(!0);const s="first"===t?parseFloat(String(p).replace(/[^\d.,]/g,"").replace(",",".")):parseFloat(String(m).replace(/[^\d.,]/g,"").replace(",","."));jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({token:e,price:s,_wpnonce:oe,is_second_method:"second"===t}),success:e=>{e.success&&e.data&&e.data.installments&&("first"===t?I(e.data.installments):ge(e.data.installments))},error:(e,s,a)=>{console.error(`Error fetching ${t} installments for token:`,s,a)},complete:()=>{k(!1)}})},Ve=()=>{0!==T&&(k(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({brand:T,price:parseFloat(String(p).replace(",",".")).toFixed(2),_wpnonce:oe}),success:e=>{e.success&&e.data&&e.data.installments&&I(e.data.installments)},error:(e,t,s)=>{console.error("Error fetching first installments:",t,s)},complete:()=>{k(!1)}}))},De=()=>{0!==_e&&(k(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({brand:_e,price:parseFloat(String(m).replace(",",".")).toFixed(2),_wpnonce:oe,is_second_method:!0}),success:e=>{e.success&&e.data&&e.data.installments&&ge(e.data.installments)},error:(e,t,s)=>{console.error("Error fetching second installments:",t,s)},complete:()=>{k(!1)}}))},Me=e=>({pix:"vindi-pagamentos-pix",credit_card:"vindi-pagamentos-credit",bolepix:"vindi-pagamentos-bolepix"}[e]||e),Ie=e=>{const t=e.replace(/\s/g,""),s=Ne();let a;w(e),s.forEach((e=>{e.regex.test(t)&&!a&&t.length>14&&(a=e,Re(e.name,e.code))})),!a&&t.length>14&&Re("mono/generic",1)},Te=e=>{const{decimal_separator:t=",",thousand_separator:s=".",precision:a=2,price_format:i="%s %v"}=pe,n=String(e).replace(",","."),r=Number(n).toFixed(a);let[u,o]=r.split(".");return u=u.replace(/\B(?=(\d{3})+(?!\d))/g,s),u+t+o},Pe=e=>{const t=e.replace(/\s/g,""),s=Ne();let a;q(e),s.forEach((e=>{e.regex.test(t)&&!a&&t.length>14&&(a=e,Oe(e.name,e.code))})),!a&&t.length>14&&Oe("mono/generic",1)},Re=(e,t=0)=>{O(e),t&&t!=T&&P(t)},Oe=(e,t=0)=>{ve(e),t&&t!=_e&&ke(t)},Ne=()=>[{code:16,name:"elo",regex:/^4011(78|79)|^43(1274|8935)|^45(1416|7393|763(1|2))|^50(4175|6699|67[0-6][0-9]|677[0-8]|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9])|^627780|^63(6297|6368|6369)|^65(0(0(3([1-3]|[5-9])|4([0-9])|5[0-1])|4(0[5-9]|[1-3][0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8]|4[1-9]|[5-8][0-9]|9[0-8])|7(0[0-9]|1[0-8]|2[0-7])|9(0[1-9]|[1-6][0-9]|7[0-8]))|16(5[2-9]|[6-7][0-9])|50(0[0-9]|1[0-9]|2[1-9]|[3-4][0-9]|5[0-8]))/},{code:3,name:"visa",regex:/^4/},{code:4,name:"mastercard",regex:/^5[1-5][0-9]{14}$|^2[2-7][0-9]{14}$/},{code:5,name:"amex",regex:/^3[47]/},{code:25,name:"hipercard",regex:/^(606282|3841)\d{10,15}$/},{code:20,name:"hiper",regex:/^(38|60|637095)\d{14}$/}],Le=e=>{L(e),j("new"===e)},Ue=e=>{ye(e),we("new"===e)},je=(t,s)=>"credit_card"===t?$e(s):(0,e.createElement)("p",null,`Pagar com ${t}`),$e=t=>{const s="first"===t,i=s?C:$,r=s?A:z,u=s?S:K,o=s?x:Y,l=s?b:H,h=s?F:X,d=s?B:W,p=s?R:fe,c=s?V:Q,m=s?D:ee,g=s?M:me,_=s?U:Ce;return(0,e.createElement)("div",{className:`wvp-credit-fields ${t}-credit-fields`},(t=>{if(!de||!he||0===he.length)return null;const s="first"===t?N:Ee,a="first"===t?Le:Ue;return(0,e.createElement)("div",{className:"woocommerce-SavedPaymentMethods-wrapper"},(0,e.createElement)("ul",{className:"woocommerce-SavedPaymentMethods wc-saved-payment-methods",style:{listStyle:"none",margin:0},"data-count":he.length+1},he.map((i=>(0,e.createElement)("li",{key:i.id,className:"woocommerce-SavedPaymentMethods-token"},(0,e.createElement)("input",{id:`${t}_wc-vindi-pagamentos-credit-payment-token-${i.id}`,type:"radio",name:`${t}_wc-vindi-pagamentos-credit-payment-token`,value:i.id,style:{width:"auto"},className:`woocommerce-SavedPaymentMethods-tokenInput ${t}_credit-token-input`,checked:s===i.id,onChange:()=>a(i.id)}),(0,e.createElement)("label",{htmlFor:`${t}_wc-vindi-pagamentos-credit-payment-token-${i.id}`},`${i.card_type} com final ${i.last4} (expira em ${i.expiry_month}/${i.expiry_year})`)))),(0,e.createElement)("li",{className:"woocommerce-SavedPaymentMethods-new"},(0,e.createElement)("input",{id:`${t}_wc-vindi-pagamentos-credit-payment-token-new`,type:"radio",name:`${t}_wc-vindi-pagamentos-credit-payment-token`,value:"new",style:{width:"auto"},className:`woocommerce-SavedPaymentMethods-tokenInput ${t}_credit-token-input`,checked:"new"===s,onChange:()=>a("new")}),(0,e.createElement)("label",{htmlFor:`${t}_wc-vindi-pagamentos-credit-payment-token-new`},(0,n.__)("Utilizar um novo método de pagamento","vindi-pagamentos")))))})(t),_?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:`${t}-wvp-credit-fields-hide`},(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-wide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-owner`},(0,n.__)("Dono do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(Z,{mask:/^[A-Za-z\s]*$/,type:"text",id:`${t}_wvp-card-owner`,className:"wvp-block-field",value:r,onAccept:e=>u(e.toUpperCase())}))),(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-wide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-number`},(0,n.__)("Número do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:`${t}_wvp-brand-icon`,src:`${re}/${p}.svg`,"data-img":p,alt:"Credit card brand"}),(0,e.createElement)(Z,{mask:"0000 0000 0000 0000",type:"text",id:`${t}_wvp-card-number`,className:"wvp-block-field",value:i,placeholder:"0000 0000 0000 0000",onAccept:s?Ie:Pe})))),(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-split`},(0,e.createElement)("div",{className:`${t}-wvp-card-date-hide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-date`},(0,n.__)("Data de expiração","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(Z,{mask:"00/00",type:"text",id:`${t}_wvp-card-date`,className:"wvp-block-field",value:o,placeholder:"MM/YY",onAccept:e=>l(e)}))),(0,e.createElement)("div",null,(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-code`},(0,n.__)("Código do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:`${t}_wvp-cvv-icon`,src:(0,a.decodeEntities)(J.codeBrand||""),"data-img":"mono/cvv.svg",alt:"Credit card CVV"}),(0,e.createElement)(Z,{mask:"0000",type:"text",id:`${t}_wvp-card-code`,className:"wvp-block-field",value:h,placeholder:"CVV",onAccept:e=>d(e)}))))):(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-code`},(0,n.__)("Código de segurança","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:`${t}_wvp-cvv-icon`,src:(0,a.decodeEntities)(J.codeBrand||""),"data-img":"mono/cvv.svg",alt:"Credit card CVV"}),(0,e.createElement)(Z,{mask:"0000",type:"text",id:`${t}_wvp-card-code`,className:"wvp-block-field",value:h,placeholder:"CVV",onAccept:e=>d(e)}))),(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-wide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-installments`,id:`${t}_wvp-card-installments-label`},(0,n.__)("Parcelas","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)("select",{id:`${t}_wvp-card-installments`,value:c,onChange:e=>m(e.target.value)},Object.keys(g).length>0?Object.keys(g).map((t=>(0,e.createElement)("option",{key:t,value:t},g[t]))):(0,e.createElement)("option",null)),(0,e.createElement)("div",{id:`${t}_wvp-installments-error`}))),(0,e.createElement)("input",{type:"hidden",id:`${t}_wvp-card-brand`,value:s?T:_e}))},qe=({paymentMethod:t})=>{if(!ce||!ce[t]||!ce[t].enabled)return null;const{value:s,text_color:a}=ce[t];return(0,e.createElement)("div",{className:"payment-discount-info"},(0,e.createElement)("span",{style:{color:a,display:"block",marginTop:"8px"}},s," % de desconto"))};return(0,e.useEffect)((()=>{(()=>{const e=document.querySelector('input[name="wc-vindi-pagamentos-multi-payment-new-payment-method"]');e&&e.remove();const t=document.createElement("input");t.type="hidden",t.name="wc-vindi-pagamentos-multi-payment-new-payment-method",t.value=Ae?"true":"false",console.log(Ae);const s=document.querySelector("form.woocommerce-checkout");s&&s.appendChild(t)})()}),[Ae]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(r,{sandbox:te,description:se}),(0,e.createElement)("div",{className:"multipayment-container "+(_?"wvp-request-loader":"")},(0,e.createElement)("input",{type:"hidden",name:"vindi_multi_payment_active",id:"vindi_multi_payment_active",value:"1"}),(0,e.createElement)("input",{type:"hidden",name:"_wpnonce",id:"wvp-card-nonce",value:oe}),(0,e.createElement)("input",{type:"hidden",id:"wvp-cart-total",name:"wvp-cart-total",value:ne}),(0,e.createElement)("div",{className:"payment-amount-section"},(0,e.createElement)("h4",null,(0,n.__)("Valor para o primeiro método","vindi-pagamentos")),(0,e.createElement)("div",{className:"payment-amount-input-container"},(0,e.createElement)("span",{className:"payment-amount-currency"},"R$"),(0,e.createElement)("input",{type:"text",name:"first_payment_amount",id:"first_payment_amount",className:"input-text wvp-block-field payment-amount-input",value:p,onChange:e=>{const t=e.target.value,s=t.replace(/[^\d.,]/g,"").replace(",","."),a=parseFloat(s),i=parseFloat(ne);if(isNaN(a)||a<=0||a>=i)v((0,n.__)("O valor deve ser maior que zero e menor que o total.","vindi-pagamentos"));else{v(""),c(t);const e=i-a;e<0&&g("0.00"),g(Te(e))}},onBlur:()=>{const e=Te(p);c(e)}})),f&&(0,e.createElement)("p",{className:"payment-amount-error"},f),(0,e.createElement)("input",{type:"hidden",name:"cart_total",id:"cart_total",value:ne})),(0,e.createElement)("div",{className:"first-payment-method"},(0,e.createElement)("h4",null,(0,n.__)("Primeiro método de pagamento","vindi-pagamentos")),(0,e.createElement)("select",{name:"first_payment_method",id:"first_payment_method",className:"select woocommerce-select",value:o,onChange:e=>l(e.target.value)},Object.entries(le).map((([t,s])=>(0,e.createElement)("option",{key:t,value:t},s)))),je(o,"first"),(0,e.createElement)(qe,{paymentMethod:o})),(0,e.createElement)("div",{className:"second-payment-amount"},(0,e.createElement)("h4",null,(0,n.__)("Valor para o segundo método","vindi-pagamentos")),(0,e.createElement)("div",{className:"payment-amount-input-container"},(0,e.createElement)("span",{className:"payment-amount-currency"},"R$"),(0,e.createElement)("input",{type:"text",name:"second_payment_amount",id:"second_payment_amount",className:"input-text wvp-block-field payment-amount-input",value:m,readOnly:!0,style:{backgroundColor:"#f7f7f7"}}))),(0,e.createElement)("div",{className:"second-payment-method"},(0,e.createElement)("h4",null,(0,n.__)("Segundo método de pagamento","vindi-pagamentos")),(0,e.createElement)("select",{name:"second_payment_method",id:"second_payment_method",className:"select woocommerce-select",value:h,onChange:e=>d(e.target.value)},Object.entries(E).map((([t,s])=>(0,e.createElement)("option",{key:t,value:t},s)))),je(h,"second"),(0,e.createElement)(qe,{paymentMethod:h})),de&&("credit_card"===o||"credit_card"===h)&&(0,e.createElement)("div",{className:"wvp-save-card-option",style:{marginTop:"20px",paddingTop:"15px",borderTop:"1px solid #eee"}},(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"checkbox",id:"wc-vindi-pagamentos-multi-payment-new-payment-method",checked:Ae,onChange:e=>Se(e.target.checked),style:{marginRight:"8px"}}),(0,n.__)("Salvar cartão para compras futuras","vindi-pagamentos")))),ie&&(0,e.createElement)(G,{gateway:ae,cpf:xe,processProps:e=>{be(e.cpf)}}))},ge=()=>{const t=(0,a.decodeEntities)(J.icon||"");return t?(0,e.createElement)("img",{src:t,style:{float:"right",marginRight:"20px"}}):""},_e={name:W,label:(0,e.createElement)((t=>(0,e.createElement)("span",{style:{width:"100%"}},ee,(0,e.createElement)(ge,null))),null),content:(0,e.createElement)(me,null),edit:(0,e.createElement)(me,null),canMakePayment:()=>!0,ariaLabel:ee,supports:{features:J.supports,showSaveOption:!1}};(0,t.registerPaymentMethod)(_e)})()})();1 (()=>{var e={703:(e,t,s)=>{"use strict";var a=s(414);function i(){}function n(){}n.resetWarningCache=i,e.exports=function(){function e(e,t,s,i,n,r){if(r!==a){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 t(){return e}e.isRequired=e;var s={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:i};return s.PropTypes=s,s}},697:(e,t,s)=>{e.exports=s(703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function s(a){var i=t[a];if(void 0!==i)return i.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,s),n.exports}(()=>{"use strict";const e=window.React,t=window.wc.wcBlocksRegistry,a=window.wp.htmlEntities,i=window.wc.wcSettings,n=window.wp.i18n,r=window.wp.data,u=window.wc.wcBlocksData;function o(t){const{sandbox:s,description:a}=t;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-description"},(0,e.createElement)("span",null,a),s&&(0,e.createElement)("div",{style:{lineHeight:1}},(0,e.createElement)("span",{style:{opacity:"80%",fontSize:"14px",fontStyle:"italic"}},s))))}function l(e){return"string"==typeof e||e instanceof String}function h(e){var t;return"object"==typeof e&&null!=e&&"Object"===(null==e||null==(t=e.constructor)?void 0:t.name)}function d(e,t){return Array.isArray(t)?d(e,((e,s)=>t.includes(s))):Object.entries(e).reduce(((e,s)=>{let[a,i]=s;return t(i,a)&&(e[a]=i),e}),{})}const p="NONE",c="LEFT",m="FORCE_LEFT",g="RIGHT",_="FORCE_RIGHT";function k(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function f(e,t){if(t===e)return!0;const s=Array.isArray(t),a=Array.isArray(e);let i;if(s&&a){if(t.length!=e.length)return!1;for(i=0;i<t.length;i++)if(!f(t[i],e[i]))return!1;return!0}if(s!=a)return!1;if(t&&e&&"object"==typeof t&&"object"==typeof e){const s=t instanceof Date,a=e instanceof Date;if(s&&a)return t.getTime()==e.getTime();if(s!=a)return!1;const n=t instanceof RegExp,r=e instanceof RegExp;if(n&&r)return t.toString()==e.toString();if(n!=r)return!1;const u=Object.keys(t);for(i=0;i<u.length;i++)if(!Object.prototype.hasOwnProperty.call(e,u[i]))return!1;for(i=0;i<u.length;i++)if(!f(e[u[i]],t[u[i]]))return!1;return!0}return!(!t||!e||"function"!=typeof t||"function"!=typeof e)&&t.toString()===e.toString()}class v{constructor(e){for(Object.assign(this,e);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?p:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?c:g}}function E(e,t){return new E.InputMask(e,t)}function y(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?E.MaskedRegExp:l(e)?E.MaskedPattern:e===Date?E.MaskedDate:e===Number?E.MaskedNumber:Array.isArray(e)||e===Array?E.MaskedDynamic:E.Masked&&e.prototype instanceof E.Masked?e:E.Masked&&e instanceof E.Masked?e.constructor:e instanceof Function?E.MaskedFunction:(console.warn("Mask not found for mask",e),E.Masked)}function C(e){if(!e)throw new Error("Options in not defined");if(E.Masked){if(e.prototype instanceof E.Masked)return{mask:e};const{mask:t,...s}=e instanceof E.Masked?{mask:e}:h(e)&&e.mask instanceof E.Masked?e:{};if(t){const e=t.mask;return{...d(t,((e,t)=>!t.startsWith("_"))),mask:t.constructor,_mask:e,...s}}}return h(e)?{...e}:{mask:e}}function w(e){if(E.Masked&&e instanceof E.Masked)return e;const t=C(e),s=y(t.mask);if(!s)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}E.createMask=w;class A{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return null!=e?e:this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return null!=e?e:this.value.length}select(e,t){if(null!=e&&null!=t&&(e!==this.selectionStart||t!==this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}E.MaskElement=A;class S extends A{constructor(e){super(),this.input=e,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 e,t,s;return null!=(e=null==(t=(s=this.input).getRootNode)?void 0:t.call(s))?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){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",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){return this._handlers.redo&&(90===e.keyCode&&e.shiftKey&&(e.metaKey||e.ctrlKey)||89===e.keyCode&&e.ctrlKey)?(e.preventDefault(),this._handlers.redo(e)):this._handlers.undo&&90===e.keyCode&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),this._handlers.undo(e)):void(e.isComposing||this._handlers.selectionChange(e))}_onBeforeinput(e){return"historyUndo"===e.inputType&&this._handlers.undo?(e.preventDefault(),this._handlers.undo(e)):"historyRedo"===e.inputType&&this._handlers.redo?(e.preventDefault(),this._handlers.redo(e)):void 0}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}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={}}}E.HTMLMaskElement=S;class x extends S{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}E.HTMLMaskElement=S;class b extends S{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s<a?s:a}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s>a?s:a}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const a=this.rootElement,i=a.getSelection&&a.getSelection();i&&(i.removeAllRanges(),i.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}E.HTMLContenteditableMaskElement=b;class F{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>F.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,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}}F.MAX_LENGTH=100,E.InputMask=class{constructor(e,t){this.el=e instanceof A?e:e.isContentEditable&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?new b(e):new x(e),this.masked=w(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new F,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(e){var t;return null==e||(null==(t=this.masked)?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof E.Masked)&&this.masked.constructor===y(e))return void this.masked.updateOptions({mask:e});const t=e instanceof E.Masked?e:w({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,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(e,t){const s=this._listeners[e];s&&s.forEach((e=>e(t)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el&&this.el.isActive&&(this.el.select(e,e),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(e){const t=this.masked.unmaskedValue,s=this.masked.value,a=this.masked.rawInputValue,i=this.displayValue,n=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==a;this._unmaskedValue=t,this._value=s,this._rawInputValue=a,this.el.value!==i&&(this.el.value=i),"auto"===e?this.alignCursor():null!=e&&(this.cursorPos=e),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,a=!this.maskEquals(t),i=this.masked.optionsIsChanged(s);a&&(this.mask=t),i&&this.masked.updateOptions(s),(a||i)&&this.updateControl()}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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,c))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new v({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,a=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,i=s===this.masked.rawInputValue?t.removeDirection:p;let n=this.masked.nearestInputPos(t.startChangePos+a,i);i!==p&&(n=this.masked.nearestInputPos(n,p)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};class B{static normalize(e){return Array.isArray(e)?e:[e,new B]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}E.ChangeDetails=B;class V{constructor(e,t,s){void 0===e&&(e=""),void 0===t&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||null!=e&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class D{constructor(e){this._value="",this._update({...D.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){void 0===t&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new V(this.extractInput(e,t),e)}appendTail(e){return l(e)&&(e=new V(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new B({inserted:e,rawInserted:e})):new B}_appendChar(e,t,s){void 0===t&&(t={});const a=this.state;let i;if([e,i]=this.doPrepareChar(e,t),e&&(i=i.aggregate(this._appendCharRaw(e,t)),!i.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=a;let n=this.pad(t);const r=this._appendCharRaw(e,t);n=n.aggregate(r),r.rawInserted||n.equals(i)?i=n:this.state=s}if(i.inserted){let e,n=!1!==this.doValidate(t);if(n&&null!=s){const t=this.state;if(!0===this.overwrite){e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.unshift(this.displayValue.length-i.tailShift)}let a=this.appendTail(s);if(n=a.rawInserted.length===s.toString().length,!(n&&a.inserted||"shift"!==this.overwrite)){this.state=t,e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.shift();a=this.appendTail(s),n=a.rawInserted.length===s.toString().length}n&&a.inserted&&(this.state=t)}n||(i=new B,this.state=a,s&&e&&(s.state=e))}return i}_appendPlaceholder(){return new B}_appendEager(){return new B}append(e,t,s){if(!l(e))throw new Error("value should be string");const a=l(s)?new V(String(s)):s;let i;null!=t&&t.tail&&(t._beforeTailState=this.state),[e,i]=this.doPrepare(e,t);for(let s=0;s<e.length;++s){const n=this._appendChar(e[s],t,a);if(!n.rawInserted&&!this.doSkipInvalid(e[s],t,a))break;i.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=t&&t.input&&e&&i.aggregate(this._appendEager()),null!=a&&(i.tailShift+=this.appendTail(a).tailShift),i}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new B}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,a=e();return this.rawInputValue=t,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,a}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return Boolean(this.skipInvalid)}doPrepare(e,t){return void 0===t&&(t={}),B.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return void 0===t&&(t={}),B.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,a,i){void 0===s&&(s=""),void 0===a&&(a=p),void 0===i&&(i={input:!0});const n=e+t,r=this.extractTail(n),u=!0===this.eager||"remove"===this.eager;let o;u&&(a=function(e){switch(e){case c:return m;case g:return _;default:return e}}(a),o=this.extractInput(0,n,{raw:!0}));let l=e;const h=new B;if(a!==p&&(l=this.nearestInputPos(e,t>1&&0!==e&&!u?p:a),h.tailShift=l-e),h.aggregate(this.remove(l)),u&&a!==p&&o===this.rawInputValue)if(a===m){let e;for(;o===this.rawInputValue&&(e=this.displayValue.length);)h.aggregate(new B({tailShift:-1})).aggregate(this.remove(e-1))}else a===_&&r.unshift();return h.aggregate(this.append(s,i,r))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!f(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||D.EMPTY_VALUES.includes(e)&&D.EMPTY_VALUES.includes(t)||!!this.format&&this.format(e,this)===this.format(this.typedValue,this)}pad(e){return new B}}D.DEFAULTS={skipInvalid:!0},D.EMPTY_VALUES=[void 0,null,""],E.Masked=D;class M{constructor(e,t){void 0===e&&(e=[]),void 0===t&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=l(e)?new V(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||null==e.stop)&&e.from===t.from+t.toString().length;if(e instanceof V)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof M){if(null==e.stop){let t;for(;e.chunks.length&&null==e.chunks[0].stop;)t=e.chunks.shift(),t.from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof E.MaskedPattern))return new V(this.toString()).appendTo(e);const t=new B;for(let s=0;s<this.chunks.length;++s){const a=this.chunks[s],i=e._mapPosToBlock(e.displayValue.length),n=a.stop;let r;if(null!=n&&(!i||i.index<=n)&&((a instanceof M||e._stops.indexOf(n)>=0)&&t.aggregate(e._appendPlaceholder(n)),r=a instanceof M&&e._blocks[n]),r){const s=r.appendTail(a);t.aggregate(s);const i=a.toString().slice(s.rawInserted.length);i&&t.aggregate(e.append(i,{tail:!0}))}else t.aggregate(e.append(a.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map((e=>e.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map((e=>{const t="chunks"in e?new M:new V;return t.state=e,t}))}unshift(e){if(!this.chunks.length||null!=e&&this.from>=e)return"";const t=null!=e?e-this.from:e;let s=0;for(;s<this.chunks.length;){const e=this.chunks[s],a=e.unshift(t);if(e.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class I{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:a}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=a,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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}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(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(t=this.block)?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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,m),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,c),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,c),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,_),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,p),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,p),!0}))}}class T{constructor(e){Object.assign(this,e),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(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new B}nearestInputPos(e,t){void 0===t&&(t=p);const s=this._value.length;switch(t){case c:case m:return 0;default:return s}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new B;const s=!0===this.eager||"append"===this.eager,a=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,i=new B({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(t.raw||t.input),i}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new B;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new V("")}appendTail(e){return l(e)&&(e=new V(String(e))),e.appendTo(this)}append(e,t,s){const a=this._appendChar(e[0],t);return null!=s&&(a.tailShift+=this.appendTail(s).tailShift),a}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=Boolean(e._rawInputValue)}pad(e){return this._appendPlaceholder()}}class P{constructor(e){const{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:r,...u}=e;this.masked=w(u),Object.assign(this,{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),0===e&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new B}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(e,t){if(void 0===t&&(t={}),this.isFilled)return new B;const s=this.masked.state;let a=this.masked._appendChar(e,this.currentMaskFlags(t));return a.inserted&&!1===this.doValidate(t)&&(a=new B,this.masked.state=s),a.inserted||this.isOptional||this.lazy||t.input||(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=Boolean(a.inserted),a}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new B:(this.isFilled=!0,new B({inserted:this.placeholderChar}))}_appendEager(){return new B}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){void 0===t&&(t=p);const s=this.value.length,a=Math.min(Math.max(e,0),s);switch(t){case c:case m:return this.isComplete?a:0;case g:case _:return this.isComplete?a:s;default:return a}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(null==e||null==(t=e._beforeTailState)?void 0:t.masked)||(null==e?void 0:e._beforeTailState)}}pad(e){return new B}}P.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]/,"*":/./},E.MaskedRegExp=class extends D{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=e=>e.search(t)>=0),super._update(e)}};class R extends D{constructor(e){super({...R.DEFAULTS,...e,definitions:Object.assign({},P.DEFAULT_DEFINITIONS,null==e?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,a=!1;for(let i=0;i<t.length;++i){if(this.blocks){const e=t.slice(i),s=Object.keys(this.blocks).filter((t=>0===e.indexOf(t)));s.sort(((e,t)=>t.length-e.length));const a=s[0];if(a){const{expose:e,repeat:t,...s}=C(this.blocks[a]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:t,parent:this},r=null!=t?new E.RepeatBlock(n):w(n);r&&(this._blocks.push(r),e&&(this.exposeBlock=r),this._maskedBlocks[a]||(this._maskedBlocks[a]=[]),this._maskedBlocks[a].push(this._blocks.length-1)),i+=a.length-1;continue}}let n=t[i],r=n in e;if(n===R.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){a=!a;continue}if(n===R.ESCAPE_CHAR){if(++i,n=t[i],!n)break;r=!1}const u=r?new P({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...C(e[n]),parent:this}):new T({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map((e=>e.state))}}set state(e){if(!e)return void this.reset();const{_blocks:t,...s}=e;this._blocks.forEach(((e,s)=>e.state=t[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((e=>e.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((e=>e.isComplete))}get isFilled(){return this._blocks.every((e=>e.isFilled))}get isFixed(){return this._blocks.every((e=>e.isFixed))}get isOptional(){return this._blocks.every((e=>e.isOptional))}doCommit(){this._blocks.forEach((e=>e.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((e,t)=>e+t.unmaskedValue),"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((e,t)=>e+t.value),"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce(((e,t)=>e+t.displayValue),"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new B;let s=null==(e=this._mapPosToBlock(this.displayValue.length))?void 0:e.index;if(null==s)return t;this._blocks[s].isFilled&&++s;for(let e=s;e<this._blocks.length;++e){const s=this._blocks[e]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._mapPosToBlock(this.displayValue.length),a=new B;if(!s)return a;for(let n,r=s.index;n=this._blocks[r];++r){var i;const s=n._appendChar(e,{...t,_beforeTailState:null==(i=t._beforeTailState)||null==(i=i._blocks)?void 0:i[r]});if(a.aggregate(s),s.consumed)break}return a}extractTail(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=new M;return e===t||this._forEachBlocksInRange(e,t,((e,t,a,i)=>{const n=e.extractTail(a,i);n.stop=this._findStopBefore(t),n.from=this._blockStartPos(t),n instanceof M&&(n.blockIndex=t),s.extend(n)})),s}extractInput(e,t,s){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),void 0===s&&(s={}),e===t)return"";let a="";return this._forEachBlocksInRange(e,t,((e,t,i,n)=>{a+=e.extractInput(i,n,s)})),a}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const a=this._stops[s];if(!(a<=e))break;t=a}return t}_appendPlaceholder(e){const t=new B;if(this.lazy&&null==e)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const a=s.index,i=null!=e?e:this._blocks.length;return this._blocks.slice(a,i).forEach((s=>{var a;s.lazy&&null==e||t.aggregate(s._appendPlaceholder(null==(a=s._blocks)?void 0:a.length))})),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const a=this._blocks[s],i=t.length;if(t+=a.displayValue,e<=t.length)return{index:s,offset:e-i}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce(((e,t)=>e+t.displayValue.length),0)}_forEachBlocksInRange(e,t,s){void 0===t&&(t=this.displayValue.length);const a=this._mapPosToBlock(e);if(a){const e=this._mapPosToBlock(t),i=e&&a.index===e.index,n=a.offset,r=e&&i?e.offset:this._blocks[a.index].displayValue.length;if(s(this._blocks[a.index],a.index,n,r),e&&!i){for(let t=a.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].displayValue.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s.aggregate(e.remove(a,i))})),s}nearestInputPos(e,t){if(void 0===t&&(t=p),!this._blocks.length)return 0;const s=new I(this,e);if(t===p)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(t===c||t===m){if(t===c){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===c){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e)return s.pos;if(s.popState(),s.ok&&s.pos<=e)return s.pos;s.popState()}return s.ok?s.pos:t===m?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return t===g||t===_?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===_?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(e,c)))):e}totalInputPositions(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s+=e.totalInputPositions(a,i)})),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map((e=>this._blocks[e])):[]}pad(e){const t=new B;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>t.aggregate(s.pad(e)))),t}}R.DEFAULTS={...D.DEFAULTS,lazy:!0,placeholderChar:"_"},R.STOP_CHAR="`",R.ESCAPE_CHAR="\\",R.InputDefinition=P,R.FixedDefinition=T,E.MaskedPattern=R;class O extends R{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:a=this.maxLength||0,autofix:i=this.autofix,...n}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).length,a),this.autofix=i;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(e){let t="",s="";const[,a,i]=e.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(t="0".repeat(a.length)+i,s="9".repeat(a.length)+i),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){let s;return void 0===t&&(t={}),[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(void 0===t&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),a=String(this.to).padStart(this.maxLength,"0"),[i,n]=this.boundaries(this.value+e);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],t):Number(i)>this.to?!t.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(a[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;const[s,a]=this.boundaries(t);return this.from<=Number(a)&&Number(s)<=this.to&&super.doValidate(e)}pad(e){const t=new B;if(this.value.length===this.maxLength)return t;const s=this.value,a=this.maxLength-this.value.length;if(a){this.reset();for(let s=0;s<a;++s)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach((e=>this._appendCharRaw(e)))}return t}}E.MaskedRange=O;class N extends R{static extractPatternOptions(e){const{mask:t,pattern:s,...a}=e;return{...a,mask:l(t)?t:s}}constructor(e){super(N.extractPatternOptions({...N.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:a,...i}={...N.DEFAULTS,...e},n=Object.assign({},N.GET_DEFAULT_BLOCKS());e.min&&(n.Y.from=e.min.getFullYear()),e.max&&(n.Y.to=e.max.getFullYear()),e.min&&e.max&&n.Y.from===n.Y.to&&(n.m.from=e.min.getMonth()+1,n.m.to=e.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=e.min.getDate(),n.d.to=e.max.getDate())),Object.assign(n,this.blocks,a),super._update({...i,mask:l(t)?t:s,blocks:n})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(N.extractPatternOptions(e))}}N.GET_DEFAULT_BLOCKS=()=>({d:{mask:O,from:1,to:31,maxLength:2},m:{mask:O,from:1,to:12,maxLength:2},Y:{mask:O,from:1900,to:9999}}),N.DEFAULTS={...R.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(e,t)=>e?[String(e.getDate()).padStart(2,"0"),String(e.getMonth()+1).padStart(2,"0"),e.getFullYear()].join("."):"",parse:(e,t)=>{const[s,a,i]=e.split(".").map(Number);return new Date(i,a-1,s)}},E.MaskedDate=N;class L extends D{constructor(e){super({...L.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map((e=>{const{expose:t,...s}=C(e),a=w({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return t&&(this.exposeMask=a),a})):[])}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){void 0===e&&(e=""),void 0===t&&(t={}),void 0===s&&(s="");const a=t.tail&&null!=t._beforeTailState?t._beforeTailState._value:this.value,i=this.rawInputValue,n=t.tail&&null!=t._beforeTailState?t._beforeTailState._rawInputValue:i,r=i.slice(n.length),u=this.currentMask,o=new B,l=null==u?void 0:u.state;return this.currentMask=this.doDispatch(e,{...t},s),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),o.tailShift=this.currentMask.value.length-a.length),r&&(o.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):l&&(this.currentMask.state=l)),o}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new B;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:(null==(t=e._beforeTailState)?void 0:t.currentMaskRef)===this.currentMask&&(null==(s=e._beforeTailState)?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return void 0===t&&(t={}),void 0===s&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){void 0===t&&(t={});let[s,a]=super.doPrepare(e,t);if(this.currentMask){let e;[s,e]=super.doPrepare(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}doPrepareChar(e,t){void 0===t&&(t={});let[s,a]=super.doPrepareChar(e,t);if(this.currentMask){let e;[s,e]=super.doPrepareChar(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}reset(){var e;null==(e=this.currentMask)||e.reset(),this.compiledMasks.forEach((e=>e.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask)return this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,void this._applyDispatch();let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isComplete)}get isFilled(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isFilled)}remove(e,t){const s=new B;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((e=>e.state)),currentMaskRef:this.currentMask,currentMask:null==(e=this.currentMask)?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:a,...i}=e;t&&this.compiledMasks.forEach(((e,s)=>e.state=t[s])),null!=s&&(this.currentMask=s,this.currentMask.state=a),super.state=i}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every(((t,s)=>{if(!e[s])return;const{mask:a,...i}=e[s];return f(t,i)&&t.maskEquals(a)})):super.maskEquals(e)}typedValueEquals(e){var t;return Boolean(null==(t=this.currentMask)?void 0:t.typedValueEquals(e))}}L.DEFAULTS={...D.DEFAULTS,dispatch:(e,t,s,a)=>{if(!t.compiledMasks.length)return;const i=t.rawInputValue,n=t.compiledMasks.map(((n,r)=>{const u=t.currentMask===n,o=u?n.displayValue.length:n.nearestInputPos(n.displayValue.length,m);return n.rawInputValue!==i?(n.reset(),n.append(i,{raw:!0})):u||n.remove(o),n.append(e,t.currentMaskFlags(s)),n.appendTail(a),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,m)))}}));return n.sort(((e,t)=>t.weight-e.weight||t.totalInputPositions-e.totalInputPositions)),t.compiledMasks[n[0].index]}},E.MaskedDynamic=L;class U extends R{constructor(e){super({...U.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const e=t.map((e=>e.length)),a=Math.min(...e),i=Math.max(...e)-a;s.mask="*".repeat(a),i&&(s.mask+="["+"*".repeat(i)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){void 0===t&&(t={});const s=Math.min(this.nearestInputPos(0,_),this.value.length),a=this.enum.filter((t=>this.matchValue(t,this.unmaskedValue+e,s)));if(a.length){1===a.length&&this._forEachBlocksInRange(0,this.value.length,((e,s)=>{const i=a[0][s];s>=this.value.length||i===e.value||(e.reset(),e._appendChar(i,t))}));const e=super._appendCharRaw(a[0][this.value.length],t);return 1===a.length&&a[0].slice(this.unmaskedValue.length).split("").forEach((t=>e.aggregate(super._appendCharRaw(t)))),e}return new B({skip:!this.isComplete})}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new V("",e)}remove(e,t){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),e===t)return new B;const s=Math.min(super.nearestInputPos(0,_),this.value.length);let a;for(a=e;a>=0&&!(this.enum.filter((e=>this.matchValue(e,this.value.slice(s,a),s))).length>1);--a);const i=super.remove(a,t);return i.tailShift+=a-e,i}get isComplete(){return this.enum.indexOf(this.value)>=0}}var j;U.DEFAULTS={...R.DEFAULTS,matchValue:(e,t,s)=>e.indexOf(t,s)===s},E.MaskedEnum=U,E.MaskedFunction=class extends D{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}};class $ extends D{constructor(e){super({...$.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t=(this.scale?"("+k(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+"\\d*"+t),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(k).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(k(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){void 0===t&&(t={});const[s,a]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(a.skip=!0),!s||this.allowPositive||this.value||"-"===s||a.aggregate(this._appendChar("-")),[s,a]}_separatorsCount(e,t){void 0===t&&(t=!1);let s=0;for(let a=0;a<e;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return void 0===e&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){void 0===t&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const i=this._value;this._value+=e;const n=this.number;let r,u=!isNaN(n),o=!1;if(u){let e;null!=this.min&&this.min<0&&this.number<this.min&&(e=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(e=this.max),null!=e&&(this.autofix?(this._value=this.format(e,this).replace($.UNMASKED_RADIX,this.radix),o||(o=i===this._value&&!t.tail)):u=!1),u&&(u=Boolean(this._value.match(this._numberRegExp)))}u?r=new B({inserted:this._value.slice(i.length),rawInserted:o?"":e,skip:o}):(this._value=i,r=new B),this._value=this._insertThousandsSeparators(this._value);const l=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(l);return r.tailShift+=(h-a)*this.thousandsSeparator.length,r}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const a=this._findSeparatorAround(t);return a>=0&&(t=a+this.thousandsSeparator.length),[e,t]}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),a=this.value.slice(t),i=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+a));const n=this._separatorsCountFromSlice(s);return new B({tailShift:(n-i)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case p:case c:case m:{const s=this._findSeparatorAround(e-1);if(s>=0){const a=s+this.thousandsSeparator.length;if(e<a||this.value.length<=a||t===m)return s}break}case g:case _:{const t=this._findSeparatorAround(e);if(t>=0)return t+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,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(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,((e,t,s,a)=>t+a)),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){void 0===t&&(t={});const a=0===this.scale&&e!==this.thousandsSeparator&&(e===this.radix||e===$.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,$.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace($.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}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(e){return(super.typedValueEquals(e)||$.EMPTY_VALUES.includes(e)&&$.EMPTY_VALUES.includes(this.typedValue))&&!(0===e&&""===this.value)}}j=$,$.UNMASKED_RADIX=".",$.EMPTY_VALUES=[...D.EMPTY_VALUES,0],$.DEFAULTS={...D.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[j.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},E.MaskedNumber=$;const q={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function z(e,t,s){void 0===t&&(t=q.MASKED),void 0===s&&(s=q.MASKED);const a=w(e);return e=>a.runIsolated((a=>(a[t]=e,a[s])))}E.PIPE_TYPE=q,E.createPipe=z,E.pipe=function(e,t,s,a){return z(t,s,a)(e)},E.RepeatBlock=class extends R{get repeatFrom(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?e:0}get repeatTo(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,a;const{repeat:i,...n}=C(e);this._blockOpts=Object.assign({},this._blockOpts,n);const r=w(this._blockOpts);this.repeat=null!=(t=null!=(s=null!=i?i:r.repeat)?s:this.repeat)?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(a=this._blocks)?void 0:a.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(e){return e<this._blocks.length?this._blocks[e]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(w(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(e,t){void 0===t&&(t={});const s=new B;for(let u,o,l=null!=(a=null==(i=this._mapPosToBlock(this.displayValue.length))?void 0:i.index)?a:Math.max(this._blocks.length-1,0);u=null!=(n=this._blocks[l])?n:o=!o&&this._allocateBlock(l);++l){var a,i,n,r;const h=u._appendChar(e,{...t,_beforeTailState:null==(r=t._beforeTailState)||null==(r=r._blocks)?void 0:r[l]});if(h.skip&&o){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(h),h.consumed)break}return s}_trimEmptyTail(e,t){var s,a;void 0===e&&(e=0);const i=Math.max((null==(s=this._mapPosToBlock(e))?void 0:s.index)||0,this.repeatFrom,0);let n;null!=t&&(n=null==(a=this._mapPosToBlock(t))?void 0:a.index),null==n&&(n=this._blocks.length-1);let r=0;for(let e=n;i<=e&&!this._blocks[e].unmaskedValue;--e,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return void 0===e&&(e=0),null==t&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}};try{globalThis.IMask=E}catch{}var K=s(697);const Y={mask:K.oneOfType([K.array,K.func,K.string,K.instanceOf(RegExp),K.oneOf([Date,Number,E.Masked]),K.instanceOf(E.Masked)]),value:K.any,unmask:K.oneOfType([K.bool,K.oneOf(["typed"])]),prepare:K.func,prepareChar:K.func,validate:K.func,commit:K.func,overwrite:K.oneOfType([K.bool,K.oneOf(["shift"])]),eager:K.oneOfType([K.bool,K.oneOf(["append","remove"])]),skipInvalid:K.bool,onAccept:K.func,onComplete:K.func,placeholderChar:K.string,displayChar:K.string,lazy:K.bool,definitions:K.object,blocks:K.object,enum:K.arrayOf(K.string),maxLength:K.number,from:K.number,to:K.number,pattern:K.string,format:K.func,parse:K.func,autofix:K.oneOfType([K.bool,K.oneOf(["pad"])]),radix:K.string,thousandsSeparator:K.string,mapToRadix:K.arrayOf(K.string),scale:K.number,normalizeZeros:K.bool,padFractionalZeros:K.bool,min:K.oneOfType([K.number,K.instanceOf(Date)]),max:K.oneOfType([K.number,K.instanceOf(Date)]),dispatch:K.func,inputRef:K.oneOfType([K.func,K.shape({current:K.object})])},H=Object.keys(Y).filter((e=>"value"!==e)),X=["value","unmask","onAccept","onComplete","inputRef"],Z=H.filter((e=>X.indexOf(e)<0)),G=function(t){var s;const a=((s=class extends e.Component{constructor(e){super(e),this._inputRef=this._inputRef.bind(this)}componentDidMount(){this.props.mask&&this.initMask()}componentDidUpdate(){const e=this.props,t=this._extractMaskOptionsFromProps(e);var s;t.mask?this.maskRef?(this.maskRef.updateOptions(t),"value"in e&&void 0!==e.value&&(this.maskValue=e.value)):this.initMask(t):(this.destroyMask(),"value"in e&&void 0!==e.value&&(null!=(s=this.element)&&s.isContentEditable&&"INPUT"!==this.element.tagName&&"TEXTAREA"!==this.element.tagName?this.element.textContent=e.value:this.element.value=e.value))}componentWillUnmount(){this.destroyMask()}_inputRef(e){this.element=e,this.props.inputRef&&(Object.prototype.hasOwnProperty.call(this.props.inputRef,"current")?this.props.inputRef.current=e:this.props.inputRef(e))}initMask(e){void 0===e&&(e=this._extractMaskOptionsFromProps(this.props)),this.maskRef=E(this.element,e).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(e){const{...t}=e;return Object.keys(t).filter((e=>Z.indexOf(e)<0)).forEach((e=>{delete t[e]})),t}_extractNonMaskProps(e){const{...t}=e;return H.forEach((e=>{"maxLength"!==e&&delete t[e]})),"defaultValue"in t||(t.defaultValue=e.mask?"":t.value),delete t.value,t}get maskValue(){return this.maskRef?"typed"===this.props.unmask?this.maskRef.typedValue:this.props.unmask?this.maskRef.unmaskedValue:this.maskRef.value:""}set maskValue(e){this.maskRef&&(e=null==e&&"typed"!==this.props.unmask?"":e,"typed"===this.props.unmask?this.maskRef.typedValue=e:this.props.unmask?this.maskRef.unmaskedValue=e:this.maskRef.value=e)}_onAccept(e){this.props.onAccept&&this.maskRef&&this.props.onAccept(this.maskValue,this.maskRef,e)}_onComplete(e){this.props.onComplete&&this.maskRef&&this.props.onComplete(this.maskValue,this.maskRef,e)}render(){return e.createElement(t,{...this._extractNonMaskProps(this.props),inputRef:this._inputRef})}}).displayName=void 0,s.propTypes=void 0,s),i=t.displayName||t.name||"Component";return a.displayName="IMask("+i+")",a.propTypes=Y,e.forwardRef(((t,s)=>e.createElement(a,{...t,ref:s})))}((t=>{let{inputRef:s,...a}=t;return e.createElement("input",{...a,ref:s})})),W=e.forwardRef(((t,s)=>e.createElement(G,{...t,ref:s}))),J=({gateway:t,cpf:s,processProps:a})=>{const i=(0,n.__)("CPF do Comprador","vindi-pagamentos"),[r,u]=(0,e.useState)(s),[o,l]=(0,e.useState)(!1);return(0,e.useEffect)((()=>{const e=document.querySelector("#vindi-pagamentos__billing_persontype");e&&2==e.value?l(!0):l(!1)}),[l]),(0,e.useEffect)((()=>{a({gateway:t,cpf:r})}),[t,r,s,a]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"vindi-pagamentos-document "+(o?"":"vindi-pagamentos-document-hidden")},(0,e.createElement)("label",{htmlFor:`document-${t}`},i,(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(W,{mask:"000.000.000-00",type:"text","aria-label":i,id:`document-${t}`,value:r,onAccept:(e,t)=>u(e),className:"wc-vindi-customer-document wvp-block-field"}))))},Q="vindi-pagamentos-multi-payment",ee=(0,i.getSetting)(`${Q}_data`,{}),te=(0,n.__)("Pagar com dois métodos","vindi-pagamentos"),se=(0,a.decodeEntities)(ee.title)||te,ae=(0,a.decodeEntities)(ee.sandbox||""),ie=(0,a.decodeEntities)(ee.description||""),ne=(0,a.decodeEntities)(ee.gateway||""),re=(0,a.decodeEntities)(ee.showCpf||!1),ue=(0,a.decodeEntities)(ee.price||""),oe=(0,a.decodeEntities)(ee.brand||""),le=(0,a.decodeEntities)(ee.nonceCheckout||""),he=(0,a.decodeEntities)(ee.nonce||""),de=(0,a.decodeEntities)(ee.availableMethods||{}),pe=(0,a.decodeEntities)(ee.savedTokens||[]),ce=(0,a.decodeEntities)(ee.enableSavedCards||!1),{currency:me={}}=window.wcSettings||{},ge=(0,a.decodeEntities)(ee.discountInfo||{}),_e=t=>{const{eventRegistration:s,emitResponse:i}=t,{onPaymentProcessing:l}=s,[h,d]=(0,e.useState)("pix"),[p,c]=(0,e.useState)("credit_card"),[m,g]=(0,e.useState)(""),[_,k]=(0,e.useState)(""),[f,v]=(0,e.useState)(!1),[E,y]=(0,e.useState)(""),[C,w]=(0,e.useState)({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")}),[A,S]=(0,e.useState)(""),[x,b]=(0,e.useState)(""),[F,B]=(0,e.useState)(""),[V,D]=(0,e.useState)(""),[M,I]=(0,e.useState)("1"),[T,P]=(0,e.useState)({}),[R,O]=(0,e.useState)(0),[N,L]=(0,e.useState)("mono/generic"),[U,j]=(0,e.useState)("new"),[$,q]=(0,e.useState)(!0),[z,K]=(0,e.useState)(""),[Y,H]=(0,e.useState)(""),[X,Z]=(0,e.useState)(""),[G,Q]=(0,e.useState)(""),[te,se]=(0,e.useState)("1"),[_e,ke]=(0,e.useState)({}),[fe,ve]=(0,e.useState)(0),[Ee,ye]=(0,e.useState)("mono/generic"),[Ce,we]=(0,e.useState)("new"),[Ae,Se]=(0,e.useState)(!0),[xe,be]=(0,e.useState)(!1),[Fe,Be]=(0,e.useState)(""),[Ve,De]=(0,e.useState)(ue),Me=(0,r.useSelect)((e=>e(u.CART_STORE_KEY).getCartData()));(0,e.useEffect)((()=>{if(Me?.totals?.total_price){const e=parseFloat(Me.totals.total_price)/100;De(e.toString())}}),[Me]),(0,e.useEffect)((()=>{if(Ve){const e=parseFloat(Ve),t=e/2;g(Le(t)),k(Le(e-t))}}),[Ve]),(0,e.useEffect)((()=>{Object.keys(de).length>0?w(de):w({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")})}),[]),(0,e.useEffect)((()=>{h&&Ie(h)}),[h]),(0,e.useEffect)((()=>{"credit_card"===h&&("new"!==U&&pe.length>0?Te(U,"first"):0!==R&&Pe())}),[R,m,U]),(0,e.useEffect)((()=>{"credit_card"===p&&("new"!==Ce&&pe.length>0?Te(Ce,"second"):0!==fe&&Re())}),[fe,_,Ce]),(0,e.useEffect)((()=>{const e=l((async()=>{const e=parseFloat(m),t=parseFloat(ue);if(e<=0||e>=t)return{type:i.responseTypes.ERROR,message:(0,n.__)("O valor do primeiro pagamento deve ser maior que zero e menor que o total.","vindi-pagamentos")};if("credit_card"===h&&"credit_card"===p&&A.replace(/\s/g,"")===z.replace(/\s/g,""))return{type:i.responseTypes.ERROR,message:(0,n.__)("Você não pode usar o mesmo cartão para ambos os métodos de pagamento.","vindi-pagamentos")};const s=String("object"==typeof U?U.id||"new":U),a=String("object"==typeof Ce?Ce.id||"new":Ce),r=R?String(R):"0",u=fe?String(fe):"0",o=String(M),l=String(te);return{type:i.responseTypes.SUCCESS,meta:{paymentMethodData:{multi_payment_enabled:"1",vindi_multi_payment_active:"1",multi_payment:JSON.stringify({first_method:Oe(h),second_method:Oe(p),first_amount:m,second_amount:_}),"vindi-pagamento_nonce":le,first_payment_method:Oe(h),second_payment_method:Oe(p),first_payment_amount:String(m),second_payment_amount:String(_),"wc-vindi-pagamentos-multi-payment-new-save-card":xe?"true":"no",..."credit_card"===h&&"new"!==s?{"first_wc-vindi-pagamentos-credit-payment-token":s,"first_wvp-code":String(V),"first_wvp-installments":o}:{},..."credit_card"===h&&"new"===s?{"first_wc-vindi-pagamentos-credit-payment-token":"new","first_wvp-owner":String(x||"").toUpperCase(),"first_wvp-number":String(A||"").replace(/\s/g,""),"first_wvp-date":String(F||""),"first_wvp-code":String(V||""),"first_wvp-installments":o,"first_wvp-brand":r}:{},..."credit_card"===p&&"new"!==a?{"second_wc-vindi-pagamentos-credit-payment-token":a,"second_wvp-code":String(G||""),"second_wvp-installments":l}:{},..."credit_card"===p&&"new"===a?{"second_wc-vindi-pagamentos-credit-payment-token":"new","second_wvp-owner":String(Y||"").toUpperCase(),"second_wvp-number":String(z||"").replace(/\s/g,""),"second_wvp-date":String(X||""),"second_wvp-code":String(G||""),"second_wvp-installments":l,"second_wvp-brand":u}:{},...re?{"wc-vindi-customer-document":String(Fe||"")}:{}}}}}));return()=>{e()}}),[i.responseTypes.ERROR,i.responseTypes.SUCCESS,l,h,p,m,_,x,A,F,V,M,R,U,Y,z,X,G,te,fe,Ce,xe,Fe]);const Ie=e=>{v(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","vindi_get_compatible_methods"),method:"POST",data:{selected_method:e,target_field:"second",security:le},success:e=>{if(e.success&&e.data){if(w(e.data),!e.data[p]){const t=Object.keys(e.data)[0];t&&c(t)}}else console.error("Error in getCompatibleMethods response:",e),w({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")})},error:(e,t,s)=>{console.error("AJAX error in getCompatibleMethods:",t,s),y((0,n.__)("Não foi possível carregar métodos de pagamento compatíveis.","vindi-pagamentos")),w({credit_card:(0,n.__)("Cartão de Crédito","vindi-pagamentos")})},complete:()=>{v(!1)}})},Te=(e,t)=>{v(!0);const s="first"===t?parseFloat(String(m).replace(/[^\d.,]/g,"").replace(",",".")):parseFloat(String(_).replace(/[^\d.,]/g,"").replace(",","."));jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({token:e,price:s,_wpnonce:he,is_second_method:"second"===t}),success:e=>{e.success&&e.data&&e.data.installments&&("first"===t?P(e.data.installments):ke(e.data.installments))},error:(e,s,a)=>{console.error(`Error fetching ${t} installments for token:`,s,a)},complete:()=>{v(!1)}})},Pe=()=>{0!==R&&(v(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({brand:R,price:parseFloat(String(m).replace(",",".")).toFixed(2),_wpnonce:he}),success:e=>{e.success&&e.data&&e.data.installments&&P(e.data.installments)},error:(e,t,s)=>{console.error("Error fetching first installments:",t,s)},complete:()=>{v(!1)}}))},Re=()=>{0!==fe&&(v(!0),jQuery.ajax({url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","checkout_installments"),method:"POST",contentType:"application/json",data:JSON.stringify({brand:fe,price:parseFloat(String(_).replace(",",".")).toFixed(2),_wpnonce:he,is_second_method:!0}),success:e=>{e.success&&e.data&&e.data.installments&&ke(e.data.installments)},error:(e,t,s)=>{console.error("Error fetching second installments:",t,s)},complete:()=>{v(!1)}}))},Oe=e=>({pix:"vindi-pagamentos-pix",credit_card:"vindi-pagamentos-credit",bolepix:"vindi-pagamentos-bolepix"}[e]||e),Ne=e=>{const t=e.replace(/\s/g,""),s=qe();let a;S(e),s.forEach((e=>{e.regex.test(t)&&!a&&t.length>14&&(a=e,je(e.name,e.code))})),!a&&t.length>14&&je("mono/generic",1)},Le=e=>{const{decimal_separator:t=",",thousand_separator:s=".",precision:a=2,price_format:i="%s %v"}=me,n=String(e).replace(",","."),r=Number(n).toFixed(a);let[u,o]=r.split(".");return u=u.replace(/\B(?=(\d{3})+(?!\d))/g,s),u+t+o},Ue=e=>{const t=e.replace(/\s/g,""),s=qe();let a;K(e),s.forEach((e=>{e.regex.test(t)&&!a&&t.length>14&&(a=e,$e(e.name,e.code))})),!a&&t.length>14&&$e("mono/generic",1)},je=(e,t=0)=>{L(e),t&&t!=R&&O(t)},$e=(e,t=0)=>{ye(e),t&&t!=fe&&ve(t)},qe=()=>[{code:16,name:"elo",regex:/^4011(78|79)|^43(1274|8935)|^45(1416|7393|763(1|2))|^50(4175|6699|67[0-6][0-9]|677[0-8]|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9])|^627780|^63(6297|6368|6369)|^65(0(0(3([1-3]|[5-9])|4([0-9])|5[0-1])|4(0[5-9]|[1-3][0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8]|4[1-9]|[5-8][0-9]|9[0-8])|7(0[0-9]|1[0-8]|2[0-7])|9(0[1-9]|[1-6][0-9]|7[0-8]))|16(5[2-9]|[6-7][0-9])|50(0[0-9]|1[0-9]|2[1-9]|[3-4][0-9]|5[0-8]))/},{code:3,name:"visa",regex:/^4/},{code:4,name:"mastercard",regex:/^5[1-5][0-9]{14}$|^2[2-7][0-9]{14}$/},{code:5,name:"amex",regex:/^3[47]/},{code:25,name:"hipercard",regex:/^(606282|3841)\d{10,15}$/},{code:20,name:"hiper",regex:/^(38|60|637095)\d{14}$/}],ze=e=>{j(e),q("new"===e)},Ke=e=>{we(e),Se("new"===e)},Ye=(t,s)=>"credit_card"===t?He(s):(0,e.createElement)("p",null,`Pagar com ${t}`),He=t=>{const s="first"===t,i=s?A:z,r=s?x:Y,u=s?b:H,o=s?F:X,l=s?B:Z,h=s?V:G,d=s?D:Q,p=s?N:Ee,c=s?M:te,m=s?I:se,g=s?T:_e,_=s?$:Ae;return(0,e.createElement)("div",{className:`wvp-credit-fields ${t}-credit-fields`},(t=>{if(!ce||!pe||0===pe.length)return null;const s="first"===t?U:Ce,a="first"===t?ze:Ke;return(0,e.createElement)("div",{className:"woocommerce-SavedPaymentMethods-wrapper"},(0,e.createElement)("ul",{className:"woocommerce-SavedPaymentMethods wc-saved-payment-methods",style:{listStyle:"none",margin:0},"data-count":pe.length+1},pe.map((i=>(0,e.createElement)("li",{key:i.id,className:"woocommerce-SavedPaymentMethods-token"},(0,e.createElement)("input",{id:`${t}_wc-vindi-pagamentos-credit-payment-token-${i.id}`,type:"radio",name:`${t}_wc-vindi-pagamentos-credit-payment-token`,value:i.id,style:{width:"auto"},className:`woocommerce-SavedPaymentMethods-tokenInput ${t}_credit-token-input`,checked:s===i.id,onChange:()=>a(i.id)}),(0,e.createElement)("label",{htmlFor:`${t}_wc-vindi-pagamentos-credit-payment-token-${i.id}`},`${i.card_type} com final ${i.last4} (expira em ${i.expiry_month}/${i.expiry_year})`)))),(0,e.createElement)("li",{className:"woocommerce-SavedPaymentMethods-new"},(0,e.createElement)("input",{id:`${t}_wc-vindi-pagamentos-credit-payment-token-new`,type:"radio",name:`${t}_wc-vindi-pagamentos-credit-payment-token`,value:"new",style:{width:"auto"},className:`woocommerce-SavedPaymentMethods-tokenInput ${t}_credit-token-input`,checked:"new"===s,onChange:()=>a("new")}),(0,e.createElement)("label",{htmlFor:`${t}_wc-vindi-pagamentos-credit-payment-token-new`},(0,n.__)("Utilizar um novo método de pagamento","vindi-pagamentos")))))})(t),_?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:`${t}-wvp-credit-fields-hide`},(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-wide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-owner`},(0,n.__)("Dono do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(W,{mask:/^[A-Za-z\s]*$/,type:"text",id:`${t}_wvp-card-owner`,className:"wvp-block-field",value:r,onAccept:e=>u(e.toUpperCase())}))),(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-wide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-number`},(0,n.__)("Número do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:`${t}_wvp-brand-icon`,src:`${oe}/${p}.svg`,"data-img":p,alt:"Credit card brand"}),(0,e.createElement)(W,{mask:"0000 0000 0000 0000",type:"text",id:`${t}_wvp-card-number`,className:"wvp-block-field",value:i,placeholder:"0000 0000 0000 0000",onAccept:s?Ne:Ue})))),(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-split`},(0,e.createElement)("div",{className:`${t}-wvp-card-date-hide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-date`},(0,n.__)("Data de expiração","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)(W,{mask:"00/00",type:"text",id:`${t}_wvp-card-date`,className:"wvp-block-field",value:o,placeholder:"MM/YY",onAccept:e=>l(e)}))),(0,e.createElement)("div",null,(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-code`},(0,n.__)("Código do cartão","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:`${t}_wvp-cvv-icon`,src:(0,a.decodeEntities)(ee.codeBrand||""),"data-img":"mono/cvv.svg",alt:"Credit card CVV"}),(0,e.createElement)(W,{mask:"0000",type:"text",id:`${t}_wvp-card-code`,className:"wvp-block-field",value:h,placeholder:"CVV",onAccept:e=>d(e)}))))):(0,e.createElement)("div",{className:"wvp-credit-field wvp-credit-field-wide"},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-code`},(0,n.__)("Código de segurança","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",{className:"wvp-brand-field"},(0,e.createElement)("img",{id:`${t}_wvp-cvv-icon`,src:(0,a.decodeEntities)(ee.codeBrand||""),"data-img":"mono/cvv.svg",alt:"Credit card CVV"}),(0,e.createElement)(W,{mask:"0000",type:"text",id:`${t}_wvp-card-code`,className:"wvp-block-field",value:h,placeholder:"CVV",onAccept:e=>d(e)}))),(0,e.createElement)("div",{className:`${t}-wvp-credit-field wvp-credit-field-wide`},(0,e.createElement)("label",{htmlFor:`${t}_wvp-card-installments`,id:`${t}_wvp-card-installments-label`},(0,n.__)("Parcelas","vindi-pagamentos"),(0,e.createElement)("span",null,"*")),(0,e.createElement)("div",null,(0,e.createElement)("select",{id:`${t}_wvp-card-installments`,value:c,onChange:e=>m(e.target.value)},Object.keys(g).length>0?Object.keys(g).map((t=>(0,e.createElement)("option",{key:t,value:t},g[t]))):(0,e.createElement)("option",null)),(0,e.createElement)("div",{id:`${t}_wvp-installments-error`}))),(0,e.createElement)("input",{type:"hidden",id:`${t}_wvp-card-brand`,value:s?R:fe}))},Xe=({paymentMethod:t})=>{if(!ge||!ge[t]||!ge[t].enabled)return null;const{value:s,text_color:a}=ge[t];return(0,e.createElement)("div",{className:"payment-discount-info"},(0,e.createElement)("span",{style:{color:a,display:"block",marginTop:"8px"}},s," % de desconto"))};return(0,e.useEffect)((()=>{(()=>{const e=document.querySelector('input[name="wc-vindi-pagamentos-multi-payment-new-payment-method"]');e&&e.remove();const t=document.createElement("input");t.type="hidden",t.name="wc-vindi-pagamentos-multi-payment-new-payment-method",t.value=xe?"true":"false",console.log(xe);const s=document.querySelector("form.woocommerce-checkout");s&&s.appendChild(t)})()}),[xe]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(o,{sandbox:ae,description:ie}),(0,e.createElement)("div",{className:"multipayment-container "+(f?"wvp-request-loader":"")},(0,e.createElement)("input",{type:"hidden",name:"vindi_multi_payment_active",id:"vindi_multi_payment_active",value:"1"}),(0,e.createElement)("input",{type:"hidden",name:"_wpnonce",id:"wvp-card-nonce",value:he}),(0,e.createElement)("input",{type:"hidden",id:"wvp-cart-total",name:"wvp-cart-total",value:ue}),(0,e.createElement)("div",{className:"payment-amount-section"},(0,e.createElement)("h4",null,(0,n.__)("Valor para o primeiro método","vindi-pagamentos")),(0,e.createElement)("div",{className:"payment-amount-input-container"},(0,e.createElement)("span",{className:"payment-amount-currency"},"R$"),(0,e.createElement)("input",{type:"text",name:"first_payment_amount",id:"first_payment_amount",className:"input-text wvp-block-field payment-amount-input",value:m,onChange:e=>{const t=e.target.value,s=t.replace(/[^\d.,]/g,"").replace(",","."),a=parseFloat(s),i=parseFloat(ue);if(isNaN(a)||a<=0||a>=i)y((0,n.__)("O valor deve ser maior que zero e menor que o total.","vindi-pagamentos"));else{y(""),g(t);const e=i-a;e<0&&k("0.00"),k(Le(e))}},onBlur:()=>{const e=Le(m);g(e)}})),E&&(0,e.createElement)("p",{className:"payment-amount-error"},E),(0,e.createElement)("input",{type:"hidden",name:"cart_total",id:"cart_total",value:ue})),(0,e.createElement)("div",{className:"first-payment-method"},(0,e.createElement)("h4",null,(0,n.__)("Primeiro método de pagamento","vindi-pagamentos")),(0,e.createElement)("select",{name:"first_payment_method",id:"first_payment_method",className:"select woocommerce-select",value:h,onChange:e=>d(e.target.value)},Object.entries(de).map((([t,s])=>(0,e.createElement)("option",{key:t,value:t},s)))),Ye(h,"first"),(0,e.createElement)(Xe,{paymentMethod:h})),(0,e.createElement)("div",{className:"second-payment-amount"},(0,e.createElement)("h4",null,(0,n.__)("Valor para o segundo método","vindi-pagamentos")),(0,e.createElement)("div",{className:"payment-amount-input-container"},(0,e.createElement)("span",{className:"payment-amount-currency"},"R$"),(0,e.createElement)("input",{type:"text",name:"second_payment_amount",id:"second_payment_amount",className:"input-text wvp-block-field payment-amount-input",value:_,readOnly:!0,style:{backgroundColor:"#f7f7f7"}}))),(0,e.createElement)("div",{className:"second-payment-method"},(0,e.createElement)("h4",null,(0,n.__)("Segundo método de pagamento","vindi-pagamentos")),(0,e.createElement)("select",{name:"second_payment_method",id:"second_payment_method",className:"select woocommerce-select",value:p,onChange:e=>c(e.target.value)},Object.entries(C).map((([t,s])=>(0,e.createElement)("option",{key:t,value:t},s)))),Ye(p,"second"),(0,e.createElement)(Xe,{paymentMethod:p})),ce&&("credit_card"===h||"credit_card"===p)&&(0,e.createElement)("div",{className:"wvp-save-card-option",style:{marginTop:"20px",paddingTop:"15px",borderTop:"1px solid #eee"}},(0,e.createElement)("label",null,(0,e.createElement)("input",{type:"checkbox",id:"wc-vindi-pagamentos-multi-payment-new-payment-method",checked:xe,onChange:e=>be(e.target.checked),style:{marginRight:"8px"}}),(0,n.__)("Salvar cartão para compras futuras","vindi-pagamentos")))),re&&(0,e.createElement)(J,{gateway:ne,cpf:Fe,processProps:e=>{Be(e.cpf)}}))},ke=()=>{const t=(0,a.decodeEntities)(ee.icon||"");return t?(0,e.createElement)("img",{src:t,style:{float:"right",marginRight:"20px"}}):""},fe={name:Q,label:(0,e.createElement)((t=>(0,e.createElement)("span",{style:{width:"100%"}},se,(0,e.createElement)(ke,null))),null),content:(0,e.createElement)(_e,null),edit:(0,e.createElement)(_e,null),canMakePayment:()=>!0,ariaLabel:se,supports:{features:ee.supports,showSaveOption:!1}};(0,t.registerPaymentMethod)(fe)})()})(); -
vindi-pagamentos/trunk/package.json
r3345266 r3346589 1 1 { 2 2 "name": "vindi-pagamentos", 3 "version": "1.0. 1",3 "version": "1.0.2", 4 4 "description": "WooCommerce payment plugin using Vindi gateways", 5 5 "repository": "https://github.com/vindi/vindi-pagamentos", -
vindi-pagamentos/trunk/readme.txt
r3345270 r3346589 1 1 === Vindi Pagamentos === 2 Contributors: a piki, aguiart0, lucastgama, andrenascimento03122 Contributors: aguiart0, lucastgama, andrenascimento0312 3 3 Tags: woocommerce, payment, gateways, vindi, pagamentos 4 4 Requires at least: 6.0 5 5 Tested up to: 6.8 6 Stable tag: 1.0. 16 Stable tag: 1.0.2 7 7 Requires PHP: 7.4 8 8 License: GPLv3 … … 56 56 57 57 == Changelog == 58 = 1.0.2 = 18-08-2025 59 * Correção: Abstract gateway corrigido. 60 * Correção: Valores dos cartões de credito corrigidos. 61 58 62 = 1.0.1 = 15-08-2025 59 63 * Correção: Valores do método de Multimeios de pagamento corrigidos. 60 61 64 62 65 = 1.0.0 = 12-08-2025 -
vindi-pagamentos/trunk/vendor/autoload.php
r3345266 r3346589 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 0685ffe192161dec314a383fad0c3371::getLoader();25 return ComposerAutoloaderInitfc119f5c149a63516aaa669f9cd70667::getLoader(); -
vindi-pagamentos/trunk/vendor/composer/autoload_real.php
r3345266 r3346589 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 0685ffe192161dec314a383fad0c33715 class ComposerAutoloaderInitfc119f5c149a63516aaa669f9cd70667 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 0685ffe192161dec314a383fad0c3371', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInitfc119f5c149a63516aaa669f9cd70667', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 0685ffe192161dec314a383fad0c3371', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInitfc119f5c149a63516aaa669f9cd70667', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit 0685ffe192161dec314a383fad0c3371::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInitfc119f5c149a63516aaa669f9cd70667::getInitializer($loader)); 31 31 32 32 $loader->register(true); 33 33 34 $filesToLoad = \Composer\Autoload\ComposerStaticInit 0685ffe192161dec314a383fad0c3371::$files;34 $filesToLoad = \Composer\Autoload\ComposerStaticInitfc119f5c149a63516aaa669f9cd70667::$files; 35 35 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 36 36 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
vindi-pagamentos/trunk/vendor/composer/autoload_static.php
r3345266 r3346589 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 0685ffe192161dec314a383fad0c33717 class ComposerStaticInitfc119f5c149a63516aaa669f9cd70667 8 8 { 9 9 public static $files = array ( … … 32 32 { 33 33 return \Closure::bind(function () use ($loader) { 34 $loader->prefixLengthsPsr4 = ComposerStaticInit 0685ffe192161dec314a383fad0c3371::$prefixLengthsPsr4;35 $loader->prefixDirsPsr4 = ComposerStaticInit 0685ffe192161dec314a383fad0c3371::$prefixDirsPsr4;36 $loader->classMap = ComposerStaticInit 0685ffe192161dec314a383fad0c3371::$classMap;34 $loader->prefixLengthsPsr4 = ComposerStaticInitfc119f5c149a63516aaa669f9cd70667::$prefixLengthsPsr4; 35 $loader->prefixDirsPsr4 = ComposerStaticInitfc119f5c149a63516aaa669f9cd70667::$prefixDirsPsr4; 36 $loader->classMap = ComposerStaticInitfc119f5c149a63516aaa669f9cd70667::$classMap; 37 37 38 38 }, null, ClassLoader::class); -
vindi-pagamentos/trunk/vendor/composer/installed.php
r3345266 r3346589 2 2 'root' => array( 3 3 'name' => 'vindi/vindi-pagamentos', 4 'pretty_version' => '1.0. 1',5 'version' => '1.0. 1.0',4 'pretty_version' => '1.0.2', 5 'version' => '1.0.2.0', 6 6 'reference' => NULL, 7 7 'type' => 'wordpress-plugin', … … 12 12 'versions' => array( 13 13 'vindi/vindi-pagamentos' => array( 14 'pretty_version' => '1.0. 1',15 'version' => '1.0. 1.0',14 'pretty_version' => '1.0.2', 15 'version' => '1.0.2.0', 16 16 'reference' => NULL, 17 17 'type' => 'wordpress-plugin', -
vindi-pagamentos/trunk/vindi-pagamentos.php
r3345266 r3346589 7 7 * Author: Apiki WordPress 8 8 * Author URI: https://github.com/vindi/ 9 * Version: 1.0. 19 * Version: 1.0.2 10 10 * Requires PHP: 7.4 11 11 * Requires at least: 6.0 … … 15 15 * 16 16 * @link https://vindi.com.br/ 17 * @since 1.0. 117 * @since 1.0.2 18 18 * @package VindiPagamentos 19 19 */
Note: See TracChangeset
for help on using the changeset viewer.