{"version":3,"file":"post_show_slide_show.js","mappings":"YAEA,MAAMA,EAAaC,SAASC,eAAe,eACrCC,EAAaC,MAAMC,KAAKJ,SAASK,iBAAiB,iBAClDC,EAAeN,SAASO,cAAc,kBACtCC,EAAYR,SAASO,cAAc,eAEzC,SAASE,EAAQC,GACf,MAAMC,EAAWD,EAAUE,WAAU,GAErC,OADAD,EAASE,UAAY,cACdF,CACT,CAEA,SAASG,IACP,OAAOf,EAAWQ,cAAc,eAClC,CAmBA,SAASQ,EAAKC,GACZ,OAAQC,IACNA,EAAMC,kBACN,MAAMC,EAAUL,IACZK,GAVR,SAAqBC,GACnB,MAAMC,GAAWD,EAAQlB,EAAWoB,QAAUpB,EAAWoB,OACnDH,EAAUL,IACZK,GAASA,EAAQI,YAAYd,EAAQP,EAAWmB,IACtD,CAMiBG,CAAYC,OAAON,EAAQO,QAAQN,OAASJ,EAAM,CAEnE,CAEIjB,IACFG,EAAWyB,SAASjB,IAClBA,EAAUkB,iBAAiB,SAAS,IA3BxC,SAAsBlB,GACpBX,EAAW8B,YAAYpB,EAAQC,IAC/BX,EAAW+B,MAAMC,QAAU,MAC7B,CAwB8CC,CAAatB,IAAW,IAEpEX,EAAW6B,iBAAiB,SAxB9B,WACE,MAAMT,EAAUL,IACZK,GAASA,EAAQc,SACrBlC,EAAW+B,MAAMC,QAAU,MAC7B,IAqBMzB,GAAcA,EAAasB,iBAAiB,QAASb,EAAK,IAC1DP,GAAWA,EAAUoB,iBAAiB,QAASb,GAAM,I","sources":["webpack://trace_taiwan/./app/javascript/packs/post_show_slide_show.js"],"sourcesContent":["// Photo lightbox on the trace show page: click a thumbnail to enlarge it, page\n// through photos with the arrows (wrapping at the ends), click the backdrop to close.\nconst modalLayer = document.getElementById(\"modal-layer\");\nconst thumbnails = Array.from(document.querySelectorAll(\".trace-photo\"));\nconst forwardArrow = document.querySelector(\".forward-arrow\");\nconst backArrow = document.querySelector(\".back-arrow\");\n\nfunction enlarge(thumbnail) {\n const enlarged = thumbnail.cloneNode(true);\n enlarged.className = \"current-img\";\n return enlarged;\n}\n\nfunction currentImage() {\n return modalLayer.querySelector(\".current-img\");\n}\n\nfunction openLightbox(thumbnail) {\n modalLayer.appendChild(enlarge(thumbnail));\n modalLayer.style.display = \"flex\";\n}\n\nfunction closeLightbox() {\n const current = currentImage();\n if (current) current.remove();\n modalLayer.style.display = \"none\";\n}\n\nfunction showPhotoAt(index) {\n const wrapped = (index + thumbnails.length) % thumbnails.length;\n const current = currentImage();\n if (current) current.replaceWith(enlarge(thumbnails[wrapped]));\n}\n\nfunction step(delta) {\n return (event) => {\n event.stopPropagation();\n const current = currentImage();\n if (current) showPhotoAt(Number(current.dataset.index) + delta);\n };\n}\n\nif (modalLayer) {\n thumbnails.forEach((thumbnail) => {\n thumbnail.addEventListener(\"click\", () => openLightbox(thumbnail));\n });\n modalLayer.addEventListener(\"click\", closeLightbox);\n if (forwardArrow) forwardArrow.addEventListener(\"click\", step(1));\n if (backArrow) backArrow.addEventListener(\"click\", step(-1));\n}\n"],"names":["modalLayer","document","getElementById","thumbnails","Array","from","querySelectorAll","forwardArrow","querySelector","backArrow","enlarge","thumbnail","enlarged","cloneNode","className","currentImage","step","delta","event","stopPropagation","current","index","wrapped","length","replaceWith","showPhotoAt","Number","dataset","forEach","addEventListener","appendChild","style","display","openLightbox","remove"],"ignoreList":[],"sourceRoot":""}