{"version":3,"file":"ngx-textmask.mjs","sources":["../../../projects/ngx-textmask/src/lib/core/constants.ts","../../../projects/ngx-textmask/src/lib/core/utilities.ts","../../../projects/ngx-textmask/src/lib/core/conformToMask.ts","../../../projects/ngx-textmask/src/lib/core/adjustCaretPosition.ts","../../../projects/ngx-textmask/src/lib/core/createTextMaskInputElement.ts","../../../projects/ngx-textmask/src/lib/angular2TextMask.ts","../../../projects/ngx-textmask/src/public-api.ts","../../../projects/ngx-textmask/src/ngx-textmask.ts"],"sourcesContent":["export const placeholderChar = '_';\nexport const strFunction = 'function';\n","import {placeholderChar as defaultPlaceholderChar} from './constants';\n\nconst emptyArray: any[] = [];\n\nexport function convertMaskToPlaceholder(mask: (string | RegExp)[] = emptyArray, placeholderChar: string = defaultPlaceholderChar) {\n  if (!isArray(mask)) {\n    throw new Error(\n      'Text-mask:convertMaskToPlaceholder; The mask property must be an array.'\n    );\n  }\n\n  if (mask.indexOf(placeholderChar) !== -1) {\n    throw new Error(\n      'Placeholder character must not be used as part of the mask. Please specify a character ' +\n      'that is not present in your mask as your placeholder character.\\n\\n' +\n      `The placeholder character that was received is: ${JSON.stringify(placeholderChar)}\\n\\n` +\n      `The mask that was received is: ${JSON.stringify(mask)}`\n    );\n  }\n\n  return mask.map((char) => {\n    return (char instanceof RegExp) ? placeholderChar : char;\n  }).join('');\n}\n\nexport function isArray(value: any): value is any[] {\n  return (Array.isArray && Array.isArray(value)) || value instanceof Array;\n}\n\nexport function isString(value: any): value is string {\n  return typeof value === 'string' || value instanceof String;\n}\n\nexport function isNumber(value: any): value is number {\n  return typeof value === 'number' && !isNaN(value);\n}\n\nexport function isNil(value: any): value is null | undefined {\n  return typeof value === 'undefined' || value === null;\n}\n\nconst strCaretTrap = '[]';\nexport function processCaretTraps(mask: (string | RegExp)[]) {\n  const indexes: number[] = [];\n\n  let indexOfCaretTrap: number;\n  while(indexOfCaretTrap = mask.indexOf(strCaretTrap), indexOfCaretTrap !== -1) { // eslint-disable-line\n    indexes.push(indexOfCaretTrap);\n\n    mask.splice(indexOfCaretTrap, 1);\n  }\n\n  return {maskWithoutCaretTraps: mask, indexes};\n}\n","import {convertMaskToPlaceholder, isArray, processCaretTraps} from './utilities';\nimport {placeholderChar as defaultPlaceholderChar, strFunction} from './constants';\n\nconst emptyArray = [];\nconst emptyString = '';\n\ninterface Config {\n  guide?: boolean;\n  previousConformedValue?: string;\n  placeholderChar?: string;\n  placeholder?: string;\n  currentCaretPosition?: number | null;\n  keepCharPositions?: boolean;\n}\n\nexport default function conformToMask(rawValue = emptyString, mask: any, config: Config = {}) {\n  if (config.currentCaretPosition === null) {\n    config.currentCaretPosition = 0;\n  }\n  if (!isArray(mask)) {\n    // If someone passes a function as the mask property, we should call the\n    // function to get the mask array - Normally this is handled by the\n    // `createTextMaskInputElement:update` function - this allows mask functions\n    // to be used directly with `conformToMask`\n    if (typeof mask === strFunction) {\n      // call the mask function to get the mask array\n      mask = mask(rawValue, config);\n\n      // mask functions can setup caret traps to have some control over how the caret moves. We need to process\n      // the mask for any caret traps. `processCaretTraps` will remove the caret traps from the mask\n      mask = processCaretTraps(mask).maskWithoutCaretTraps;\n    } else {\n      throw new Error(\n        'Text-mask:conformToMask; The mask property must be an array.'\n      );\n    }\n  }\n\n  // These configurations tell us how to conform the mask\n  // const {\n  //   guide = true,\n  //   previousConformedValue = emptyString,\n  //   placeholderChar = defaultPlaceholderChar,\n  //   placeholder = convertMaskToPlaceholder(mask, placeholderChar),\n  //   currentCaretPosition,\n  //   keepCharPositions\n  // } = config\n\n  const {\n    guide = true,\n    previousConformedValue = emptyString,\n    placeholderChar = defaultPlaceholderChar,\n    placeholder = convertMaskToPlaceholder(mask, placeholderChar),\n    currentCaretPosition = 0,\n    keepCharPositions\n  } = config\n\n  // The configs below indicate that the user wants the algorithm to work in *no guide* mode\n  const suppressGuide = !guide && previousConformedValue !== undefined;\n\n  // Calculate lengths once for performance\n  const rawValueLength = rawValue.length;\n  const previousConformedValueLength = previousConformedValue.length;\n  const placeholderLength = placeholder.length;\n  const maskLength = mask.length;\n\n  // This tells us the number of edited characters and the direction in which they were edited (+/-)\n  const editDistance = rawValueLength - previousConformedValueLength;\n\n  // In *no guide* mode, we need to know if the user is trying to add a character or not\n  const isAddition = editDistance > 0;\n\n  // Tells us the index of the first change. For (438) 394-4938 to (38) 394-4938, that would be 1\n  const indexOfFirstChange = currentCaretPosition + (isAddition ? -editDistance : 0);\n\n  // We're also gonna need the index of last change, which we can derive as follows...\n  const indexOfLastChange = indexOfFirstChange + Math.abs(editDistance);\n\n  // If `conformToMask` is configured to keep character positions, that is, for mask 111, previous value\n  // _2_ and raw value 3_2_, the new conformed value should be 32_, not 3_2 (default behavior). That's in the case of\n  // addition. And in the case of deletion, previous value _23, raw value _3, the new conformed string should be\n  // __3, not _3_ (default behavior)\n  //\n  // The next block of logic handles keeping character positions for the case of deletion. (Keeping\n  // character positions for the case of addition is further down since it is handled differently.)\n  // To do this, we want to compensate for all characters that were deleted\n  if (keepCharPositions === true && !isAddition) {\n    // We will be storing the new placeholder characters in this variable.\n    let compensatingPlaceholderChars = emptyString;\n\n    // For every character that was deleted from a placeholder position, we add a placeholder char\n    for (let i = indexOfFirstChange; i < indexOfLastChange; i++) {\n      if (placeholder[i] === placeholderChar) {\n        compensatingPlaceholderChars += placeholderChar;\n      }\n    }\n\n    // Now we trick our algorithm by modifying the raw value to make it contain additional placeholder characters\n    // That way when the we start laying the characters again on the mask, it will keep the non-deleted characters\n    // in their positions.\n    rawValue = (\n      rawValue.slice(0, indexOfFirstChange) +\n      compensatingPlaceholderChars +\n      rawValue.slice(indexOfFirstChange, rawValueLength)\n    );\n  }\n\n  // Convert `rawValue` string to an array, and mark characters based on whether they are newly added or have\n  // existed in the previous conformed value. Identifying new and old characters is needed for `conformToMask`\n  // to work if it is configured to keep character positions.\n  const rawValueArr = rawValue\n    .split(emptyString)\n    .map((char, i) => ({char, isNew: i >= indexOfFirstChange && i < indexOfLastChange}));\n\n  // The loop below removes masking characters from user input. For example, for mask\n  // `00 (111)`, the placeholder would be `00 (___)`. If user input is `00 (234)`, the loop below\n  // would remove all characters but `234` from the `rawValueArr`. The rest of the algorithm\n  // then would lay `234` on top of the available placeholder positions in the mask.\n  for (let i = rawValueLength - 1; i >= 0; i--) {\n    const {char} = rawValueArr[i];\n\n    if (char !== placeholderChar) {\n      const shouldOffset = i >= indexOfFirstChange && previousConformedValueLength === maskLength;\n\n      if (char === placeholder[(shouldOffset) ? i - editDistance : i]) {\n        rawValueArr.splice(i, 1);\n      }\n    }\n  }\n\n  // This is the variable that we will be filling with characters as we figure them out\n  // in the algorithm below\n  let conformedValue = emptyString;\n  let someCharsRejected = false;\n\n  // Ok, so first we loop through the placeholder looking for placeholder characters to fill up.\n  placeholderLoop: for (let i = 0; i < placeholderLength; i++) {\n    const charInPlaceholder = placeholder[i];\n\n    // We see one. Let's find out what we can put in it.\n    if (charInPlaceholder === placeholderChar) {\n      // But before that, do we actually have any user characters that need a place?\n      if (rawValueArr.length > 0) {\n        // We will keep chipping away at user input until either we run out of characters\n        // or we find at least one character that we can map.\n        while (rawValueArr.length > 0) {\n          // Let's retrieve the first user character in the queue of characters we have left\n                    const rawValueCharResult = rawValueArr.shift();\n          if (!rawValueCharResult) {\n            continue;\n          }\n          const {char: rawValueChar, isNew} = rawValueCharResult;\n\n          // If the character we got from the user input is a placeholder character (which happens\n          // regularly because user input could be something like (540) 90_-____, which includes\n          // a bunch of `_` which are placeholder characters) and we are not in *no guide* mode,\n          // then we map this placeholder character to the current spot in the placeholder\n          if (rawValueChar === placeholderChar && suppressGuide !== true) {\n            conformedValue += placeholderChar;\n\n            // And we go to find the next placeholder character that needs filling\n            continue placeholderLoop;\n\n          // Else if, the character we got from the user input is not a placeholder, let's see\n          // if the current position in the mask can accept it.\n          } else if (mask[i].test(rawValueChar)) {\n            // we map the character differently based on whether we are keeping character positions or not.\n            // If any of the conditions below are met, we simply map the raw value character to the\n            // placeholder position.\n            if (\n              keepCharPositions !== true ||\n              isNew === false ||\n              previousConformedValue === emptyString ||\n              guide === false ||\n              !isAddition\n            ) {\n              conformedValue += rawValueChar;\n            } else {\n              // We enter this block of code if we are trying to keep character positions and none of the conditions\n              // above is met. In this case, we need to see if there's an available spot for the raw value character\n              // to be mapped to. If we couldn't find a spot, we will discard the character.\n              //\n              // For example, for mask `1111`, previous conformed value `_2__`, raw value `942_2__`. We can map the\n              // `9`, to the first available placeholder position, but then, there are no more spots available for the\n              // `4` and `2`. So, we discard them and end up with a conformed value of `92__`.\n              const rawValueArrLength = rawValueArr.length;\n              let indexOfNextAvailablePlaceholderChar = null;\n\n              // Let's loop through the remaining raw value characters. We are looking for either a suitable spot, ie,\n              // a placeholder character or a non-suitable spot, ie, a non-placeholder character that is not new.\n              // If we see a suitable spot first, we store its position and exit the loop. If we see a non-suitable\n              // spot first, we exit the loop and our `indexOfNextAvailablePlaceholderChar` will stay as `null`.\n              for (let i = 0; i < rawValueArrLength; i++) {\n                const charData = rawValueArr[i];\n\n                if (charData.char !== placeholderChar && charData.isNew === false) {\n                  break;\n                }\n\n                if (charData.char === placeholderChar) {\n                  indexOfNextAvailablePlaceholderChar = i;\n                  break;\n                }\n              }\n\n              // If `indexOfNextAvailablePlaceholderChar` is not `null`, that means the character is not blocked.\n              // We can map it. And to keep the character positions, we remove the placeholder character\n              // from the remaining characters\n              if (indexOfNextAvailablePlaceholderChar !== null) {\n                conformedValue += rawValueChar;\n                rawValueArr.splice(indexOfNextAvailablePlaceholderChar, 1);\n\n              // If `indexOfNextAvailablePlaceholderChar` is `null`, that means the character is blocked. We have to\n              // discard it.\n              } else {\n                i--;\n              }\n            }\n\n            // Since we've mapped this placeholder position. We move on to the next one.\n            continue placeholderLoop;\n          } else {\n            someCharsRejected = true;\n          }\n        }\n      }\n\n      // We reach this point when we've mapped all the user input characters to placeholder\n      // positions in the mask. In *guide* mode, we append the left over characters in the\n      // placeholder to the `conformedString`, but in *no guide* mode, we don't wanna do that.\n      //\n      // That is, for mask `(111)` and user input `2`, we want to return `(2`, not `(2__)`.\n      if (suppressGuide === false) {\n        conformedValue += placeholder.substr(i, placeholderLength);\n      }\n\n      // And we break\n      break;\n\n    // Else, the charInPlaceholder is not a placeholderChar. That is, we cannot fill it\n    // with user input. So we just map it to the final output\n    } else {\n      conformedValue += charInPlaceholder;\n    }\n  }\n\n  // The following logic is needed to deal with the case of deletion in *no guide* mode.\n  //\n  // Consider the silly mask `(111) /// 1`. What if user tries to delete the last placeholder\n  // position? Something like `(589) /// `. We want to conform that to `(589`. Not `(589) /// `.\n  // That's why the logic below finds the last filled placeholder character, and removes everything\n  // from that point on.\n  if (suppressGuide && isAddition === false) {\n    let indexOfLastFilledPlaceholderChar = null;\n\n    // Find the last filled placeholder position and substring from there\n    for (let i = 0; i < conformedValue.length; i++) {\n      if (placeholder[i] === placeholderChar) {\n        indexOfLastFilledPlaceholderChar = i;\n      }\n    }\n\n    if (indexOfLastFilledPlaceholderChar !== null) {\n      // We substring from the beginning until the position after the last filled placeholder char.\n      conformedValue = conformedValue.substr(0, indexOfLastFilledPlaceholderChar + 1);\n    } else {\n      // If we couldn't find `indexOfLastFilledPlaceholderChar` that means the user deleted\n      // the first character in the mask. So we return an empty string.\n      conformedValue = emptyString;\n    }\n  }\n\n  return {conformedValue, meta: {someCharsRejected}};\n}\n","const defaultArray: any[] = [];\nconst emptyString = '';\n\ninterface AdjustCaretPositionArgs {\n  previousConformedValue?: string;\n  previousPlaceholder?: string;\n  currentCaretPosition?: number | null;\n  conformedValue: string;\n  rawValue: string;\n  placeholderChar: string;\n  placeholder: string;\n  indexesOfPipedChars?: any[];\n  caretTrapIndexes?: any[];\n}\n\nexport default function adjustCaretPosition({\n  previousConformedValue = emptyString,\n  previousPlaceholder = emptyString,\n  currentCaretPosition = 0,\n  conformedValue,\n  rawValue,\n  placeholderChar,\n  placeholder,\n  indexesOfPipedChars = defaultArray,\n  caretTrapIndexes = defaultArray\n}: AdjustCaretPositionArgs) {\n  if (currentCaretPosition === 0 || !rawValue.length) { return 0; }\n  if (currentCaretPosition === null) { return 0; }\n\n  // Store lengths for faster performance?\n  const rawValueLength = rawValue.length;\n  const previousConformedValueLength = previousConformedValue.length;\n  const placeholderLength = placeholder.length;\n  const conformedValueLength = conformedValue.length;\n\n  // This tells us how long the edit is. If user modified input from `(2__)` to `(243__)`,\n  // we know the user in this instance pasted two characters\n  const editLength = rawValueLength - previousConformedValueLength;\n\n  // If the edit length is positive, that means the user is adding characters, not deleting.\n  const isAddition = editLength > 0;\n\n  // This is the first raw value the user entered that needs to be conformed to mask\n  const isFirstRawValue = previousConformedValueLength === 0;\n\n  // A partial multi-character edit happens when the user makes a partial selection in their\n  // input and edits that selection. That is going from `(123) 432-4348` to `() 432-4348` by\n  // selecting the first 3 digits and pressing backspace.\n  //\n  // Such cases can also happen when the user presses the backspace while holding down the ALT\n  // key.\n  const isPartialMultiCharEdit = editLength > 1 && !isAddition && !isFirstRawValue;\n\n  // This algorithm doesn't support all cases of multi-character edits, so we just return\n  // the current caret position.\n  //\n  // This works fine for most cases.\n  if (isPartialMultiCharEdit) { return currentCaretPosition; }\n\n  // For a mask like (111), if the `previousConformedValue` is (1__) and user attempts to enter\n  // `f` so the `rawValue` becomes (1f__), the new `conformedValue` would be (1__), which is the\n  // same as the original `previousConformedValue`. We handle this case differently for caret\n  // positioning.\n  const possiblyHasRejectedChar = isAddition && (\n    previousConformedValue === conformedValue ||\n    conformedValue === placeholder\n  );\n\n  let startingSearchIndex = 0;\n  let trackRightCharacter;\n  let targetChar: string = '';\n\n  if (possiblyHasRejectedChar) {\n    startingSearchIndex = currentCaretPosition - editLength;\n  } else {\n    // At this point in the algorithm, we want to know where the caret is right before the raw input\n    // has been conformed, and then see if we can find that same spot in the conformed input.\n    //\n    // We do that by seeing what character lies immediately before the caret, and then look for that\n    // same character in the conformed input and place the caret there.\n\n    // First, we need to normalize the inputs so that letter capitalization between raw input and\n    // conformed input wouldn't matter.\n    const normalizedConformedValue = conformedValue.toLowerCase();\n    const normalizedRawValue = rawValue.toLowerCase();\n\n    // Then we take all characters that come before where the caret currently is.\n    const leftHalfChars = normalizedRawValue.substr(0, currentCaretPosition).split(emptyString);\n\n    // Now we find all the characters in the left half that exist in the conformed input\n    // This step ensures that we don't look for a character that was filtered out or rejected by `conformToMask`.\n    const intersection = leftHalfChars.filter((char) => normalizedConformedValue.indexOf(char) !== -1);\n\n    // The last character in the intersection is the character we want to look for in the conformed\n    // value and the one we want to adjust the caret close to\n    targetChar = intersection[intersection.length - 1];\n\n    // Calculate the number of mask characters in the previous placeholder\n    // from the start of the string up to the place where the caret is\n    const previousLeftMaskChars = previousPlaceholder\n      .substr(0, intersection.length)\n      .split(emptyString)\n      .filter(char => char !== placeholderChar)\n      .length;\n\n    // Calculate the number of mask characters in the current placeholder\n    // from the start of the string up to the place where the caret is\n    const leftMaskChars = placeholder\n      .substr(0, intersection.length)\n      .split(emptyString)\n      .filter(char => char !== placeholderChar)\n      .length;\n\n    // Has the number of mask characters up to the caret changed?\n    const masklengthChanged = leftMaskChars !== previousLeftMaskChars;\n\n    // Detect if `targetChar` is a mask character and has moved to the left\n    const targetIsMaskMovingLeft = (\n      previousPlaceholder[intersection.length - 1] !== undefined &&\n      placeholder[intersection.length - 2] !== undefined &&\n      previousPlaceholder[intersection.length - 1] !== placeholderChar &&\n      previousPlaceholder[intersection.length - 1] !== placeholder[intersection.length - 1] &&\n      previousPlaceholder[intersection.length - 1] === placeholder[intersection.length - 2]\n    );\n\n    // If deleting and the `targetChar` `is a mask character and `masklengthChanged` is true\n    // or the mask is moving to the left, we can't use the selected `targetChar` any longer\n    // if we are not at the end of the string.\n    // In this case, change tracking strategy and track the character to the right of the caret.\n    if (\n      !isAddition &&\n      (masklengthChanged || targetIsMaskMovingLeft) &&\n      previousLeftMaskChars > 0 &&\n      placeholder.indexOf(targetChar) > -1 &&\n      rawValue[currentCaretPosition] !== undefined\n    ) {\n      trackRightCharacter = true;\n      targetChar = rawValue[currentCaretPosition];\n    }\n\n    // It is possible that `targetChar` will appear multiple times in the conformed value.\n    // We need to know not to select a character that looks like our target character from the placeholder or\n    // the piped characters, so we inspect the piped characters and the placeholder to see if they contain\n    // characters that match our target character.\n\n    // If the `conformedValue` got piped, we need to know which characters were piped in so that when we look for\n    // our `targetChar`, we don't select a piped char by mistake\n    const pipedChars = indexesOfPipedChars.map((index) => normalizedConformedValue[index]);\n\n    // We need to know how many times the `targetChar` occurs in the piped characters.\n    const countTargetCharInPipedChars = pipedChars.filter((char) => char === targetChar).length;\n\n    // We need to know how many times it occurs in the intersection\n    const countTargetCharInIntersection = intersection.filter((char) => char === targetChar).length;\n\n    // We need to know if the placeholder contains characters that look like\n    // our `targetChar`, so we don't select one of those by mistake.\n    const countTargetCharInPlaceholder = placeholder\n      .substr(0, placeholder.indexOf(placeholderChar))\n      .split(emptyString)\n      .filter((char, index) => (\n        // Check if `char` is the same as our `targetChar`, so we account for it\n        char === targetChar &&\n\n        // but also make sure that both the `rawValue` and placeholder don't have the same character at the same\n        // index because if they are equal, that means we are already counting those characters in\n        // `countTargetCharInIntersection`\n        rawValue[index] !== char\n      ))\n      .length;\n\n    // The number of times we need to see occurrences of the `targetChar` before we know it is the one we're looking\n    // for is:\n    const requiredNumberOfMatches = (\n      countTargetCharInPlaceholder +\n      countTargetCharInIntersection +\n      countTargetCharInPipedChars +\n      // The character to the right of the caret isn't included in `intersection`\n      // so add one if we are tracking the character to the right\n      (trackRightCharacter ? 1 : 0)\n    );\n\n    // Now we start looking for the location of the `targetChar`.\n    // We keep looping forward and store the index in every iteration. Once we have encountered\n    // enough occurrences of the target character, we break out of the loop\n    // If are searching for the second `1` in `1214`, `startingSearchIndex` will point at `4`.\n    let numberOfEncounteredMatches = 0;\n    for (let i = 0; i < conformedValueLength; i++) {\n      const conformedValueChar = normalizedConformedValue[i];\n\n      startingSearchIndex = i + 1;\n\n      if (conformedValueChar === targetChar) {\n        numberOfEncounteredMatches++;\n      }\n\n      if (numberOfEncounteredMatches >= requiredNumberOfMatches) {\n        break;\n      }\n    }\n  }\n\n  // At this point, if we simply return `startingSearchIndex` as the adjusted caret position,\n  // most cases would be handled. However, we want to fast forward or rewind the caret to the\n  // closest placeholder character if it happens to be in a non-editable spot. That's what the next\n  // logic is for.\n\n  // In case of addition, we fast forward.\n  if (isAddition) {\n    // We want to remember the last placeholder character encountered so that if the mask\n    // contains more characters after the last placeholder character, we don't forward the caret\n    // that far to the right. Instead, we stop it at the last encountered placeholder character.\n    let lastPlaceholderChar = startingSearchIndex;\n\n    for (let i = startingSearchIndex; i <= placeholderLength; i++) {\n      if (placeholder[i] === placeholderChar) {\n        lastPlaceholderChar = i;\n      }\n\n      if (\n        // If we're adding, we can position the caret at the next placeholder character.\n        placeholder[i] === placeholderChar ||\n\n        // If a caret trap was set by a mask function, we need to stop at the trap.\n        caretTrapIndexes.indexOf(i) !== -1 ||\n\n        // This is the end of the placeholder. We cannot move any further. Let's put the caret there.\n        i === placeholderLength\n      ) {\n        return lastPlaceholderChar;\n      }\n    }\n  } else {\n    // In case of deletion, we rewind.\n    if (trackRightCharacter) {\n      // Searching for the character that was to the right of the caret\n      // We start at `startingSearchIndex` - 1 because it includes one character extra to the right\n      for (let i = startingSearchIndex - 1; i >= 0; i--) {\n        // If tracking the character to the right of the cursor, we move to the left until\n        // we found the character and then place the caret right before it\n\n        if (\n          // `targetChar` should be in `conformedValue`, since it was in `rawValue`, just\n          // to the right of the caret\n          conformedValue[i] === targetChar ||\n\n          // If a caret trap was set by a mask function, we need to stop at the trap.\n          caretTrapIndexes.indexOf(i) !== -1 ||\n\n          // This is the beginning of the placeholder. We cannot move any further.\n          // Let's put the caret there.\n          i === 0\n        ) {\n          return i;\n        }\n      }\n    } else {\n      // Searching for the first placeholder or caret trap to the left\n\n      for (let i = startingSearchIndex; i >= 0; i--) {\n        // If we're deleting, we stop the caret right before the placeholder character.\n        // For example, for mask `(111) 11`, current conformed input `(456) 86`. If user\n        // modifies input to `(456 86`. That is, they deleted the `)`, we place the caret\n        // right after the first `6`\n\n        if (\n          // If we're deleting, we can position the caret right before the placeholder character\n          placeholder[i - 1] === placeholderChar ||\n\n          // If a caret trap was set by a mask function, we need to stop at the trap.\n          caretTrapIndexes.indexOf(i) !== -1 ||\n\n          // This is the beginning of the placeholder. We cannot move any further.\n          // Let's put the caret there.\n          i === 0\n        ) {\n          return i;\n        }\n      }\n    }\n  }\n\n  return 0;\n}\n","import adjustCaretPosition from './adjustCaretPosition';\nimport conformToMask from './conformToMask';\nimport {convertMaskToPlaceholder, isString, isNumber, processCaretTraps} from './utilities';\nimport {placeholderChar as defaultPlaceholderChar, strFunction} from './constants';\n\nconst emptyString = '';\nconst strNone = 'none';\nconst strObject = 'object';\nconst isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);\nconst defer = typeof requestAnimationFrame !== 'undefined' ? requestAnimationFrame : setTimeout;\n\ninterface CreateTextMaskInputElementArgs {\n  inputElement: HTMLInputElement;\n  mask: any;\n  guide?: boolean;\n  pipe?: any;\n  placeholderChar?: string;\n  keepCharPositions?: boolean;\n  showMask?: boolean;\n}\n\nexport default function createTextMaskInputElement(config: CreateTextMaskInputElementArgs) {\n  // Anything that we will need to keep between `update` calls, we will store in this `state` object.\n  const state: { previousConformedValue?: string; previousPlaceholder?: string } = {previousConformedValue: undefined, previousPlaceholder: undefined};\n\n  return {\n    state,\n\n    // `update` is called by framework components whenever they want to update the `value` of the input element.\n    // The caller can send a `rawValue` to be conformed and set on the input element. However, the default use-case\n    // is for this to be read from the `inputElement` directly.\n    update(rawValue: any, {\n      inputElement,\n      mask: providedMask,\n      guide,\n      pipe,\n      placeholderChar = defaultPlaceholderChar,\n      keepCharPositions = false,\n      showMask = false\n    } = config) {\n      // if `rawValue` is `undefined`, read from the `inputElement`\n      if (typeof rawValue === 'undefined') {\n        rawValue = inputElement.value;\n      }\n\n      // If `rawValue` equals `state.previousConformedValue`, we don't need to change anything. So, we return.\n      // This check is here to handle controlled framework components that repeat the `update` call on every render.\n      if (rawValue === state.previousConformedValue) { return; }\n\n      // Text Mask accepts masks that are a combination of a `mask` and a `pipe` that work together. If such a `mask` is\n      // passed, we destructure it below, so the rest of the code can work normally as if a separate `mask` and a `pipe`\n      // were passed.\n      if (typeof providedMask === strObject && providedMask.pipe !== undefined && providedMask.mask !== undefined) {\n        pipe = providedMask.pipe;\n        providedMask = providedMask.mask;\n      }\n\n      // The `placeholder` is an essential piece of how Text Mask works. For a mask like `(111)`, the placeholder would\n      // be `(___)` if the `placeholderChar` is set to `_`.\n      let placeholder;\n\n      // We don't know what the mask would be yet. If it is an array, we take it as is, but if it's a function, we will\n      // have to call that function to get the mask array.\n      let mask;\n\n      // If the provided mask is an array, we can call `convertMaskToPlaceholder` here once and we'll always have the\n      // correct `placeholder`.\n      if (providedMask instanceof Array) {\n        placeholder = convertMaskToPlaceholder(providedMask, placeholderChar);\n      }\n\n      // In framework components that support reactivity, it's possible to turn off masking by passing\n      // `false` for `mask` after initialization. See https://github.com/text-mask/text-mask/pull/359\n      if (providedMask === false) { return; }\n\n      // We check the provided `rawValue` before moving further.\n      // If it's something we can't work with `getSafeRawValue` will throw.\n      const safeRawValue = getSafeRawValue(rawValue);\n\n      // `selectionEnd` indicates to us where the caret position is after the user has typed into the input\n      const {selectionEnd: currentCaretPosition} = inputElement;\n\n      // We need to know what the `previousConformedValue` and `previousPlaceholder` is from the previous `update` call\n      const {previousConformedValue, previousPlaceholder} = state;\n\n      let caretTrapIndexes;\n\n      // If the `providedMask` is a function. We need to call it at every `update` to get the `mask` array.\n      // Then we also need to get the `placeholder`\n      if (typeof providedMask === strFunction) {\n        mask = providedMask(safeRawValue, {currentCaretPosition, previousConformedValue, placeholderChar});\n\n        // disable masking if `mask` is `false`\n        if (mask === false) { return; }\n\n        // mask functions can setup caret traps to have some control over how the caret moves. We need to process\n        // the mask for any caret traps. `processCaretTraps` will remove the caret traps from the mask and return\n        // the indexes of the caret traps.\n        const {maskWithoutCaretTraps, indexes} = processCaretTraps(mask);\n\n        mask = maskWithoutCaretTraps; // The processed mask is what we're interested in\n        caretTrapIndexes = indexes; // And we need to store these indexes because they're needed by `adjustCaretPosition`\n\n        placeholder = convertMaskToPlaceholder(mask, placeholderChar);\n\n      // If the `providedMask` is not a function, we just use it as-is.\n      } else {\n        mask = providedMask;\n      }\n\n      // The following object will be passed to `conformToMask` to determine how the `rawValue` will be conformed\n      const conformToMaskConfig = {\n        previousConformedValue,\n        guide,\n        placeholderChar,\n        pipe,\n        placeholder,\n        currentCaretPosition,\n        keepCharPositions\n      };\n\n      // `conformToMask` returns `conformedValue` as part of an object for future API flexibility\n      const {conformedValue} = conformToMask(safeRawValue ? safeRawValue.toString() : '', mask, conformToMaskConfig);\n\n      // The following few lines are to support the `pipe` feature.\n      const piped = typeof pipe === strFunction;\n\n      let pipeResults = {};\n\n      // If `pipe` is a function, we call it.\n      if (piped) {\n        // `pipe` receives the `conformedValue` and the configurations with which `conformToMask` was called.\n        pipeResults = pipe(conformedValue, {rawValue: safeRawValue, ...conformToMaskConfig});\n\n        // `pipeResults` should be an object. But as a convenience, we allow the pipe author to just return `false` to\n        // indicate rejection. Or return just a string when there are no piped characters.\n        // If the `pipe` returns `false` or a string, the block below turns it into an object that the rest\n        // of the code can work with.\n        if (pipeResults === false) {\n          // If the `pipe` rejects `conformedValue`, we use the `previousConformedValue`, and set `rejected` to `true`.\n          pipeResults = {value: previousConformedValue, rejected: true};\n        } else if (isString(pipeResults)) {\n          pipeResults = {value: pipeResults};\n        }\n      }\n\n      // Before we proceed, we need to know which conformed value to use, the one returned by the pipe or the one\n      // returned by `conformToMask`.\n      const finalConformedValue = (piped) ? (pipeResults as any)['value'] : conformedValue;\n\n      // After determining the conformed value, we will need to know where to set\n      // the caret position. `adjustCaretPosition` will tell us.\n            const adjustedCaretPosition = placeholder ? adjustCaretPosition({\n        previousConformedValue,\n        previousPlaceholder,\n        conformedValue: finalConformedValue,\n        placeholder,\n        rawValue: safeRawValue,\n        currentCaretPosition,\n        placeholderChar,\n        indexesOfPipedChars: (pipeResults as any)['indexesOfPipedChars'],\n        caretTrapIndexes\n      }) : 0;\n\n      // Text Mask sets the input value to an empty string when the condition below is set. It provides a better UX.\n      const inputValueShouldBeEmpty = finalConformedValue === placeholder && adjustedCaretPosition === 0;\n      const emptyValue = showMask ? placeholder : emptyString;\n      const inputElementValue = (inputValueShouldBeEmpty) ? emptyValue : finalConformedValue;\n\n            state.previousConformedValue = inputElementValue; // store value for access for next time\n      if (placeholder) {\n        state.previousPlaceholder = placeholder;\n      }\n\n      // In some cases, this `update` method will be repeatedly called with a raw value that has already been conformed\n      // and set to `inputElement.value`. The below check guards against needlessly readjusting the input state.\n      // See https://github.com/text-mask/text-mask/issues/231\n      if (inputElement.value === inputElementValue) {\n        return;\n      }\n\n            inputElement.value = inputElementValue; // set the input value\n      if (adjustedCaretPosition !== null) {\n        safeSetSelection(inputElement, adjustedCaretPosition); // adjust caret position\n      }\n    }\n  };\n}\n\nfunction safeSetSelection(element: HTMLInputElement, selectionPosition: number) {\n  if (document.activeElement === element) {\n    if (isAndroid) {\n      defer(() => element.setSelectionRange(selectionPosition, selectionPosition, strNone));\n    } else {\n      element.setSelectionRange(selectionPosition, selectionPosition, strNone);\n    }\n  }\n}\n\nfunction getSafeRawValue(inputValue: any) {\n  if (isString(inputValue)) {\n    return inputValue;\n  } else if (isNumber(inputValue)) {\n    return String(inputValue);\n  } else if (inputValue === undefined || inputValue === null) {\n    return emptyString;\n  } else {\n    throw new Error(\n      'The \\'value\\' provided to Text Mask needs to be a string or a number. The value ' +\n      `received was:\\n\\n ${JSON.stringify(inputValue)}`\n    );\n  }\n}\n","import { Directive, ElementRef, forwardRef, Input, Inject, OnChanges, Optional, Provider, Renderer2, SimpleChanges } from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor, COMPOSITION_BUFFER_MODE } from '@angular/forms';\nimport {ɵgetDOM as getDOM} from '@angular/platform-browser';\nimport { createTextMaskInputElement } from './core';\n\nexport class TextMaskConfig {\n  mask: Array<string | RegExp> | ((raw: string) => Array<string | RegExp>) | false = [];\n  guide?: boolean;\n  placeholderChar?: string;\n  pipe?: (conformedValue: string, config: TextMaskConfig) => false | string | object;\n  keepCharPositions?: boolean;\n  showMask?: boolean;\n}\n\nexport const MASKEDINPUT_VALUE_ACCESSOR: Provider = {\n  provide: NG_VALUE_ACCESSOR,\n  useExisting: forwardRef(() => MaskedInputDirective),\n  multi: true\n};\n\n/**\n * We must check whether the agent is Android because composition events\n * behave differently between iOS and Android.\n */\nfunction _isAndroid(): boolean {\n  const userAgent = getDOM() ? getDOM().getUserAgent() : '';\n  return /android (\\d+)/.test(userAgent.toLowerCase());\n}\n\n@Directive({\n  standalone: true,\n  // eslint-disable-next-line @angular-eslint/no-host-metadata-property\n  host: {\n    '(input)': '_handleInput($event.target)',\n    '(blur)': 'onTouched()',\n    '(compositionstart)': '_compositionStart()',\n    '(compositionend)': '_compositionEnd($event.target)'\n  },\n  selector: '[textMask]',\n  exportAs: 'textMask',\n  providers: [MASKEDINPUT_VALUE_ACCESSOR]\n})\nexport class MaskedInputDirective implements ControlValueAccessor, OnChanges {\n  @Input('textMask') textMaskConfig: TextMaskConfig = {\n    mask: [],\n    guide: true,\n    placeholderChar: '_',\n    pipe: undefined,\n    keepCharPositions: false,\n  };\n\n  onChange = (_: any) => {};\n  onTouched = () => {};\n\n  private textMaskInputElement: any;\n  private inputElement!: HTMLInputElement;\n\n  /** Whether the user is creating a composition string (IME events). */\n  private _composing = false;\n\n  constructor(\n    private _renderer: Renderer2,\n    private _elementRef: ElementRef,\n    @Optional() @Inject(COMPOSITION_BUFFER_MODE)private _compositionMode: boolean\n  ) {\n    if (this._compositionMode == null) {\n      this._compositionMode = !_isAndroid();\n    }\n  }\n\n  ngOnChanges(changes: SimpleChanges) {\n    this._setupMask(true);\n    if (this.textMaskInputElement !== undefined) {\n      this.textMaskInputElement.update(this.inputElement.value);\n    }\n  }\n\n  writeValue(value: any) {\n    this._setupMask();\n\n    // set the initial value for cases where the mask is disabled\n    const normalizedValue = value == null ? '' : value;\n    this._renderer.setProperty(this.inputElement, 'value', normalizedValue);\n\n    if (this.textMaskInputElement !== undefined) {\n      this.textMaskInputElement.update(value);\n    }\n  }\n\n  registerOnChange(fn: (_: any) => void): void { this.onChange = fn; }\n  registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n\n  setDisabledState(isDisabled: boolean): void {\n    this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);\n  }\n\n  \n  _handleInput(target: EventTarget | null) {\n    const input = target as HTMLInputElement | null;\n    if (!input) return;\n    if (!this._compositionMode || (this._compositionMode && !this._composing)) {\n      this._setupMask();\n\n      if (this.textMaskInputElement !== undefined) {\n        this.textMaskInputElement.update(input.value);\n\n        // get the updated value\n        const value = this.inputElement.value;\n        this.onChange(value);\n      }\n    }\n  }\n\n  _setupMask(create = false) {\n    if (!this.inputElement) {\n      if (this._elementRef.nativeElement.tagName.toUpperCase() === 'INPUT') {\n        // `textMask` directive is used directly on an input element\n        this.inputElement = this._elementRef.nativeElement;\n      } else {\n        // `textMask` directive is used on an abstracted input element, `md-input-container`, etc\n        this.inputElement = this._elementRef.nativeElement.getElementsByTagName('INPUT')[0];\n      }\n    }\n    \n    if (this.inputElement && create) {\n      this.textMaskInputElement = createTextMaskInputElement(\n        Object.assign({inputElement: this.inputElement}, this.textMaskConfig)\n      );\n    }\n    \n  }\n\n  _compositionStart(): void { this._composing = true; }\n\n  _compositionEnd(target: EventTarget | null): void {\n    this._composing = false;\n    const input = target as HTMLInputElement | null;\n    if (this._compositionMode && input) {\n      this._handleInput(input);\n    }\n  }\n}\n","/*\n * Public API Surface of ngx-textmask\n */\n\nexport * from './lib/angular2TextMask';\nexport { conformToMask } from './lib/core';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["emptyArray","placeholderChar","defaultPlaceholderChar","emptyString","getDOM"],"mappings":";;;;;AAAO,MAAM,eAAe,GAAG,GAAG;AAC3B,MAAM,WAAW,GAAG,UAAU;;ACCrC,MAAM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