import{b as s}from"./chunk-72ZP56JR.js";import"./chunk-FEIY7W7S.js";function n(o,e,t){let i=document.querySelector("#say-content"),c=document.querySelector("#say-author"),a=document.querySelector("#say-from");i.innerText=o,e&&(c.innerText=e),t&&(a.innerText=`\u300C${t}\u300D`)}function r(){window.CONFIG.say.api&&fetch(window.CONFIG.say.api).then(o=>{if(o.ok)o.json().then(e=>{if(window.CONFIG.say.hitokoto)n(e.hitokoto,e.from_who,e.from);else{let t=e[Math.floor(Math.random()*e.length)];t.content?n(t.content,t.author,t.from):n(t)}});else throw new Error(`${window.CONFIG.say.api}, HTTP error, status = ${o.status}`)}).catch(o=>{console.error(o.message)})}document.addEventListener("DOMContentLoaded",r);document.addEventListener("pjax:success",()=>{s()&&r()});export{r as fetchApiToSay,n as say};