import{r as t,a as i,b as e,B as o,f as n}from"./util-2b4068db.js";var s=[function(t,i,e){return[".container",i," {box-sizing: border-box;width: 100%;display: flex;}\n.hit-counter",i,' {box-sizing: border-box;display: flex;background-image: linear-gradient(45deg, #79589f, #009edb);border: 2px solid;line-height: 1;font-size: 112.5%;font-family: "Courier New", Courier, serif;font-weight: bold;color: #f6f0e2;}\n.hit-counter.light-mode',i," {box-shadow: 0.2em 0.2em 0 #1e1e60;}\n.hit-counter.dark-mode",i," {box-shadow: 0.2em 0.2em 0 #f6f0e2;}\n.hit-counter",i," span",i," {padding: 0.3em 0.4em 0.2em;text-align: center;display: block;flex: 1;}\n.hit-counter",i," span:not(:first-child)",i," {border-left: 2px solid;}\n.hit-counter.light-mode",i,",.hit-counter.light-mode",i," span",i," {border-color: #1e1e60;}\n.hit-counter.dark-mode",i,",.hit-counter.dark-mode",i," span",i," {border-color: #f6f0e2;}\n"].join("")}];function r(t,i,e,o){const{d:n,h:s}=t;return[s("div",{classMap:{container:!0},key:9},[s("div",{classMap:{"hit-counter":!0,"light-mode":!0},key:8},[s("span",{key:0},[n(i.digit8)]),s("span",{key:1},[n(i.digit7)]),s("span",{key:2},[n(i.digit6)]),s("span",{key:3},[n(i.digit5)]),s("span",{key:4},[n(i.digit4)]),s("span",{key:5},[n(i.digit3)]),s("span",{key:6},[n(i.digit2)]),s("span",{key:7},[n(i.digit1)])])])]}var d=t(r);r.stylesheets=[],s&&r.stylesheets.push.apply(r.stylesheets,s),r.stylesheetTokens={hostAttribute:"wck-hitCounter_hitCounter-host",shadowAttribute:"wck-hitCounter_hitCounter"};class h extends o{constructor(...t){super(...t),this.digit1="?",this.digit2="?",this.digit3="?",this.digit4="?",this.digit5="?",this.digit6="?",this.digit7="?",this.digit8="?",this.host=null}connectedCallback(){this.postCount()}async postCount(){const[t,i]=await n(this,`/hitCounter?site=${window.location.host}`,{method:"POST"});i?this.renderCount("ERROR".padEnd(8,"!")):this.renderCount(t.count)}renderCount(t){const i=t.toString().split("").reverse();[...Array(8)].forEach(((t,e)=>{this[`digit${e+1}`]=i[e]||"0"}))}}i(h,{publicProps:{host:{config:0}},fields:["digit1","digit2","digit3","digit4","digit5","digit6","digit7","digit8"]});var a=e(h,{tmpl:d});customElements.define("wck-hit-counter",a.CustomElementConstructor);
