{"version":3,"file":"components-paginated-list.0678e18a55649423bef1.js","mappings":"yLAIA,MAOMA,EAAgBC,UACpB,MAAMC,EAASC,EAAED,OACXE,EAAWF,EAAOG,QARD,kCASjBC,EAAOC,SAASC,cANP,yBAQfL,EAAEM,iBAEFL,EAASM,UAAUC,IAAI,sBAAuB,cAE9C,MAAMC,QAAYC,EAAAA,EAAAA,IAASX,EAAOY,MAAMC,OAElCC,EAAkBT,SAASU,cAAcC,yBAAyBN,EAAIO,YAC5Ef,EAASgB,YAAYJ,GAErB,MAAMK,EAAcd,SAASU,cAAcC,yBAAyBN,EAAIN,MAEpEJ,EAAOoB,aApBQ,6BAqBjBhB,EAAKiB,gBAAgBF,IAErBG,EAAAA,EAAAA,GAASjB,SAASkB,OAElBnB,EAAKoB,OAAOL,EACd,EAGF,GACEM,KAAM,MACJC,EAAAA,EAAAA,IAAG,QAhCiB,gCAgCwB5B,EAAc,E","sources":["webpack://kelberman.org/./themes/app/src/scripts/components/paginated-list.js"],"sourcesContent":["import scrollTo from '@common/scroll-to'\nimport ajax from '@common/ajax'\nimport { on } from 'delegated-events'\n\nconst selectors = {\n paginatedListControls: '[data-paginated-list-controls]',\n paginatedListTrigger: '[data-paginated-list-trigger]',\n paginatedListHide: 'data-paginated-list-hide',\n paginatedList: '[data-paginated-list]',\n}\n\nconst handleTrigger = async (e) => {\n const target = e.target\n const controls = target.closest(selectors.paginatedListControls)\n const list = document.querySelector(selectors.paginatedList)\n\n e.preventDefault()\n\n controls.classList.add('pointer-events-none', 'opacity-60')\n\n const res = await ajax.get(target.href).json()\n\n const updatedControls = document.createRange().createContextualFragment(res.pagination)\n controls.replaceWith(updatedControls)\n\n const updatedList = document.createRange().createContextualFragment(res.list)\n\n if (target.hasAttribute(selectors.paginatedListHide)) {\n list.replaceChildren(updatedList)\n\n scrollTo(document.body)\n } else {\n list.append(updatedList)\n }\n}\n\nexport default {\n init: () => {\n on('click', selectors.paginatedListTrigger, handleTrigger)\n },\n}\n"],"names":["handleTrigger","async","target","e","controls","closest","list","document","querySelector","preventDefault","classList","add","res","ajax","href","json","updatedControls","createRange","createContextualFragment","pagination","replaceWith","updatedList","hasAttribute","replaceChildren","scrollTo","body","append","init","on"],"sourceRoot":""}