{"version":3,"file":"codeBox.obs.js","sources":["../../src/Security/codeBoxCharacter.partial.obs","../../../Rock.JavaScript.Obsidian/node_modules/style-inject/dist/style-inject.es.js","../../src/Security/codeBox.obs"],"sourcesContent":["<!-- Copyright by the Spark Development Network; Licensed under the Rock Community License -->\n<template>\n    <input :value=\"modelValue\"\n           autocomplete=\"one-time-code\"\n           :autofocus=\"boxIndex === 0\"\n           :class=\"`rock-code-box-${boxIndex + 1} form-control flex-grow-1 flex-sm-grow-0 flex-shrink-1 ${boxIndex > 0 ? 'ml-1' : ''}`\"\n           :disabled=\"disabled\"\n           :id=\"`${uniqueId}-${boxIndex + 1}`\"\n           :maxlength=\"maxLength\"\n           ref=\"inputElement\"\n           type=\"text\"\n           @paste=\"onPaste\"\n           @keydown=\"onKeydown\" />\n</template>\n\n<style scoped>\n.rock-code-box input {\n    width: 47px;\n    height: 64px;\n    text-align: center;\n    font-size: 24px;\n}\n</style>\n\n<script setup lang=\"ts\">\n    import { ref, PropType, onMounted } from \"vue\";\n    import { CodeBoxCharacterController } from \"./types.partial\";\n\n    const props = defineProps({\n        modelValue: {\n            type: String as PropType<string>,\n            required: false,\n            default: null\n        },\n\n        boxIndex: {\n            type: Number as PropType<number>,\n            required: true\n        },\n\n        uniqueId: {\n            type: String as PropType<string>,\n            required: true\n        },\n\n        allowedChars: {\n            type: Object as PropType<RegExp>,\n            required: false,\n            default: /^[a-zA-Z0-9]$/\n        },\n\n        disabled: {\n            type: Boolean as PropType<boolean>,\n            required: false,\n            default: false\n        },\n\n        maxLength: {\n            type: Number as PropType<number>,\n            required: true\n        }\n    });\n\n    const emit = defineEmits<{\n        (e: \"update:modelValue\", value: string): void,\n        (e: \"pasteValues\", value: string): void,\n        (e: \"clear\", boxIndex: number): void,\n        (e: \"move\", boxIndex: number): void,\n        (e: \"complete\"): void,\n        (e: \"ready\", value: CodeBoxCharacterController): void\n    }>();\n\n    //#region Values\n\n    const inputElement = ref();\n\n    //#endregion\n\n    //#region Event Handlers\n\n    /** Event handler for the \"paste\" event. */\n    function onPaste(_event: Event): void {\n        // The \"paste\" event is handled before the input is updated with the pasted value.\n        // Temporarily store the original input value\n        // and clear it so the pasted content overwrites the previous content.\n        const originalValue = inputElement.value.value;\n        inputElement.value.value = \"\";\n\n        // Wait for the \"paste\" event to result in an input change,\n        // then process the pasted value.\n        onNextInput((event: InputEvent): void => {\n            // Revert the pasted value to the original value (stored above),\n            // and let the parent codeBox handle the pasted value\n            // so it can update the individual codeBoxCharacter components.\n            const pastedValue: string = inputElement.value.value;\n            inputElement.value.value = originalValue;\n\n            // If the full code was pasted into any code box,\n            // and if the characters are all valid,\n            // then paste the values across all code boxes.\n            if (pastedValue.length === props.maxLength && pastedValue.split(\"\").every(pastedCharacter => props.allowedChars.test(pastedCharacter))) {\n                // This will leave the pasted value in the current text box.\n                emit(\"pasteValues\", pastedValue);\n                emit(\"complete\");\n            }\n\n            // If an invalid or incomplete code is pasted into the field,\n            // then prevent the event from bubbling up.\n            event.preventDefault();\n            return;\n        });\n    }\n\n    /** Event handler for the \"keydown\" event. */\n    function onKeydown(event: KeyboardEvent): void {\n        const value = inputElement.value.value;\n        // KeyboardEvent.key values can be found at - https://www.w3.org/TR/uievents-key/#named-key-attribute-values.\n        const key = {\n            backspace: \"Backspace\",\n            delete: \"Delete\",\n            enter: \"Enter\"\n        } as const;\n        // Legacy KeyboardEvent.keyCode documentation can be found at - https://www.w3.org/TR/uievents/#dom-keyboardevent-keycode.\n        // Some KeyboardEvent.keyCode values can be found at - https://www.w3.org/TR/uievents/#fixed-virtual-key-codes.\n        const keyCode = {\n            backspace: 8,\n            delete: 46,\n            enter: 13\n        } as const;\n\n        // First check the `key` property.\n        // If this is an older supported browser,\n        // then fallback to checking the `keyCode` then `charCode` properties.\n        const isBackspace = event.key === key.backspace || event.keyCode === keyCode.backspace || event.charCode === keyCode.backspace;\n        const isDelete = event.key === key.delete || event.keyCode === keyCode.delete || event.charCode === keyCode.delete;\n        const isEnter = event.key === key.enter || event.keyCode === keyCode.enter || event.charCode === keyCode.enter;\n\n        // Allow Backspace and Delete if the input has a value.\n        if ((isBackspace || isDelete) && value.length >= 1) {\n            // Update the model value on the next \"input\" event.\n            onNextInput(() => {\n                emit(\"update:modelValue\", inputElement.value.value);\n            });\n\n            return;\n        }\n\n        // If Backspace was pressed and this input is empty,\n        // then clear the previous code box and set focus to it.\n        if (isBackspace) {\n            if (props.boxIndex > 0) {\n                emit(\"clear\", props.boxIndex - 1);\n                emit(\"move\", props.boxIndex - 1);\n            }\n\n            event.preventDefault();\n            return;\n        }\n\n        // Allow the Enter key to submit a form if this is a child element of a form with a submit button.\n        if (isEnter) {\n            return;\n        }\n\n        // Prevent more than one character from being entered manually into the box.\n        if (value.length >= 1 && !event.ctrlKey) {\n            event.preventDefault();\n            return;\n        }\n\n        // If the input is empty and a valid key was pressed,\n        // then update the input and either move to the next input\n        // or emit a \"complete\" event.\n        if (!event.ctrlKey) {\n            // Process the value after the keypress results in an input change.\n            onNextInput(() => {\n                // Emit the \"update:modelValue\" update event before the \"complete\" event below.\n                emit(\"update:modelValue\", inputElement.value.value);\n\n                // Move to the next box if this isn't the last one.\n                if (props.boxIndex < props.maxLength - 1) {\n                    emit(\"move\", props.boxIndex + 1);\n                }\n                // Complete if this is the last one.\n                else if (props.boxIndex === props.maxLength - 1) {\n                    emit(\"complete\");\n                }\n            });\n        }\n    }\n\n    /**\n     * Event handler when for when the input value changes.\n     * @param event\n     */\n    function onInputChanged(event): void {\n        const pastedValue: string = event.target.value;\n\n        // If the full code was pasted into any code box,\n        // and if the characters are all valid,\n        // then paste the values across all code boxes.\n        if (pastedValue.length === props.maxLength && pastedValue.split(\"\").every(pastedCharacter => props.allowedChars.test(pastedCharacter))) {\n            // This will leave the pasted value in the current text box.\n            emit(\"pasteValues\", pastedValue);\n            emit(\"complete\");\n        }\n    }\n\n    //#endregion\n\n    //#region Functions\n\n    /** Adds a one-time \"input\" event handler that will be executed before the `onInputChanged` event handler. */\n    function onNextInput(inputEventListener: (event: InputEvent) => void): void {\n        function deregisteringInputEventHandler(event: InputEvent): void {\n            inputElement.value.removeEventListener(\"input\", deregisteringInputEventHandler);\n            inputEventListener(event);\n        }\n\n        // Configure the callback to preprocess the \"input\" event.\n        inputElement.value.removeEventListener(\"input\", onInputChanged);\n        inputElement.value.addEventListener(\"input\", deregisteringInputEventHandler);\n        inputElement.value.addEventListener(\"input\", onInputChanged);\n    }\n\n    //#endregion\n\n    onMounted(() => {\n        // Add the \"input\" event handler here instead of in the template\n        // so that it is clear that we manually manage the \"input\" event handlers.\n        inputElement.value.addEventListener(\"input\", onInputChanged);\n\n        // Emit the codeBoxCharacter controller object once this component is ready.\n        emit(\"ready\", {\n            focus(): void {\n                inputElement.value.focus();\n            },\n            clear(): void {\n                emit(\"update:modelValue\", \"\");\n            },\n            boxIndex: props.boxIndex\n        });\n    });\n</script>\n","function styleInject(css, ref) {\n  if ( ref === void 0 ) ref = {};\n  var insertAt = ref.insertAt;\n\n  if (!css || typeof document === 'undefined') { return; }\n\n  var head = document.head || document.getElementsByTagName('head')[0];\n  var style = document.createElement('style');\n  style.type = 'text/css';\n\n  if (insertAt === 'top') {\n    if (head.firstChild) {\n      head.insertBefore(style, head.firstChild);\n    } else {\n      head.appendChild(style);\n    }\n  } else {\n    head.appendChild(style);\n  }\n\n  if (style.styleSheet) {\n    style.styleSheet.cssText = css;\n  } else {\n    style.appendChild(document.createTextNode(css));\n  }\n}\n\nexport default styleInject;\n","<!-- Copyright by the Spark Development Network; Licensed under the Rock Community License -->\n<template>\n    <RockFormField v-model=\"internalModelValue\"\n                   name=\"codebox\"\n                   :rules=\"rules\">\n        <template #default=\"{uniqueId, field}\">\n            <div :class=\"['form-group rock-code-box', isRequired ? 'required' : '']\">\n                <div class=\"control-wrapper\">\n                    <div class=\"d-flex\">\n                        <CodeBoxCharacter v-for=\"(character, index) of characters\"\n                                          :modelValue=\"character\"\n                                          :allowedChars=\"allowedChars\"\n                                          :boxIndex=\"index\"\n                                          :disabled=\"disabled\"\n                                          :key=\"index\"\n                                          :maxLength=\"maxLength\"\n                                          :modelModifiers=\"modelModifiers\"\n                                          :uniqueId=\"uniqueId\"\n                                          @clear=\"onClear\"\n                                          @complete=\"onComplete\"\n                                          @move=\"onMove\"\n                                          @pasteValues=\"onPasteValues\"\n                                          @ready=\"onReady\"\n                                          @update:modelValue=\"value => onCodeBoxCharacterUpdated(value, index)\" />\n                    </div>\n                </div>\n            </div>\n        </template>\n    </RockFormField>\n</template>\n\n<style scoped>\n.rock-code-box input {\n    width: 47px;\n    height: 64px;\n    text-align: center;\n    font-size: 24px;\n}\n</style>\n\n<script setup lang=\"ts\">\n    import { computed, onMounted, PropType, ref } from \"vue\";\n    import CodeBoxCharacter from \"./codeBoxCharacter.partial.obs\";\n    import { CodeBoxCharacterController } from \"./types.partial\";\n    import RockFormField from \"@Obsidian/Controls/rockFormField.obs\";\n    import { useVModelPassthrough } from \"@Obsidian/Utility/component\";\n    import { normalizeRules, rulesPropType } from \"@Obsidian/ValidationRules\";\n\n    type CodeBoxModelModifiers = {\n        capitalize?: unknown\n    };\n\n    const props = defineProps({\n        modelValue: {\n            type: String as PropType<string>,\n            required: false,\n            default: null\n        },\n\n        allowedChars: {\n            type: Object as PropType<RegExp>,\n            required: false,\n            default: /^[a-zA-Z0-9]$/\n        },\n\n        disabled: {\n            type: Boolean as PropType<boolean>,\n            required: false,\n            default: false\n        },\n\n        maxLength: {\n            type: Number as PropType<number>,\n            required: true\n        },\n\n        modelModifiers: {\n            type: Object as PropType<CodeBoxModelModifiers>,\n            required: false,\n            default: null\n        },\n\n        rules: rulesPropType\n    });\n\n    const emit = defineEmits<{\n        (e: \"update:modelValue\", value: string): void,\n        (e: \"complete\", value: string): void\n    }>();\n\n    /** Controllers for each codeBoxCharacter component. */\n    const codeBoxCharacterControllers: Record<number, CodeBoxCharacterController> = {};\n\n    //#region Values\n\n    const internalModelValue = useVModelPassthrough(props, \"modelValue\", emit);\n    const characters = ref<string[]>(getMaxLengthCharacters(props.modelValue.split(\"\")));\n\n    //#endregion\n\n    //#region Computed Values\n\n    /** The internal rules we will be used for calculations. */\n    const internalRules = computed(() => normalizeRules(props.rules));\n\n    /** Determines if this field is marked as required. */\n    const isRequired = computed(() => internalRules.value.includes(\"required\"));\n\n    //#endregion\n\n    //#region Event Handlers\n\n    /** Event handler for a codeBoxCharacter component being updated. */\n    function onCodeBoxCharacterUpdated(value: string, boxIndex: number): void {\n        // Modify the value if there are any modifiers present.\n        if (props.modelModifiers?.capitalize) {\n            value = value?.toLocaleUpperCase();\n        }\n\n        // Update the character associated with the codeBoxCharacter component.\n        characters.value[boxIndex] = value;\n\n        // Update the model value (which is the code combined from all the characters).\n        internalModelValue.value = characters.value.join(\"\");\n    }\n\n    /** Event handler for a codeBoxCharacter component being cleared. */\n    function onClear(boxIndex: number): void {\n        codeBoxCharacterControllers[boxIndex].clear();\n    }\n\n    /** Event handler for moving focus to a codeBoxCharacter component. */\n    function onMove(boxIndex: number): void {\n        codeBoxCharacterControllers[boxIndex].focus();\n    }\n\n    /** Event handler for a value being pasted into a codeBoxCharacter component. */\n    function onPasteValues(value: string): void {\n        // Modify the value if there are any modifiers present.\n        if (props.modelModifiers?.capitalize) {\n            value = value?.toLocaleUpperCase();\n        }\n\n        // Set all the characters to the pasted value after splitting it.\n        characters.value = getMaxLengthCharacters(value.split(\"\"));\n    }\n\n    /**\n     * Event handler for a codeBoxCharacter component completing.\n     *\n     * This can be sent from any of the codeBoxCharacter components if\n     * it recognizes that the entire code has been entered.\n     */\n    function onComplete(): void {\n        const code = characters.value.join(\"\");\n        internalModelValue.value = code;\n        emit(\"complete\", code);\n    }\n\n    /**\n     * Event handler for a codeBoxCharacter component being ready.\n     *\n     * The codeBoxCharacter component will provide an object that can be used to control it.\n     */\n    function onReady(event: CodeBoxCharacterController): void {\n        codeBoxCharacterControllers[event.boxIndex] = event;\n    }\n\n    //#endregion\n\n    //#region Functions\n\n    /**\n     * Copies a source array and ensures the resulting array has `length === props.maxLength`.\n     *\n     * If the `source.length < props.maxLength`, then `\"\"` elements will be added.\n     *\n     * If the `source.length > props.maxLength`, then excess elements will be removed.\n     */\n    function getMaxLengthCharacters(source: string[]): string[] {\n        if (source.length > props.maxLength) {\n            // Truncate to match the max length of the code box.\n            return source.slice(0, props.maxLength);\n        }\n        else if (source.length < props.maxLength) {\n            const result = [...source];\n\n            // Pad the array to match the maxLength of the code box.\n            const charactersToInsert = props.maxLength - result.length;\n            for (let i = 0; i < charactersToInsert; i++) {\n                result.push(\"\");\n            }\n\n            return result;\n        }\n        else {\n            return [...source];\n        }\n    }\n\n    //#endregion\n\n    //#region Watchers\n\n    //#endregion\n\n    onMounted(() => {\n        // Try to focus on the first codeBoxCharacter component when this component is mounted.\n        codeBoxCharacterControllers[0]?.focus();\n    });\n</script>\n"],"names":["props","__props","emit","__emit","inputElement","ref","onPaste","_event","originalValue","value","onNextInput","event","pastedValue","length","maxLength","split","every","pastedCharacter","allowedChars","test","preventDefault","onKeydown","key","backspace","delete","enter","keyCode","isBackspace","charCode","isDelete","isEnter","boxIndex","ctrlKey","onInputChanged","target","inputEventListener","deregisteringInputEventHandler","removeEventListener","addEventListener","onMounted","focus","clear","styleInject","css","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","codeBoxCharacterControllers","internalModelValue","useVModelPassthrough","characters","getMaxLengthCharacters","modelValue","internalRules","computed","normalizeRules","rules","isRequired","includes","onCodeBoxCharacterUpdated","_props$modelModifiers","modelModifiers","capitalize","_value","toLocaleUpperCase","join","onClear","onMove","onPasteValues","_props$modelModifiers2","_value2","onComplete","code","onReady","source","slice","result","charactersToInsert","i","push","_codeBoxCharacterCont"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA4BI,IAAMA,KAAK,GAAGC,OAiCZ,CAAA;UAEF,IAAMC,IAAI,GAAGC,MAOT,CAAA;MAIJ,IAAA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