{"version":3,"sources":["jsdelivr-header.js","/npm/@buildit/gravity-ui-web@3.4.0/dist/gravity.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,AC4CE,SAAS,iBAAiB,oBAAoB,MAlB9C,WAEE,MAAM,EAAgB,SAAS,iBAAiB,+BAIhD,MAAM,UAAU,QAAQ,KAAK,GAAgB,IAC3C,EAAa,iBAAiB,SAAS,KACrC,MAAM,EAAwD,SAA9C,EAAa,aAAa,gBAC1C,EAAa,aAAa,eAAgB,QAAQ,GAAS,GAC3D,GAEN,CAOE,EAAmB","file":"/npm/@buildit/gravity-ui-web@3.4.0/dist/gravity.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@buildit/gravity-ui-web@3.4.0/dist/gravity.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Basic client-side JS to add basic behaviours to interactive UI components.\n *\n * Complex applications should probably replace this with a corresponding implementation\n * using their preferred framework (React, Vue, Angular, etc.). This JS code along with the\n * \"pattern info\" displayed for each UI component in our style guide should be used as a\n * reference when doing so.\n *\n * The important thing is that the DOM structure is Gravity's \"API\". Whether you generate it\n * server-side, write it into a static HTML file or generate it client-side, all implementations\n * MUST create the same HTML structures (same choice of elements and attributes) in order\n * for Gravity's CSS to style them correctly.\n *\n */\n// eslint-disable-next-line func-names\n(function () {\n  /**\n   * Initialises all toggle buttons on the page.\n   *\n   * This function finds all toggle buttons and adds a click\n   * event handler which toggles the value of the aria-pressed\n   * attribute.\n   *\n   * Noe that the \"click\" hander is triggered by users clicking,\n   * tapping or acitivating the button via the SPACE and ENTER\n   * keys.\n   *\n   * This code is heavily inspired by Heydon Pickering's excellent\n   * \"Toggle Buttons\" post on his \"Inclusive Components\" blog:\n   * https://inclusive-components.design/toggle-button/\n   *\n   */\n  function initToggleButtons() {\n    // eslint-disable-next-line no-undef\n    const toggleButtons = document.querySelectorAll('[type=button][aria-pressed]');\n\n    // IE-compatible way of iterating over the NodeList\n    // (See: https://developer.mozilla.org/en-US/docs/Web/API/NodeList)\n    Array.prototype.forEach.call(toggleButtons, (toggleButton) => {\n      toggleButton.addEventListener('click', () => {\n        const pressed = toggleButton.getAttribute('aria-pressed') === 'true';\n        toggleButton.setAttribute('aria-pressed', String(!pressed));\n      });\n    });\n  }\n\n  /**\n   * Runs the various init functions once the DOM has loaded.\n   */\n  // eslint-disable-next-line no-undef\n  document.addEventListener('DOMContentLoaded', () => {\n    initToggleButtons();\n  });\n}());\n"]}