incr-regex-package
Version:
An incremental regular expression parser in JavaScript; useful for input validation, RegExp
1 lines • 41.9 kB
JavaScript
var iRX=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t){if(!t)return t;for(var e=1,n=arguments.length;e<n;e++){var r=arguments[e];if("function"==typeof r||"object"===o(r)&&null!==r)for(var i,u=-1,a=Object.keys(r),s=a?a.length:0;++u<s;)t[i=a[u]]=r[i]}return t}function h(t){return s({},t)}n.r(e);var c=function(){var t=Function.prototype.call,e=(t.bind([].slice),t.bind({}.toString)),n=function(t){return void 0===t},r=function(t){var n="[object "+t+"]";return function(t){return e(t)==n}},i=function(t){var n="[object "+t+"]";return function(r){if(e(r)!==n)throw new TypeError("Expected "+t);return r}},u=r("Array"),a=i("Array"),s=function(t){return function(e){return o(e)==t}},h=function(t){return function(e){if(o(e)!==t)throw new TypeError("Expected a"+("object"===t?"n":"")+t+".");return e}},c=h("function"),f=s("function");h("String");return{int32:function(t){if((0|t)!==t)throw new TypeError("Expected a 32-bit natural.");return t},nat32:function(t){if((0|t)!==t||t<0)throw new TypeError("Expected a 32-bit natural.");return t},func:c,isFunc:f,typeOf:h,isTypeOf:s,arr:a,isArr:u,classOf:i,isClassOf:r,instanceOf:function(t){return function(e){if(!(e instanceof t))throw new TypeError("Expected an instance of "+t);return e}},isUndef:n}}();function f(t){return t}function l(t){var e=[];return e.concat.apply(e,t)}function p(t,e){if(t===e)return!0;if(!t||!e)return!1;if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]instanceof Array&&t[n]instanceof Array){if(!p(t[n],e[n]))return!1}else if(e[n]!==t[n])return!1;return!0}function v(t,e,n){if(!t||!e)return!1;var r=t.length,i=e.length;if(n+i>r)return!1;for(var u=n,o=0;o<i;u++,o++)if(e[o]instanceof Array&&t[u]instanceof Array){if(!v(t[u],e[o],0))return!1}else if(t[u]!==e[o])return!1;return!0}function d(t,e){for(var n=0;n<e.length;n++)t.push(e[n]);return t}function y(t){for(var e=[],n=0,r=t.length;n<=r;n++)e.push(t.charAt(r-n));return e.join("")}"function"!=typeof Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}return e});var g=new RegExp(function(){function t(t){return t.split("").map((function(t){return"\\"+t})).join("|")}var e=t(".|+*?()^$"),n="dDsSbBwW".split("").join("|"),r=t("[]{}\\"),i=[e,n,r].join("|");return["\\[(?:\\\\u|\\\\\\]|\\\\\\\\|(\\\\)?\\[|[^\\]\\[\\\\])*?\\]","\\{(?:\\d+,\\d+|\\d+|\\d+,|,\\d+)\\}","\\\\(?:"+i+")","\\(\\?:|\\?\\?|\\*\\?|\\+\\?",e,"[^.+?{}\\]\\[|()\\\\]"].map((function(t){return"(?:"+t+")"})).join("|")}(),"g");function m(t){var e=t.match(/\{(\d+)(,(\d*))?\}/),n=Number(e[1]);return{min:Number(e[1]),max:e[3]?Number(e[3]):e[2]?void 0:n}}function k(t,e){return void 0===t?e:(t.push(e),t)}var _=function(){function t(e){r(this,t),this.length=0,this.data=[],e&&this.push(e),this.maxLen=0}return u(t,[{key:"forEach",value:function(t){for(var e=this.data,n=0;n<this.length;n++)t(e[n],n,this);return this}},{key:"reduce",value:function(t,e){for(var n=this.data,r=0;r<this.length;r++)e=t(e,n[r],r,this);return e}},{key:"filter",value:function(e){var n=new t,r=this.data;n.maxLen=this.maxLen;for(var i=0;i<this.length;i++)e(r[i],i,this)&&n.push(r[i]);return n}},{key:"map",value:function(e){var n=new t,r=this.data;n.maxLen=this.maxLen;for(var i=0;i<this.length;i++)n.push(e(r[i],i,this));return n}},{key:"toArray",value:function(){return this.reduce(k,[])}},{key:"reset",value:function(){return this.length=0,this.maxLen=0,this}},{key:"contains",value:function(t){for(var e=this.data,n=this.length,r=0;r<n;r++)if(e[r]===t)return this}},{key:"push",value:function(t){return void 0===t?this:this.contains(t)?this:(this.data[this.length++]=t,this.length>this.maxLen&&(this.maxLen=this.length),this)}},{key:"pop",value:function(){return this.length<=0?this:(length--,this)}},{key:"top",value:function(){if(!(this.length<=0))return data[this.length-1]}},{key:"addAll",value:function(t){var e=this;return t?(t.forEach((function(t){return e.push(t)})),this):this}},{key:"clone",value:function(){return this.map((function(t){return t}))}}]),t}(),b=function(){function t(e,n){r(this,t),this.head=e,this.tail=n}return u(t,[{key:"equals",value:function(t){return null!==t&&(this.head===t.head&&this.tail===t.tail)}},{key:"addAll",value:function(t){return t?S(a).reduce((function(t,e){return O(e,t)}),this):this}},{key:"map",value:function(t){return function t(e,n,r){return r=r||0,n?O(e(E(n),r,n),t(e,x(n),r+1)):n}(t,this)}},{key:"reduce",value:function(t,e){return w(t,this,e)}},{key:"reverse",value:function(t){return S(this,t)}}]),t}();function O(t,e,n){return new b(t,e)}function E(t){if(!t)throw Error("n_head of empty list");return t.head}function x(t){if(!t)throw Error("n_tail of empty list");return t.tail}function S(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t?S(x(t),O(E(t),e)):e}function w(t,e,n){return e?w(t,x(e),t(n,E(e))):n}function A(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],r=!0,i=!1,u=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,u=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw u}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function I(){}function N(){}function R(){}function P(){}function C(t,e){return t.toString=function(){return e||t.val},t}Array.prototype.find||(Array.prototype.find=function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],u=0;u<r;u++)if(e=n[u],t.call(i,e,u,n))return e});var T=[!0,void 0],M=[!1,void 0];function L(t){return t!==$?T:M}var j=C({type:"N",val:"<SKIP>",multi:N,op:"SKIP",match:L}),F=C({type:"N",val:"\b",multi:N,op:"SINGLE",match:q(/[\b]/)}),V=C({type:"L",val:")"}),D=C({type:"R",val:")"}),U=C({type:"B",val:"|",op:"OR"}),B=C({type:"U",val:"?",op:"MULTI"}),K=C({type:"U",val:"*",op:"MULTI"}),z=C({type:"U",val:"+",op:"MULTI"}),X=C({type:"B",val:".",op:"."}),Z=function(){return!1},Y=function(){return C({type:"N",val:"(.)",multi:I,op:"ANY",match:L})},$=C({type:"N",val:"DONE",multi:P,op:"DONE",match:Z}),H=C({type:"N",val:"MORE",multi:P,op:"MORE",match:Z}),G=C({type:"N",val:"MAYBE",multi:P,op:"MAYBE",match:Z}),W=C({type:"N",val:"FAILED",multi:P,op:"FAILED",match:Z});function q(t){return function(e){return e===$||void 0!==e&&!e.match(t)?M:T}}var J={"\\d":q(/\d/),"\\D":q(/\D/),"\\s":q(/\s/),"\\S":q(/\S/),"\\w":q(/\w/),"\\W":q(/\W/)};function Q(t){return{type:"N",val:t,multi:I,op:"SPECIAL-CHARSET",match:J[t]}}function tt(t){return{type:"N",val:t,multi:I,op:"CHARSET",match:q(new RegExp(t))}}function et(t){return t&&!t.oper&&t.multi!==P&&t.match}function nt(t){return t&&!t.oper&&t.multi===P&&t.match}function rt(t){return t&&t.oper===X}function it(t){return t&&t.oper===U}function ut(t){return t&&t.oper===B}function ot(t){return t&&t.oper===K}function at(t){return t&&"N"===t.type&&"ANY"===t.op}function st(t){return t&&"N"===t.type&&("CHARSET"===t.op||"SPECIAL-CHARSET"===t.op)}function ht(t,e,n){return t===X?ft(e,n):t===U?lt(e,n):n?{oper:t,left:e,right:n}:e}function ct(t,e){return{oper:t,left:e}}function ft(t,e){return t===j?e:e===j?t:e?{oper:X,left:t,right:e}:t}function lt(t,e){return e?{oper:U,left:t,right:e}:t}function pt(t){return{oper:K,left:t}}function vt(t){return{oper:B,left:t}}function dt(t){return ft(t,pt(yt(t)))}function yt(t){if(void 0!==t){if(t===$)return $;if("N"===t.type&&void 0===t.oper)return{type:"N",val:t.val,multi:t.multi,op:t.op,match:t.match};if(t.left&&(rt(t)||ut(t)||ot(t)||it(t)))return t.right?{oper:t.oper,left:yt(t.left),right:yt(t.right)}:{oper:t.oper,left:yt(t.left)};throw new Error("Copy of an invalid node "+t)}}var gt="⋯",mt="_",kt="◑";function _t(t,e){if((et(t)||nt(t))&&e)return t.nextNode=e,t;if(rt(t)){var n=e?_t(t.right,e):t.right;return _t(t.left,n),t}if(it(t)&&e)return t.left===j?t.left=e:_t(t.left,e),t.right===j?t.right=e:_t(t.right,e),t;if(ut(t)&&e)return _t(t.left,e),t.nextNode=e,t;if(ot(t)&&e){var r=t;return _t(t.left,r),t.nextNode=e,t}return t}function bt(t){if(t&&t!==$){if(rt(t))return bt(t.left);if(et(t))return et(t)(void 0)[1];if(it(t)){var e=bt(t.left);return e===bt(t.right)?e:void 0}ut(t)||ot(t)||nt(t)}}function Ot(t){var e=t&&t.length>0?bt(t.data[0]):void 0;if(void 0!==e)return t.reduce((function(t,e){return t===bt(e)?t:void 0}),e)}function Et(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new _;if(t===$)return e===$?(r.push($),$):W;if(rt(t))return Et(t.left,e,n,r);if(it(t))return xt(Et(t.left,e,n,r),Et(t.right,e,n,r));if(ut(t)||ot(t))return xt(nt(t.left)?$:Et(t.left,e,n,r),Et(t.nextNode,e,n,r));if(et(t)){var i=t.match(e);return i[0]&&r.push(t),i[0]?t.nextNode===$?$:H:W}return nt(t)?e===$?Et(t.nextNode,e,n,r):t.match(n,e)[0]||void 0===e?Et(t.nextNode,e,n,r):W:W}function xt(t,e){return t===W?e:t===G?G:t===H?e===$||e===G?G:H:e===H||e===G?G:$}function St(t,e,n,r){if(r=void 0===r||r!==n?new _:r,n.reduce((function(n,i){return xt(Et(i,t,e,r),n)}),W)!==W&&0!==r.length)return r}function wt(t){for(var e=t.length,n=new _,r=0;r<e;r++){var i=t.data[r];n.push(i===$?$:i.nextNode)}return n}function At(t,e,n){if(t!==n&&t!==$&&void 0!==t)return rt(t)?At(t.left,e,n):it(t)?At(t.left,e,n)||At(t.right,e,n):ut(t)||ot(t)?At(t.left,e,t)||At(t.nextNode,e,n):nt(t)?At(t.nextNode,e,n):et(t)&&e.contains(t)?t:void 0}function It(t,e){var n=A(Pt(t,e),4),r=n[0],i=(n[1],n[2],n[3]);if(r)return function(t){if(void 0===t||t.length<2)return t;for(var e=t.map((function(t){var e=A(t,2),n=A(e[0],2);return[[n[0],n[1]],e[1]]})),n=function(t){var n=A(e[t],2),r=A(n[0],2),i=r[0],u=r[1],o=n[1],a=A(e[t+1],2),s=A(a[0],2),h=s[0],c=(s[1],a[1],i.filter((function(t){return At(t.nextNode,h)}))),f=Ot(c)||o;e[t]=[[c,u],f]},r=e.length-2;r>=0;r--)n(r);return e}(i).reduce((function(t,e){var n=A(e,2);n[0];return t+(n[1]||mt)}),"")}function Nt(t,e){return t.map((function(t){return At(t,e)})).filter((function(t){return void 0!==t}))}function Rt(t,e,n){if(void 0!==n){var r=wt(n),i=St(t===mt?void 0:t,e,r);return void 0!==i?[i,r]:void 0}}function Pt(t,e){var n={};return n.nextNode=t,e.split("").reduce((function(t,e){var n=A(t,4),r=n[0],i=n[1],u=n[2],o=n[3],a=void 0;return r&&(a=Rt(e,i,u)),void 0!==a?(o.push([a,e]),[!0,e,a[0],o]):[!1,i,u,o]}),[!0,void 0,new _(n),[]])}[["matchable",et],["boundary",nt],["dot",rt],["or",it],["zero_or_one",ut],["zero_or_more,",ot],["MORE,",H],["MAYBE,",G],["makeFS",_t],["DONE,",$],["FAILED,",W]].map((function(t){if(void 0===t[1])throw new Error(t[0]+" not defined")}));function Ct(t,e){return e&&t&&t.oper?"("+Ct(t)+")":t&&t.oper?"B"==t.oper.type?"."==t.oper.op?"("+Ct(t.left)+"."+Ct(t.right)+")":"("+Ct(t.left)+"|"+Ct(t.right)+")":"U"==t.oper.type?"("+Ct(t.left,!1)+t.oper.val+")":void 0:t===$?"<DONE>":t.val}function Tt(t,e){return t&&t.oper?"B"==t.oper.type?"."==t.oper.op?e>2?"("+Tt(t.left,2)+Tt(t.right,2)+")":Tt(t.left,2)+Tt(t.right,2):e>1?"("+Tt(t.left,1)+"|"+Tt(t.right,1)+")":Tt(t.left,e+1)+"|"+Tt(t.right,e):"U"==t.oper.type?e>3?"("+Tt(t.left,1)+")"+t.oper.val:Tt(t.left,3)+t.oper.val:void 0:t===$?"<DONE>":t.val||"~~~"}function Mt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}if(!d)throw new Error("array_append is undefined");function Lt(t){return t&&"U"==t.type&&"MULTIRANGE"==t.op}var jt=[!1,void 0],Ft=[!0,void 0];function Vt(t){return function(e){return e===$||void 0!==e&&e!==t?jt:[!0,t]}}function Dt(t){return!/\w|\d/.test(t||".")}function Ut(t,e){var n=!t||Dt(t),r=Dt(e);return n&&!r||!n&&r?Ft:jt}function Bt(){return!1}var Kt={"*":K,"+":z,"?":B},zt={t:"\t",n:"\n",r:"\r"};function Xt(t,e){return!(t<e)&&(t>e||(1&+t)>0)}var Zt=[{match:["(","|",")"],put:["(",")"]},{match:["<SKIP>","|","<SKIP>"],put:["<SKIP>"]},{match:["<SKIP>","<SKIP>"],put:["<SKIP>"]},{match:["(","<SKIP>",")"],put:["<SKIP>"]},{match:["<SKIP>","*"],put:["<SKIP>"]},{match:["<SKIP>","+"],put:["<SKIP>"]},{match:["(","|"],put:["(","<SKIP>","|"]},{match:["|",")"],put:["|","<SKIP>",")"]},{match:["|","|"],put:["|","<SKIP>","|"]},{match:["(",")"],put:["<SKIP>"]}];function Yt(t,e){for(var n=0;n<Zt.length;n++)if(v(t,Zt[n].match,e))return Zt[n]}function $t(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=Yt(t,n);i?(d(e,i.put),n+=i.match.length-1):e.push(t[n])}return e}var Ht=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.operand=[],this.operator=[],this.basePrec=0,this.wasOp=!0,this.lastop=void 0}var e,n,r;return e=t,r=[{key:"parse",value:function(e){"string"!=typeof e&&(e=e.toString().replace(/\\\//g,"/").replace(/^\/|\/$/g,""));var n=function(t){t&&("|"==t[t.length-1]&&(t=t.concat("<SKIP>")),"|"==t[0]&&(t=["<SKIP>"].concat(t)));for(var e=$t(t);!p(t,e);)e=$t(t=e);return t}(e.match(g)),r=(n=n||[]).reduce((function(t,e){return t.addToken(e)}),new t);return r.val()&&r.pushOp(X,0),r.operand.push($),r.pushOp(void 0,-1),_t(r.val())}}],(n=[{key:"toString",value:function(){return"{ operand: "+this.operand.map(Ct)+" operator: "+this.operator.map((function(t){return t.toString()}))+" prec: "+this.BasePrec+" wasOp: "+this.wasOp+"}"}},{key:"opState",value:function(t,e,n){var r=function(t){return t?"OPERATOR":"OPERAND"};if(this.lastop=n,this.wasOp!=t)throw new Error("RegExp parsing expected: "+r(t)+" but was: "+r(this.wasOp));this.wasOp=e}},{key:"addToken",value:function(t){if(!t)return this.finishUp();var e,n="<SKIP>"==(e=t)?j:"("==e||"(?:"==e?V:")"==e?D:"."==e?Y():"[\\b]"==e?F:"^"==e||"$"==e?{type:"N",val:e,multi:P,op:"BOUNDARY",match:Bt}:"\\b"==e||"\\B"==e?{type:"N",val:e,multi:P,op:"BOUNDARY",match:Ut}:/^\[.*\]$/.test(e)?tt(e):"|"==e?U:/^[?+*]\??$/.test(e)?Kt[e.substring(0,1)]:/^\{[^}]*\}$/.test(e)?{type:"U",val:e,op:"MULTIRANGE",fn:m(e)}:/^\\[dDsSwW]$/.test(e)?Q(e):/^\\[trn]$/.test(e)?{type:"N",val:zt[e.substring(1,2)],multi:N,op:"NON-PRINTING",match:__match("\\"+e.substring(1))}:/^\\[.?+*{}()$^\\:|\][]$/.test(e)?{type:"N",val:e.substring(1,2),multi:N,op:"SINGLE",match:Vt(e.substring(1))}:{type:"N",val:e,multi:N,op:"SINGLE",match:Vt(e)};switch("N"!=n.type&&"L"!=n.type||this.wasOp||(this.pushOp(X,this.basePrec+4),this.opState(!1,!0)),n.type){case"L":this.opState(!0,!0,V),this.basePrec+=10;break;case"R":if(this.opState(!1,!1,D),this.basePrec-=10,this.basePrec<0)throw Error("Syntax error "+this.basePrec);break;case"":case"B":this.pushOp(n,this.basePrec+2),this.opState(!1,!0,n);break;case"U":this.pushOp(n,this.basePrec+7),this.opState(!1,!1,n);break;case"N":this.operand.push(n),this.opState(!0,!1,n);break;default:throw Error("Syntax error - in regexp")}return this}},{key:"pushOp",value:function(t,e){for(var n=this.topV()||{prec:-100};n&&Xt(n.prec,e);){var r,i;i=this.popOper(),n.op.type&&"B"!==n.op.type?Lt(n.op)?this.operand.push(this.applyMulti(n.op,i)):n.op===z?this.oneOrMore(i):this.unaryOp(n.op,i):(r=this.popOper(),this.operand.push(ht(n.op,r,i))),this.operator.pop(),n=this.topV()}e>=0&&this.operator.push({op:t,prec:e})}},{key:"finishUp",value:function(){return void 0===this.wasOp?this:(this.wasOp?this.pushOp(void 0,-1):(this.pushOp(X,0),this.operand.push($),this.pushOp(void 0,-1)),this.wasOp=void 0,this)}},{key:"val",value:function(){return 0===this.operand.length?void 0:this.operand[this.operand.length-1]}},{key:"topV",value:function(){return 0===this.operator.length?void 0:this.operator[this.operator.length-1]}},{key:"popOper",value:function(){return this.operand.pop()}},{key:"applyMulti",value:function(t,e){var n,r=t.fn.min,i=t.fn.max;if(nt(e))throw new SyntaxError("repetition of boundary element: '"+e.val+"'' has no meaning");var u=function(t,e,r){if(0===r)return t;for(n=0;n<r;n++)e=yt(e),t=t?ft(t,e):e;return t||e};return 0===r?void 0===i?pt(e):u(void 0,vt(e),i):void 0===i?u(u(void 0,e,r),pt(e),1):u(u(e,e,r-1),vt(yt(e)),i-r)}},{key:"oneOrMore",value:function(t){if(nt(t))throw new SyntaxError("repetition of boundary element: "+t.val+" has no meaning");this.operand.push(dt(t))}},{key:"unaryOp",value:function(t,e){if(nt(e))throw new SyntaxError("modifier ("+t.val+") of boundary element: "+e.val+" has no meaning");this.operand.push(ct(t,e))}}])&&Mt(e.prototype,n),r&&Mt(e,r),t}();function Gt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Wt(t,e){return new fe(t,e)}function qt(t){return t.split("").map((function(t){return"*"===t?gt:"?"===t?kt:"_"===t?mt:t})).join("")}function Jt(t){return t===mt||Qt(t)}function Qt(t){return t===kt||t===gt}function te(t){return t===mt}function ee(t,e){t.length<e.length?t.length:e.length;for(var n=function(t,e){for(var n=0;n<t.length;n++)if(!e(t.charAt(n)))return t.substring(n+1,t.length);return t}(function(t,e){return y(function(t,e){for(var n=0;n<t.length&&n<e.length;n++)if(t.charAt(n)!==e.charAt(n))return t.substring(0,n);return t.length<e.length?t:e}(y(t),y(e)))}(t,e),Qt),r="",i=function(t){var e=0;return function(n){switch(n){case 1:return e<t.length?t.charAt(e):void 0;case 2:e++;break;default:return e<t.length}}},u=function(t,e){return t==e||Qt(t)&&Qt(e)},o=function(t,e){return t===gt?t:e},a=i(t),s=i(e);a()&&s();){var h=a(1),c=s(1),f=Qt(h)||Qt(c);u(h,c)?(r+=o(h,c),a(2),s(2)):f?Qt(h)?(r+=h,a(2)):(r+=c,s(2)):(r+=mt,a(2),s(2))}return function(t,e){function n(t,e,n){for(var r=t.length-n,i=0;i<n;r++,i++)if(t.charAt(r)!==e.charAt(i))return!1;return!0}for(var r=Math.min(t.length,e.length);r>0;r--)if(n(t,e,r))return t.substr(0,t.length-r)+e;return t+e}(r,n)}function ne(t,e,n,r,i){var u=function(t,n){return ot(t)?e(n,gt):n};return(function o(a,s,h){if(!a)return t(s);if(h&&a===E(h))return o(a.nextNode,u(a,s),x(h));if(a===$)return t(s);if(rt(a))return o(a.left,s,h);if(it(a)){var c=o(a.left,s,h),f=o(a.right,s,h);return n(c,f)}if(ut(a))return r?r(a,s,o,h):o(a.nextNode,e(s,kt),h);if(ot(a))return r?r(a,s,o,h):o(a.nextNode,e(s,gt),h);if(et(a)){var l=et(a)(void 0)[1]||(i?i(a,mt):mt);return o(a.nextNode,e(s,l),h)}if(nt(a))return o(a.nextNode,s,h);return t(s)})}function re(t,e,n){return function(r,i){return r.reduce((function(n,r){return e(n,t(r,i))}),n())}}function ie(t,e){if(!t)return e;switch(t.val){case"[0-9]":case"\\d":return"9̲";case"[A-Za-z]":case"[a-zA-Z]":case"[a-z]":return"a̲";case"[A-Z]":return"A̲";case"[0-9A-Za-z]":case"[A-Z0-9a-z]":case"[A-Za-z0-9]":case"[0-9a-zA-Z]":case"[a-z0-9A-Z]":case"[a-zA-Z0-9]":return"z̲";default:return e}}[["matchable",et],["boundary",nt],["dot",rt],["or",it],["zero_or_one",ut],["zero_or_more,",ot],["MORE,",H],["MAYBE,",G],["makeFS",_t],["DONE,",$],["FAILED,",W]].map((function(t){if(void 0===t[1])throw new Error(t[0]+" not defined")}));var ue,oe,ae=function(t,e){var n=function(t){return void 0===t?[]:[t]},r=function(t,e){return l([t,e])},i=e?function(t,e,n,i){if(t.left){var u=n(t.nextNode,e,i),o=n(t.left,e,ot(t)?O(t,i):i);return r(u,o)}}:void 0;return re(ne(n,(function(t,e){return t+e}),r,i,t),(function(t,e){return l(k(t,e))}),n)},se=ae(ie,!0),he=ae(ie,!1),ce=(oe=re(ne(ue=function(t){return t},(function(t,e){return t+e}),(function(t,e){return ee(t,e)})),(function(t,e){return ee(t||e,e)}),ue),function(t){return function(t){for(var e,n=[],r=0;r<t.length;r++){var i=t.charAt(r);Qt(i)&&e===i||(e=i,n.push(i))}return n.join("")}(oe(t,""))});var fe=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var r=30;e||n?(!n&&e&&(n=Ht.parse(e)),this.str=e,this.base=n,this.tracker=[],this.current=new _(n),this.one=this.current,this.two=new _,this.lastCh=void 0,this.maxLen=0,this.mask=void 0,this._len=30):(this.str="",this.base=void 0,this.tracker=void 0,this.current=void 0,this.one=this.current,this.two=void 0,this.lastCh=void 0,this.maxLen=0,this._mask=void 0,(r=function t(e){if(!e)return 0;if(e===$)return 0;if(rt(e))return function(t,e){return-1===t||-1===e?-1:t+e}(t(e.left),t(e.right));if(it(e)){var n=t(e.left);return n>=0&&n===t(e.right)?n:-1}return ut(e)||ot(e)?-1:et(e)?et(e)(void 0)[1]:nt(e)?t(e.left):0}(this.base))<=0&&(r=30),this._len=r)}var e,n,r;return e=t,(n=[{key:"toString",value:function(){return this.str}},{key:"getInputLength",value:function(){return this.tracker.length}},{key:"isDone",value:function(t){return(t>=this.tracker.length||void 0===t)&&this.state()===$}},{key:"getTree",value:function(){return this.base}},{key:"minChars",value:function(){return this._mask=ce(this.current),this._mask}},{key:"minCharsList",value:function(t){return function(t){for(var e={},n=[],r=0;r<t.length;r++)t[r]in e||(n.push(t[r]),e[t[r]]=!0);return n}((t?se:he)(this.current,this.inputStr()))}},{key:"match",value:function(t){var e=Ot(this.current),n=this.test(t===mt?void 0:t);return void 0===n&&t&&function(t){var e=t.charCodeAt(0);return e>=97&&e<=122}(t)&&(n=this.test(t.toUpperCase()),t=t.toUpperCase()),this._update(n,t,e)}},{key:"matchStr",value:function(t){var e=t.length,n=!0,r=0,i=0;for(i=0;i<e;i++){var u=t[i];if(!this.match(u)){n=!1;break}this.lastCh=u,r++}return[n,r,t.substring(0,i)]}},{key:"state",value:function(){return this._state=this._state||this._stateCompute(),this._state}},{key:"stateStr",value:function(){var t=this.state();return t===H?"MORE":t===G?"OK":"DONE"}},{key:"inputStr",value:function(){return this.tracker.map((function(t){return t[0]})).join("")}},{key:"fixed",value:function(){return Ot(this.current)}},{key:"getCurrentStates",value:function(){return this.current.map(f)}},{key:"reset",value:function(){return this.tracker=[],this.current.reset(),this.current.push(this.base),this.lastCh=void 0,this._state=void 0,this._mask=void 0,this}},{key:"clone",value:function(){var t=Wt();return t.str=this.str,t.base=this.base,t.tracker=this.tracker.slice(0),t.one=this.one.map(f),t.two=this.two.map(f),t.current=this.current==this.one?t.one:t.two,t.lastCh=this.lastCh,t._state=this._state,t._mask=void 0,t._len=this.length,t}},{key:"getInputTracker",value:function(){return this.tracker.map(f)}},{key:"_after",value:function(t,e){return e?this.tracker.filter((function(n,r){return r>=e&&(t||void 0===n[1])})).map((function(t){return t[0]})).join(""):(t?this.tracker:this.tracker.filter((function(t){return void 0===t[1]}))).map((function(t){return t[0]})).join("")}},{key:"_getArr",value:function(){return this.current===this.one?this.two.reset():this.one.reset()}},{key:"action",value:function(t,e,n,r){if(t===$)return e===$?(n.push($),$):W;if(rt(t))return this.action(t.left,e,n,r);if(it(t)){var i=this.action(t.left,e,n,r),u=this.action(t.right,e,n,r);return this._result(i,u)}if(ut(t)||ot(t)){var o=nt(t.left)?$:this.action(t.left,e,n,!0),a=this.action(t.nextNode,e,n,r);return this._result(o,a)}if(et(t)){var s=t.match(e);return s[0]&&n.push(t.nextNode),s[0]?t.nextNode===$?$:H:W}return nt(t)?r?W:e===$?this.action(t.nextNode,e,n):t.match(this.lastCh,e)[0]||void 0===e?this.action(t.nextNode,e,n):W:W}},{key:"_result",value:function(t,e){return t===e?t:t===H||e===H?H:void 0}},{key:"test",value:function(t,e){var n=this;e=e||this.current;var r=W,i=this._getArr();if(e.forEach((function(e){r=n._result(n.action(e,t,i),r)})),r!==W&&0!==i.length)return i}},{key:"_update",value:function(t,e,n){return void 0!==t&&(this.tracker.push([void 0===e?mt:e,n]),t.maxLen>this.maxLen&&(this.maxLen=t.maxLen),this.current=t,this.lastCh=e,this._state=void 0,this._mask=void 0),void 0!==t}},{key:"_stateCompute",value:function(){return void 0===this.test(void 0)?$:function(t){return void 0!==t&&t.filter((function(t){return t===$})).length===t.length}(this.test($))?G:H}},{key:"length",get:function(){return this._len}}])&&Gt(e.prototype,n),r&&Gt(e,r),t}();function le(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function pe(t,e){var n=t[e];void 0!==n[1]&&n[0]!==n[1]&&(n[0]=n[1])}var ve=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.matcher=e,this._lastEditableIndex=void 0}var e,n,r;return e=t,(n=[{key:"getFirstEditableAtOrAfter",value:function(t){for(var e=t,n=this.getInputTracker();e<n.length;e++){if(void 0===n[e][1])return e;pe(n,e)}var r=this.minChars();e=n.length;for(var i=0;i<r.length&&!Jt(r.charAt(i));i++,e++);return e}},{key:"fixTracker",value:function(){for(var t=this.getInputTracker(),e=0;e<t.length;e++)pe(t,e)}},{key:"getFirstEditableAtOrBefore",value:function(t){var e=this.getInputTracker();for(t>=e.length&&(t=e.length-1);t>0;t--){if(void 0===e[t][1])return t;pe(e,t)}return 0}},{key:"getInputLength",value:function(){return this.matcher.getInputLength()}},{key:"updateFixed",value:function(){var t=this.matcher.inputStr();return null!=(t=It(this.matcher.base,t))&&(this.matcher.reset(),this.matcher.matchStr(t),!0)}},{key:"setPos",value:function(t){if(void 0!==t){var e=this.getInputTracker(),n=e.map((function(t){return t[0]})).join("").substr(0,t);for(this.reset(),this.matchStr(n),e=this.getInputTracker();e.length<t&&void 0!==this.fixed();)if(!this.match(this.fixed())){t=this.getInputLength();break}this._resetCache()}return t}},{key:"toString",value:function(){return this.matcher.toString()}},{key:"after",value:function(t){return this.matcher._after(!0,t)}},{key:"valueWithMask",value:function(){return this.matcher.valueWithMask()}},{key:"rawValue",value:function(t){return this.matcher.rawValue(t)}},{key:"_after",value:function(t,e){return this.matcher._after(t,e)}},{key:"isDone",value:function(t){return this.matcher.isDone(t)}},{key:"setToFirstEditableAfter",value:function(t){return void 0===t&&(t=this.getInputLength()),this.setPos(this.getFirstEditableAtOrAfter(t))}},{key:"lastEditableIndex",value:function(){if(void 0===this._lastEditableIndex){var t=this.getInputTracker(),e=this.clone(),n=this.getFirstEditableAtOrAfter(t.length);e.setPos(n),e.state()===$&&(n=t.length),this._lastEditableIndex=n}return this._lastEditableIndex}},{key:"getTree",value:function(){return this.matcher.getTree()}},{key:"minChars",value:function(t){if(void 0===t)return this.matcher.minChars();var e=this.matcher.clone(),n=this.matcher._after(!0,0).substring(0,t);if(e.reset(),!e.matchStr(n)[0])throw new Error("Unexpected error (matchStr failed) from "+e.constructor.name||!1);return e.minChars()}},{key:"minCharsList",value:function(t){return this.matcher.minCharsList(t)}},{key:"emptyAt",value:function(t){var e=this.getInputTracker();return t<e.length&&te(e[t][0])}},{key:"match",value:function(t){this._resetCache();var e=this.matcher.match(t);return this.fixTracker(),e}},{key:"matchStr",value:function(t){this._resetCache();var e=this.matcher.matchStr(t);return this.fixTracker(),e}},{key:"state",value:function(){return this.matcher.state()}},{key:"fixed",value:function(){return this.matcher.fixed()}},{key:"reset",value:function(){return this.matcher.reset(),this._resetCache(),this}},{key:"clone",value:function(){return new t(this.matcher.clone())}},{key:"getInputTracker",value:function(){return this.matcher.tracker}},{key:"getFullTracker",value:function(){var t=this.getInputTracker(),e=this.matcher.minChars().map((function(t){return Jt(t)?[t,void 0]:[t,t]}));return[].concat(t,e)}},{key:"_resetCache",value:function(){this._lastEditableIndex=void 0}},{key:"stateStr",value:function(){return this.matcher.stateStr()}},{key:"length",get:function(){return this.matcher.length}}])&&le(e.prototype,n),r&&le(e,r),t}();function de(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],r=!0,i=!1,u=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,u=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw u}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ye(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ge(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function me(t,e,n){return e&&ge(t.prototype,e),n&&ge(t,n),t}function ke(t,e){return e=e||t,{start:Math.min(t,e),end:Math.max(t,e)}}function _e(t,e,n){return be(ke(t.start+e,t.end+(void 0===n?e:n)))}function be(t,e,n,r){n=n||function(t){return t},r=r||n;var i=function(t,e,n){return n(Math.max(Math.min(t,e.end),e.start))};return e?{start:i(t.start,e,r),end:i(t.end,e,n)}:t}function Oe(t){return!function(t){return t?t.end-t.start:0}(t)}var Ee=function(){function t(e){if(ye(this,t),null===(e=s({pattern:null,selection:{start:0,end:0},value:"",history:{data:[],index:null,lastOp:null}},e)).pattern)throw new Error("RXInputMask: you must provide a pattern.");this.setPattern(e.pattern,{value:e.value,selection:e.selection,history:e.history})}return me(t,[{key:"getState",value:function(){return{pattern:this.pattern.clone(),selection:_e(this.selection,0),value:this._getValue(),history:{data:[],index:null,lastOp:null}}}},{key:"input",value:function(t){if(Oe(this.selection)&&this.pattern.isDone(this.selection.start))return!1;var e=de(this._input(t,this.selection,this.pattern),3),n=e[0],r=e[1],i=e[2];if(!n)return!1;var u=[this._getValue(),this.selection,this.pattern],o=u[0],a=u[1],s=u[2];return this._lastOp="input",this.selection=r,this.pattern=i,this.value=this.getValue(),null!==this._historyIndex&&(this._history.splice(this._historyIndex,this._history.length-this._historyIndex),this._historyIndex=null),("input"!==this._lastOp||!Oe(a)||null!==this._lastSelection&&a.start!==this._lastSelection.start)&&this._history.push({value:o,selection:a,lastOp:this._lastOp,pattern:s}),this._lastSelection=a,!0}},{key:"_input",value:function(t,e,n){Oe(e)&&n.emptyAt(e.start)&&(e=_e(e,0,1));var r=n.clone(),i=e,u=i.start,o=i.end;e=this._updateSelection(e,r.getFirstEditableAtOrAfter(e.start)),o=r.getFirstEditableAtOrAfter(e.end),r.updateFixed(u,o);var a=Ie(r,!1,o),s=e.start;if(r.setPos(s),r.fixTracker(),void 0!==t&&!Ae(r,t))return[!1,e,r];e=this._updateSelection(e,r.getInputLength()),o=Math.max(o,e.end);var h=r.getFirstEditableAtOrAfter(r.getInputLength()),c=this._insertRest(a,r,s,o+1);return Se(c||r),c.fixTracker(),[!0,ke(h,h),c||r]}},{key:"_insertRest",value:function(t,e,n,r){return function t(e,n,r,i,u){if(e>=n.length)return r;if(i>u||r.isDone())return r;var o=r.clone();if(Ae(o,n.charAt(e))){var a=t(e+1,n,o,o.getInputLength()-1,u);if(void 0!==a)return a}for(;we(r,!1););return r.match(void 0),t(e,n,r,i+1,u)}(0,t,e,n,r+t.length)}},{key:"backspace",value:function(){var t=this.pattern.getFirstEditableAtOrAfter(0);if(this.selection.start<t||this.selection.end<t)return!1;var e=h(this.selection),n=this._getValue(),r=this.selection,i=r.start,u=r.end;if(i===u){if(u=(i=this.pattern.getFirstEditableAtOrBefore(i-1))+1,i<t)return}else if(u===(i=this.pattern.getFirstEditableAtOrBefore(u<i?u:i))&&u++,u<=t)return;var o=this._input(void 0,ke(i,u),this.pattern),a=this.pattern;return!!o[0]&&(this.pattern=o[2],this.selection.start=this.selection.end=i,this.pattern.fixTracker(),null!==this._historyIndex&&this._history.splice(this._historyIndex,this._history.length-this._historyIndex),("backspace"!==this._lastOp||e.start!==e.end||null!==this._lastSelection&&e.start!==this._lastSelection.start)&&this._history.push({value:n,selection:e,lastOp:this._lastOp,pattern:a}),this._lastOp="backspace",this._lastSelection=h(e),!0)}},{key:"del",value:function(){return Oe(this.selection)?(this.right(this.selection),this.backspace()):this.backspace()}},{key:"paste",value:function(t){var e={value:this.value.slice(),selection:h(this.selection),_lastOp:this._lastOp,_history:this._history.slice(),_historyIndex:this._historyIndex,_lastSelection:h(this._lastSelection),pattern:this.pattern.clone()},n=this.getRawValueAt(this.selection.end);this.pattern.setPos(this.selection.start);var r=this._setValueFrom(this.selection.start,t);return this.selection.end=this.pattern.getInputLength(),!(!r||!this._setValueFrom(this.selection.end,n))||(s(this,e),!1)}},{key:"undo",value:function(){if(0===this._history.length||0===this._historyIndex)return!1;var t;if(null===this._historyIndex){this._historyIndex=this._history.length-1,t=this._history[this._historyIndex];var e=this._getValue();t.value===e&&t.selection.start===this.selection.start&&t.selection.end===this.selection.end||this._history.push({value:e,selection:h(this.selection),lastOp:this._lastOp,startUndo:!0,pattern:this.pattern.clone()})}else t=this._history[--this._historyIndex];return this.pattern=t.pattern,this.setValue(t.value),this.selection=t.selection,this._lastOp=t.lastOp,!0}},{key:"redo",value:function(){if(0===this._history.length||null===this._historyIndex)return!1;var t=this._history[++this._historyIndex];return this._historyIndex===this._history.length-1&&(this._historyIndex=null,t.startUndo&&this._history.pop()),this.pattern=t.pattern.clone(),this.setValue(t.value),this.selection=t.selection,this._lastOp=t.lastOp,!0}},{key:"left",value:function(t){var e=h(t);return e&&Oe(e)&&(e.start=e.end=t.start-1,this.setSelection(e)),this}},{key:"right",value:function(t){var e=h(t);return e&&e.start===e.end&&(e.start=e.end=t.start+1,this.setSelection(e)),this}},{key:"setPattern",value:function(t,e){for(e=s({value:""},e),this.pattern=new ve(Wt(t)),this.setValue(e.value),this.emptyValue=this.pattern.minChars(),this.setSelection(e.selection);this.skipFixed(!0););if(Oe(this.selection)&&0!==this.pattern.getInputTracker().length){var n=this._getValue();this.setValue(n),this.selection.start=this.selection.end=n.length}return this._resetHistory(),this}},{key:"select",value:function(t,e){return this.selection=e<t?ke(e,t):ke(t,e),this}},{key:"setSelection",value:function(t){var e=this,n=t===this.selection?this.selection:h(t),r=this.selection||n,i=function(t){return e.pattern.getFirstEditableAtOrAfter(t)},u=function(t){return e.pattern.getFirstEditableAtOrBefore(t)};this.selection=r;var o,a,s=ke(i(0),this.pattern.lastEditableIndex());return Oe(n)?this.selection=be(n,s,(o=this.selection,a=n,o.start>a.start?u:i)):this.selection=be(n,s,i,u),this}},{key:"_adjustSelection",value:function(t,e){return Oe(t)?ke(e?this.pattern.getFirstEditableAtOrAfter(t.start):this.pattern.getFirstEditableAtOrBefore(t.start)):ke(this.pattern.getFirstEditableAtOrBefore(t.start),this.pattern.getFirstEditableAtOrAfter(t.end))}},{key:"_setValueFrom",value:function(t,e){var n=this.pattern.clone(),r=!0;void 0!==t&&n.setPos(t);for(var i=0;i<e.length&&r;i++){r&=Ae(n,e.charAt(i))}return r&&(Se(n),this.pattern=n),r}},{key:"setValue",value:function(t){var e=new Ne("RXInputMask:");if(this.getValue()===t)return!0;var n=this.pattern.clone();null===t&&(t=""),n.reset(),e.println("iterate over",t,"length:",t.length);for(var r=0;r<t.length;r++){var i=t.charAt(r);if(e.print("index: ",r,"char:",i,"minChars:",n.minChars(),"sameAsRest",xe(t.substring(r),n.minChars()),"---"),xe(t.substring(r),n.minChars()))break;if(te(i)&&(i=void 0),!Ae(n,i))return!1}return this.pattern=n,this.value=this.getValue(),!0}},{key:"minCharsList",value:function(t){return this.pattern.minCharsList(t)}},{key:"getSelection",value:function(){return h(this.selection)}},{key:"_getValue",value:function(){return Ie(this.pattern,!0,0)}},{key:"getValue",value:function(){return Ie(this.pattern,!0,0)+this.pattern.minChars()}},{key:"getRawValue",value:function(){return Ie(this.pattern,!1,0)}},{key:"getRawValueAt",value:function(t){return Ie(this.pattern,!1,t)}},{key:"reset",value:function(){return this.pattern.reset(),this._resetHistory(),this.value=this.getValue(),this.selection.start=this.selection.end=0,this.setSelection(this.selection),this}},{key:"_resetHistory",value:function(){return this._history=[],this._historyIndex=null,this._lastOp=null,this._lastSelection=h(this.selection),this}},{key:"_updateSelection",value:function(t,e){var n=h(t);return n.start=e,e>n.end&&(n.end=e),n}},{key:"skipFixed",value:function(t){return we(this.pattern,t)}},{key:"isDone",value:function(){var t=this.pattern.clone(),e=this.getValue().split("");if(function(t,e){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}((function(t){return te(t)}),e))return"MORE";t.reset();for(var n=0;n<e.length;n++)if(!Jt(e[n])&&!t.match(e[n]))return"MORE";return t.stateStr()}}]),t}();function xe(t,e){return t===e}function Se(t){for(var e=t.minChars(),n=0;e.length>n&&!Jt(e.charAt(0));n++){if(!t.match(e.charAt(0)))return n>0;e=t.minChars()}return n>0}function we(t,e){var n=t.minChars();if(!0!==(e=!!e)&&n.length>1&&Qt(n.charAt(0))&&!Jt(n.charAt(1))){if(t.match(n.charAt(1)))return!0}else if(n.length>0&&!Jt(n.charAt(0)))return t.match(n.charAt(0));return!1}function Ae(t,e){if(t.match(e))return!0;for(var n=t.clone();we(t,!1);)if(t.match(e))return!0;return t.reset(),t.matchStr(Ie(n,!0,0)),!1}function Ie(t,e,n){var r=t.getInputTracker();return n?r.filter((function(t,r){return r>=n&&(e||void 0===t[1])})).map((function(t){return t[0]})).join(""):(e?r:r.filter((function(t){return void 0===t[1]}))).map((function(t){return t[0]})).join("")}var Ne=function(){function t(e){ye(this,t),this.content=e||""}return me(t,[{key:"print",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.content+=","+(e||[]).map((function(t){return JSON.stringify(t)})).join(" "),this}},{key:"println",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return this.print.apply(this,e),this.content+="\n",this}},{key:"flush",value:function(){console.log(this.content),this.content=""}}]),t}();if(n.d(e,"MANY",(function(){return I})),n.d(e,"TERM",(function(){return N})),n.d(e,"PERHAPS_MORE",(function(){return R})),n.d(e,"BOUNDARY",(function(){return P})),n.d(e,"matchable",(function(){return et})),n.d(e,"boundary",(function(){return nt})),n.d(e,"dot",(function(){return rt})),n.d(e,"or",(function(){return it})),n.d(e,"zero_or_one",(function(){return ut})),n.d(e,"zero_or_more",(function(){return ot})),n.d(e,"anychar",(function(){return at})),n.d(e,"charset",(function(){return st})),n.d(e,"OP",(function(){return C})),n.d(e,"SKIP",(function(){return j})),n.d(e,"BS",(function(){return F})),n.d(e,"LP",(function(){return V})),n.d(e,"RP",(function(){return D})),n.d(e,"OR",(function(){return U})),n.d(e,"ZERO_OR_ONE",(function(){return B})),n.d(e,"ZERO_OR_MORE",(function(){return K})),n.d(e,"ONE_OR_MORE",(function(){return z})),n.d(e,"DOT",(function(){return X})),n.d(e,"FALSE",(function(){return Z})),n.d(e,"DONE",(function(){return $})),n.d(e,"MAYBE",(function(){return G})),n.d(e,"MORE",(function(){return H})),n.d(e,"FAILED",(function(){return W})),n.d(e,"RX_OP",(function(){return ht})),n.d(e,"RX_UNARY",(function(){return ct})),n.d(e,"RX_CONS",(function(){return ft})),n.d(e,"RX_OR",(function(){return lt})),n.d(e,"RX_ZERO_OR_ONE",(function(){return vt})),n.d(e,"RX_ZERO_OR_MORE",(function(){return pt})),n.d(e,"RX_ONE_OR_MORE",(function(){return dt})),n.d(e,"copyNode",(function(){return yt})),n.d(e,"stdRxMeta",(function(){return Q})),n.d(e,"makeCharSet",(function(){return tt})),n.d(e,"makeFSM",(function(){return _t})),n.d(e,"rxMatchArr",(function(){return St})),n.d(e,"rxNextState",(function(){return wt})),n.d(e,"rxMatch",(function(){return Et})),n.d(e,"rxCanReach",(function(){return At})),n.d(e,"rxGetActualStartState",(function(){return Nt})),n.d(e,"advancedRxMatcher",(function(){return Pt})),n.d(e,"incrRegEx",(function(){return Wt})),n.d(e,"printExpr",(function(){return Ct})),n.d(e,"printExprS",(function(){return Tt})),n.d(e,"RxParser",(function(){return Ht})),n.d(e,"RXInputMask",(function(){return Ee})),n.d(e,"contract",(function(){return c})),n.d(e,"RxMatcher",(function(){return ve})),n.d(e,"IREGEX",(function(){return fe})),n.d(e,"convertMask",(function(){return qt})),n.d(e,"isMeta",(function(){return Jt})),n.d(e,"isOptional",(function(){return Qt})),n.d(e,"isHolder",(function(){return te})),void 0===Wt)throw new Error("incrRegEx not defined");if(void 0===Ee)throw new Error("RXInputMask not defined");if(void 0===ve)throw new Error("RxMatcher not defined")}]);