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IC,iBAAiB,SAAS,WAC5BH,GACF,GAEJ,CAEA,SAASI,IACP,IAAIF,EAAMnD,SAASC,eAAe,wBAC9BkD,GACFA,EAAIC,iBAAiB,SAAS,WAC5BT,GACF,GAEJ,C","sources":["webpack://iHOD-RWD/./app/javascript/packs/application.js","webpack://iHOD-RWD/./app/javascript/utils/util.js"],"sourcesContent":["/* eslint no-console:0 */\n// This file is automatically compiled by Webpack, along with any other files\n// present in this directory. You're encouraged to place your actual application logic in\n// a relevant structure within app/javascript and only use these pack files to reference\n// that code so it'll be compiled.\n//\n// To reference this file, add <%= append_javascript_pack_tag 'application' %> to the appropriate\n// layout file, like app/views/layouts/application.html.erb\n\n// import 'bootstrap';\n\n\nimport $ from \"expose-loader?exposes=$,jQuery!jquery\"\nimport '@fortawesome/fontawesome-pro/js/all.js';\nimport ujs from '@rails/ujs';\nimport 'core-js/stable';\nimport 'regenerator-runtime/runtime';\nimport { printNoCommentsInit, printWithCommentsInit } from '../utils/util';\n\n\nujs.start();\n\n// console.log('Hello World from Shakapacker');\n\n\n","// using these custom functions as oppose to js classList methods\n// for special handling of svg's\nconst LOWEST_SAFARI_IOS_VERSION = 16.4;\nexport const GOOGLE_PDF_VIEWER_PREFFIX = 'https://docs.google.com/gview?url=';\nexport const GOOGLE_PDF_VIEWER_SUFFIX = '&embedded=true';\n\nexport function googleWrapper(url) {\n  const isPDF = /\\.pdf$/i.test(url); // Check if the URL ends with .pdf (case insensitive)\n  \n  if (isPDF) {\n    return `${GOOGLE_PDF_VIEWER_PREFFIX}${url}${GOOGLE_PDF_VIEWER_SUFFIX}`;\n  }\n  \n  return url; // Return the original URL if it's not a .pdf\n}\n\nfunction isSafariVersionSmallerThan(aVersion) {\n  const ua = navigator.userAgent;\n  const match = ua.match(/Version\\/(\\d+\\.\\d+)(?:.*Safari\\/(\\d+\\.\\d+))?/);\n\n  if (match && match[1]) {\n    const safariVersion = parseFloat(match[1]);\n    const targetVersion = parseFloat(aVersion);\n\n    return safariVersion < targetVersion;\n  }\n\n  // Return false if the browser is not Safari\n  return false;\n}\n\nexport function isPDFJSCompatible() {\n  return !isSafariVersionSmallerThan(LOWEST_SAFARI_IOS_VERSION);\n}\n\nconst styleButton = (button, classes) => {\n  // classes is an array of strings, ie ['active', 'loading']\n  button.classList.add(...classes);\n};\n\nconst resetButton = (button, classes) => {\n  const buttonTypes = ['current-item', 'refresh'];\n\n  // FontAwesome uses the browsers MutationObserver interface to watch changes to the page\n  // https://fontawesome.com/how-to-use/with-the-api/setup/configuration#observemutations\n  // therefore caching the element does not work and we must query for it after the page updates\n  button = buttonTypes.includes(button.dataset.button)\n    ? button.querySelector('svg')\n    : button;\n  // classes is an array of strings, ie ['active', 'loading']\n  button.classList.remove(...classes);\n};\n\n// use 'saveSubmit' method in a submit handler\nconst detectSubmit = {\n  saveSubmit(form) {\n    if (!form) return;\n    form.dataset.submitted = true;\n  },\n  submitted(form) {\n    if (!form) return;\n    return form.dataset.submitted;\n  },\n};\n\nconst generateAssociatedFields = (button) => {\n  const time = new Date().getTime();\n  const regexp = new RegExp(button.dataset.id, 'g');\n  return { id: time, newFields: button.dataset.fields.replace(regexp, time) };\n};\n\nconst removeAttachment = (button) => {\n  const associatedAttachment = button.closest('.associated-fields');\n  associatedAttachment.style.display = 'none';\n  associatedAttachment.querySelector('input[type=hidden').value = true;\n};\n\n// b is a boolean. true enables, false disables.\nconst enableElement = (id, b) => {\n  const elem = document.getElementById(id);\n  if (b) {\n    elem.removeAttribute('disabled');\n  } else {\n    elem.setAttribute('disabled', 'disabled');\n  }\n};\n\n// b is a boolean. true shows, false hides.\n// Adapted from https://gomakethings.com/how-to-show-and-hide-elements-with-vanilla-javascript/\nconst showElement = function (id, b) {\n  const elem = document.getElementById(id);\n  const style = b ? 'block' : 'none';\n  elem.style.display = style;\n};\n\n/*\n * Concatenate two HtmlCollection objects.\n * Returns a new array that has all elements from both collections.\n * https://stackoverflow.com/questions/24133231/concatenating-html-object-arrays-with-javascript\n *\n * NOTE:\n * You may not need this function if you can fetch both\n * collections at once through\n * document.querySelector()/querySelectorAll().\n */\nconst concatCollections = function (htmlColl1, htmlColl2) {\n  let allItems = [];\n  allItems = Array.prototype.concat.apply(allItems, htmlColl1);\n  allItems = Array.prototype.concat.apply(allItems, htmlColl2);\n  return allItems;\n};\n\n// Remove all items from a list.\nconst removeAllListItems = function (id) {\n  const list = document.getElementById(id);\n  while (list.firstChild) {\n    list.removeChild(list.firstChild);\n  }\n};\n\n// Capitalize the first character in the string s.\n// Returns a new string; s is unchanged.\nconst capitalizeFirst = function (s) {\n  if (s.length === 0) {\n    return s;\n  }\n  return s[0].toUpperCase() + s.slice(1);\n};\n\n/*\n * Use this to get around the occasional issue where refreshing a page\n * would repost, with a browser warning, etc.\n *\n * On Firefox, this appears to turn the post into a get, which is perfect.\n * (Or maybe it literally replaces the post with a get?)\n */\nconst clearPostData = () => {\n  history.replaceState(null, document.title, location.href);\n};\n\n/*\n * Use this function with the `await` keyword, in an `async` function.\n * For an example, see `ensureIframeLoaded` in app/javascript/utils/iframe_checker.js\n */\nfunction sleep(seconds) {\n  return new Promise((resolve) => setTimeout(resolve, seconds * 2000));\n}\n\nconst isMobileScreen = (width = 576) => window.innerWidth <= width;\n\nexport const evalTrueFalse = (bool) => {\n  if (bool == 'true') {\n    return true;\n  }\n  if (bool == 'false') {\n    return false;\n  }\n};\n\nexport const postData = (data, route) => {\n  return $.post(route, data, null, 'json');\n};\n\n/**\n * use to toggle a class in TR element base on the state (checked/unchecked) of a check box in TD\n * @param {TR element} rowContainCheckBox\n * @param {string} className this is the class of the checkbox\n * @param {string} toogleClassName a CSS class that needed to be toggle\n * @param {bool} bool desired state of the checkbox\n */\nexport const handleCheckbox = (\n  rowContainCheckBox,\n  className,\n  toogleClassName,\n  bool\n) => {\n  //console.log(bool, rowContainCheckBox, className, toogleClassName);\n  var box = rowContainCheckBox.querySelector(`.${className}`);\n  //console.log(box);\n  if (box) {\n    rowContainCheckBox.querySelector(`.${className}`).checked = bool;\n    //console.log(rowContainCheckBox.querySelector(`.${className}`));\n  }\n  if (bool) {\n    rowContainCheckBox.classList.add(`${toogleClassName}`);\n    return;\n  }\n  rowContainCheckBox.classList.remove(`${toogleClassName}`);\n  //console.log(rowContainCheckBox);\n};\n\n\nfunction handlePrintWithComments() {\n  let comments = document.querySelectorAll('.comments');\n  if (comments) {\n    comments.forEach((el) => {\n      el.classList.remove('d-print-none');\n    });\n    window.print();\n  }\n}\n\nfunction handlePrintWithNoComments(){\n  let comments = document.querySelectorAll('.comments');\n  if (comments) {\n    comments.forEach((el) => {\n      el.classList.add('d-print-none');\n    });\n    window.print();\n  }\n}\n\nfunction printNoCommentsInit() {\n  let btn = document.getElementById('printNoCommentBtn');\n  if (btn) {\n    btn.addEventListener('click', () => {\n      handlePrintWithNoComments();\n    });\n  }\n}\n\nfunction printWithCommentsInit() {\n  let btn = document.getElementById('printWithCommentsBtn');\n  if (btn) {\n    btn.addEventListener('click', () => {\n      handlePrintWithComments();\n    });\n  }\n}\nexport {\n  handlePrintWithComments,\n  handlePrintWithNoComments,\n  printNoCommentsInit,\n  printWithCommentsInit,\n  capitalizeFirst,\n  clearPostData,\n  concatCollections,\n  detectSubmit,\n  enableElement,\n  generateAssociatedFields,\n  removeAllListItems,\n  removeAttachment,\n  resetButton,\n  showElement,\n  sleep,\n  styleButton,\n  isMobileScreen,\n};\n"],"names":["ujs","GOOGLE_PDF_VIEWER_PREFFIX","GOOGLE_PDF_VIEWER_SUFFIX","googleWrapper","url","test","concat","styleButton","button","classes","_button$classList","classList","add","apply","_toConsumableArray","resetButton","_button$classList2","includes","dataset","querySelector","remove","detectSubmit","saveSubmit","form","submitted","generateAssociatedFields","time","Date","getTime","regexp","RegExp","id","newFields","fields","replace","removeAttachment","associatedAttachment","closest","style","display","value","enableElement","b","elem","document","getElementById","removeAttribute","setAttribute","showElement","removeAllListItems","list","firstChild","removeChild","capitalizeFirst","s","length","toUpperCase","slice","clearPostData","history","replaceState","title","location","href","sleep","seconds","Promise","resolve","setTimeout","isMobileScreen","width","arguments","undefined","window","innerWidth","evalTrueFalse","bool","postData","data","route","$","post","handleCheckbox","rowContainCheckBox","className","toogleClassName","checked","handlePrintWithComments","comments","querySelectorAll","forEach","el","print","handlePrintWithNoComments","printNoCommentsInit","btn","addEventListener","printWithCommentsInit"],"sourceRoot":""}