{"version":3,"sources":["webpack:///./node_modules/blacklight-frontend/app/javascript/blacklight/core.js","webpack:///./node_modules/blacklight-frontend/app/javascript/blacklight/modal.js","webpack:///./node_modules/blacklight-frontend/app/javascript/blacklight/button_focus.js","webpack:///./node_modules/blacklight-frontend/app/javascript/blacklight/search_context.js"],"names":["Blacklight","buffer","Array","onLoad","func","push","activate","i","length","call","listeners","Turbo","Turbolinks","supported","BrowserAdapter","forEach","listener","document","addEventListener","elem","querySelector","classList","remove","add","csrfToken","content","csrfParam","window","undefined","modal","modalSelector","triggerLinkSelector","triggerFormSelector","preserveLinkSelector","containerSelector","modalCloseSelector","onFailure","jqXHR","textStatus","errorThrown","console","error","this","url","status","contents","type","$","find","html","show","receiveAjax","container","append","jQuery","parseHTML","first","e","Event","trigger","isDefaultPrevented","modalAjaxLinkClick","preventDefault","ajax","attr","fail","done","modalAjaxFormSubmit","data","serialize","setupModal","on","preserveFormSelector","checkCloseModal","event","target","modalFlashes","hide","fadeIn","el","bootstrap","Modal","VERSION","getOrCreateInstance","querySelectorAll","button","focus","doSearchContextBehavior","do_search_context_behavior","warn","elements","prototype","slice","element","handleSearchContextMethod","currentTarget","handle_search_context_method","link","href","getAttribute","form","createElement","method","action","formContent","metaKey","ctrlKey","dataset","turbo","setAttribute","style","display","innerHTML","body","appendChild","click","stopPropagation"],"mappings":"4EAAA,MAAMA,GACAC,EAAS,IAAIC,MACV,CACLC,OAAQ,SAAUC,GAChBH,EAAOI,KAAKD,EACd,EACAE,SAAU,WACR,IAAK,IAAIC,EAAI,EAAGA,EAAIN,EAAOO,OAAQD,IACjCN,EAAOM,GAAGE,MAEd,EACAC,UAAW,WACT,IAAIA,EAAY,GAchB,MAbqB,qBAAVC,MACTD,EAAUL,KAAK,cACgB,qBAAfO,YAA8BA,WAAWC,UAErDD,WAAWE,eACbJ,EAAUL,KAAK,mBAGfK,EAAUL,KAAK,YAAa,oBAG9BK,EAAUL,KAAK,oBAEVK,CACT,IA3Be,IACbT,EAgCND,EA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D,EAAKE,aAAa,qBACzBxB,EAASsB,EAAKE,aAAa,UAC3B3E,EAAYxB,WAAWwB,YACvBE,EAAY1B,WAAW0B,YACvB0E,EAAOnF,SAASoF,cAAc,QAClCD,EAAKE,OAAS,OACdF,EAAKG,OAASL,EACd,IAAIM,EAAc,0FACgBP,EAAKE,aAAa,6BAGhDzB,EAAM+B,SAAW/B,EAAMgC,WACzBN,EAAKO,QAAQC,MAAQ,QACrBjC,EAAS,eAEO/C,IAAdF,QAAyCE,IAAdJ,IAC7BgF,GAAe,gBAAgB9E,aAAqBF,uBAKtDgF,GAAe,0BACX7B,GACFyB,EAAKS,aAAa,SAAUlC,GAE9ByB,EAAKU,MAAMC,QAAU,OACrBX,EAAKY,UAAYR,EACjBvF,SAASgG,KAAKC,YAAYd,GAC1BA,EAAKhF,cAAc,mBAAmB+F,QACtCzC,EAAMZ,iBACNY,EAAM0C,iBACR,EACApH,WAAWG,QAAO,WAChBH,WAAWuF,yBACb,G","file":"js/npm.blacklight-frontend-c145152037a5084c8f91.chunk.js","sourcesContent":["const Blacklight = function () {\n var buffer = new Array();\n return {\n onLoad: function (func) {\n buffer.push(func);\n },\n activate: function () {\n for (var i = 0; i < buffer.length; i++) {\n buffer[i].call();\n }\n },\n listeners: function () {\n var listeners = [];\n if (typeof Turbo !== 'undefined') {\n listeners.push('turbo:load');\n } else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {\n // Turbolinks 5\n if (Turbolinks.BrowserAdapter) {\n listeners.push('turbolinks:load');\n } else {\n // Turbolinks < 5\n listeners.push('page:load', 'DOMContentLoaded');\n }\n } else {\n listeners.push('DOMContentLoaded');\n }\n return listeners;\n }\n };\n}();\n\n// turbolinks triggers page:load events on page transition\n// If app isn't using turbolinks, this event will never be triggered, no prob.\nBlacklight.listeners().forEach(function (listener) {\n document.addEventListener(listener, function () {\n Blacklight.activate();\n });\n});\nBlacklight.onLoad(function () {\n const elem = document.querySelector('.no-js');\n\n // The \"no-js\" class may already have been removed because this function is\n // run on every turbo:load event, in that case, it won't find an element.\n if (!elem) return;\n elem.classList.remove('no-js');\n elem.classList.add('js');\n});\nBlacklight.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content;\nBlacklight.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content;\nwindow.Blacklight = Blacklight;","/*\n The blacklight modal plugin can display some interactions inside a Bootstrap\n modal window, including some multi-page interactions.\n\n It supports unobtrusive Javascript, where a link or form that would have caused\n a new page load is changed to display it's results inside a modal dialog,\n by this plugin. The plugin assumes there is a Bootstrap modal div\n on the page with id #blacklight-modal to use as the modal -- the standard Blacklight\n layout provides this.\n\n To make a link or form have their results display inside a modal, add\n `data-blacklight-modal=\"trigger\"` to the link or form. (Note, form itself not submit input)\n With Rails link_to helper, you'd do that like:\n\n link_to something, link, data: { blacklight_modal: \"trigger\" }\n\n The results of the link href or form submit will be displayed inside\n a modal -- they should include the proper HTML markup for a bootstrap modal's\n contents. Also, you ordinarily won't want the Rails template with wrapping\n navigational elements to be used. The Rails controller could suppress\n the layout when a JS AJAX request is detected, OR the response\n can include a `
` -- only the contents\n of the container will be placed inside the modal, the rest of the\n page will be ignored.\n\n If you'd like to have a link or button that closes the modal,\n you can just add a `data-dismiss=\"modal\"` to the link,\n standard Bootstrap convention. But you can also have\n an href on this link for non-JS contexts, we'll make sure\n inside the modal it closes the modal and the link is NOT followed.\n\n Link or forms inside the modal will ordinarily cause page loads\n when they are triggered. However, if you'd like their results\n to stay within the modal, just add `data-blacklight-modal=\"preserve\"`\n to the link or form.\n\n Here's an example of what might be returned, demonstrating most of the devices available:\n\n
\n
\n \n

Request Placed

\n
\n\n
\n

Some message

\n <%= link_to \"This result will still be within modal\", some_link, data: { blacklight_modal: \"preserve\" } %>\n
\n\n\n
\n <%= link_to \"Close the modal\", request_done_path, class: \"submit button dialog-close\", data: { dismiss: \"modal\" } %>\n
\n
\n\n\n One additional feature. If the content returned from the AJAX modal load\n has an element with `data-blacklight-modal=close`, that will trigger the modal\n to be closed. And if this element includes a node with class \"flash_messages\",\n the flash-messages node will be added to the main page inside #main-flahses.\n\n == Events\n\n We'll send out an event 'loaded.blacklight.blacklight-modal' with the #blacklight-modal\n dialog as the target, right after content is loaded into the modal but before\n it is shown (if not already a shown modal). In an event handler, you can\n inspect loaded content by looking inside $(this). If you call event.preventDefault(),\n we won't 'show' the dialog (although it may already have been shown, you may want to\n $(this).modal(\"hide\") if you want to ensure hidden/closed.\n\n The data-blacklight-modal=close behavior is implemented with this event, see for example.\n*/\n\n// We keep all our data in Blacklight.modal object.\n// Create lazily if someone else created first.\nif (Blacklight.modal === undefined) {\n Blacklight.modal = {};\n}\n\n// a Bootstrap modal div that should be already on the page hidden\nBlacklight.modal.modalSelector = '#blacklight-modal';\n\n// Trigger selectors identify forms or hyperlinks that should open\n// inside a modal dialog.\nBlacklight.modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';\nBlacklight.modal.triggerFormSelector = 'form[data-blacklight-modal~=trigger]';\n\n// preserve selectors identify forms or hyperlinks that, if activated already\n// inside a modal dialog, should have destinations remain inside the modal -- but\n// won't trigger a modal if not already in one.\n//\n// No need to repeat selectors from trigger selectors, those will already\n// be preserved. MUST be manually prefixed with the modal selector,\n// so they only apply to things inside a modal.\nBlacklight.modal.preserveLinkSelector = Blacklight.modal.modalSelector + ' a[data-blacklight-modal~=preserve]';\nBlacklight.modal.containerSelector = '[data-blacklight-modal~=container]';\nBlacklight.modal.modalCloseSelector = '[data-blacklight-modal~=close]';\n\n// Called on fatal failure of ajax load, function returns content\n// to show to user in modal. Right now called only for extreme\n// network errors.\nBlacklight.modal.onFailure = function (jqXHR, textStatus, errorThrown) {\n console.error('Server error:', this.url, jqXHR.status, errorThrown);\n var contents = '
' + '
There was a problem with your request.
' + '
' + '

Expected a successful response from the server, but got an error

' + '
' + this.type + ' ' + this.url + \"\\n\" + jqXHR.status + ': ' + errorThrown + '
';\n $(Blacklight.modal.modalSelector).find('.modal-content').html(contents);\n Blacklight.modal.show();\n};\nBlacklight.modal.receiveAjax = function (contents) {\n // does it have a data- selector for container?\n // important we don't execute script tags, we shouldn't.\n // code modelled off of JQuery ajax.load. https://github.com/jquery/jquery/blob/main/src/ajax/load.js?source=c#L62\n var container = $('
').append(jQuery.parseHTML(contents)).find(Blacklight.modal.containerSelector).first();\n if (container.length !== 0) {\n contents = container.html();\n }\n $(Blacklight.modal.modalSelector).find('.modal-content').html(contents);\n\n // send custom event with the modal dialog div as the target\n var e = $.Event('loaded.blacklight.blacklight-modal');\n $(Blacklight.modal.modalSelector).trigger(e);\n // if they did preventDefault, don't show the dialog\n if (e.isDefaultPrevented()) return;\n Blacklight.modal.show();\n};\nBlacklight.modal.modalAjaxLinkClick = function (e) {\n e.preventDefault();\n $.ajax({\n url: $(this).attr('href')\n }).fail(Blacklight.modal.onFailure).done(Blacklight.modal.receiveAjax);\n};\nBlacklight.modal.modalAjaxFormSubmit = function (e) {\n e.preventDefault();\n $.ajax({\n url: $(this).attr('action'),\n data: $(this).serialize(),\n type: $(this).attr('method') // POST\n }).fail(Blacklight.modal.onFailure).done(Blacklight.modal.receiveAjax);\n};\nBlacklight.modal.setupModal = function () {\n // Event indicating blacklight is setting up a modal link,\n // you can catch it and call e.preventDefault() to abort\n // setup.\n var e = $.Event('setup.blacklight.blacklight-modal');\n $('body').trigger(e);\n if (e.isDefaultPrevented()) return;\n\n // Register both trigger and preserve selectors in ONE event handler, combining\n // into one selector with a comma, so if something matches BOTH selectors, it\n // still only gets the event handler called once.\n $('body').on('click', Blacklight.modal.triggerLinkSelector + ', ' + Blacklight.modal.preserveLinkSelector, Blacklight.modal.modalAjaxLinkClick);\n $('body').on('submit', Blacklight.modal.triggerFormSelector + ', ' + Blacklight.modal.preserveFormSelector, Blacklight.modal.modalAjaxFormSubmit);\n\n // Catch our own custom loaded event to implement data-blacklight-modal=closed\n $('body').on('loaded.blacklight.blacklight-modal', Blacklight.modal.checkCloseModal);\n\n // we support doing data-dismiss=modal on a with a href for non-ajax\n // use, we need to suppress following the a's href that's there for\n // non-JS contexts.\n $('body').on('click', Blacklight.modal.modalSelector + ' a[data-dismiss~=modal]', function (e) {\n e.preventDefault();\n });\n};\n\n// A function used as an event handler on loaded.blacklight.blacklight-modal\n// to catch contained data-blacklight-modal=closed directions\nBlacklight.modal.checkCloseModal = function (event) {\n if ($(event.target).find(Blacklight.modal.modalCloseSelector).length) {\n var modalFlashes = $(this).find('.flash_messages');\n Blacklight.modal.hide(event.target);\n event.preventDefault();\n var mainFlashes = $('#main-flashes');\n mainFlashes.append(modalFlashes);\n modalFlashes.fadeIn(500);\n }\n};\nBlacklight.modal.hide = function (el) {\n if (typeof bootstrap !== 'undefined' && typeof bootstrap.Modal !== 'undefined' && bootstrap.Modal.VERSION >= \"5\") {\n bootstrap.Modal.getOrCreateInstance(el || document.querySelector(Blacklight.modal.modalSelector)).hide();\n } else {\n $(el || Blacklight.modal.modalSelector).modal('hide');\n }\n};\nBlacklight.modal.show = function (el) {\n if (typeof bootstrap !== 'undefined' && typeof bootstrap.Modal !== 'undefined' && bootstrap.Modal.VERSION >= \"5\") {\n bootstrap.Modal.getOrCreateInstance(el || document.querySelector(Blacklight.modal.modalSelector)).show();\n } else {\n $(el || Blacklight.modal.modalSelector).modal('show');\n }\n};\nBlacklight.onLoad(function () {\n Blacklight.modal.setupModal();\n});","Blacklight.onLoad(function () {\n // Button clicks should change focus. As of 10/3/19, Firefox for Mac and\n // Safari both do not set focus to a button on button click.\n // See https://zellwk.com/blog/inconsistent-button-behavior/ for background information\n document.querySelectorAll('button.collapse-toggle').forEach(button => {\n button.addEventListener('click', () => {\n event.target.focus();\n });\n });\n});","Blacklight.doSearchContextBehavior = function () {\n if (typeof Blacklight.do_search_context_behavior == 'function') {\n console.warn(\"do_search_context_behavior is deprecated. Use doSearchContextBehavior instead.\");\n return Blacklight.do_search_context_behavior();\n }\n const elements = document.querySelectorAll('a[data-context-href]');\n // Equivalent to Array.from(), but supports ie11\n const nodes = Array.prototype.slice.call(elements);\n nodes.forEach(function (element) {\n element.addEventListener('click', function (e) {\n Blacklight.handleSearchContextMethod.call(e.currentTarget, e);\n });\n });\n};\n\n// this is the Rails.handleMethod with a couple adjustments, described inline:\n// first, we're attaching this directly to the event handler, so we can check for meta-keys\nBlacklight.handleSearchContextMethod = function (event) {\n if (typeof Blacklight.handle_search_context_method == 'function') {\n console.warn(\"handle_search_context_method is deprecated. Use handleSearchContextMethod instead.\");\n return Blacklight.handle_search_context_method(event);\n }\n var link = this;\n\n // instead of using the normal href, we need to use the context href instead\n let href = link.getAttribute('data-context-href');\n let target = link.getAttribute('target');\n let csrfToken = Blacklight.csrfToken();\n let csrfParam = Blacklight.csrfParam();\n let form = document.createElement('form');\n form.method = 'post';\n form.action = href;\n let formContent = `\n `;\n\n // check for meta keys.. if set, we should open in a new tab\n if (event.metaKey || event.ctrlKey) {\n form.dataset.turbo = \"false\";\n target = '_blank';\n }\n if (csrfParam !== undefined && csrfToken !== undefined) {\n formContent += ``;\n }\n\n // Must trigger submit by click on a button, else \"submit\" event handler won't work!\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n formContent += '';\n if (target) {\n form.setAttribute('target', target);\n }\n form.style.display = 'none';\n form.innerHTML = formContent;\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n event.preventDefault();\n event.stopPropagation();\n};\nBlacklight.onLoad(function () {\n Blacklight.doSearchContextBehavior();\n});"],"sourceRoot":""}