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KAAMtE,OAAQ2X,QAAS,WCZ/C,IAiBqBsL,GAAyB,SAAAC,2RAAArmB,CAAAomB,EAAAC,GAAA,UAAApmB,EAAAC,GAAAkmB,GAAA,SAAAA,IAAA,mGAAAjmB,CAAA,KAAAimB,GAAAnmB,EAAAG,MAAA,KAAAC,UAAA,UAAA+lB,sFAAA,EAASnC,IAAlCmC,GACZrjB,OAAMwC,GAAAA,GAAA,GACR0e,GAAsBlhB,QAAM,IAC/B4iB,SAAU,CAAEle,KAAMtE,OAAQ2X,QAAS,UACnC8K,QAAS,CAAEne,KAAMxE,QAAS6X,SAAS,KChBvC9b,EAAYsnB,SAAS,oBAAqBC,GAG1CvnB,EAAYsnB,SAAS,oBAAqBE,GAG1CxnB,EAAYsnB,SAAS,uBAAwBG,GAG7CznB,EAAYsnB,SAAS,sBAAuBI,GAG5C1nB,EAAYsnB,SAAS,mBAAoBK,GAGzC3nB,EAAYsnB,SAAS,qBAAsBM,GAG3C5nB,EAAYsnB,SAAS,2BAA4BO,IAGjD7nB,EAAYsnB,SAAS,mBAAoBQ,IAGzC9nB,EAAYsnB,SAAS,8CAA+CS,IAGpE/nB,EAAYsnB,SAAS,uBAAwBU,IAG7ChoB,EAAYsnB,SAAS,YAAaW,IAGlCjoB,EAAYsnB,SAAS,mBAAoBY,IAGzCloB,EAAYsnB,SAAS,eAAgBa,IAGrCnoB,EAAYsnB,SAAS,mBAAoBc,IAGzCpoB,EAAYsnB,SAAS,aAAce,IAGnCroB,EAAYsnB,SAAS,eAAgBrC,IAGrCjlB,EAAYsnB,SAAS,qBAAsBgB,IAG3CtoB,EAAYsnB,SAAS,oBAAqBF","sources":["webpack://typist6/./app/javascript/controllers/application.js","webpack://typist6/./app/javascript/controllers/ehr/file_manager_controller.js","webpack://typist6/./app/javascript/controllers/ehr/phone_number_input_controller.js","webpack://typist6/./app/javascript/controllers/ehr/scenario_events_controller.js","webpack://typist6/./app/javascript/controllers/ehr/navigation_bar_controller.js","webpack://typist6/./app/javascript/controllers/ehr/poll_server_controller.js","webpack://typist6/./app/javascript/controllers/ehr/scroll_to_top_controller.js","webpack://typist6/./app/javascript/controllers/ehr/sort_div_containers_controller.js","webpack://typist6/./app/javascript/controllers/ehr/form_helper_controller.js","webpack://typist6/./app/javascript/controllers/ehr/claim_service_calculations_form_helper_controller.js","webpack://typist6/./app/javascript/controllers/ehr/trix_chart_note_controller.js","webpack://typist6/./app/javascript/controllers/selectize_controller.js","webpack://typist6/./app/javascript/controllers/form_array_input_controller.js","webpack://typist6/./app/javascript/controllers/react_render_controller.js","webpack://typist6/./app/javascript/controllers/space_to_advance_controller.js","webpack://typist6/./app/javascript/controllers/unit_group_controller.js","webpack://typist6/./app/javascript/controllers/toggle_class_controller.js","webpack://typist6/./app/javascript/controllers/toggle_class_radio_controller.js","webpack://typist6/./app/javascript/controllers/visibility_d_none_controller.js","webpack://typist6/./app/javascript/controllers/index.js"],"sourcesContent":["import { Application } from '@hotwired/stimulus';\n\nconst application = Application.start();\n\n// Configure Stimulus development experience\napplication.debug = false;\nwindow.Stimulus = application;\n\n// https://stackoverflow.com/questions/75701014/using-turbo-frames-how-can-i-reload-the-whole-page-if-the-form-submited-succeede\n// https://turbo.hotwired.dev/reference/events#turbo%3Aframe-missing\n// - The hotwire docs say you can cancel this event. On another event on the page, it means to just call event.preventDefault()\ndocument.addEventListener('turbo:frame-missing', (event) => {\n  // The default behaviour is for turbo to display an error message. We want to continue with the request\n  // (eg. redirect from patient search to login page will have a frame-missing event because the login page\n  // doesn't have 'ehr-main' turbo frame wrapper)\n  const {\n    detail: { response, visit },\n  } = event;\n  event.preventDefault();\n  // alternative is to use response.url, but we end up with 2 requests and the flash message ends up disappearing by the second one\n  // the caveat with just sending the response is that we need to render the layout as well\n  visit(response);\n});\n\nexport { application };\n","import { Controller } from '@hotwired/stimulus';\n\n// This Stimulus controller manages file uploads to the Database model\n// It takes care of showing and hiding a progress bar and also is used to\n// delete attachments (by removing corresponding hidden input fields)\n// Connects to data-controller=\"ehr--file-manager\"\nexport default class extends Controller {\n  static targets = ['existingDocument', 'submissionForm', 'progressBarContainer', 'progressBar'];\n\n  initialize() {\n    this.uploadStartCallback = this.uploadStartCallback.bind(this);\n    this.progressUpdateCallback = this.progressUpdateCallback.bind(this);\n    this.uploadEndCallback = this.uploadEndCallback.bind(this);\n  }\n  connect() {\n    this.element.addEventListener('direct-upload:start', this.uploadStartCallback);\n    this.element.addEventListener('direct-upload:progress', this.progressUpdateCallback);\n    this.element.addEventListener('direct-upload:end', this.uploadEndCallback);\n  }\n\n  uploadStartCallback() {\n    this.progressBarContainerTarget.classList.remove('opacity-0');\n    this.progressBarTarget.style.width = 0;\n    this.progressBarContainerTarget.setAttribute('aria-value', 0);\n  }\n  progressUpdateCallback(event) {\n    const { progress } = event.detail;\n    this.progressBarTarget.style.width = `${progress}%`;\n    this.progressBarContainerTarget.setAttribute('aria-value', progress);\n  }\n\n  uploadEndCallback() {\n    this.progressBarContainerTarget.classList.add('opacity-0');\n  }\n\n  // Delete an attachment by removing the corresponding hidden input field (active storage interprets it as removing that file)\n  // and submitting the entire form\n  delete(event) {\n    event.preventDefault();\n    const confirmed = window.confirm('Are you sure?');\n    if (!confirmed) return;\n\n    // Disable delete button\n    event.currentTarget.disabled = true;\n\n    // Delete the associated hidden input field\n    const hiddenInput = this.element.querySelector(`input[data-signed-id=${event.params.signedId}]`);\n    if (hiddenInput) {\n      hiddenInput.remove();\n    } else {\n      // throw an error if hidden input field matching an existing attachment cannot be located\n      // Or do nothing since that just means it is already deleted\n    }\n    // Submit the form\n    this.submissionFormTarget.requestSubmit();\n  }\n\n  disconnect() {\n    this.element.removeEventListener('direct-upload:start', this.uploadStartCallback);\n    this.element.removeEventListener('direct-upload:progress', this.progressUpdateCallback);\n    this.element.removeEventListener('direct-upload:end', this.uploadEndCallback);\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\nimport IMask from 'imask';\n\n// Connects to data-controller=\"ehr--phone-number-input\"\nexport default class extends Controller {\n  static values = {\n    extension: Boolean,\n    readonlyPhoneNumber: String,\n  };\n  connect() {\n    const maskOptions = {\n      mask: this.extensionValue ? '000000' : '(000)000-0000',\n      // If lazy mode is true, the placeholder (___)___-____ is not visible when value is null\n      lazy: true,\n      placeholderChar: '_',\n    };\n    if (this.element.tagName === 'INPUT') {\n      IMask(this.element, maskOptions);\n    } else {\n      // if not using an input field, but a a div instead, calculate the masked value without attaching anything to the DOM, and update\n      // the inside of the div instead (eg. this is used by the patient's show view)\n      const masked = IMask.createMask(maskOptions);\n      masked.resolve(this.readonlyPhoneNumberValue);\n      this.element.textContent = masked.value;\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n// Connects to data-controller=\"ehr--phone-number-input\"\nexport default class extends Controller {\n  static values = {\n    when: Number,\n    duration: Number,\n    events: Array,\n    databaseId: Number,\n  };\n\n  // The targets captured are\n  // - 3 slots where we load the event cards,\n  // - a target array for all the pre-rendered events (ones that are hidden initially until their timeouts fire off and they are loaded into one of the 3 slots)\n  // - widgets\n  static targets = [\n    'slotPatientAtDesk',\n    'slotPhoneCall',\n    'slotClinicInteraction',\n    'preRenderedEvent',\n    'messagingWidget',\n    'emailWidget',\n    'phoneWidget',\n    'voicemailWidget',\n    'testing',\n  ];\n\n  /* -----------------------------------------------------------------------------\n  Lifecycle methods\n  --------------------------------------------------------------------------------*/\n  // Running everything in initialize instead of connect, because even with data-turbo-permanent, connect runs with every page load\n  initialize() {\n    /* -- Configuration -- */\n    this.muteSounds = true;\n    // There is a delay between when an item is completed in a slot, and a new one from the queue is added\n    // The delay helps to visually show that a new item from the queue has been\n    this.delayBetweenQueuedItemsInMs = 500;\n    // Min number of ms we should display the loading animation for when user submits final interaction to the server\n    this.minDelayAfterConversationEndInMs = 3000;\n    this.debugMode = false;\n    // This variable determines if we should clear timeouts when this controller is disconnected\n    // It is needed because this controller is inside a data-turbo-permanent div, so when we press the back button,\n    // the html gets preserved, but also the disconnect action gets triggered (which we don't want to happen since the sidebar is still on screen)\n    this.clearTimeoutsOnDisconnect = true;\n\n    /* -- Binding `this` to some methods that are being used as callbacks -- */\n    this.checkIfStimulusControllerWillBeReInitialized = this.checkIfStimulusControllerWillBeReInitialized.bind(this);\n\n    /* -- References -- */\n    //  names of timeout types when storing timeout ids in this.scenarioEventTimeouts\n    // NOTE: adding a nested TYPE key because this way the compiler will throw an error if the wrong parent key name is used\n    this.TIMEOUTS = {\n      SHOW: { TYPE: 'SHOW' },\n      REMOVE: { TYPE: 'REMOVE' },\n      SOUND: { TYPE: 'SOUND' },\n      QUEUE_DELAY: { TYPE: 'QUEUE_DELAY' },\n      PROMPT_DELAY: { TYPE: 'PROMPT_DELAY' },\n      CONVERSATION_FINISHED_DELAY: { TYPE: 'CONVERSATION_FINISHED_DELAY' },\n    };\n    // Creating this hash for convenience of retreiving the correct element based on event type\n    this.eventSlots = {\n      patient_at_desk: this.slotPatientAtDeskTarget,\n      phone_call: this.slotPhoneCallTarget,\n      clinic_interaction: this.slotClinicInteractionTarget,\n    };\n    this.sidebar = bootstrap.Offcanvas.getOrCreateInstance('#ehrSidebar');\n    this.ringingSound = new Audio(\n      'https://typist-javascripts.s3.amazonaws.com/COMTelph_Fixed+telephone+ring+4+(ID+0253)_BSB.mp3'\n    );\n    // Array of objects representing scenario events, passed to this stimulus controller\n    // eg. [{id: 'event-1', type: 'phone_call'}]\n    this.scenarioEvents = this.eventsValue;\n    // The event cards pre-rendered using this.scenarioEvents above. All the properties in the original event object\n    // are passed on to the html card via data attributes\n    // The result is an object where the keys are eventIds and values are the HTML element instances\n    // eg. {'event-1': <HTMLElement>}\n    this.preRenderedEventElements = this.preRenderedEventTargets.reduce((acc, eventElement) => {\n      return {\n        ...acc,\n        [eventElement.dataset.eventId]: eventElement,\n      };\n    }, {});\n\n    // Create inverse relationships between events that execute conditionally after another event is completed\n    // So in this case, the key will be an event id that once completed, will trigger the event in the value of the object\n    // eg. {'event-1': [<HTMLElement>, <HTMLElement>]}\n    this.dependentScenarioEventsMap = this.scenarioEvents\n      .filter((e) => e.after_event_completed)\n      .reduce((acc, { id, after_event_completed }) => {\n        const existingElements = acc[after_event_completed] || [];\n        const dependentElement = this.preRenderedEventElements[id];\n        return {\n          ...acc,\n          [after_event_completed]: [...existingElements, dependentElement],\n        };\n      }, {});\n\n    /* -- Other variables -- */\n    // This object holds on to all the timeouts that are being generated (timeout ids).\n    // The keys are the eventId of a scenario event and values are an array of all the related timeout idsm eg. {'event-1': [1,2]}\n    this.scenarioEventTimeouts = {};\n    // outcomes of events (expired, or decision picked) are recorded in this object\n    // eg. {'event-a': {expired: true, final_reply_id: null}, 'event-b': {expired: false, final_reply_id: 12}}\n    this.eventOutcomes = {};\n\n    /* -- Init -- */\n    // generate timeouts (i.e. card enters slot, update queue, card expires, etc) for all\n    // event scenarios that do not have a `after_event_completed` property defined and are not already previously completed\n    const events = this.preRenderedEventTargets.filter((el) => {\n      // Include standalone events (do not depend on other events), and exclude previously completed events\n      return !el.dataset.afterEventCompleted && el.dataset.previouslyCompleted !== 'true';\n    });\n\n    // TODO: Once we have time, we should probably remove this because this logic of dealing with events dependent on\n    // previously completed events is being done on the server side\n    // include events that depend on previously completed events\n    const eventsDependentOnPreviouslyCompletedEvents = this.preRenderedEventTargets\n      .filter((el) => {\n        return el.dataset.previouslyCompleted === 'true';\n      })\n      .reduce((acc, el) => {\n        const dependentEvents = this.dependentScenarioEventsMap[el.dataset.eventId];\n        if (dependentEvents) {\n          return [...acc, ...dependentEvents];\n        } else {\n          return acc;\n        }\n      }, []);\n\n    // NOTE: passing the pre-rendered HTML elements here instead of the original array of objects representing the events, because\n    // most manipulation of the event cards (eg. popping next event from queue, triggering an event after another)\n    // is done via vanilla js manupulation of the DOM and the targets are dynamic (eg. instead of keeping track here of which of the events\n    // is currently in the queue for phone call slot using some plain object array, we move the pre-rendered HTML elements for these events to a div container\n    // for queued items, and when it's time to pop-off the queue, we just fetch the first element from that div)\n    // Initially, display standalone events (do not depend on other events) and events that depend on previously completed events\n    this.scenarioEventTimeouts = this.generateScenarioEventTimeouts([...events, ...eventsDependentOnPreviouslyCompletedEvents]);\n  }\n\n  // Callback for tubo:before-render event listener\n  // Checks to see if new page being navigated to has the ehrSidebar turbo-permanent element (meaning turbo will keep stimulus controller on the page a\n  // and won't re-initialize)\n  checkIfStimulusControllerWillBeReInitialized(event) {\n    // Search the new page for an element that has both the same ID and the data-turbo-permanent attribute.\n    // In most cases, this element won't be present because navigating between tabs in the EHR database swaps only parts of the page via turbo frames,\n    // and the sidebar (which is outside these frames) isn’t included in that query.\n    // Although this event listener triggers on every page and turbo frame update, the sidebar—being marked as data-turbo-permanent—only reconnects or disconnects under these conditions:\n    //  1. A full page refresh.\n    //  2. Navigating to a page that lacks a data-turbo-permanent version of the sidebar.\n    //  3. Using the browser’s back button.\n    // Therefore, for cases 2 and 3, detecting a data-turbo-permanent element on the new full page is sufficient.\n    // This is important because we need to keep the timeouts active as long as the sidebar’s HTML remains on the page (Turbo preserves the HTML),\n    // and only clear them when the sidebar is truly removed.\n    const newPermanentElement = event.detail.newBody.querySelector(`#ehrSidebar[data-turbo-permanent]`);\n    this.clearTimeoutsOnDisconnect = !newPermanentElement;\n  }\n\n  connect() {\n    // Adding this event listener here instead of initialize because this is just a turbo event listener that is fine to be added/removed\n    // on connect and disconnect (our timeouts are set in initialize because they are very specific and we don't want to re-initialize them every time\n    // this controller connects/reconnects (eg. when user presses back in the browser))\n    document.addEventListener('turbo:before-render', this.checkIfStimulusControllerWillBeReInitialized);\n  }\n\n  disconnect() {\n    this.log(`Controller is disconnected and event listeners are removed`);\n\n    document.removeEventListener('turbo:before-render', this.checkIfStimulusControllerWillBeReInitialized);\n\n    // Since this controller is now wrapped inside a data-turbo-permanent element, disconnect doesn't activate when browsing tabs within the\n    // ehr database. It does though activate when navigating away or pressing the browser back button (even if still within the database)\n    // we do want to clear timeouts if navigating away, but don't want to clear them if pressing back and if we are still within the database\n    // checkIfStimulusControllerWillBeReInitialized() callback determines if we need to clear the timeouts based on the presence of the sidebar\n    // on the page being navigated to (see the method for more details)\n    if (this.clearTimeoutsOnDisconnect) {\n      this.log(`Timeouts are removed`);\n      Object.entries(this.scenarioEventTimeouts).forEach(([event_id, timeouts]) => {\n        timeouts.forEach(({ id, type }) => {\n          this.log(`TIMEOUT ${event_id}: ${type} cleared`);\n          clearTimeout(id);\n        });\n      });\n    }\n  }\n\n  /* -----------------------------------------------------------------------------\n  Actions\n  --------------------------------------------------------------------------------*/\n  // This is the click action for the last button in a conversation ('Complete Interaction')\n  endConversation(e) {\n    e.preventDefault();\n    this.endScenarioEvent(e.target.dataset.scenarioEventId);\n  }\n\n  // This is the click action for the first response in the scenario event card\n  openConversation(e) {\n    e.preventDefault();\n\n    // Get the instance of the whole scenario event element that the user clicked respond on\n    const preRenderedEventElement = this.preRenderedEventElements[e.target.dataset.scenarioEventId];\n    const interactionContainerElement = preRenderedEventElement.querySelector('.scenario-event-interaction');\n\n    // Remove active status on the icon, change its color and modify text\n    preRenderedEventElement.classList.remove('active');\n    preRenderedEventElement.classList.add('in-progress');\n    const eventType = preRenderedEventElement.dataset.eventType;\n    const eventTitleElement = preRenderedEventElement.querySelector('.event-type-heading');\n    if (eventType === 'phone_call') {\n      eventTitleElement.innerHTML = 'Call In Progress..';\n    } else if (eventType === 'patient_at_desk') {\n      eventTitleElement.innerHTML = 'Talking To Patient..';\n    } else if (eventType === 'clinic_interaction') {\n      eventTitleElement.innerHTML = 'Clinic Interaction In Progress..';\n    }\n\n    // disable all the other cards until this one is finished\n    this.disableEventSlots();\n\n    // Cancel the remove scenario event timeout\n    this.scenarioEventTimeouts[preRenderedEventElement.dataset.eventId]\n      .filter(({ type }) => type == this.TIMEOUTS.REMOVE.TYPE)\n      .forEach(({ id }) => {\n        this.log(`TIMEOUT ${preRenderedEventElement.dataset.eventId}: ${this.TIMEOUTS.REMOVE.TYPE} cleared`);\n        clearTimeout(id);\n      });\n\n    // Remove the initial respond button and Enable the interaction div\n    preRenderedEventElement.querySelector('.start-conversation-btn').remove();\n    interactionContainerElement.classList.remove('d-none');\n  }\n\n  respond(e) {\n    e.preventDefault();\n\n    // Get the instance of the whole scenario event element that the user clicked respond on\n    const preRenderedEventElement = this.preRenderedEventElements[e.target.dataset.scenarioEventId];\n    const interactionContainerElement = preRenderedEventElement.querySelector('.scenario-event-interaction');\n    const interactionHistoryElement = interactionContainerElement.querySelector('.interaction-history');\n    const parentInteractionTree = JSON.parse(preRenderedEventElement.dataset.interaction);\n    const chosenReplyIdx = e.params.replyIdx;\n    const isFirstPrompt = chosenReplyIdx == undefined;\n\n    // Add the chosen reply\n    let selectedInteractionTreeBranch;\n    if (isFirstPrompt) {\n      // This is for the scenario when it's the very first interaction\n      selectedInteractionTreeBranch = parentInteractionTree;\n    } else {\n      selectedInteractionTreeBranch = parentInteractionTree.reply_options[chosenReplyIdx];\n    }\n\n    if (selectedInteractionTreeBranch.reply) {\n      const replyNodeElement = document.createElement('div');\n      replyNodeElement.classList.add('text-primary', 'fst-italic', 'mb-2');\n      replyNodeElement.innerHTML = selectedInteractionTreeBranch.reply;\n      interactionHistoryElement.append(replyNodeElement);\n    }\n\n    // Add prompt (if it exists) and new response options with a delay\n    let promptLength = 0;\n    let promptDelayInMs = 0;\n    // Check that the prompt is defined\n    if (typeof selectedInteractionTreeBranch.prompt == 'string') {\n      promptLength = selectedInteractionTreeBranch.prompt.length;\n      if (!isFirstPrompt && promptLength < 25) {\n        promptDelayInMs = 500;\n      } else if (!isFirstPrompt && promptLength >= 25 && promptLength < 70) {\n        promptDelayInMs = 1200;\n      } else if (!isFirstPrompt && promptLength >= 70) {\n        promptDelayInMs = 2200;\n      }\n    }\n\n    // Disable button until prompt appears and display waiting animation\n    const continueConversationBtn = interactionContainerElement.querySelector('.response-button-container .btn');\n    if (continueConversationBtn) {\n      continueConversationBtn.disabled = true;\n      const btnDropdownMenuElement = interactionContainerElement.querySelector('.response-button-container .dropdown-menu');\n      btnDropdownMenuElement.classList.remove('show');\n      btnDropdownMenuElement.setAttribute('aria-expanded', 'false');\n      if (!isFirstPrompt) {\n        preRenderedEventElement.classList.add('waiting-for-prompt');\n      }\n    }\n\n    const promptDelayTimeout = setTimeout(() => {\n      this.log(\n        `TIMEOUT ${e.target.dataset.scenarioEventId}: ${this.TIMEOUTS.PROMPT_DELAY.TYPE} created (${promptDelayInMs}ms for ${promptLength} chars)`\n      );\n      // remove the waiting animation\n      preRenderedEventElement.classList.remove('waiting-for-prompt');\n\n      // Add the prompt\n      if (selectedInteractionTreeBranch.prompt) {\n        const promptNodeElement = document.createElement('div');\n        promptNodeElement.classList.add('text-secondary', 'mb-2');\n        promptNodeElement.innerHTML = selectedInteractionTreeBranch.prompt;\n        interactionHistoryElement.append(promptNodeElement);\n      }\n\n      const responseBtnContainerElement = interactionContainerElement.querySelector('.response-button-container');\n\n      // Update response button\n      if (selectedInteractionTreeBranch.reply_options.length > 0) {\n        responseBtnContainerElement.innerHTML = '';\n        const responseBtnGroupElement = document.createElement('div');\n        responseBtnGroupElement.classList.add('btn-group', 'btn-group-sm', 'w-100');\n        responseBtnGroupElement.setAttribute('role', 'group');\n\n        const responseBtnElement = document.createElement('button');\n        responseBtnElement.classList.add('btn', 'btn-outline-primary', 'dropdown-toggle');\n        responseBtnElement.dataset.bsToggle = 'dropdown';\n        responseBtnElement.setAttribute('aria-expanded', 'false');\n        responseBtnElement.innerHTML = 'Choose a Response';\n\n        // set new options\n        const responseBtnOptionsElement = document.createElement('ul');\n        responseBtnOptionsElement.classList.add('dropdown-menu', 'w-100');\n        responseBtnOptionsElement.innerHTML = '';\n        selectedInteractionTreeBranch.reply_options.forEach(({ reply }, idx) => {\n          const replyOptionListElement = document.createElement('li');\n          const replyOptionsAnchorElement = document.createElement('a');\n          replyOptionsAnchorElement.classList.add('dropdown-item', 'fst-italic', 'text-wrap');\n          replyOptionsAnchorElement.dataset.action = 'click->ehr--scenario-events#respond';\n          replyOptionsAnchorElement.dataset.scenarioEventId = preRenderedEventElement.dataset.eventId;\n          replyOptionsAnchorElement.setAttribute('data-ehr--scenario-events-reply-idx-param', idx);\n          replyOptionsAnchorElement.setAttribute('href', '');\n          replyOptionsAnchorElement.innerHTML = reply;\n          replyOptionListElement.appendChild(replyOptionsAnchorElement);\n          responseBtnOptionsElement.appendChild(replyOptionListElement);\n        });\n\n        responseBtnGroupElement.appendChild(responseBtnElement);\n        responseBtnGroupElement.appendChild(responseBtnOptionsElement);\n        responseBtnContainerElement.appendChild(responseBtnGroupElement);\n      } else {\n        // This runs if there are no more reply options (so this is the end of the conversation)\n        responseBtnContainerElement.innerHTML = '';\n        const responseBtnElement = document.createElement('button');\n        responseBtnElement.innerHTML = 'Complete Interaction';\n        responseBtnElement.classList.add('btn', 'btn-outline-primary', 'btn-sm');\n        responseBtnElement.dataset.action = 'click->ehr--scenario-events#endConversation';\n        responseBtnElement.dataset.scenarioEventId = preRenderedEventElement.dataset.eventId;\n        responseBtnContainerElement.append(responseBtnElement);\n        // Since this is the end of conversation, we can record the final reply option the user chose\n        this.eventOutcomes[e.target.dataset.scenarioEventId] = {\n          expired: false,\n          final_reply_id: selectedInteractionTreeBranch.id,\n        };\n      }\n    }, promptDelayInMs);\n\n    this.scenarioEventTimeouts[preRenderedEventElement.dataset.eventId].push({\n      type: this.TIMEOUTS.PROMPT_DELAY.TYPE,\n      id: promptDelayTimeout,\n    });\n\n    // Update dataset variable for the interaction\n    preRenderedEventElement.dataset.interaction = JSON.stringify(selectedInteractionTreeBranch);\n  }\n\n  /* -----------------------------------------------------------------------------\n  Helpers\n  --------------------------------------------------------------------------------*/\n\n  endScenarioEvent(scenarioEventId) {\n    // Get the instance of the whole scenario event element that the user clicked respond on\n    const preRenderedEventElement = this.preRenderedEventElements[scenarioEventId];\n\n    // Show a 'Done' message with a checkmark\n    const responseBtnContainer = preRenderedEventElement.querySelector('.response-button-container');\n    responseBtnContainer.innerHTML = '';\n\n    const scenarioEventDoneElement = preRenderedEventElement.querySelector('.scenario-event-finished-message');\n    scenarioEventDoneElement.classList.remove('d-none');\n\n    this.log(`TIMEOUT ${scenarioEventId}: ${this.TIMEOUTS.CONVERSATION_FINISHED_DELAY.TYPE} created`);\n    let conversationFinishedTimeout;\n\n    // this creates a minimum amount of time we want the loading animation to be on screen\n    const conversationFinishedMinTimeoutPromise = new Promise((resolve) => {\n      conversationFinishedTimeout = setTimeout(resolve, this.minDelayAfterConversationEndInMs);\n    });\n\n    const response = fetch(`/labs/databases/${this.databaseIdValue}/interaction_completed.json`, {\n      method: 'PATCH',\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      body: JSON.stringify({ interactions: { event_id: scenarioEventId } }),\n    });\n\n    // We want the loading animation to be on screen for at least the timeout set by conversationFinishedMinTimeoutPromise\n    Promise.all([response, conversationFinishedMinTimeoutPromise])\n      .then(([serverResponse]) => {\n        return serverResponse.json().then((data) => {\n          if (serverResponse.ok) {\n            return Promise.resolve(data);\n          } else {\n            return Promise.reject(data);\n          }\n        });\n      })\n      .then(() => {\n        // NOTE: even though we are getting a success message from the server, for now just displaying\n        // a general 'done!' message right away. To display messages from server for success, we should\n        // add another message of 'submitting interaction' and then add an additional timer to show 'done'\n        // so not adding that at the moment to avoid unnecessary complexity\n        // 1. Remove it from view\n        this.removeScenarioEvent(preRenderedEventElement);\n        // 2. Check if there are any events conditional on this one being completed\n        const dependentScenarioEvents = this.dependentScenarioEventsMap[scenarioEventId];\n        if (dependentScenarioEvents) {\n          this.scenarioEventTimeouts = {\n            ...this.scenarioEventTimeouts,\n            ...this.generateScenarioEventTimeouts(dependentScenarioEvents),\n          };\n        }\n        this.enableEventSlots();\n      })\n      .catch((jsonResponse) => {\n        // Even though the interaction might say done and loading spinner goes off, if the server cant save the interaction,\n        // the message will be replaced with an error message from the server\n        scenarioEventDoneElement.classList.add('d-none');\n        const scenarioEventErrorMessageElement = preRenderedEventElement.querySelector('.scenario-event-error-message');\n        if (typeof jsonResponse == 'object' && Object.prototype.hasOwnProperty.call(jsonResponse, 'message')) {\n          scenarioEventErrorMessageElement.querySelector('.message').innerHTML = jsonResponse.message;\n        }\n        scenarioEventErrorMessageElement.classList.remove('d-none');\n      });\n\n    this.scenarioEventTimeouts[scenarioEventId].push({\n      type: this.TIMEOUTS.CONVERSATION_FINISHED_DELAY.TYPE,\n      id: conversationFinishedTimeout,\n    });\n  }\n\n  // Generate timeouts for each scenario event (eg. when the card should be added to a slot, when it should be removed if it expired)\n  // scenarioEvents is an array of HTMLElements of pre-rendered scenario event cards\n  generateScenarioEventTimeouts(scenarioEvents) {\n    return scenarioEvents.reduce((acc, preRenderedElement) => {\n      // 1. Extract the scenario event properties from current HTML Element stored in its data attributes\n      const id = preRenderedElement.dataset.eventId;\n      const type = preRenderedElement.dataset.eventType;\n      const when_in_s = isNaN(parseInt(preRenderedElement.dataset.whenInS, 10))\n        ? null\n        : parseInt(preRenderedElement.dataset.whenInS, 10);\n      const duration_in_s = isNaN(parseInt(preRenderedElement.dataset.durationInS, 10))\n        ? null\n        : parseInt(preRenderedElement.dataset.durationInS, 10);\n\n      // 2. Initialize variable for storing all the timeouts that will be generated for this scenario event\n      const timeouts = [];\n      const preRenderedEventElement = this.preRenderedEventElements[id];\n\n      // 3. Generate timeouts\n\n      // Timeout - Show Event\n      const showEventTimeout = setTimeout(() => {\n        this.log(`TIMEOUT ${id}: ${this.TIMEOUTS.SHOW.TYPE} created`);\n        // Open drawer, if not open already\n        this.sidebar.show();\n        if (type == 'patient_at_desk' || type == 'phone_call' || type == 'clinic_interaction') {\n          // Activate animations\n          if (type == 'phone_call') {\n            preRenderedEventElement.classList.add('active');\n          }\n\n          // Add the new element\n          this.insertScenarioEvent(preRenderedEventElement);\n        } else if (type == 'voicemail' || type == 'instant_message' || type == 'email') {\n          this.updateWidgetBadge(type);\n        } else {\n          throw new Error(`Unknown scenario event type: ${type}`);\n        }\n      }, when_in_s * 1000);\n      timeouts.push({ type: this.TIMEOUTS.SHOW.TYPE, id: showEventTimeout });\n\n      // Timeout - Play Sound (if config above does not specify to mute sounds)\n      if (type == 'phone_call' && !this.muteSounds) {\n        this.log(`phone ringing sound`);\n        const playSoundTimeout = setTimeout(() => {\n          this.log(`TIMEOUT ${id}: ${this.TIMEOUTS.SOUND.TYPE} created`);\n          this.ringingSound.load(); // this resets the audio\n          this.ringingSound.play();\n        }, when_in_s * 1000);\n        timeouts.push({ type: this.TIMEOUTS.SOUND.TYPE, id: playSoundTimeout });\n      }\n\n      // Timeout - Remove Event (if event has duration_in_s)\n      if (duration_in_s) {\n        const removeEventTimeout = setTimeout(\n          () => {\n            this.log(`TIMEOUT ${id}: ${this.TIMEOUTS.REMOVE.TYPE} created`);\n            this.removeScenarioEvent(preRenderedEventElement);\n          },\n          (duration_in_s + when_in_s) * 1000\n        );\n        timeouts.push({ type: this.TIMEOUTS.REMOVE.TYPE, id: removeEventTimeout });\n\n        // record that the event has expired\n        this.eventOutcomes[id] = {\n          expired: true,\n          final_reply_id: null,\n        };\n      }\n      return {\n        ...acc,\n        [id]: timeouts,\n      };\n    }, {});\n  }\n\n  // Remove a scenario event card from its current slot and populate the slot with the next event from the queue\n  // scenarioEventElement is an HTMLElement representing the scenario event card\n  removeScenarioEvent(scenarioEventElement) {\n    const targetSlot = this.eventSlots[scenarioEventElement.dataset.eventType];\n    // 1. Update the queue badge\n    this.updateQueueBadge(targetSlot, -1);\n\n    // 2. Remove timeouts associated with the scenario event being removed\n    this.scenarioEventTimeouts[scenarioEventElement.dataset.eventId].forEach(({ id, type }) => {\n      this.log(`TIMEOUT ${scenarioEventElement.dataset.eventId}: ${type} cleared`);\n      clearTimeout(id);\n    });\n\n    // 3. remove the scenario event card HTMLElement from view\n    scenarioEventElement.remove();\n\n    // 4. If there is an event in the queue for this slot, move it into the slot\n\n    // Now that there is an empty slot, update it with anything currently in queue\n    // Only run this if the element removed is not in the queue container\n    const elementInQueue = scenarioEventElement.dataset.inQueue === 'true';\n    if (!elementInQueue) {\n      this.popEventFromQueue(scenarioEventElement.dataset.eventType);\n    }\n  }\n\n  // Checks if there are any HTMLElements in the hidden queue container for a slot, and if there are, moves them into the slot\n  // slotType is a string representing one of the 3 slots, eg 'phone_call', 'patient_at_desk', 'clinic_interaction'\n  popEventFromQueue(slotType) {\n    const targetSlot = this.eventSlots[slotType];\n    const placeholderSlot = targetSlot.querySelector('.placeholder-slot');\n    // The queue div may contain multiple queued elements, querySelector selects the first one found\n    const queuedEvent = targetSlot.querySelector('.queued-pre-rendered-events .scenario-event');\n    if (queuedEvent) {\n      // If a queued element has been found, we display a small animation between the current element being removed and the queued one\n      // being added to the slot (without a delay and an animation, it is confusing and feels like the first card was never cleared in the first place)\n      placeholderSlot.classList.add('loading');\n      queuedEvent.dataset.inQueue = false;\n      const delayTimeout = setTimeout(() => {\n        targetSlot.querySelector('.current-event-container').append(queuedEvent);\n        placeholderSlot.classList.remove('loading');\n      }, this.delayBetweenQueuedItemsInMs);\n      // Update the collection of timeouts\n      this.scenarioEventTimeouts[queuedEvent.dataset.eventId].push({ type: this.TIMEOUTS.QUEUE_DELAY.TYPE, id: delayTimeout });\n    }\n  }\n\n  // Disable (grey out and display a message) all the scenario events in non-active slots, so that\n  // the user knows to finish the scenario in the active slot first\n  disableEventSlots() {\n    document\n      .querySelectorAll('.ehr-sidebar .event-slot .current-event-container .scenario-event:not(.in-progress)')\n      .forEach((scenarioEvent) => {\n        const btn = scenarioEvent.querySelector('.start-conversation-btn');\n        if (btn) btn.setAttribute('disabled', true);\n        scenarioEvent.classList.add('disabled');\n      });\n  }\n\n  // Remove the greyed out effect and re-enable buttons on slots that have been disabled while\n  // user had another slot active\n  enableEventSlots() {\n    document.querySelectorAll('.ehr-sidebar .event-slot .scenario-event').forEach((scenarioEvent) => {\n      const btn = scenarioEvent.querySelector('.start-conversation-btn');\n      if (btn) btn.removeAttribute('disabled');\n      scenarioEvent.classList.remove('disabled');\n    });\n  }\n\n  // Insert the passed in scenario event element (newScenarioEventElement) into\n  // the appropriate event slot (phone call, patient at desk, or clinic interaction)\n  insertScenarioEvent(newScenarioEventElement) {\n    // The event has been triggered at this point, so we want to update the backend\n    // TODO: link this promise to the loading animation and display a success or a fail message\n    // Send the completed event information to the backend\n    if (!newScenarioEventElement.dataset.triggeredAt) {\n      fetch(`/labs/databases/${this.databaseIdValue}/interaction_triggered.json`, {\n        method: 'PATCH',\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        body: JSON.stringify({ interactions: { event_id: newScenarioEventElement.dataset.eventId } }),\n      });\n    }\n\n    const targetSlot = this.eventSlots[newScenarioEventElement.dataset.eventType];\n\n    const currentEvent = targetSlot.querySelector('.scenario-event');\n    if (currentEvent) {\n      this.updateQueueBadge(targetSlot, 1);\n\n      // Move the event to the hidden queue container\n      const queueContainer = targetSlot.querySelector('.queued-pre-rendered-events');\n      newScenarioEventElement.dataset.inQueue = true;\n      queueContainer.append(newScenarioEventElement);\n\n      // if slot is not empty, add/increase the queue badge\n    } else {\n      // If slot is empty, add the new event into the slot\n      newScenarioEventElement.dataset.inQueue = false;\n      targetSlot.querySelector('.current-event-container').append(newScenarioEventElement);\n    }\n  }\n\n  // Each slot has an html badge element in the corner that represents the queue. This method updates the number in the queue\n  // by the value of changeBy\n  // targetSlotElement is an HTMLElement for one of the 3 slots\n  updateQueueBadge(targetSlotElement, changeBy = 1) {\n    const badgeElement = targetSlotElement.querySelector('.events-in-queue');\n    const numInQueue = parseInt(badgeElement.dataset.numInQueue, 10);\n\n    // Update the value and dataset attribute of queue by changeBy value\n    badgeElement.dataset.numInQueue = Math.max(numInQueue + changeBy, 0);\n    badgeElement.innerHTML = '';\n    badgeElement.appendChild(document.createTextNode(badgeElement.dataset.numInQueue));\n    const accessibilityString = document.createElement('span');\n    accessibilityString.innerHTML = `more event(s)`;\n    accessibilityString.classList.add('visually-hidden');\n    badgeElement.appendChild(accessibilityString);\n  }\n\n  // Update the number on one of the widget badges (eg. Email, IM, or Email tabs)\n  updateWidgetBadge(eventType) {\n    if (eventType == 'voicemail') {\n      this.updateQueueBadge(this.voicemailWidgetTarget);\n    } else if (eventType == 'instant_message') {\n      this.updateQueueBadge(this.messagingWidgetTarget);\n    } else if (eventType == 'email') {\n      this.updateQueueBadge(this.emailWidgetTarget);\n    }\n  }\n\n  // Using this over console.log because easier to turn off globally for the entire stimulus controller\n  log(message) {\n    if (this.debugMode) {\n      console.log(`[scenario_events][DEBUG] - ${message}`);\n      console.groupCollapsed('\\t↳State');\n      console.log('Timeouts', this.scenarioEventTimeouts, '\\nOutcomes', this.eventOutcomes);\n      console.groupEnd();\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n// This Stimulus controller helps to change the css of the active button on the EHR right-hand navigation menu\n// (since we are using turbo-frames to change the main content, the navbar does not, so we need some async javascript\n// to bring that functionality back)\n// Connects to data-controller=\"ehr--navigation-bar-controller\"\nexport default class extends Controller {\n  static targets = ['navLink'];\n\n  initialize() {\n    // Need to do this because otherwise when this function is being used as a callback, it loses its\n    // value of `this` and starts pointing to the global space (this is similar pattern to how React does it)\n    this.handlePageChange = this.handlePageChange.bind(this);\n  }\n\n  handlePageChange(event, url) {\n    const destinationPageUrl = event ? event.detail.url : url;\n    // Clear all active nav buttons\n    this.navLinkTargets.forEach((el) => {\n      el.classList.remove('bg-primary', 'active');\n      el.classList.add('bg-primary', 'bg-light');\n    });\n\n    // Assign active style to the current nav button\n    const activeNav = this.navLinkTargets.find((el) => {\n      // special case is the edit patient pages, which takes the form of /labs/databases/246/patients/631\n      if (el.ariaLabel === 'New Patient' && /\\/labs\\/databases\\/\\d+\\/patients\\/\\d+/.test(destinationPageUrl)) {\n        return true;\n      }\n\n      // special case for claim files pages\n      if (el.ariaLabel === 'Billing') {\n        // The passed in parentUrl for claim files is the index action (eg. /labs/databases/1143/claim_files)\n        // Currently, all of our other claim file related pages are a subset of that (eg. /labs/databases/1143/claim_files/daily)\n        // So that's all we are checkin here\n        const parentUrl = new URL(el.dataset.navUrlDestinations);\n        const currentUrl = new URL(destinationPageUrl);\n        if (currentUrl.pathname.startsWith(parentUrl.pathname)) return true;\n      }\n\n      return el.dataset.navUrlDestinations === destinationPageUrl;\n    });\n    if (activeNav) {\n      activeNav.classList.remove('bg-light');\n      activeNav.classList.add('bg-primary', 'active');\n    } else {\n      // Console log an error because no active nav button has been selected\n    }\n  }\n\n  connect() {\n    document.addEventListener('turbo:visit', this.handlePageChange);\n    // Run handle page change on initial page load\n    this.handlePageChange(null, window.location.href);\n  }\n  disconnect() {\n    document.removeEventListener('turbo:visit', this.handlePageChange);\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n/**\n * @class PollServerController\n * @description A Stimulus controller that polls the server with retries, displaying progress through a progress bar.\n *              Connects to data-controller=\"ehr--poll-server\"\n * @extends Controller\n * @example\n *\n * ```html\n * <div data-controller=\"ehr--poll-server\"\n *      data-ehr--poll-server-url-to-poll-value=\"<%= check_registration_status_stripe_v2_payments_url(product_id: @product.id, format: :json) %>\"\n *      data-ehr--poll-server-num-retries-value=\"5\"\n *      data-ehr--poll-server-ms-between-retries-value=\"2000\"\n *      data-ehr--poll-server-debug-value=\"true\">\n *\n *   <!-- Failure Container -->\n *   <div data-ehr--poll-server-target=\"failContainer\" class=\"d-none\">\n *     Failed to register the product. Please try again.\n *   </div>\n *\n *   <!-- Progress Bar Container -->\n *   <div data-ehr--poll-server-target=\"progressBarContainer\">\n *      <div class=\"progress mb-2\" role=\"progressbar\" aria-label=\"Checking for active subscriptions\" aria-valuenow=\"0\" aria-valuemin=\"0\" aria-valuemax=\"100\">\n *        <div class=\"progress-bar\" style=\"width: 0%;\"></div>\n *      </div>\n *      <div class=\"d-flex align-items-center\">\n *        <div class=\"spinner-border spinner-border-sm me-2\" role=\"status\">\n *          <span class=\"visually-hidden\">Loading...</span>\n *        </div>\n *        <span class=\"text-secondary\">Checking for active subscriptions</span>\n *      </div>\n *    </div>\n * </div>\n * ```\n */\nexport default class extends Controller {\n  /**\n   * @property {HTMLElement} failContainerTarget - The container element to show upon failure.\n   * @property {HTMLElement} progressBarContainerTarget - The container element for the progress bar.\n   *\n   * @property {Boolean} debugValue - A debug flag to enable or disable logging.\n   * @property {Number} numAttemptsValue - The number of attempts made during polling.\n   * @property {String} urlToPollValue - The URL to poll for the status check.\n   * @property {Number} numRetriesValue - The maximum number of retries allowed.\n   * @property {Number} msBetweenRetriesValue - The milliseconds to wait between retry attempts.\n   */\n  static targets = ['failContainer', 'progressBarContainer'];\n  static values = {\n    debug: { type: Boolean, default: false },\n    numAttempts: Number,\n    urlToPoll: String,\n    numRetries: { type: Number, default: 4 },\n    msBetweenRetries: { type: Number, default: 1000 },\n  };\n\n  async connect() {\n    this.progressElement = this.progressBarContainerTarget.querySelector('.progress');\n    this.progressBarElement = this.progressBarContainerTarget.querySelector('.progress-bar');\n    this.progressBarElement.style.transition = `width ${Math.round((this.msBetweenRetriesValue / 1000) * 10) / 10}s`;\n\n    try {\n      const data = await this.fetchWithRetries({\n        url: this.urlToPollValue,\n        numRetriesLeft: this.numRetriesValue,\n        msBetweenRetries: this.msBetweenRetriesValue,\n      });\n      window.location.href = data.redirectUrl;\n    } catch (error) {\n      this.failContainerTarget.classList.remove('d-none');\n    } finally {\n      this.progressBarContainerTarget.classList.add('d-none');\n    }\n  }\n\n  /**\n   * Polls the server with retries.\n   *\n   * @param {Object} params - The parameters for polling.\n   * @param {String} params.url - The URL to poll.\n   * @param {Object} [params.options] - The fetch options (method, headers, body).\n   * @param {Number} params.msBetweenRetries - The milliseconds to wait between retries.\n   * @param {Number} params.numRetriesLeft - The number of retries left.\n   *\n   * @returns {Promise} - Resolves if successful, rejects if all retries fail.\n   */\n  async fetchWithRetries({\n    url,\n    options = { method: 'POST', headers: { 'Content-Type': 'application/json' } },\n    msBetweenRetries,\n    numRetriesLeft,\n  }) {\n    if (numRetriesLeft >= 0) {\n      const attemptNumber = this.numRetriesValue - numRetriesLeft + 1;\n      this.log(`Checking with server (attempt #${attemptNumber}), ${url}`);\n\n      // Update the progress bar\n      const percentProgress = ((this.numRetriesValue - numRetriesLeft) / this.numRetriesValue) * 100;\n      this.progressBarElement.style.width = `${percentProgress}%`;\n      this.progressElement.setAttribute('aria-valuenow', percentProgress);\n\n      try {\n        const response = await fetch(url, options);\n        if (!response.ok) throw new Error('Network response was not ok');\n        const data = await response.json();\n\n        if (data.registered) {\n          return data;\n        } else {\n          throw new Error('Not registered yet');\n        }\n      } catch (error) {\n        await this.sleep(msBetweenRetries);\n        let modifiedOptions = { ...options };\n        if (numRetriesLeft === 1) {\n          modifiedOptions.body = JSON.stringify({ last_fetch_attempt: true });\n        }\n        return this.fetchWithRetries({\n          url,\n          options: modifiedOptions,\n          msBetweenRetries,\n          numRetriesLeft: numRetriesLeft - 1,\n        });\n      }\n    } else {\n      this.log('Out of retries');\n      throw new Error('Out of retries');\n    }\n  }\n\n  /**\n   * Pauses execution for a given number of milliseconds.\n   * @param {Number} ms - Milliseconds to sleep.\n   * @returns {Promise} - Resolves after the specified time.\n   */\n  sleep(ms) {\n    return new Promise((resolve) => setTimeout(resolve, ms));\n  }\n\n  /**\n   * Logs a message to the console if the debug flag is enabled.\n   *\n   * @param {String} message - The message to log.\n   */\n  log(message) {\n    if (this.debugValue) {\n      console.log(`[poll-server-controller][DEBUG] - ${message}`);\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n// This controller scrolls an element (with an overflow auto or scroll) or window to the top (or middle) of its internal scrollable view\n// Eg. useful when in EHR patient view we click Save, and then the turbo frame gets swapped with error messages at the top,\n// having this controller on the scrollable div scrolls the flash messages into view\n\n// Connects to data-controller=\"ehr--scroll-to-top\"\nexport default class extends Controller {\n  static values = {\n    topOfWindow: Boolean,\n    toElement: Boolean,\n  };\n\n  connect() {\n    if (this.topOfWindowValue) {\n      // scroll to the top of the global window\n      window.scrollTo(0, 0);\n    } else if (this.toElementValue) {\n      // scrolls the target element to middle of the page\n      this.element.scrollIntoView({ block: 'center', behavior: 'instant' });\n    } else {\n      // scroll to the top of the element with overflow\n      this.element.scrollTo(0, 0);\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n/** A Stimulus controller for sorting elements based on data attributes and updating the UI accordingly.\n * It supports multi-criteria sorting with optional ascending or descending order.\n *\n * Important things to keep in mind:\n * - IMPORTANT: when passing an array to action params, make sure the outer string uses single quotes and the array items use double\n * - the data attributes that div elements are being sorted by are dashed, but when read using dataset they are camelcase. So when specifying the sortBy params on each button, use camelcase names\n *    eg. data-first-name=\"Jane\" on the element to be sorted, then 'firstName' should be passed to data-ehr--sort-div-containers-sort-by-param\n *\n * @example\n * <!-- HTML Example: -->\n * <div data-controller=\"ehr--sort-div-containers\">\n * <button\n *    class=\"btn btn-outline-primary rounded-0 ms-2\"\n *    data-action=\"click->ehr--sort-div-containers#sortElements\"\n *    data-ehr--sort-div-containers-sort-by-param='[\"firstName\", \"lastName\"]'\n *    data-ehr--sort-div-containers-target=\"sortButton\"\n *    data-sort-order-ascending=\"true\"\n *    data-bootstrap-icon-ascending-class=\"bi-sort-alpha-down\"\n *    data-bootstrap-icon-descending-class=\"bi-sort-alpha-up\"\n *    data-button-text=\"Sort By First Name\"\n *  >\n *    <!-- Button content generated by the controller -->\n *  </button>\n *   <div data-ehr--sort-div-containers-target=\"sortedElementsContainer\">\n *     <div data-ehr--sort-div-containers-target=\"elementToSort\" data-first-name=\"John\" data-last-name=\"Doe\">John Doe</div>\n *     <div data-ehr--sort-div-containers-target=\"elementToSort\" data-first-name=\"Jane\" data-last-name=\"Smith\">Jane Smith</div>\n *   </div>\n * </div>\n */\nexport default class extends Controller {\n  static targets = ['elementToSort', 'sortedElementsContainer', 'sortButton'];\n\n  connect() {\n    this.sortButtonTargets.forEach((btnEl) => this.setButtonContent(btnEl));\n  }\n\n  /**\n   * Handles the sorting of elements when a sort button is clicked. Once clicked, the content of the button changes to the opposite sorting order (reverse the bootstrap order icon)\n   *\n   * @param {Event} e - The click event triggered by the sort button.\n   *\n   * @remarks\n   * - When passing an array to the `params` attribute in HTML, ensure that the outer string uses single quotes (`'`) and the array items use double quotes (`\"`).\n   * - The sorting process first handles the secondary criteria to allow stable sorting on the primary criteria.\n   *\n   */\n  sortElements(e) {\n    const reverse = !this.parseValue(e.target.dataset.sortOrderAscending);\n    // NOTE: reversing the sortBy array so the secondary sort happens first and the primary sort happens on an already sorted array\n    const sortedElements = e.params.sortBy.reverse().reduce((acc, sortBy) => {\n      return acc.sort((a, b) => {\n        const attrA = this.parseValue(a.dataset[sortBy]);\n        const attrB = this.parseValue(b.dataset[sortBy]);\n\n        if (attrA < attrB) return reverse ? 1 : -1;\n        if (attrA > attrB) return reverse ? -1 : 1;\n\n        return 0;\n      });\n    }, this.elementToSortTargets);\n\n    this.sortedElementsContainerTarget.innerHTML = '';\n    sortedElements.forEach((el) => this.sortedElementsContainerTarget.appendChild(el));\n\n    // Update the button to reflect the opposite sort order\n    const isOrderAscending = this.parseValue(e.target.dataset.sortOrderAscending);\n    e.target.dataset.sortOrderAscending = !isOrderAscending;\n    this.setButtonContent(e.target);\n  }\n\n  /**\n   * Parses a value to ensure it can be compared correctly during sorting.\n   *\n   * @param {string} value - The value to be parsed.\n   * @returns {string|number|boolean} - Returns a boolean if the value is 'true' or 'false', a number if the value is numeric, otherwise returns a lowercase string.\n   *\n   * @example\n   * // Example parsing behavior:\n   * this.parseValue(\"true\"); // Returns true (boolean)\n   * this.parseValue(\"42\"); // Returns 42 (number)\n   * this.parseValue(\"hello\"); // Returns \"hello\" (lowercase string)\n   */\n  parseValue(value) {\n    // Handle boolean values\n    if (value.toLowerCase() === 'true') return true;\n    if (value.toLowerCase() === 'false') return false;\n\n    // Check if the value can be converted to a number\n    return isNaN(value) ? value.toLowerCase() : Number(value);\n  }\n\n  /**\n   * Sets the content of the sort button, updating the icon and label based on the current sort order.\n   *\n   * @param {HTMLElement} btn - The sort button element.\n   */\n  setButtonContent(btn) {\n    const isSortOrderAscending = this.parseValue(btn.dataset.sortOrderAscending);\n    const sortIconEl = document.createElement('i');\n    btn.innerHTML = '';\n    if (isSortOrderAscending) {\n      sortIconEl.classList.add('bi', btn.dataset.bootstrapIconAscendingClass, 'me-1');\n      btn.appendChild(sortIconEl);\n      btn.appendChild(document.createTextNode(btn.dataset.buttonText));\n    } else {\n      sortIconEl.classList.add('bi', btn.dataset.bootstrapIconDescendingClass, 'me-1');\n      btn.appendChild(sortIconEl);\n      btn.appendChild(document.createTextNode(btn.dataset.buttonText));\n    }\n  }\n}\n","/* eslint-disable no-undef */\nimport { Controller } from '@hotwired/stimulus';\n\n// This controller helps manage sub-forms of chart entries page.\n// eg. auto updates allergy type field based on the allergy selected from the selectize dropdown\n// To be defined on the top container of a chart entry type\n// (eg. container for chart notes, or container for allergies)\n// Connects to data-controller=\"ehr--form-helper\"\nexport default class extends Controller {\n  static values = {\n    // Used by allergies form, an object where an allergen is a key, and the value is a category that allergen belongs to\n    // eg. { 'medical': { \"Peanuts\": \"Food\", \"Tree nuts\": \"Food\"}, 'non_medical': {\"Ibuprofen\": \"NSAID\"}}\n    allergenCategoryMappings: Object,\n    // Used by treatments form to modify dropdown choices for 'drug form', depending on treatment route chosen\n    // eg. { 'Oral': ['Tablet'], 'Intravenous': ['Injection']}\n    treatmentRouteAndFormMappings: Object,\n  };\n\n  static targets = ['deceasedFamilyHistoryRevealArea', 'mustCompleteCheckbox', 'submitButton'];\n\n  initialize() {}\n  connect() {\n    if (this.mustCompleteCheckboxTargets && this.hasSubmitButtonTarget) {\n      this.toggleSubmitButtonDisabledState();\n    }\n\n    if (this.hasAllergenCategoryMappingsValue) {\n      this.combinedAllergenCategoryMappings = {\n        ...this.allergenCategoryMappingsValue['Medical'],\n        ...this.allergenCategoryMappingsValue['Non-Medical'],\n      };\n    }\n    // turning off autocomplete on all input fields\n    // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill\n    this.element.querySelectorAll('input').forEach((el) => el.setAttribute('autocomplete', 'one-time-code'));\n\n    // If we are specifying the validate action on the form that is using this controller, then\n    // add `novalidate` attribute so that the browser doesn't validate it automatically, and instead we do it\n    // using the Validation API in the validate method manually\n    if (this.element.getAttribute('data-action')?.includes('ehr--form-helper#validate')) {\n      this.element.setAttribute('novalidate', '');\n    }\n  }\n\n  // Disables the submit button if not all of the mandatory checkboxes are checked off\n  // This is an on-change event\n  toggleSubmitButtonDisabledState(event) {\n    this.submitButtonTarget.disabled = !this.mustCompleteCheckboxTargets.every((checkbox) => checkbox.checked);\n  }\n\n  // Auto-update the allergen type form input, depending on what the user has picked for the allergen\n  // This gets activated when the allergy dropdown input changes (detected via custom event emitted by selectize)\n  updateAllergenCategoryInput(event) {\n    const currentSelectInputValue = event.target.value;\n    const targetInput = this.element.querySelector(`#${event.params.targetId}`);\n    targetInput.value = this.combinedAllergenCategoryMappings[currentSelectInputValue] || '';\n  }\n\n  // The family history form has a deceased checkbox. If it is checked off, we want to unhide 2 extra inputs (deceased date and cause)\n  // This method also clears the inputs when the checkbox is unchecked and the inputs are hidden (so that we don't end up sending\n  // the values of the hidden inputs to the server when form is submitted)\n  toggleDeceasedInputs(event) {\n    if (event.currentTarget.checked) {\n      this.deceasedFamilyHistoryRevealAreaTarget.classList.remove('d-none');\n    } else {\n      this.deceasedFamilyHistoryRevealAreaTarget.classList.add('d-none');\n      // reset the input fields so we don't end up sending their values to the backend when form is submitted\n      this.deceasedFamilyHistoryRevealAreaTarget.querySelectorAll('input').forEach((input) => (input.value = ''));\n    }\n  }\n\n  // Update the dropdown options for the \"drug form\" select input (treatment chart entry form)\n  // based on what treatment route was chosen (eg. if user chose 'Oral', then drug form dropdown would include 'tablet', 'capsule', etc)\n  updateDrugFormInput(event) {\n    const selectElement = event.currentTarget;\n    // This is the drug form select\n    const targetSelectElement = this.element.querySelector(`#${event.params.targetId}`);\n    // Chosen value for treatment route\n    const selectedRoute = selectElement.value;\n\n    // Clear the druf form dropdown if no valid route option was selected (eg. if user selects a blank for route)\n    if (!selectedRoute) {\n      targetSelectElement.innerHTML = '';\n    }\n\n    const newOptions = this.treatmentRouteAndFormMappingsValue[selectedRoute]\n      .map((drugForm) => `<option value=\"${drugForm}\">${drugForm}</option>`)\n      .join('\\n');\n    targetSelectElement.innerHTML = `\n      <option value=\"\" label=\" \"></option>\n      ${newOptions}\n    `.trim();\n  }\n\n  /**\n   * Validates the form element, prevents submission if invalid,\n   * and focuses on the first invalid input element. This is the onsubmit method for the form (if specified)\n   * NOTE: doesn't work with select inputs that use .selectize at the moment\n   *\n   * @param {Event} event - The event object representing the form submission event.\n   */\n  validate(event) {\n    // Check the validity of the form element and prevent form submission if its not valid\n    if (!this.element.checkValidity()) {\n      event.preventDefault();\n      event.stopPropagation();\n    }\n\n    // Add 'was-validated' class to all elements with the 'needs-validation' class, which would make any bootstrap\n    // .invalid-feedback and .valid-feedback elements visible (also will apply styling to the input elements)\n    this.element.querySelectorAll('.needs-validation').forEach((el) => el.classList.add('was-validated'));\n\n    // Find the first invalid input element (input, select, or textarea)\n    const firstInvalidInput = this.element.querySelector('input:invalid, select:invalid, textarea:invalid');\n    if (firstInvalidInput) {\n      // Scroll to the first invalid input element, center it in the viewport and focus (replicate default browser behaviour)\n      firstInvalidInput.scrollIntoView({ block: 'center' });\n      firstInvalidInput.focus();\n    }\n  }\n}\n","/* eslint-disable no-undef */\nimport { Controller } from '@hotwired/stimulus';\n\n/**\n * This Stimulus controller provides interactive form logic for calculating claim service details:\n * - Tracks the default total amount and quantity to update overall service costs.\n * - Resets key fields when the user changes the service code.\n * - Prevents accidental form submission via the Enter key.\n *\n * Usage:\n *   - Connect this controller to a form or DOM element with the [data-controller=\"ehr--claim-service-calculations-form-helper\"] attribute.\n *   - Place matching data-target attributes on the relevant form fields:\n *       data-ehr--claim-service-calculations-form-helper-target=\"totalAmountInput\"\n *       data-ehr--claim-service-calculations-form-helper-target=\"quantityInput\"\n *       etc.\n *   - The controller listens to change events on the inputs to update the total amount automatically.\n *     Each input has a dedicated listener below, so bind it via data attributes and the action syntax,\n *     eg. data-action=\"ehr--claim-service-calculations-form-helper#codeHasChanged\"\n */\nexport default class extends Controller {\n  static values = {\n    defaultTotalAmount: { type: String, default: '100.00' },\n  };\n\n  static targets = ['totalAmountInput', 'quantityInput', 'noChargeInput', 'codeInput', 'percentageInput'];\n\n  initialize() {\n    this.defaultTotalAmount = this.defaultTotalAmountValue;\n    // This is our internal way to track the total amount because it can be overriden by the user\n    // or can be the product of default total amount and quantity. Percentage change does not affect this value\n    // because we want to allow the user to revert the percentage back to the previous value\n    this.internallyTrackedTotalAmount = this.defaultTotalAmount;\n  }\n\n  connect() {\n    // Want to prevent submit via enter because we are dealing with a nested form and an add service Button(which is also a submit button),\n    // so it gets triggered by the enter key\n    this.element.addEventListener('keydown', this.preventEnterSubmit);\n  }\n\n  // Event listener for when the code input field changed value\n  codeHasChanged(evt) {\n    // Reset totalAmount, quantity, and no charge\n    this.resetFieldsOnCodeChange();\n  }\n\n  // Event listener for when the totalAmount input field changed value\n  totalAmountHasChanged(evt) {\n    // Store the totalAmount manually entered by the user in an internal variable, so that when\n    // multiplying by percentage we can go back and forth between 100% and any other value\n    this.internallyTrackedTotalAmount = evt.target.value;\n  }\n\n  // Event listener for when the quantity input field changed value\n  quantityHasChanged(evt) {\n    // multiply the total amount not only by the quantity, but also by the already applied percentage\n    this.totalAmountInputTarget.value = (\n      (this.defaultTotalAmount * evt.target.value * this.percentageInputTarget.value) /\n      100\n    ).toFixed(2);\n    // Update the internal value of totalAmount so that if the percentage value was to change,\n    // it would act on the totalAmount multiplied by the quantity\n    this.internallyTrackedTotalAmount = this.totalAmountInputTarget.value;\n  }\n\n  // Event listener for when the percentage input field changed value\n  percentageHasChanged(evt) {\n    // Modify the totalAmount that has been entered by the user (override) or is the product of default totalAmount and quantity\n    this.totalAmountInputTarget.value = ((this.internallyTrackedTotalAmount * evt.target.value) / 100).toFixed(2);\n  }\n\n  // Reset totalAmount to the default value, quantity to 1, and no charge checkbox to off\n  resetFieldsOnCodeChange() {\n    this.totalAmountInputTarget.value = this.defaultTotalAmountValue;\n    this.quantityInputTarget.value = 1;\n    this.noChargeInputTarget.checked = false;\n  }\n\n  preventEnterSubmit(event) {\n    if (event.key === 'Enter') {\n      event.preventDefault();\n    }\n  }\n\n  disconnect() {\n    // Clean up event listener when controller is disconnected\n    this.element.removeEventListener('keydown', this.preventEnterSubmit);\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n// Useful commands for Trix editor that are not clearly stated in the readme\n// - Clear the document (https://github.com/basecamp/trix/issues/903) - though this method leaves a blank line in the beginning\n//   another way to delete is to select all text and delete\n// ```\n// trixEditorElement.editor.loadJSON(JSON.parse('{\"document\": []}'))\n// ```\n// - Go to the end of the document (https://github.com/basecamp/trix/issues/1069)\n// ```\n// const length = editor.getDocument().toString().length // Get the length of the document\n// editor.setSelectedRange(length - 1) // Set the cursor to the end of the document\n// ```\n\n// This controller uses the Trix editor interface to add custom EHR note templates (eg. SOAP note, etc)\n// and add any other functionalities to Trix edditors used by our EHR app\n// Connects to data-controller=\"ehr--trix-chart-note\"\nexport default class extends Controller {\n  static values = {\n    noteTemplate: String,\n    provider: Object,\n    patient: Object,\n    currentDate: String,\n    persisted: Boolean,\n    campusAddress: String,\n  };\n\n  connect() {\n    // We need to wrap most startup logic into trix-initialize event because Trix adds a whole new element to the DOM\n    // and needs to instantiate the JS instance before we can interface with it\n    this.element.addEventListener('trix-initialize', () => {\n      // store trix instance in an instance variable, so it can be accessed by other methods\n      this.trix = this.element.querySelector('trix-editor');\n\n      // Exit early and do not add a template if we are editing a chart entry (so we don't end up overriding the existing content with\n      // a brand new template)\n      if (this.persistedValue) return;\n\n      // Add content to the chart note if user is creating (not updating)\n      if (this.noteTemplateValue == 'SOAP Note') {\n        this.addSoapTemplate();\n      } else if (\n        this.noteTemplateValue == 'General Letter' ||\n        this.noteTemplateValue == 'Sick/Absentee Letter' ||\n        this.noteTemplateValue == 'Referral Letter'\n      ) {\n        this.addLetterTemplate();\n      }\n    });\n  }\n\n  addSoapTemplate() {\n    // Clear the editor first\n    this.clearEditor();\n\n    // NOTE: we tried to add spaces after the colons but Trix gets rid of them and removes &nbsp;. No obvious way to fix it for now, so leaving it as is\n    // If the bold text when starting to type becomes more of an issue, can always move the colon outside the strong element\n    // Sounds like it might have something to do with this https://github.com/basecamp/trix/blob/fda14c5ae88a0821cf8999a53dcb3572b4172cf0/src/trix/views/piece_view.js#L127-L142\n    // and here is an example of the issue reported by other users: https://github.com/basecamp/trix/issues/774\n    this.trix.editor.insertHTML('<strong>S:</strong><br/><strong>O:</strong><br/><strong>A:</strong><br/><strong>P:</strong>');\n    this.trix.editor.deactivateAttribute('bold');\n  }\n\n  addLetterTemplate() {\n    // Clear the editor first\n    this.clearEditor();\n\n    const providerInfo = this.hasProviderValue ? `${this.providerValue['full_name_with_title']}<br/>` : '';\n    const letterBody = `${this.campusAddressValue}<br/><br/>${this.currentDateValue}<br/><br/>re: ${this.patientValue['first_name']} ${this.patientValue['last_name']}`;\n    this.trix.editor.insertHTML(`${[providerInfo]}${letterBody}`);\n    this.trix.editor.deactivateAttribute('bold');\n  }\n\n  clearEditor() {\n    const length = this.trix.editor.getDocument().toString().length; // Get the length of the document\n    this.trix.editor.setSelectedRange([0, length - 1]);\n    this.trix.editor.deleteInDirection('forward');\n  }\n\n  disconnect() {\n    // NOTE: since event listeners are attached to this element, once it is destroyed,\n    // event listeners will be as well\n  }\n}\n","/* eslint-disable no-undef */\nimport { Controller } from '@hotwired/stimulus';\n\nimport 'jquery-ui-sortable';\nimport '@selectize/selectize/dist/js/selectize.min.js';\nimport '@selectize/selectize/dist/css/selectize.css';\nimport '@selectize/selectize/dist/css/selectize.bootstrap5.css';\n\n// This controller instantiates selectize plugin on select input fields it is applied to\n// Connects to data-controller=\"selectize\"\nexport default class extends Controller {\n  static values = {\n    // Pass this value to the selectize options. Allows the user to create new items that aren't in the initial list of options.\n    create: { type: Boolean, default: false },\n    allowEmpty: { type: Boolean, default: true },\n    // if selectize is inside a container that has overflow hidden, the dropdown becomes clipped. To counter that,\n    // dropdownParent can be changed to 'body', which is what this value toggles\n    hiddenOverflowContainer: { type: Boolean, default: false },\n  };\n  connect() {\n    // Preventing the element from being initialized multiple times. This solves the bug where if you navigate away from a page with selectize and click back, it used to duplicate the selectize input\n    if (!$(this.element)[0].selectize) {\n      $(this.element).selectize({\n        // Allows the user to create new items that aren't in the initial list of options.\n        create: this.createValue,\n        allowEmptyOption: this.allowEmptyValue,\n        showEmptyOptionInDropdown: true,\n        // This setting prevents the dropdown from being clipped if the selectize element is inside a container with hidden overflow\n        // src: https://github.com/selectize/selectize.js/issues/192 and https://selectize.dev/docs/usage#configuration\n        dropdownParent: this.hiddenOverflowContainerValue ? 'body' : null,\n        // we need to dispatch a custom event when the selection in the dropdown changes\n        // because selectize does not emit the usual `change` event, so we can't use the default\n        // option in our stimulus controllers\n        // by emitting a custom named event (instead of re dispatching 'change'), makes it easier for\n        // us to track it\n        onChange: () => {\n          const event = new Event('selectizeInputChange');\n          this.element.dispatchEvent(event);\n        },\n        render: {\n          // This section can be used to render custom html elements (and have more control over the css and styles rendered)\n          // Default html templates can be found here: https://github.com/selectize/selectize.js/blob/master/src/selectize.js\n          // Instructions on custom rendering is here: https://selectize.dev/docs/usage#custom-rendering\n        },\n      });\n      // change value of autocomplete from new-password (set already by selectize) to 'one-time-code'. For some reason, new-password doesn't work\n      // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill\n      $(this.element)[0].selectize.$control_input[0].setAttribute('autocomplete', 'one-time-code');\n\n      // There is an annoying behaviour when you search in selectize and press enter to confirm the selected item,\n      // it ends up just submitting the form. This also happens with other form fields, but there it is expected,\n      // here it is not. So instead of turning off enter key for the entire form (otherwise things like textareas would also be affected)\n      // just turning off enter key for selectize\n      $(this.element)[0].selectize.$control_input[0].addEventListener('keypress', (event) => {\n        if (event.keyCode === 13) {\n          // Check if the key pressed is Enter\n          event.preventDefault(); // Prevent the default action (form submission)\n        }\n      });\n    }\n  }\n\n  disconnect() {\n    // NOTE: can't destroy the element here because end up in an infinite loop since selectize appears to destroy the original select element and then re-add it\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n// This controller acts as an array input in a form, specifically for the EHR static scenarios\n// where we want to add and remove multiple static scenarios\n\n// Connects to data-controller=\"form-array-input\"\nexport default class extends Controller {\n  static targets = ['selectedScenarios', 'placeholderMessage', 'addedScenario'];\n  connect() {\n    this.showOrHidePlaceholder();\n  }\n\n  add(e) {\n    const scenarioName = e.params.scenarioName;\n\n    // Put together the html element that has the name of the added scenario, hidden input element, and the remove button\n    const container = document.createElement('div');\n    container.dataset.formArrayInputTarget = 'addedScenario';\n    container.classList.add('d-flex', 'align-items-center');\n    const visibleScenarioName = document.createElement('div');\n    visibleScenarioName.classList.add('badge', 'text-bg-primary', 'fs-6', 'fw-normal');\n    visibleScenarioName.appendChild(document.createTextNode(scenarioName));\n    const hiddenFieldTag = document.createElement('input');\n    hiddenFieldTag.setAttribute('type', 'hidden');\n    hiddenFieldTag.setAttribute('name', 'scenario_names_arr[]');\n    hiddenFieldTag.setAttribute('value', scenarioName);\n    const removeButton = document.createElement('button');\n    removeButton.classList.add('btn', 'btn-link');\n    removeButton.appendChild(document.createTextNode('remove'));\n    removeButton.setAttribute('type', 'button');\n    removeButton.dataset.action = 'form-array-input#remove';\n    removeButton.innerHTML = `<i class=\"bi bi-x-lg px-2\" aria-hidden=\"true\"></i>`;\n\n    container.appendChild(removeButton);\n    container.appendChild(visibleScenarioName);\n    container.appendChild(hiddenFieldTag);\n\n    // Add the new scenario to the scenarios container\n    this.selectedScenariosTarget.appendChild(container);\n\n    this.showOrHidePlaceholder();\n  }\n\n  remove(e) {\n    // Make sure this is aligned with the struction of html element. Currently the remove button is one level deep from the container\n    // that needs to be removed\n    e.currentTarget.parentNode.remove();\n\n    this.showOrHidePlaceholder();\n  }\n\n  showOrHidePlaceholder() {\n    // Display/hide placeholder\n    if (this.addedScenarioTargets.length == 0) {\n      this.placeholderMessageTarget.classList.remove('d-none');\n    } else {\n      this.placeholderMessageTarget.classList.add('d-none');\n    }\n  }\n}\n","/* global require, process */\n\nimport { Controller } from '@hotwired/stimulus';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\n// NOTE: when inside a turbo-permanent, initialize gets rendered only once, but connect and disconnect get rendered every time we navigate between pages\n// (because even with turbo-permanent, the element is being attached and detached to the DOM)\nexport default class extends Controller {\n  static values = {\n    props: Object,\n    name: String,\n  };\n\n  initialize() {\n    if (this.nameValue && !window.reactComponents[this.nameValue]) {\n      throw new Error(`React component ${this.nameValue} not found in global namespace. Make sure to register it.`);\n    }\n    if (!document.documentElement.hasAttribute('data-turbo-preview') && window.reactComponents[this.nameValue]) {\n      log('MOUNTING', this.nameValue);\n      // Root should only be created once (in React 18)\n      this.root = createRoot(this.element);\n      const component = React.createElement(window.reactComponents[this.nameValue], this.propsValue);\n      this.root.render(component);\n    } else {\n      // Can insert a placeholder here for this component in the DOM of the turbo preview cached page\n    }\n  }\n\n  disconnect() {\n    // Note: this is only to deal with page navigation and element being removed. disconnect() can also be activated\n    // for other reasons, eg manually removing a component from the DOM. However, can't see a scenario right now where a data-turbo-permanent\n    // element would be removed in such a way\n    const turboPermanent = this.element.hasAttribute('data-turbo-permanent');\n    const turboPermanentOnIncomingPage = turboPermanent && window.upcomingTurboPermanentIds.includes(this.element.id);\n    // Since we cannot easily tell if we are navigating to a page that doesn't have a matching data-turbo-permanent element, we rely\n    // on before-render event listener in the initial js file in the packs directory to update the global window.upcomingTurboPermanentIds\n    if (turboPermanentOnIncomingPage)\n      log(`MATCHING TURBO PERMANENT ELEMENT (${this.nameValue}) DETECTED ON THE INCOMING PAGE (this element is not unmounted)`);\n    if (!turboPermanentOnIncomingPage && this.root) {\n      log('UNMOUNTING', this.nameValue);\n      this.root.unmount();\n    }\n  }\n}\n\n// Wrapper for console log that only outputs if we are in development environment\nfunction log(...args) {\n  if (process.env.NODE_ENV === 'development') {\n    console.log('[REACT_RENDER] -- ', ...args);\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n// place this controller around any link tag <a>. Apply the attribute data-follow-on-space=true\n// to enable pressing the space key to advance. Only one controller should be present on a page\n// at a given time.\n//\n// Example usage with erb:\n// <%= link_to(\"Press Space!\", new_ladder_ladder_result_path(@ladder), data: { 'follow-on-space' => true}) %>\n// Example usage with html:\n// <a href=\"/ladders\" data-follow-on-space=\"true\">Press Space!</a>\n\nexport default class extends Controller {\n  // add event listener on initialize\n  initialize() {\n    document.addEventListener('keydown', this.listenForSpace);\n  }\n\n  // remove event listener on initialize\n  disconnect() {\n    document.removeEventListener('keydown', this.listenForSpace);\n  }\n\n  listenForSpace(e) {\n    const isSpace = e.key === ' ' || e.code === 'Space';\n    if (isSpace) {\n      e.preventDefault();\n      // get the first link tag with the data-follow-on-space attribute\n      const linkTag = document.querySelector('[data-follow-on-space]');\n      linkTag.click();\n      return;\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n// Connects to data-controller=\"react_component-group\"\nexport default class extends Controller {\n  static targets = ['description', 'descriptionButton'];\n\n  // on click event for showing/hiding unit group decription\n  toggleDescription() {\n    const descriptionEl = this.descriptionTarget;\n    const descriptionButtonEl = this.descriptionButtonTarget;\n    // boolean on the element which is toggled and is used to decide whether to hide or show the description\n    const showDescription = descriptionEl.dataset.showDescription === 'true';\n\n    if (showDescription) {\n      // remove the text truncation, update the status via data-show-description, and change the button text\n      descriptionEl.classList.remove('text-truncate');\n      descriptionButtonEl.textContent = '(less)';\n      descriptionEl.dataset.showDescription = 'false';\n    } else {\n      // remove the text truncation, update the status via data-show-description, and change the button text\n      descriptionEl.classList.add('text-truncate');\n      descriptionButtonEl.textContent = '(more)';\n      descriptionEl.dataset.showDescription = 'true';\n    }\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n/**\n * ToggleClassController\n *\n * This controller syncs a checkbox with the presence of a CSS class on a group of target elements.\n *\n * When `checkOn` is true (default):\n *   - The checkbox is checked if every target element has the CSS class.\n *   - It is unchecked if none have the class.\n *   - It is indeterminate if only some have the class.\n *\n * When `checkOn` is false:\n *   - The checkbox is checked if no target element has the CSS class.\n *   - It is unchecked if every target element has the class.\n *   - It is indeterminate if only some have the class.\n *\n * If no target elements match, the checkbox is checked and disabled.\n *\n * Data Attributes:\n *   data-toggle-class-controller-css-selector-value:\n *     CSS selector for target elements.\n *   data-toggle-class-controller-css-class-value:\n *     CSS class to toggle (default: \"show\").\n *   data-toggle-class-controller-check-on-value:\n *     Boolean flag; when true, the checkbox is checked if all target elements have the class (default: true).\n */\nexport default class ToggleClassController extends Controller {\n  static values = {\n    cssSelector: String,\n    cssClass: { type: String, default: 'show' },\n    checkOn: { type: Boolean, default: true },\n  };\n\n  /**\n   * Called when the controller connects.\n   * Initializes target elements and the checkbox, sets the initial state,\n   * and attaches MutationObservers to monitor class changes.\n   */\n  connect() {\n    // Get target elements (they may lie outside this controller's element).\n    this.elements = document.querySelectorAll(this.cssSelectorValue);\n    // Find the checkbox within this controller.\n    this.checkbox = this.element.querySelector('input[type=\"checkbox\"]');\n\n    if (!this.checkbox) {\n      console.error('ToggleClassController: No checkbox input found.');\n      return;\n    }\n\n    // If no target elements are found, check and disable the checkbox.\n    if (this.elements.length === 0) {\n      this.checkbox.checked = true;\n      this.checkbox.disabled = true;\n      return;\n    }\n\n    // Set the initial checkbox state.\n    this.updateCheckbox();\n\n    // Attach MutationObservers to update the checkbox when a target element's class changes.\n    this.observers = Array.from(this.elements).map((el) => {\n      const observer = new MutationObserver((mutations) => {\n        if (mutations.some((m) => m.type === 'attributes' && m.attributeName === 'class')) {\n          this.updateCheckbox();\n        }\n      });\n      observer.observe(el, { attributes: true, attributeFilter: ['class'] });\n      return observer;\n    });\n  }\n\n  /**\n   * Called when the controller disconnects.\n   * Cleans up any MutationObservers.\n   */\n  disconnect() {\n    this.observers?.forEach((observer) => observer.disconnect());\n  }\n\n  /**\n   * Updates the checkbox state based on the CSS class presence on target elements.\n   */\n  updateCheckbox() {\n    const total = this.elements.length;\n    // Count elements meeting the criteria:\n    // If checkOn is true, count elements that have the class.\n    // Otherwise, count those that lack the class.\n    const count = Array.from(this.elements).filter((el) =>\n      this.checkOnValue ? el.classList.contains(this.cssClassValue) : !el.classList.contains(this.cssClassValue)\n    ).length;\n\n    const checked = count === total;\n    const indeterminate = count > 0 && count < total;\n\n    // Update the checkbox state and ARIA attribute.\n    this.checkbox.checked = checked;\n    this.checkbox.indeterminate = indeterminate;\n    this.checkbox.setAttribute('aria-checked', indeterminate ? 'mixed' : checked ? 'true' : 'false');\n  }\n\n  /**\n   * Toggles the CSS class on all target elements based on the checkbox state.\n   */\n  toggle() {\n    // When checkOn is true, add the class if the checkbox is checked; remove it if unchecked.\n    // When false, the action is reversed.\n    const force = this.checkOnValue ? this.checkbox.checked : !this.checkbox.checked;\n    this.elements.forEach((el) => el.classList.toggle(this.cssClassValue, force));\n  }\n}\n","import { Controller } from '@hotwired/stimulus';\n\n/**\n * Stimulus Controller for managing the visibility of elements based on radio button selection.\n *\n * This controller collects elements associated with each radio input target using a CSS\n * selector defined in the target's data attribute (data-css-selector). When a radio button is\n * selected, it adds cssClassToRemove value to all elements targeted by non-selected radio buttons, and removes\n * this class from the elements targeted by the selected radio button.\n *\n */\nexport default class extends Controller {\n  static targets = ['radioInput'];\n  static values = {\n    cssClassToRemove: { type: String, default: 'd-none' },\n  };\n\n  connect() {\n    // For each radioInput target, find all elements matching the CSS selector specified in its data attribute,\n    // and flatten the resulting array into a single list.\n    this.allTargetElements = this.radioInputTargets\n      .map((el) => Array.from(document.querySelectorAll(el.dataset.cssSelector)))\n      .flat();\n  }\n\n  /**\n   * Event handler for changes on radio inputs.\n   */\n  radioOnChange() {\n    this.updateCssOnTargetElements();\n  }\n\n  /**\n   * Updates the css of elements based on the selected radio button.\n   *\n   * This method first identifies the currently selected radio button. It then applies the css value of cssClassToRemove\n   * to elements targeted by non-selected radio buttons (via cssSelector attribute). Finally, it adds the css value of cssClassToRemove\n   * to the elements targeted by the selected radio button (via cssSelector attribute).\n   */\n  updateCssOnTargetElements() {\n    // Find the selected radio button.\n    const selected = this.element.querySelector('input[type=\"radio\"]:checked');\n    if (!selected) return;\n\n    // Add the cssClassToRemove class to all the targets associated with the non-selected radio buttons\n    this.allTargetElements.forEach((el) => el.classList.add(this.cssClassToRemoveValue));\n\n    // Remove the cssClassToRemove class to all targets associated with the selected radio button\n    document.querySelectorAll(selected.dataset.cssSelector).forEach((target) => {\n      target.classList.remove(this.cssClassToRemoveValue);\n    });\n  }\n}\n","import ToggleClassController from './toggle_class_controller';\n\n/**\n * VisibilityDNoneController\n *\n * This controller toggles visibility using the \"d-none\" CSS class.\n * - An element with \"d-none\" is hidden.\n * - The checkbox is checked when all target elements are visible (i.e. lack \"d-none\").\n *\n * Thus, `checkOn` is set to false so that the checkbox reflects absence of \"d-none\".\n *\n * Data Attributes (inherited from the base controller):\n *   data-toggle-class-controller-css-selector-value:\n *     CSS selector for target elements.\n *   data-toggle-class-controller-css-class-value:\n *     CSS class to toggle (default overridden to \"d-none\").\n *   data-toggle-class-controller-check-on-value:\n *     Boolean flag; when false, the checkbox is checked if all target elements do NOT have the class.\n */\nexport default class VisibilityDNoneController extends ToggleClassController {\n  static values = {\n    ...ToggleClassController.values,\n    cssClass: { type: String, default: 'd-none' },\n    checkOn: { type: Boolean, default: false },\n  };\n}\n","// This file is auto-generated by ./bin/rails stimulus:manifest:update\n// Run that command whenever you add a new controller or create them with\n// ./bin/rails generate stimulus controllerName\n\nimport { application } from './application';\n\nimport Ehr__FileManagerController from './ehr/file_manager_controller';\napplication.register('ehr--file-manager', Ehr__FileManagerController);\n\nimport Ehr__PhoneNumberInputController from './ehr/phone_number_input_controller';\napplication.register('ehr--phone-number', Ehr__PhoneNumberInputController);\n\nimport Ehr__ScenarioEventsController from './ehr/scenario_events_controller';\napplication.register('ehr--scenario-events', Ehr__ScenarioEventsController);\n\nimport Ehr__NavigationBarController from './ehr/navigation_bar_controller';\napplication.register('ehr--navigation-bar', Ehr__NavigationBarController);\n\nimport Ehr__PollServerController from './ehr/poll_server_controller';\napplication.register('ehr--poll-server', Ehr__PollServerController);\n\nimport Ehr__ScrollToTopController from './ehr/scroll_to_top_controller';\napplication.register('ehr--scroll-to-top', Ehr__ScrollToTopController);\n\nimport Ehr__SortDivContainersController from './ehr/sort_div_containers_controller';\napplication.register('ehr--sort-div-containers', Ehr__SortDivContainersController);\n\nimport Ehr__FormHelperController from './ehr/form_helper_controller';\napplication.register('ehr--form-helper', Ehr__FormHelperController);\n\nimport Ehr__ClaimServiceCalculationsFormHelper from './ehr/claim_service_calculations_form_helper_controller';\napplication.register('ehr--claim-service-calculations-form-helper', Ehr__ClaimServiceCalculationsFormHelper);\n\nimport Ehr__TrixChartNoteController from './ehr/trix_chart_note_controller';\napplication.register('ehr--trix-chart-note', Ehr__TrixChartNoteController);\n\nimport SelectizeController from './selectize_controller';\napplication.register('selectize', SelectizeController);\n\nimport FormArrayInputController from './form_array_input_controller';\napplication.register('form-array-input', FormArrayInputController);\n\nimport ReactRenderController from './react_render_controller';\napplication.register('react-render', ReactRenderController);\n\nimport SpaceToAdvanceController from './space_to_advance_controller';\napplication.register('space-to-advance', SpaceToAdvanceController);\n\nimport UnitGroupController from './unit_group_controller';\napplication.register('unit-group', UnitGroupController);\n\nimport ToggleClassController from './toggle_class_controller';\napplication.register('toggle-class', ToggleClassController);\n\nimport ToggleClassRadioController from './toggle_class_radio_controller';\napplication.register('toggle-class-radio', ToggleClassRadioController);\n\nimport VisibilityDNoneController from './visibility_d_none_controller';\napplication.register('visibility-d-none', VisibilityDNoneController);\n"],"names":["application","Application","start","debug","window","Stimulus","document","addEventListener","event","_event$detail","detail","response","visit","preventDefault","_default","_Controller","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","key","value","this","uploadStartCallback","bind","progressUpdateCallback","uploadEndCallback","element","progressBarContainerTarget","classList","remove","progressBarTarget","style","width","setAttribute","progress","concat","add","confirm","currentTarget","disabled","hiddenInput","querySelector","params","signedId","submissionFormTarget","requestSubmit","removeEventListener","Controller","targets","maskOptions","mask","extensionValue","lazy","placeholderChar","tagName","IMask","masked","resolve","readonlyPhoneNumberValue","textContent","values","extension","Boolean","readonlyPhoneNumber","String","_this","muteSounds","delayBetweenQueuedItemsInMs","minDelayAfterConversationEndInMs","debugMode","clearTimeoutsOnDisconnect","checkIfStimulusControllerWillBeReInitialized","TIMEOUTS","SHOW","TYPE","REMOVE","SOUND","QUEUE_DELAY","PROMPT_DELAY","CONVERSATION_FINISHED_DELAY","eventSlots","patient_at_desk","slotPatientAtDeskTarget","phone_call","slotPhoneCallTarget","clinic_interaction","slotClinicInteractionTarget","sidebar","bootstrap","Offcanvas","getOrCreateInstance","ringingSound","Audio","scenarioEvents","eventsValue","preRenderedEventElements","preRenderedEventTargets","reduce","acc","eventElement","_objectSpread","_defineProperty","dataset","eventId","dependentScenarioEventsMap","filter","e","after_event_completed","_ref","id","existingElements","dependentElement","_toConsumableArray","scenarioEventTimeouts","eventOutcomes","events","el","afterEventCompleted","previouslyCompleted","eventsDependentOnPreviouslyCompletedEvents","dependentEvents","generateScenarioEventTimeouts","newPermanentElement","newBody","_this2","log","Object","entries","forEach","_ref2","_ref3","_slicedToArray","event_id","_ref4","type","clearTimeout","endScenarioEvent","target","scenarioEventId","_this3","preRenderedEventElement","interactionContainerElement","eventType","eventTitleElement","innerHTML","disableEventSlots","_ref5","_ref6","_this4","selectedInteractionTreeBranch","interactionHistoryElement","parentInteractionTree","JSON","parse","interaction","chosenReplyIdx","replyIdx","isFirstPrompt","undefined","reply_options","reply","replyNodeElement","createElement","append","promptLength","promptDelayInMs","prompt","length","continueConversationBtn","btnDropdownMenuElement","promptDelayTimeout","setTimeout","promptNodeElement","responseBtnContainerElement","responseBtnGroupElement","responseBtnElement","bsToggle","responseBtnOptionsElement","_ref7","idx","replyOptionListElement","replyOptionsAnchorElement","action","appendChild","expired","final_reply_id","push","stringify","_this5","conversationFinishedTimeout","scenarioEventDoneElement","conversationFinishedMinTimeoutPromise","Promise","fetch","databaseIdValue","method","headers","body","interactions","all","then","_ref8","serverResponse","json","data","ok","reject","removeScenarioEvent","dependentScenarioEvents","enableEventSlots","jsonResponse","scenarioEventErrorMessageElement","prototype","hasOwnProperty","call","message","_this6","preRenderedElement","when_in_s","isNaN","parseInt","whenInS","duration_in_s","durationInS","timeouts","showEventTimeout","show","insertScenarioEvent","Error","updateWidgetBadge","playSoundTimeout","load","play","removeEventTimeout","scenarioEventElement","_this7","targetSlot","updateQueueBadge","_ref10","inQueue","popEventFromQueue","slotType","placeholderSlot","queuedEvent","delayTimeout","querySelectorAll","scenarioEvent","btn","removeAttribute","newScenarioEventElement","triggeredAt","queueContainer","targetSlotElement","changeBy","badgeElement","numInQueue","Math","max","createTextNode","accessibilityString","voicemailWidgetTarget","messagingWidgetTarget","emailWidgetTarget","console","groupCollapsed","groupEnd","when","Number","duration","Array","databaseId","handlePageChange","url","destinationPageUrl","navLinkTargets","activeNav","find","ariaLabel","test","parentUrl","URL","navUrlDestinations","pathname","startsWith","location","href","_regeneratorRuntime","t","r","n","o","defineProperty","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","arg","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","g","defineIteratorMethods","_invoke","AsyncIterator","invoke","__await","callInvokeWithMethodAndArg","done","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","delegateYield","asyncGeneratorStep","gen","_next","_throw","info","error","_asyncToGenerator","fn","self","args","err","_defineProperties","props","descriptor","_toPropertyKey","input","hint","prim","toPrimitive","res","_toPrimitive","_setPrototypeOf","Derived","hasNativeReflectConstruct","Reflect","construct","sham","Proxy","valueOf","_isNativeReflectConstruct","result","Super","_getPrototypeOf","NewTarget","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","subClass","superClass","Constructor","protoProps","staticProps","_fetchWithRetries","_connect","instance","_callee","_context","progressElement","progressBarElement","transition","round","msBetweenRetriesValue","fetchWithRetries","urlToPollValue","numRetriesLeft","numRetriesValue","msBetweenRetries","redirectUrl","t0","failContainerTarget","_callee2","_ref$options","options","attemptNumber","percentProgress","modifiedOptions","_context2","registered","sleep","last_fetch_attempt","_x","ms","debugValue","default","numAttempts","urlToPoll","numRetries","topOfWindowValue","scrollTo","toElementValue","scrollIntoView","block","behavior","topOfWindow","toElement","sortButtonTargets","btnEl","setButtonContent","parseValue","sortOrderAscending","sortedElements","sortBy","sort","b","attrA","attrB","elementToSortTargets","sortedElementsContainerTarget","isOrderAscending","toLowerCase","isSortOrderAscending","sortIconEl","bootstrapIconAscendingClass","buttonText","bootstrapIconDescendingClass","_this$element$getAttr","mustCompleteCheckboxTargets","hasSubmitButtonTarget","toggleSubmitButtonDisabledState","hasAllergenCategoryMappingsValue","combinedAllergenCategoryMappings","allergenCategoryMappingsValue","getAttribute","includes","submitButtonTarget","every","checkbox","checked","currentSelectInputValue","targetId","deceasedFamilyHistoryRevealAreaTarget","selectElement","targetSelectElement","selectedRoute","newOptions","treatmentRouteAndFormMappingsValue","map","drugForm","join","trim","checkValidity","stopPropagation","firstInvalidInput","focus","allergenCategoryMappings","treatmentRouteAndFormMappings","defaultTotalAmount","defaultTotalAmountValue","internallyTrackedTotalAmount","preventEnterSubmit","evt","resetFieldsOnCodeChange","totalAmountInputTarget","percentageInputTarget","toFixed","quantityInputTarget","noChargeInputTarget","trix","persistedValue","noteTemplateValue","addSoapTemplate","addLetterTemplate","clearEditor","editor","insertHTML","deactivateAttribute","providerInfo","hasProviderValue","providerValue","letterBody","campusAddressValue","currentDateValue","patientValue","getDocument","toString","setSelectedRange","deleteInDirection","noteTemplate","provider","patient","currentDate","persisted","campusAddress","$","selectize","createValue","allowEmptyOption","allowEmptyValue","showEmptyOptionInDropdown","dropdownParent","hiddenOverflowContainerValue","onChange","Event","dispatchEvent","render","$control_input","keyCode","allowEmpty","hiddenOverflowContainer","showOrHidePlaceholder","scenarioName","container","formArrayInputTarget","visibleScenarioName","hiddenFieldTag","removeButton","selectedScenariosTarget","parentNode","addedScenarioTargets","placeholderMessageTarget","nameValue","reactComponents","documentElement","hasAttribute","root","createRoot","component","React","propsValue","turboPermanentOnIncomingPage","upcomingTurboPermanentIds","unmount","listenForSpace","code","click","descriptionEl","descriptionTarget","descriptionButtonEl","descriptionButtonTarget","showDescription","ToggleClassController","elements","cssSelectorValue","updateCheckbox","observers","from","observer","MutationObserver","mutations","some","m","attributeName","observe","attributes","attributeFilter","_this$observers","disconnect","total","count","checkOnValue","contains","cssClassValue","indeterminate","force","toggle","cssSelector","cssClass","checkOn","allTargetElements","radioInputTargets","flat","updateCssOnTargetElements","selected","cssClassToRemoveValue","cssClassToRemove","VisibilityDNoneController","_ToggleClassControlle","register","Ehr__FileManagerController","Ehr__PhoneNumberInputController","Ehr__ScenarioEventsController","Ehr__NavigationBarController","Ehr__PollServerController","Ehr__ScrollToTopController","Ehr__SortDivContainersController","Ehr__FormHelperController","Ehr__ClaimServiceCalculationsFormHelper","Ehr__TrixChartNoteController","SelectizeController","FormArrayInputController","ReactRenderController","SpaceToAdvanceController","UnitGroupController","ToggleClassRadioController"],"sourceRoot":""}