import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{er as t}from"./control-ui-foundation-CeFMP1Ly.js";import{fl as n,lr as r,ml as i}from"./control-ui-core-pH6nakZ-.js";import{G as a,J as o,W as s,Z as c,rt as l}from"./lit-runtime-BEtFSUCp.js";import{Cn as u,ln as d}from"./control-ui-core-DGVkFhVB.js";import{Gt as f,Ht as p,Lt as m,Rt as h,qt as g}from"./control-ui-core-Br5DB0Zj.js";import{Br as _,Fr as v,Ir as y,Lr as b,Nr as x,Pr as S,Rr as C,Ur as w,Wr as T,jr as E,zr as D}from"./control-ui-boot-Cdpgu1Gm.js";import{n as O,t as k}from"./settings-workspace-Bo4nqRhI.js";function A(e){return new Date(e).toLocaleDateString(f.getLocale())}function j(e,t={}){let n=y.filter(t=>e.has(t.id)).length,r=n===y.length,i=g(`quickSettings.appearance.lobsterdexSeen`,{seen:String(n),total:String(y.length)});return o`
    <section class="lobsterdex-page">
      <header
        class="lobsterdex-page__header ${r?`lobsterdex-page__header--complete`:``}"
      >
        <div>
          <h2>${g(`tabs.lobsterdex`)}</h2>
          <p>${g(`subtitles.lobsterdex`)}</p>
        </div>
        <span class="lobsterdex-page__count">${i}</span>
      </header>
      ${t.copyFeedback?.status===`error`?o`<div class="callout danger" role="alert">${g(`common.copyFailed`)}</div>`:a}
      <div class="lobsterdex-page__grid" aria-label=${i}>
        ${y.map(n=>{let r=E(n),i=e.get(n.id),s=i!==void 0,c=s?i.name??_(n.id):`?`,l=C[n.id],u=s&&i.firstSeenAt!==null?g(`quickSettings.appearance.lobsterdexCardFirstVisited`,{date:A(i.firstSeenAt)}):null,d=i?.shinySeenAt==null?null:g(`quickSettings.appearance.lobsterdexCardShinySeen`,{date:A(i.shinySeenAt)});return o`
            <article
              id="lobsterdex-${n.id}"
              class="lobsterdex-page__card ${s?``:`lobsterdex-page__card--unseen`}"
            >
              <button
                type="button"
                class="lobsterdex-page__copy-link"
                aria-label=${g(`quickSettings.appearance.lobsterdexCardCopyLink`)}
                @click=${()=>t.onCopyLink?.(n.id)}
              >
                <span aria-hidden="true"
                  >${t.copyFeedback?.status===`copied`&&t.copyFeedback.paletteId===n.id?m.check:m.link}</span
                >
              </button>
              <div
                class="lobsterdex-page__sprite lobster-pet lobster-pet--palette-${n.id} ${s?``:`lobsterdex__mini--unseen`}"
                style=${S(r)}
              >
                ${v(r,{standalone:!0})}
                ${i?.shinySeenAt==null?a:o`<span
                      class="lobsterdex__mini-star lobsterdex-page__star"
                      aria-hidden="true"
                      >✦</span
                    >`}
              </div>
              <h3>${c}</h3>
              <p class="lobsterdex-page__lore">${s?l.flavor:l.hint}</p>
              <div class="lobsterdex-page__dates">
                ${u?o`<p class="lobsterdex-page__date"><time>${u}</time></p>`:a}
                ${d?o`<p class="lobsterdex-page__date"><time>${d}</time></p>`:a}
              </div>
            </article>
          `})}
      </div>
    </section>
  `}function M(){return(M=e((()=>{s(),h(),x(),D(),b(),p()})))()}var N;function P(){return(P=e((()=>{s(),c(),d(),T(),b(),k(),i(),M(),N=class extends n{constructor(...e){super(...e),this.copyFeedback=null,this.copyAttempt=0,this.copyResetTimer=null,this.copyLink=async e=>{let t=++this.copyAttempt;this.copyFeedback=null,this.copyResetTimer!==null&&(window.clearTimeout(this.copyResetTimer),this.copyResetTimer=null);let n=`${location.origin}${location.pathname}#lobsterdex-${e}`,i=await r(n,()=>this.isConnected&&t===this.copyAttempt);!this.isConnected||t!==this.copyAttempt||(this.copyFeedback={paletteId:e,status:i?`copied`:`error`},this.copyResetTimer=window.setTimeout(()=>{this.copyFeedback=null,this.copyResetTimer=null},1500))}}disconnectedCallback(){this.copyAttempt+=1,this.copyFeedback=null,this.copyResetTimer!==null&&(window.clearTimeout(this.copyResetTimer),this.copyResetTimer=null),super.disconnectedCallback()}firstUpdated(){if(!location.hash.startsWith(`#lobsterdex-`))return;let e=y.find(e=>e.id===location.hash.slice(12));if(!e)return;let t=this.querySelector(`#lobsterdex-${e.id}`);if(!t)return;let n=e=>{e.target===t&&e.animationName===`lobsterdex-card-highlight`&&(t.classList.remove(`lobsterdex-page__card--highlight`),t.removeEventListener(`animationend`,n))};t.addEventListener(`animationend`,n),t.classList.add(`lobsterdex-page__card--highlight`),requestAnimationFrame(()=>{requestAnimationFrame(()=>t.scrollIntoView({block:`center`}))})}render(){return o`
      <section class="content-header">
        <div class="page-title">${u(`lobsterdex`)}</div>
      </section>
      ${O(j(w(),{copyFeedback:this.copyFeedback,onCopyLink:e=>void this.copyLink(e)}))}
    `}},t([l()],N.prototype,`copyFeedback`,void 0),customElements.get(`openclaw-lobsterdex-page`)||customElements.define(`openclaw-lobsterdex-page`,N)})))()}P();
//# sourceMappingURL=lobsterdex-page-bHiZugyT.js.map