diff options
Diffstat (limited to 'vendor/twbs/bootstrap/site/assets/js')
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/application.js | 28 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/partials/code-examples.js (renamed from vendor/twbs/bootstrap/site/assets/js/code-examples.js) | 17 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/partials/sidebar.js | 30 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/partials/snippets.js | 168 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/search.js | 24 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/snippets.js | 171 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/stackblitz.js | 66 | ||||
-rw-r--r-- | vendor/twbs/bootstrap/site/assets/js/vendor/clipboard.min.js | 7 |
8 files changed, 309 insertions, 202 deletions
diff --git a/vendor/twbs/bootstrap/site/assets/js/application.js b/vendor/twbs/bootstrap/site/assets/js/application.js index a16defbd4..afab46e53 100644 --- a/vendor/twbs/bootstrap/site/assets/js/application.js +++ b/vendor/twbs/bootstrap/site/assets/js/application.js @@ -4,27 +4,17 @@ /*! * JavaScript for Bootstrap's docs (https://getbootstrap.com/) - * Copyright 2011-2024 The Bootstrap Authors + * Copyright 2011-2025 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. * For details, see https://creativecommons.org/licenses/by/3.0/. */ -(() => { - 'use strict' +/* eslint-disable import/no-unresolved */ +import sidebarScroll from 'js/partials/sidebar.js' +import codeExamples from 'js/partials/code-examples.js' +import snippets from 'js/partials/snippets.js' +/* eslint-enable import/no-unresolved */ - // Scroll the active sidebar link into view - const sidenav = document.querySelector('.bd-sidebar') - const sidenavActiveLink = document.querySelector('.bd-links-nav .active') - - if (sidenav && sidenavActiveLink) { - const sidenavHeight = sidenav.clientHeight - const sidenavActiveLinkTop = sidenavActiveLink.offsetTop - const sidenavActiveLinkHeight = sidenavActiveLink.clientHeight - const viewportTop = sidenavActiveLinkTop - const viewportBottom = viewportTop - sidenavHeight + sidenavActiveLinkHeight - - if (sidenav.scrollTop > viewportTop || sidenav.scrollTop < viewportBottom) { - sidenav.scrollTop = viewportTop - (sidenavHeight / 2) + (sidenavActiveLinkHeight / 2) - } - } -})() +sidebarScroll() +codeExamples() +snippets() diff --git a/vendor/twbs/bootstrap/site/assets/js/code-examples.js b/vendor/twbs/bootstrap/site/assets/js/partials/code-examples.js index 3462da59b..1e86df9f9 100644 --- a/vendor/twbs/bootstrap/site/assets/js/code-examples.js +++ b/vendor/twbs/bootstrap/site/assets/js/partials/code-examples.js @@ -2,18 +2,18 @@ // IT'S ALL JUST JUNK FOR OUR DOCS! // ++++++++++++++++++++++++++++++++++++++++++ -/*! +/* * JavaScript for Bootstrap's docs (https://getbootstrap.com/) - * Copyright 2011-2024 The Bootstrap Authors + * Copyright 2011-2025 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. * For details, see https://creativecommons.org/licenses/by/3.0/. */ -/* global ClipboardJS: false, bootstrap: false */ +/* global bootstrap: false */ -(() => { - 'use strict' +import ClipboardJS from 'clipboard' +export default () => { // Insert copy to clipboard button before .highlight const btnTitle = 'Copy to clipboard' const btnEdit = 'Edit on StackBlitz' @@ -63,6 +63,11 @@ const namespace = 'http://www.w3.org/1999/xlink' const originalXhref = iconFirstChild.getAttributeNS(namespace, 'href') const originalTitle = event.trigger.title + const isCheckIconVisible = originalXhref === '#check2' + + if (isCheckIconVisible) { + return + } tooltipBtn.setContent({ '.tooltip-inner': 'Copied!' }) event.trigger.addEventListener('hidden.bs.tooltip', () => { @@ -87,4 +92,4 @@ tooltipBtn.setContent({ '.tooltip-inner': btnTitle }) }, { once: true }) }) -})() +} diff --git a/vendor/twbs/bootstrap/site/assets/js/partials/sidebar.js b/vendor/twbs/bootstrap/site/assets/js/partials/sidebar.js new file mode 100644 index 000000000..bf42e7b5e --- /dev/null +++ b/vendor/twbs/bootstrap/site/assets/js/partials/sidebar.js @@ -0,0 +1,30 @@ +// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT +// IT'S ALL JUST JUNK FOR OUR DOCS! +// ++++++++++++++++++++++++++++++++++++++++++ + +/* + * JavaScript for Bootstrap's docs (https://getbootstrap.com/) + * Copyright 2011-2025 The Bootstrap Authors + * Licensed under the Creative Commons Attribution 3.0 Unported License. + * For details, see https://creativecommons.org/licenses/by/3.0/. + */ + +export default () => { + // Scroll the active sidebar link into view + const sidenav = document.querySelector('.bd-sidebar') + const sidenavActiveLink = document.querySelector('.bd-links-nav .active') + + if (!sidenav || !sidenavActiveLink) { + return + } + + const sidenavHeight = sidenav.clientHeight + const sidenavActiveLinkTop = sidenavActiveLink.offsetTop + const sidenavActiveLinkHeight = sidenavActiveLink.clientHeight + const viewportTop = sidenavActiveLinkTop + const viewportBottom = viewportTop - sidenavHeight + sidenavActiveLinkHeight + + if (sidenav.scrollTop > viewportTop || sidenav.scrollTop < viewportBottom) { + sidenav.scrollTop = viewportTop - (sidenavHeight / 2) + (sidenavActiveLinkHeight / 2) + } +} diff --git a/vendor/twbs/bootstrap/site/assets/js/partials/snippets.js b/vendor/twbs/bootstrap/site/assets/js/partials/snippets.js new file mode 100644 index 000000000..498071b41 --- /dev/null +++ b/vendor/twbs/bootstrap/site/assets/js/partials/snippets.js @@ -0,0 +1,168 @@ +// NOTICE!!! Initially embedded in our docs this JavaScript +// file contains elements that can help you create reproducible +// use cases in StackBlitz for instance. +// In a real project please adapt this content to your needs. +// ++++++++++++++++++++++++++++++++++++++++++ + +/* + * JavaScript for Bootstrap's docs (https://getbootstrap.com/) + * Copyright 2011-2025 The Bootstrap Authors + * Licensed under the Creative Commons Attribution 3.0 Unported License. + * For details, see https://creativecommons.org/licenses/by/3.0/. + */ + +/* global bootstrap: false */ + +export default () => { + // -------- + // Tooltips + // -------- + // Instantiate all tooltips in a docs or StackBlitz + document.querySelectorAll('[data-bs-toggle="tooltip"]') + .forEach(tooltip => { + new bootstrap.Tooltip(tooltip) + }) + + // -------- + // Popovers + // -------- + // Instantiate all popovers in docs or StackBlitz + document.querySelectorAll('[data-bs-toggle="popover"]') + .forEach(popover => { + new bootstrap.Popover(popover) + }) + + // ------------------------------- + // Toasts + // ------------------------------- + // Used by 'Placement' example in docs or StackBlitz + const toastPlacement = document.getElementById('toastPlacement') + if (toastPlacement) { + document.getElementById('selectToastPlacement').addEventListener('change', function () { + if (!toastPlacement.dataset.originalClass) { + toastPlacement.dataset.originalClass = toastPlacement.className + } + + toastPlacement.className = `${toastPlacement.dataset.originalClass} ${this.value}` + }) + } + + // Instantiate all toasts in docs pages only + document.querySelectorAll('.bd-example .toast') + .forEach(toastNode => { + const toast = new bootstrap.Toast(toastNode, { + autohide: false + }) + + toast.show() + }) + + // Instantiate all toasts in docs pages only + // js-docs-start live-toast + const toastTrigger = document.getElementById('liveToastBtn') + const toastLiveExample = document.getElementById('liveToast') + + if (toastTrigger) { + const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample) + toastTrigger.addEventListener('click', () => { + toastBootstrap.show() + }) + } + // js-docs-end live-toast + + // ------------------------------- + // Alerts + // ------------------------------- + // Used in 'Show live alert' example in docs or StackBlitz + + // js-docs-start live-alert + const alertPlaceholder = document.getElementById('liveAlertPlaceholder') + const appendAlert = (message, type) => { + const wrapper = document.createElement('div') + wrapper.innerHTML = [ + `<div class="alert alert-${type} alert-dismissible" role="alert">`, + ` <div>${message}</div>`, + ' <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>', + '</div>' + ].join('') + + alertPlaceholder.append(wrapper) + } + + const alertTrigger = document.getElementById('liveAlertBtn') + if (alertTrigger) { + alertTrigger.addEventListener('click', () => { + appendAlert('Nice, you triggered this alert message!', 'success') + }) + } + // js-docs-end live-alert + + // -------- + // Carousels + // -------- + // Instantiate all non-autoplaying carousels in docs or StackBlitz + document.querySelectorAll('.carousel:not([data-bs-ride="carousel"])') + .forEach(carousel => { + bootstrap.Carousel.getOrCreateInstance(carousel) + }) + + // ------------------------------- + // Checks & Radios + // ------------------------------- + // Indeterminate checkbox example in docs and StackBlitz + document.querySelectorAll('.bd-example-indeterminate [type="checkbox"]') + .forEach(checkbox => { + if (checkbox.id.includes('Indeterminate')) { + checkbox.indeterminate = true + } + }) + + // ------------------------------- + // Links + // ------------------------------- + // Disable empty links in docs examples only + document.querySelectorAll('.bd-content [href="#"]') + .forEach(link => { + link.addEventListener('click', event => { + event.preventDefault() + }) + }) + + // ------------------------------- + // Modal + // ------------------------------- + // Modal 'Varying modal content' example in docs and StackBlitz + // js-docs-start varying-modal-content + const exampleModal = document.getElementById('exampleModal') + if (exampleModal) { + exampleModal.addEventListener('show.bs.modal', event => { + // Button that triggered the modal + const button = event.relatedTarget + // Extract info from data-bs-* attributes + const recipient = button.getAttribute('data-bs-whatever') + // If necessary, you could initiate an Ajax request here + // and then do the updating in a callback. + + // Update the modal's content. + const modalTitle = exampleModal.querySelector('.modal-title') + const modalBodyInput = exampleModal.querySelector('.modal-body input') + + modalTitle.textContent = `New message to ${recipient}` + modalBodyInput.value = recipient + }) + } + // js-docs-end varying-modal-content + + // ------------------------------- + // Offcanvas + // ------------------------------- + // 'Offcanvas components' example in docs only + const myOffcanvas = document.querySelectorAll('.bd-example-offcanvas .offcanvas') + if (myOffcanvas) { + myOffcanvas.forEach(offcanvas => { + offcanvas.addEventListener('show.bs.offcanvas', event => { + event.preventDefault() + }, false) + }) + } +} diff --git a/vendor/twbs/bootstrap/site/assets/js/search.js b/vendor/twbs/bootstrap/site/assets/js/search.js index b095d3bbd..b2bd660a4 100644 --- a/vendor/twbs/bootstrap/site/assets/js/search.js +++ b/vendor/twbs/bootstrap/site/assets/js/search.js @@ -2,21 +2,31 @@ // IT'S ALL JUST JUNK FOR OUR DOCS! // ++++++++++++++++++++++++++++++++++++++++++ -(() => { - 'use strict' +/*! + * JavaScript for Bootstrap's docs (https://getbootstrap.com/) + * Copyright 2024-2025 The Bootstrap Authors + * Licensed under the Creative Commons Attribution 3.0 Unported License. + * For details, see https://creativecommons.org/licenses/by/3.0/. + */ + +import docsearch from '@docsearch/js' +// https://gohugo.io/hugo-pipes/js/#options +// eslint-disable-next-line import/no-unresolved +import { appId, apiKey, indexName } from '@params'; +(() => { const searchElement = document.getElementById('docsearch') - if (!window.docsearch || !searchElement) { + if (!searchElement) { return } const siteDocsVersion = searchElement.getAttribute('data-bd-docs-version') - window.docsearch({ - apiKey: '3151f502c7b9e9dafd5e6372b691a24e', - indexName: 'bootstrap', - appId: 'AK7KMZKZHQ', + docsearch({ + apiKey, + indexName, + appId, container: searchElement, searchParameters: { facetFilters: [`version:${siteDocsVersion}`] diff --git a/vendor/twbs/bootstrap/site/assets/js/snippets.js b/vendor/twbs/bootstrap/site/assets/js/snippets.js index 94d8f6dee..d18ab41c4 100644 --- a/vendor/twbs/bootstrap/site/assets/js/snippets.js +++ b/vendor/twbs/bootstrap/site/assets/js/snippets.js @@ -1,170 +1,15 @@ -// NOTICE!!! Initially embedded in our docs this JavaScript -// file contains elements that can help you create reproducible -// use cases in StackBlitz for instance. -// In a real project please adapt this content to your needs. -// ++++++++++++++++++++++++++++++++++++++++++ - -/*! +/* * JavaScript for Bootstrap's docs (https://getbootstrap.com/) - * Copyright 2011-2024 The Bootstrap Authors + * Copyright 2011-2025 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. * For details, see https://creativecommons.org/licenses/by/3.0/. */ -/* global bootstrap: false */ - -(() => { - 'use strict' - - // -------- - // Tooltips - // -------- - // Instantiate all tooltips in a docs or StackBlitz - document.querySelectorAll('[data-bs-toggle="tooltip"]') - .forEach(tooltip => { - new bootstrap.Tooltip(tooltip) - }) - - // -------- - // Popovers - // -------- - // Instantiate all popovers in docs or StackBlitz - document.querySelectorAll('[data-bs-toggle="popover"]') - .forEach(popover => { - new bootstrap.Popover(popover) - }) - - // ------------------------------- - // Toasts - // ------------------------------- - // Used by 'Placement' example in docs or StackBlitz - const toastPlacement = document.getElementById('toastPlacement') - if (toastPlacement) { - document.getElementById('selectToastPlacement').addEventListener('change', function () { - if (!toastPlacement.dataset.originalClass) { - toastPlacement.dataset.originalClass = toastPlacement.className - } - - toastPlacement.className = `${toastPlacement.dataset.originalClass} ${this.value}` - }) - } - - // Instantiate all toasts in docs pages only - document.querySelectorAll('.bd-example .toast') - .forEach(toastNode => { - const toast = new bootstrap.Toast(toastNode, { - autohide: false - }) - - toast.show() - }) - - // Instantiate all toasts in docs pages only - // js-docs-start live-toast - const toastTrigger = document.getElementById('liveToastBtn') - const toastLiveExample = document.getElementById('liveToast') - - if (toastTrigger) { - const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample) - toastTrigger.addEventListener('click', () => { - toastBootstrap.show() - }) - } - // js-docs-end live-toast - - // ------------------------------- - // Alerts - // ------------------------------- - // Used in 'Show live alert' example in docs or StackBlitz - - // js-docs-start live-alert - const alertPlaceholder = document.getElementById('liveAlertPlaceholder') - const appendAlert = (message, type) => { - const wrapper = document.createElement('div') - wrapper.innerHTML = [ - `<div class="alert alert-${type} alert-dismissible" role="alert">`, - ` <div>${message}</div>`, - ' <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>', - '</div>' - ].join('') - - alertPlaceholder.append(wrapper) - } - - const alertTrigger = document.getElementById('liveAlertBtn') - if (alertTrigger) { - alertTrigger.addEventListener('click', () => { - appendAlert('Nice, you triggered this alert message!', 'success') - }) - } - // js-docs-end live-alert - - // -------- - // Carousels - // -------- - // Instantiate all non-autoplaying carousels in docs or StackBlitz - document.querySelectorAll('.carousel:not([data-bs-ride="carousel"])') - .forEach(carousel => { - bootstrap.Carousel.getOrCreateInstance(carousel) - }) - - // ------------------------------- - // Checks & Radios - // ------------------------------- - // Indeterminate checkbox example in docs and StackBlitz - document.querySelectorAll('.bd-example-indeterminate [type="checkbox"]') - .forEach(checkbox => { - if (checkbox.id.includes('Indeterminate')) { - checkbox.indeterminate = true - } - }) - - // ------------------------------- - // Links - // ------------------------------- - // Disable empty links in docs examples only - document.querySelectorAll('.bd-content [href="#"]') - .forEach(link => { - link.addEventListener('click', event => { - event.preventDefault() - }) - }) - - // ------------------------------- - // Modal - // ------------------------------- - // Modal 'Varying modal content' example in docs and StackBlitz - // js-docs-start varying-modal-content - const exampleModal = document.getElementById('exampleModal') - if (exampleModal) { - exampleModal.addEventListener('show.bs.modal', event => { - // Button that triggered the modal - const button = event.relatedTarget - // Extract info from data-bs-* attributes - const recipient = button.getAttribute('data-bs-whatever') - // If necessary, you could initiate an Ajax request here - // and then do the updating in a callback. - - // Update the modal's content. - const modalTitle = exampleModal.querySelector('.modal-title') - const modalBodyInput = exampleModal.querySelector('.modal-body input') +// Note that this file is not published; we only include it in scripts.html +// for StackBlitz to work - modalTitle.textContent = `New message to ${recipient}` - modalBodyInput.value = recipient - }) - } - // js-docs-end varying-modal-content +/* eslint-disable import/no-unresolved */ +import snippets from 'js/partials/snippets.js' +/* eslint-enable import/no-unresolved */ - // ------------------------------- - // Offcanvas - // ------------------------------- - // 'Offcanvas components' example in docs only - const myOffcanvas = document.querySelectorAll('.bd-example-offcanvas .offcanvas') - if (myOffcanvas) { - myOffcanvas.forEach(offcanvas => { - offcanvas.addEventListener('show.bs.offcanvas', event => { - event.preventDefault() - }, false) - }) - } -})() +snippets() diff --git a/vendor/twbs/bootstrap/site/assets/js/stackblitz.js b/vendor/twbs/bootstrap/site/assets/js/stackblitz.js new file mode 100644 index 000000000..35bd39df3 --- /dev/null +++ b/vendor/twbs/bootstrap/site/assets/js/stackblitz.js @@ -0,0 +1,66 @@ +// NOTICE!!! Initially embedded in our docs this JavaScript +// file contains elements that can help you create reproducible +// use cases in StackBlitz for instance. +// In a real project please adapt this content to your needs. +// ++++++++++++++++++++++++++++++++++++++++++ + +/*! + * JavaScript for Bootstrap's docs (https://getbootstrap.com/) + * Copyright 2024-2025 The Bootstrap Authors + * Licensed under the Creative Commons Attribution 3.0 Unported License. + * For details, see https://creativecommons.org/licenses/by/3.0/. + */ + +import sdk from '@stackblitz/sdk' +// https://gohugo.io/hugo-pipes/js/#options +import { + cssCdn, docsVersion, jsBundleCdn, jsSnippetFile +} from '@params' // eslint-disable-line import/no-unresolved + +// Open in StackBlitz logic +document.querySelectorAll('.btn-edit').forEach(btn => { + btn.addEventListener('click', event => { + const codeSnippet = event.target.closest('.bd-code-snippet') + const exampleEl = codeSnippet.querySelector('.bd-example') + + const htmlSnippet = exampleEl.innerHTML + const jsSnippet = codeSnippet.querySelector('.btn-edit').getAttribute('data-sb-js-snippet') + // Get extra classes for this example + const classes = Array.from(exampleEl.classList).join(' ') + + openBootstrapSnippet(htmlSnippet, jsSnippet, classes) + }) +}) + +const openBootstrapSnippet = (htmlSnippet, jsSnippet, classes) => { + const indexHtml = `<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link href="${cssCdn}" rel="stylesheet"> + <link href="https://getbootstrap.com/docs/${docsVersion}/assets/css/docs.css" rel="stylesheet"> + <title>Bootstrap Example</title> + <${'script'} defer src="${jsBundleCdn}"></${'script'}> + </head> + <body class="p-3 m-0 border-0 ${classes}"> + <!-- Example Code Start--> +${htmlSnippet.trimStart().replace(/^/gm, ' ').replace(/^ {4}$/gm, '').trimEnd()} + <!-- Example Code End --> + </body> +</html> +` + + const project = { + files: { + 'index.html': indexHtml, + ...(jsSnippet && { 'index.js': jsSnippetFile }) + }, + title: 'Bootstrap Example', + description: `Official example from ${window.location.href}`, + template: jsSnippet ? 'javascript' : 'html', + tags: ['bootstrap'] + } + + sdk.openProject(project, { openFile: 'index.html' }) +} diff --git a/vendor/twbs/bootstrap/site/assets/js/vendor/clipboard.min.js b/vendor/twbs/bootstrap/site/assets/js/vendor/clipboard.min.js deleted file mode 100644 index 1103f811e..000000000 --- a/vendor/twbs/bootstrap/site/assets/js/vendor/clipboard.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * clipboard.js v2.0.11 - * https://clipboardjs.com/ - * - * Licensed MIT © Zeno Rocha - */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof t?n=o(t,e):t instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==t?void 0:t.type)?n=o(t.value,e):(n=r()(t),c("copy")),n};function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=t.action,n=void 0===e?"copy":e,o=t.container,e=t.target,t=t.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==e){if(!e||"object"!==l(e)||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return t?f(t,{container:o}):e?"cut"===n?a(e):f(e,{container:o}):void 0};function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(n){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=v(n);return t=o?(t=v(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),e=this,!(t=t)||"object"!==p(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){t="data-clipboard-".concat(t);if(e.hasAttribute(t))return e.getAttribute(t)}var b=function(){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}(r,i());var t,e,n,o=h(r);function r(t,e){var n;return function(t){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this),(n=o.call(this)).resolveOptions(e),n.listenClick(t),n}return t=r,n=[{key:"copy",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body};return f(t,e)}},{key:"cut",value:function(t){return a(t)}},{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof t?[t]:t,e=!!document.queryCommandSupported;return t.forEach(function(t){e=e&&!!document.queryCommandSupported(t)}),e}}],(e=[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===p(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=u()(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget,n=this.action(e)||"copy",t=s({action:n,container:this.container,target:this.target(e),text:this.text(e)});this.emit(t?"success":"error",{action:n,text:t,trigger:e,clearSelection:function(){e&&e.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(t){return m("action",t)}},{key:"defaultTarget",value:function(t){t=m("target",t);if(t)return document.querySelector(t)}},{key:"defaultText",value:function(t){return m("text",t)}},{key:"destroy",value:function(){this.listener.destroy()}}])&&d(t.prototype,e),n&&d(t,n),r}()},828:function(t){var e;"undefined"==typeof Element||Element.prototype.matches||((e=Element.prototype).matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector),t.exports=function(t,e){for(;t&&9!==t.nodeType;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}},438:function(t,e,n){var u=n(828);function i(t,e,n,o,r){var i=function(e,n,t,o){return function(t){t.delegateTarget=u(t.target,n),t.delegateTarget&&o.call(e,t)}}.apply(this,arguments);return t.addEventListener(n,i,r),{destroy:function(){t.removeEventListener(n,i,r)}}}t.exports=function(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}},879:function(t,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},370:function(t,e,n){var f=n(879),l=n(438);t.exports=function(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!f.string(e))throw new TypeError("Second argument must be a String");if(!f.fn(n))throw new TypeError("Third argument must be a Function");if(f.node(t))return c=e,a=n,(u=t).addEventListener(c,a),{destroy:function(){u.removeEventListener(c,a)}};if(f.nodeList(t))return o=t,r=e,i=n,Array.prototype.forEach.call(o,function(t){t.addEventListener(r,i)}),{destroy:function(){Array.prototype.forEach.call(o,function(t){t.removeEventListener(r,i)})}};if(f.string(t))return t=t,e=e,n=n,l(document.body,t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");var o,r,i,u,c,a}},817:function(t){t.exports=function(t){var e,n="SELECT"===t.nodeName?(t.focus(),t.value):"INPUT"===t.nodeName||"TEXTAREA"===t.nodeName?((e=t.hasAttribute("readonly"))||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),e||t.removeAttribute("readonly"),t.value):(t.hasAttribute("contenteditable")&&t.focus(),n=window.getSelection(),(e=document.createRange()).selectNodeContents(t),n.removeAllRanges(),n.addRange(e),n.toString());return n}},279:function(t){function e(){}e.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o<r;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],r=[];if(o&&e)for(var i=0,u=o.length;i<u;i++)o[i].fn!==e&&o[i].fn._!==e&&r.push(o[i]);return r.length?n[t]=r:delete n[t],this}},t.exports=e,t.exports.TinyEmitter=e}},r={},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o(686).default;function o(t){if(r[t])return r[t].exports;var e=r[t]={exports:{}};return n[t](e,e.exports,o),e.exports}var n,r});
\ No newline at end of file |