1"use strict";var VanillaOTP=function(t,e=null){if(this.emptyChar=" ","string"==typeof t)this.container=document.querySelector(t);else{if(!(t instanceof Element))return;this.container=t}e&&("string"==typeof e?this.updateTo=document.querySelector(e)||null:e instanceof Element?this.updateTo=e:this.updateTo=null),this.inputs=Array.from(this.container.querySelectorAll("input[type=text], input[type=number], input[type=password]"));let n=this,u=n.inputs.length;for(let t=0;t<u;t++){let e=n.inputs[t];e.addEventListener("input",(function(){if(isNaN(e.value))return e.value=e.dataset.otpInputRestore||"",n._updateValue();if(0==e.value.length)return n._saveInputValue(t);if(1==e.value.length)return n._saveInputValue(t),n._updateValue(),void(t+1<u&&n.inputs[t+1].focus());if(t==u-1)return n._setInputValue(t,e.value);let i=e.value.split("");for(let e=0;e<i.length&&!(e+t>=u);e++)n._setInputValue(e+t,i[e]);let l=Math.min(u-1,t+i.length);n.inputs[l].focus()})),e.addEventListener("keydown",(function(i){if(8==i.keyCode&&""==e.value&&0!=t)return n._setInputValue(t-1,""),void n.inputs[t-1].focus();if(46==i.keyCode&&t!=u-1){let l=e.selectionStart||0;for(let e=t+l;e<u-1;e++)n._setInputValue(e,n.inputs[e+1].value);return n._setInputValue(u-1,""),e.selectionStart&&(e.selectionStart=l),void i.preventDefault()}37!=i.keyCode||null!=e.selectionStart&&0!=e.selectionStart?39!=i.keyCode||null!=e.selectionStart&&e.selectionEnd!=e.value.length||t+1<u&&(i.preventDefault(),n.inputs[t+1].focus(),n.inputs[t+1].select()):t>0&&(i.preventDefault(),n.inputs[t-1].focus(),n.inputs[t-1].select())}))}};VanillaOTP.prototype.setEmptyChar=function(t){this.emptyChar=t},VanillaOTP.prototype.getValue=function(){let t="",e=this;return this.inputs.forEach((function(n){t+=""==n.value?e.emptyChar:n.value})),t},VanillaOTP.prototype.setValue=function(t){if(isNaN(t))return void console.error("Please enter an integer value.");let e=(t=""+t).split("");for(let t=0;t<this.inputs.length;t++)this._setInputValue(t,e[t]||"")},VanillaOTP.prototype._setInputValue=function(t,e){return isNaN(e)?console.error("Please enter an integer value."):this.inputs[t]?(this.inputs[t].value=String(e).substring(0,1),this._saveInputValue(t),void this._updateValue()):console.error("Index not found.")},VanillaOTP.prototype._saveInputValue=function(t,e){if(!this.inputs[t])return console.error("Index not found.");this.inputs[t].dataset.otpInputRestore=e||this.inputs[t].value},VanillaOTP.prototype._updateValue=function(){this.updateTo&&(this.updateTo.value=this.getValue())};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.