"use strict";const e={filler:"*",maskType:1,prefixType:1,prefixLimit:0,prefixSpecifyChar:"",suffixType:1,suffixLimit:0,suffixSpecifyChar:"",ignoreChar:"",useUnrealMask:!1,unrealMaskLength:1};exports.useTextMask=function(t={}){const r={...e,...t};function n(e){return r.filler.repeat(e.length)}function i(e){if(e.length<=1)return e;const t=e[0];if(2===e.length)return t+r.filler;const n=e.slice(-1);return t+r.filler.repeat(e.length-2)+n}function s(e){if(e.length<=7)return e;const t=e.slice(0,3),n=e.slice(-4);return t+r.filler.repeat(e.length-7)+n}function l(e){const t=e.indexOf("@");if(e.length<=3||t>-1&&t<3)return e;let n=0,i=e.length-3;t>0&&(n=t,i=t-3);const s=e.slice(0,3),l=n?e.slice(n):"";return s+r.filler.repeat(i)+l}function f(e){if(e.length<=9)return e;const t=e.slice(0,6),n=e.slice(-3);return t+r.filler.repeat(4)+n}function a(e){const t=e.split(".");if(t.length<1)return e;const n=("."+r.filler.repeat(3)).repeat(3);return t[0]+n}function p(e){if(e.length<=3)return e;const t=e[0],n=e.slice(-2);return t+r.filler.repeat(e.length-3)+n}function u(e){if(e.length<=10)return e;const t=e.slice(0,6),n=e.slice(-4);return t+r.filler.repeat(e.length-10)+n}function c(e){let t=0,n=0;if(2===r.prefixType&&(t=r.prefixLimit||0),(3===r.prefixType||4===r.prefixType)&&r.prefixSpecifyChar){let n=e.indexOf(r.prefixSpecifyChar);n>-1&&(t=3===r.prefixType?n:n+r.prefixSpecifyChar.length)}if(2===r.suffixType&&(n=r.suffixLimit||0),(3===r.suffixType||4===r.suffixType)&&r.suffixSpecifyChar){let t=e.indexOf(r.suffixSpecifyChar);t>-1&&(n=3===r.suffixType?e.length-t-r.suffixSpecifyChar.length:e.length-t)}if(t+n>=e.length)return e;const i=t?e.slice(0,t):"",s=n?e.slice(-n):"";let l="";if(r.ignoreChar){const i=r.ignoreChar.split(","),s=e.slice(t,e.length-n),f=new RegExp("("+i.map((e=>e.replace(/\*/g,"\\*"))).join("|")+")","g");let a=s.split(f);a=a.map((e=>{if(e&&!i.includes(e)){const t=r.useUnrealMask?r.unrealMaskLength||1:e.length;e=r.filler.repeat(t)}return e})),l=a.join("")}else{const i=r.useUnrealMask?r.unrealMaskLength||1:e.length-t-n;l=r.filler.repeat(i)}return i+l+s}return{maskAll:n,maskName:i,maskPhoneNumber:s,maskEmailAddress:l,maskIdNumber:f,maskIPAddress:a,maskLicensePlate:p,maskBankCard:u,maskCustom:c,getMaskedText:function(e){return e?1===r.maskType?n(e):2===r.maskType?i(e):3===r.maskType?s(e):4===r.maskType?l(e):5===r.maskType?f(e):6===r.maskType?a(e):7===r.maskType?p(e):8===r.maskType?u(e):0===r.maskType?c(e):e:""}}};