live2dapi-noa 2.4.7 → 2.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ const live2d_path = (() => {
8
8
  return new URL("../../", url).href;
9
9
  }
10
10
  }
11
- return "https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.7/";
11
+ return "https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.8/";
12
12
  })();
13
13
  function loadExternalResource(url, type) {
14
14
  let tag;
@@ -1,7 +1,7 @@
1
1
  /*! Live2D API | Generated from src/ | https://github.com/nova1751/live2d-api */
2
- "use strict";(()=>{var Y="zh-CN";function _(o){Y=o??"zh-CN"}function g(o,e){return Y==="en"?e:o}var G={hitokoto:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4l0 0 0 0 0 0 0 0 .3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',asteroids:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L284 427.7l-68.5 74.1c-8.9 9.7-22.9 12.9-35.2 8.1S160 493.2 160 480V396.4c0-4 1.5-7.8 4.2-10.7L331.8 202.8c5.8-6.3 5.6-16-.4-22s-15.7-6.4-22-.7L106 360.8 17.7 316.6C7.1 311.3 .3 300.7 0 288.9s5.9-22.8 16.1-28.7l448-256c10.7-6.1 23.9-5.5 34 1.4z"/></svg>',"switch-model":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M399 384.2C376.9 345.8 335.4 320 288 320H224c-47.4 0-88.9 25.8-111 64.2c35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm256 16a72 72 0 1 0 0-144 72 72 0 1 0 0 144z"/></svg>',"switch-texture":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M320 64A64 64 0 1 0 192 64a64 64 0 1 0 128 0zm-96 96c-35.3 0-64 28.7-64 64v48c0 17.7 14.3 32 32 32h1.8l11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5h38.7c16.3 0 30-12.3 31.8-28.5L318.2 304H320c17.7 0 32-14.3 32-32V224c0-35.3-28.7-64-64-64H224zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"/></svg>',photo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M220.6 121.2L271.1 96 448 96v96H333.2c-21.9-15.1-48.5-24-77.2-24s-55.2 8.9-77.2 24H64V128H192c9.9 0 19.7-2.3 28.6-6.8zM0 128V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H271.1c-9.9 0-19.7 2.3-28.6 6.8L192 64H160V48c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16l0 16C28.7 64 0 92.7 0 128zM168 304a88 88 0 1 1 176 0 88 88 0 1 1 -176 0z"/></svg>',info:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>',quit:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>'};function E(o){return Array.isArray(o)?o[Math.floor(Math.random()*o.length)]:o}function L(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var P,H,U;function z(){clearTimeout(H),sessionStorage.removeItem("waifu-text"),document.getElementById("waifu-tips")?.classList.remove("waifu-tips-active")}function q(o,e){clearTimeout(H),sessionStorage.setItem("waifu-text",String(e));let t=document.getElementById("waifu-tips");t.innerHTML=o,t.classList.add("waifu-tips-active")}function w(o,e,t){!o||U||Number(sessionStorage.getItem("waifu-text"))>t||(q(E(o),t),H=setTimeout(z,e))}function J(o,e){if(!e){w(L(o),5e3,11);return}U=e,q(L(o),11)}function X(o){let e=document.getElementById("live2d");if(!e)return;let t=P?.find(({selector:n})=>e.closest(n)),i=t?E(t.text):P?void 0:g("指挥官,我在。","Right here, Commander.");i&&(U=o,q(i.replace("{text}",()=>L(e.textContent??"")),11))}function K(o,e){U===o&&(U=void 0,e?z():H=setTimeout(z,1200))}function ue(o){if(location.pathname==="/"){let s=new Date().getHours();for(let{hour:a,text:r}of o){let[c,d=c]=a.split("-").map(Number);if(c<=s&&s<=d)return r}}let e=L(document.title.split(" - ")[0]),t=g(`欢迎阅读<span>「${e}」</span>`,`Welcome to <span>${e}</span>!`);if(!document.referrer)return t;let{hostname:i}=new URL(document.referrer);return i===location.hostname?t:g(`Hello!来自 <span>${L({baidu:"百度",so:"360搜索",google:"谷歌搜索"}[i.split(".")[1]]??i)}</span> 的朋友<br>${t}`,`Hello, visitor from <span>${L(i)}</span>!<br>${t}`)}function me(o){let[e,t]=o.split("/").map(Number);return e*100+t}function Q(o){P=o.click;let e=[...o.message.default],t=new Date,i=(t.getMonth()+1)*100+t.getDate();for(let{date:u,text:v}of o.seasons){let[l,m=l]=u.split("-").map(me);l<=i&&i<=m&&e.push(E(v).replace("{year}",String(t.getFullYear())))}let n=2e4,s=Date.now(),a;function r(){if(document.hidden)return;let u=n-(Date.now()-s);u<=0&&!localStorage.getItem("waifu-display")&&w(e,6e3,9),a=setTimeout(r,u>0?u:n)}let c=()=>{s=Date.now()};window.addEventListener("pointermove",c,{passive:!0}),window.addEventListener("pointerdown",c,{passive:!0}),window.addEventListener("keydown",c),document.hidden||(a=setTimeout(r,n)),w(ue(o.time),7e3,11);let d;for(let u of["mouseover","click"])window.addEventListener(u,v=>{let l=v.target;if(!(l instanceof Element)||v.live2dHandlesCaption)return;let m=u==="click"&&l.closest("#waifu .waifu-model-stage"),p=m?document.getElementById("live2d"):l.closest("#live2d"),y=o[u].find(({selector:C})=>l.closest(C)||m&&p?.closest(C));!y||u==="mouseover"&&y.selector===d||(u==="mouseover"&&(d=y.selector),w(E(y.text).replace("{text}",()=>L(l.textContent??"")),4e3,u==="click"&&p?11:8))});let h=()=>{};h.toString=()=>(w(o.message.console,6e3,9),""),console.log("%c",h),window.addEventListener("copy",()=>w(o.message.copy,6e3,9)),document.addEventListener("visibilitychange",()=>{clearTimeout(a),document.hidden||(c(),a=setTimeout(r,n),localStorage.getItem("waifu-display")||w(o.message.visibilitychange,6e3,9))})}async function T(o){let e=await fetch(o);if(!e.ok)throw new Error(`Failed to load ${o} (HTTP ${e.status})`);return e.json()}var Z="/gh/nova1751/live2d-api@cdn-b3ac5ae545e2/",ee="https://cdn.jsdelivr.net",j=ee+Z,fe=/\/gh\/nova1751\/live2d-api@widget-[^/]+\/?$/,ge=/\/live2dapi-noa(?:@[^/]+)?\/?$/;function te(o){let e=new URL(o,document.baseURI);return!ge.test(e.pathname)&&!fe.test(e.pathname)||/@1\.[^/]+\/?$/.test(e.pathname)?o:(e.hostname==="cdn.jsdmirror.com"?e.origin:ee)+Z}var W=()=>g("我的新衣服好看嘛?","How do you like my new outfit?"),k=o=>Number(localStorage.getItem(o))||0,D=class{constructor(e){this.options=e;this.revision=0;this.loaded=!1;this.useCDN=typeof e.cdnPath=="string";let t=e.modelBaseUrl??(e.cdnPath&&te(e.cdnPath))??e.apiPath;if(typeof t!="string")throw new TypeError("Invalid initWidget argument");this.base=t.endsWith("/")?t:t+"/"}reopen(e){if(this.loaded)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}cancel(){this.revision++}async fetchCatalog(){let e=this.base+"model_list.json",t=await fetch(e);if(t.status===404&&!this.options.modelBaseUrl&&this.base!==j){let i=await T(j+"model_list.json");return this.base=j,i}if(!t.ok)throw new Error(`Failed to load ${e} (HTTP ${t.status})`);return t.json()}list(){return this.catalog??(this.catalog=this.fetchCatalog().catch(e=>{throw this.catalog=void 0,e}))}async load(e=k("modelId"),t=k("modelTexturesId"),i,n=!1,s=++this.revision,a=!1){let r;if(this.options.modelUrl)r=this.options.modelUrl;else if(this.useCDN){let{models:d}=await this.list();d[e]||(e=0);let h=d[e],u=Array.isArray(h)?h:[h];u[t]||(t=0);let v=a?u[t]:E(u);t=u.indexOf(v),r=this.base+"model/"+v+"/index.json"}else r=this.base+"get/?id="+e+"-"+t;if(s!==this.revision)return;let c=window.loadlive2d("live2d",r,{start:n,locale:this.options.locale,coreUrl:this.options.coreUrl});c&&await c,s===this.revision&&(this.options.modelUrl||(localStorage.setItem("modelId",String(e)),localStorage.setItem("modelTexturesId",String(t))),w(i,4e3,10),this.loaded=!0)}async costume(e){if(this.options.modelUrl||!this.useCDN)return;let t=++this.revision,i=k("modelId"),n=(await this.list()).models[i],a=(Array.isArray(n)?n:[n]).findIndex(r=>new URL(this.base+"model/"+r+"/index.json",document.baseURI).href===e);a>=0&&await this.load(i,a,W(),!1,t,!0)}async nextModel(e=!1){let t=++this.revision,i=k("modelId");if(this.useCDN){let{models:s,messages:a}=await this.list(),r=(i+1)%s.length;return this.load(r,0,g(a[r],"Ready for duty!"),e,t)}let{model:n}=await T(this.base+"switch/?id="+i);return this.load(n.id,0,n.message,e,t)}async nextTexture(e=!1){let t=++this.revision,i=k("modelId"),n=k("modelTexturesId");if(this.useCDN){let a=(await this.list()).models[i],r=Array.isArray(a)?a.length:1;return this.load(i,n,W(),e,t)}let{textures:s}=await T(this.base+"rand_textures/?id="+i+"-"+n);s.id===1&&n===1?w(g("我还没有其他衣服呢!","This is my only outfit so far!"),4e3,10):await this.load(i,s.id,W(),e,t)}};var $=class{constructor(){this.revision=0}begin(e){let t=document.getElementById("waifu"),i=t?.querySelector(".waifu-surface"),n=++this.revision;return t&&(this.still&&!this.still.isConnected&&(i??t).prepend(this.still),t.setAttribute("data-model-loading","")),s=>{if(this.revision!==n||!t)return;let a=document.createElement("canvas");a.className="waifu-model-still",a.setAttribute("aria-hidden","true"),a.width=s.width,a.height=s.height;try{let r=a.getContext("2d");r&&r.drawImage(s,0,0),this.still?.remove(),this.still=r?a:void 0}finally{if(i){let r=e();t.style.setProperty("--waifu-aspect",String(r)),t.toggleAttribute("data-wide-model",r>=1.35)}t.removeAttribute("data-model-loading"),t.hasAttribute("data-initial-framing")&&(t.removeAttribute("data-initial-framing"),document.activeElement?.matches("#waifu-toggle:focus-visible")&&t.querySelector("#waifu-tool button")?.focus({preventScroll:!0}))}}}};var B={scale:1,x:0,y:0},f=128;function O(o,e,t){let i=0;for(let n=0;n<o.length;n++)if(i+=o[n],i>e*t)return n;return o.length-1}function he(o,e,t,i){let n=new Float64Array(f),s=new Float64Array(f),a=f,r=0,c=0;for(let b=0;b<o.length;b++){if(!o[b])continue;let M=Math.floor(b/f);n[b%f]+=o[b],s[M]+=o[b],c+=o[b],a=Math.min(a,M),r=Math.max(r,M+1)}if(!c)return B;a=Math.max(a,O(s,c,.001)-2);let d=O(n,c,.001),h=O(n,c,.999)+1,u=h-d,v=r-a,l=i?Math.max(.7,Math.min(1.9,u/v*.93/.94)):1;i?.(l);let m=Math.min(1,l),p=Math.min(1,1/l),y=Math.min(.93*f*p/v,.94*f*m/u,5/e.scale),C=0,A=0;if(t)for(let b=a+2;b<r;b+=4)for(let M=d+2;M<h;M+=4){if(o[b*f+M]<96)continue;t((M+.5)/f,(b+.5)/f).some(de=>/^(head|face|body|bust|torso)\d*$/i.test(de))&&(C+=M+.5,A++)}let x=A>=3?C/A:O(n,c,.5)+.5,R=.475*f*m/y,le=Math.max(h-R,Math.min(d+R,x));return{scale:e.scale*y,x:(.5-le/f)*y,y:.5-.03*p+(.5-r/f)*y}}function oe(o){let e={scale:.65,x:0,y:0},t=document.createElement("canvas");t.width=t.height=f;let i=t.getContext("2d",{willReadFrequently:!0}),n=new Uint8Array(f*f),s=new Uint8Array(n.length),a=0,r=0,c=0;return{initial:e,measure(d,h){if(!i)return B;let u=performance.now();if(!(u<c)){a++;try{i.clearRect(0,0,f,f),i.drawImage(d,0,0,f,f);let{data:v}=i.getImageData(0,0,f,f),l=0;for(let m=0;m<n.length;m++){let p=v[4*m+3];s[m]=p>=24?p:0,s[m]&&l++}l>=16&&(n.set(s),r++,c=u+80)}catch{return B}if(!(r<3&&a<10))return r?he(n,e,h,o):B}}}}var ne=["fairy","doll","adjutant","npc","squad","background"],ie=["default","normal","destroy"];function N(o,e){let t=o.indexOf(e);return t<0?o.length:t}function pe(o,e){let t=new Intl.Collator("en",{numeric:!0}),i=o.map(n=>{let[s,a,r,c]=n.split("/"),d=e[[s,a,r].join("/")],h=r==="base"?-1:d??(s==="fairy"&&/^\d+$/.test(r)?Number(r):Number.MAX_SAFE_INTEGER);return{id:n,category:s,character:a,version:r,form:c,order:h}});return i.sort((n,s)=>N(ne,n.category)-N(ne,s.category)||t.compare(n.category,s.category)||t.compare(n.character,s.character)||n.order-s.order||t.compare(n.version,s.version)||N(ie,n.form)-N(ie,s.form)||t.compare(n.form,s.form)),i.map(n=>n.id)}async function se(o,e,t="zh-CN"){let i=new URL(o,document.baseURI),n=await fetch(i);if(!n.ok)throw new Error("Cannot load catalog: HTTP "+n.status);let s=await n.json();if(s.schemaVersion!==1||!s.models||!s.sources)throw new Error("Unsupported model catalog");let a=new Map,r=Object.keys(s.models).filter(l=>(!e||!l.startsWith("other/"))&&s.models[l].some(m=>m.manifest)),c=e?s.presentation:void 0,d=t==="en"?c?.en:c,h=l=>{let m=c?.aliases[l];return m&&r.includes(m)?m:l},u=e?pe(r.filter(l=>h(l)===l),c?.outfitOrder??{}):r;function v(l,m){if(e&&!r.includes(l))throw new Error("Model outside the selected collection: "+l);let p=s.models[l]?.find(x=>x.manifest&&(!m||x.source===m));if(!p?.manifest)throw new Error("No model manifest for "+l);let y=new URL(s.sources[p.source].baseUrl,n.url||i);i.hostname==="cdn.jsdmirror.com"&&y.hostname==="cdn.jsdelivr.net"&&y.pathname.startsWith("/gh/nova1751/live2d-api@cdn-")&&(y.hostname=i.hostname);let C=x=>new URL(x.split("/").map(encodeURIComponent).join("/"),y).href,A;if(p.dialogue){let x=a.get(p.source);x||(x=new Map((s.audio?.[p.source]??[]).map(R=>[R.toUpperCase(),C(R)])),a.set(p.source,x)),A={captions:t==="en"?void 0:d?.captions,url:C(p.dialogue),audio:x}}return{captions:d?.captions,modelUrl:C(p.manifest),dialogue:A,soundAliases:p.soundAliases}}return{ids:u,visibleId:h,labels:d?.labels??{},resolve:v,legacyIds:s.legacyIds}}var F=class{constructor(e,t){this.url=e;this.options=t;this.sequence=0;this.transition=new $;let i=t.collection?":"+t.collection:"",n="live2d:model:"+e+i,s=a=>a.replace(/(\/gh\/nova1751\/live2d-api)@catalog-[a-f0-9]{16}(\/catalog\/library\.json:girls-frontline)$/,"$1$2");if(this.key=s(n),this.key!==n&&!localStorage.getItem(this.key)){let a=[n,...Object.keys(localStorage)].find(r=>s(r)===this.key&&localStorage.getItem(r));a&&localStorage.setItem(this.key,localStorage.getItem(a))}}open(){return this.library??(this.library=se(this.url,this.options.collection,this.options.locale).catch(e=>{throw this.library=void 0,e}))}async select(e,t){let i=++this.sequence;try{let n=await this.open();if(i!==this.sequence)return;let s=e(n.ids,n.legacyIds,n.visibleId),{modelUrl:a,dialogue:r,soundAliases:c,captions:d}=n.resolve(s),h=1,u=this.options.collection==="girls-frontline"&&!s.startsWith("background/")?oe(l=>{h=l}):void 0,v=this.options.collection?this.transition.begin(()=>h):void 0;await window.loadlive2d("live2d",a,{start:t,locale:this.options.locale,captions:d,framing:u,onPaint:v,coreUrl:this.options.coreUrl,dialogue:r,soundAliases:c}),i===this.sequence&&(this.active=n.visibleId(s),localStorage.setItem(this.key,s),window.dispatchEvent(new CustomEvent("live2d:model",{detail:s})))}catch(n){throw i===this.sequence&&document.getElementById("waifu")?.removeAttribute("data-initial-framing"),n}}load(e,t,i,n=!1){return this.select((s,a,r)=>{let c=localStorage.getItem(this.key);if(this.options.collection)return this.options.modelId??(c&&s.includes(r(c))?c:s[0]);let d=a?.[Number(localStorage.getItem("modelId"))]?.[Number(localStorage.getItem("modelTexturesId"))];return this.options.modelId??(c&&s.includes(r(c))?c:d&&s.includes(d)?d:s[0])},n)}choose(e){return this.select(()=>e,!1)}cancel(){this.sequence++}reopen(e){if(this.active)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}character(e){return e.split("/").slice(0,2).join("/")}nextModel(e=!1){return this.select(t=>{let i=[...new Set(t.map(s=>this.character(s)))],n=i[(i.indexOf(this.character(this.active??""))+1)%i.length];return t.find(s=>this.character(s)===n)},e)}nextTexture(e=!1){return this.select(t=>{let i=t.filter(n=>this.character(n)===this.character(this.active??t[0]));{let n=i.filter(s=>s!==this.active);return n.length?n[Math.floor(Math.random()*n.length)]:i[0]}return i[(i.indexOf(this.active??"")+1)%i.length]},e)}async costume(e){let t=await this.open(),i=t.ids.find(n=>t.resolve(n).modelUrl===e);i&&await this.select(()=>i,!1)}};var we=document.currentScript,ve=we?.dataset.asteroidsUrl??"https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.7/asteroids.js",I=o=>document.getElementById(o);function S(o){console.error("[Live2D]",o);let e=document.getElementById("waifu-status");e&&(e.textContent=g("加载失败,请检查网络或切换模型后重试。","Could not load the model. Check your connection or try another character."),w(e.textContent,5e3,10))}async function ye(o){if(o==="en"){w(["One step at a time, Commander.","Even on a quiet day, there is something worth noticing."],6e3,9);return}let e=await T("https://v1.hitokoto.cn");w(L(e.hitokoto),6e3,9),setTimeout(()=>{w(`这句一言来自 <span>「${L(String(e.from))}」</span>,是 <span>${L(String(e.creator))}</span> 在 hitokoto.cn 投稿的。`,4e3,9)},6e3)}function be(){if(window.Asteroids)(window.ASTEROIDSPLAYERS??(window.ASTEROIDSPLAYERS=[])).push(new window.Asteroids);else{let o=document.createElement("script");o.src=ve,document.head.appendChild(o)}}var ae;function ce(){clearTimeout(ae),localStorage.removeItem("waifu-display"),I("waifu-toggle").setAttribute("tabindex","-1"),I("waifu-toggle").setAttribute("aria-expanded","true"),I("waifu").style.display="";let o=I("waifu");o.hasAttribute("data-initial-framing")?o.style.bottom="0":setTimeout(()=>{o.style.bottom="0"},0)}function V(o){return o.isTrusted&&!!window.loadlive2d.prepareInteraction?.()}function xe(){let o=I("waifu").contains(document.activeElement);window.loadlive2d.hide?.(),localStorage.setItem("waifu-display",String(Date.now())),w(g("愿你有一天能与重要的人重逢。","I hope you meet the people you miss again."),2e3,11),I("waifu").style.bottom="-500px",ae=setTimeout(()=>{I("waifu").style.display="none";let e=I("waifu-toggle");e.removeAttribute("tabindex"),e.setAttribute("aria-expanded","false"),e.classList.add("waifu-toggle-active"),o&&e.focus()},window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:3e3)}function re(o,e,t=!1){sessionStorage.removeItem("waifu-text");let i=o.collection==="girls-frontline",n='<canvas id="live2d" width="800" height="800"></canvas>';document.body.insertAdjacentHTML("beforeend",`<div id="waifu" lang="${o.locale==="en"?"en":"zh-CN"}"${i?' class="waifu-adaptive"':""}${i&&e instanceof F?" data-initial-framing":""}>
2
+ "use strict";(()=>{var Y="zh-CN";function _(o){Y=o??"zh-CN"}function p(o,e){return Y==="en"?e:o}var G={hitokoto:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4l0 0 0 0 0 0 0 0 .3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',asteroids:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L284 427.7l-68.5 74.1c-8.9 9.7-22.9 12.9-35.2 8.1S160 493.2 160 480V396.4c0-4 1.5-7.8 4.2-10.7L331.8 202.8c5.8-6.3 5.6-16-.4-22s-15.7-6.4-22-.7L106 360.8 17.7 316.6C7.1 311.3 .3 300.7 0 288.9s5.9-22.8 16.1-28.7l448-256c10.7-6.1 23.9-5.5 34 1.4z"/></svg>',"switch-model":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M399 384.2C376.9 345.8 335.4 320 288 320H224c-47.4 0-88.9 25.8-111 64.2c35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm256 16a72 72 0 1 0 0-144 72 72 0 1 0 0 144z"/></svg>',"switch-texture":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M320 64A64 64 0 1 0 192 64a64 64 0 1 0 128 0zm-96 96c-35.3 0-64 28.7-64 64v48c0 17.7 14.3 32 32 32h1.8l11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5h38.7c16.3 0 30-12.3 31.8-28.5L318.2 304H320c17.7 0 32-14.3 32-32V224c0-35.3-28.7-64-64-64H224zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"/></svg>',photo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M220.6 121.2L271.1 96 448 96v96H333.2c-21.9-15.1-48.5-24-77.2-24s-55.2 8.9-77.2 24H64V128H192c9.9 0 19.7-2.3 28.6-6.8zM0 128V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H271.1c-9.9 0-19.7 2.3-28.6 6.8L192 64H160V48c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16l0 16C28.7 64 0 92.7 0 128zM168 304a88 88 0 1 1 176 0 88 88 0 1 1 -176 0z"/></svg>',info:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>',quit:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>'};function E(o){return Array.isArray(o)?o[Math.floor(Math.random()*o.length)]:o}function I(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var P,H,U;function z(){clearTimeout(H),sessionStorage.removeItem("waifu-text"),document.getElementById("waifu-tips")?.classList.remove("waifu-tips-active")}function q(o,e){clearTimeout(H),sessionStorage.setItem("waifu-text",String(e));let t=document.getElementById("waifu-tips");t.innerHTML=o,t.classList.add("waifu-tips-active")}function v(o,e,t){!o||U||Number(sessionStorage.getItem("waifu-text"))>t||(q(E(o),t),H=setTimeout(z,e))}function J(o,e){if(!e){v(I(o),5e3,11);return}U=e,q(I(o),11)}function X(o){let e=document.getElementById("live2d");if(!e)return;let t=P?.find(({selector:n})=>e.closest(n)),i=t?E(t.text):P?void 0:p("指挥官,我在。","Right here, Commander.");i&&(U=o,q(i.replace("{text}",()=>I(e.textContent??"")),11))}function K(o,e){U===o&&(U=void 0,e?z():H=setTimeout(z,1200))}function ue(o){if(location.pathname==="/"){let s=new Date().getHours();for(let{hour:c,text:r}of o){let[a,u=a]=c.split("-").map(Number);if(a<=s&&s<=u)return r}}let e=I(document.title.split(" - ")[0]),t=p(`欢迎阅读<span>「${e}」</span>`,`Welcome to <span>${e}</span>!`);if(!document.referrer)return t;let{hostname:i}=new URL(document.referrer);return i===location.hostname?t:p(`Hello!来自 <span>${I({baidu:"百度",so:"360搜索",google:"谷歌搜索"}[i.split(".")[1]]??i)}</span> 的朋友<br>${t}`,`Hello, visitor from <span>${I(i)}</span>!<br>${t}`)}function me(o){let[e,t]=o.split("/").map(Number);return e*100+t}function Q(o){P=o.click;let e=[...o.message.default],t=new Date,i=(t.getMonth()+1)*100+t.getDate();for(let{date:f,text:y}of o.seasons){let[l,g=l]=f.split("-").map(me);l<=i&&i<=g&&e.push(E(y).replace("{year}",String(t.getFullYear())))}let n=2e4,s=Date.now(),c;function r(){if(document.hidden)return;let f=n-(Date.now()-s);f<=0&&!localStorage.getItem("waifu-display")&&v(e,6e3,9),c=setTimeout(r,f>0?f:n)}let a=()=>{s=Date.now()};window.addEventListener("pointermove",a,{passive:!0}),window.addEventListener("pointerdown",a,{passive:!0}),window.addEventListener("keydown",a),document.hidden||(c=setTimeout(r,n)),v(ue(o.time),7e3,11);let u;for(let f of["mouseover","click"])window.addEventListener(f,y=>{let l=y.target;if(!(l instanceof Element)||y.live2dHandlesCaption)return;let g=f==="click"&&l.closest("#waifu .waifu-model-stage"),m=g?document.getElementById("live2d"):l.closest("#live2d"),b=o[f].find(({selector:C})=>l.closest(C)||g&&m?.closest(C));!b||f==="mouseover"&&b.selector===u||(f==="mouseover"&&(u=b.selector),v(E(b.text).replace("{text}",()=>I(l.textContent??"")),4e3,f==="click"&&m?11:8))});let h=()=>{};h.toString=()=>(v(o.message.console,6e3,9),""),console.log("%c",h),window.addEventListener("copy",()=>v(o.message.copy,6e3,9)),document.addEventListener("visibilitychange",()=>{clearTimeout(c),document.hidden||(a(),c=setTimeout(r,n),localStorage.getItem("waifu-display")||v(o.message.visibilitychange,6e3,9))})}async function S(o){let e=await fetch(o);if(!e.ok)throw new Error(`Failed to load ${o} (HTTP ${e.status})`);return e.json()}var Z="/gh/nova1751/live2d-api@cdn-b3ac5ae545e2/",ee="https://cdn.jsdelivr.net",j=ee+Z,fe=/\/gh\/nova1751\/live2d-api@widget-[^/]+\/?$/,ge=/\/live2dapi-noa(?:@[^/]+)?\/?$/;function te(o){let e=new URL(o,document.baseURI);return!ge.test(e.pathname)&&!fe.test(e.pathname)||/@1\.[^/]+\/?$/.test(e.pathname)?o:(e.hostname==="cdn.jsdmirror.com"?e.origin:ee)+Z}var W=()=>p("我的新衣服好看嘛?","How do you like my new outfit?"),k=o=>Number(localStorage.getItem(o))||0,D=class{constructor(e){this.options=e;this.revision=0;this.loaded=!1;this.useCDN=typeof e.cdnPath=="string";let t=e.modelBaseUrl??(e.cdnPath&&te(e.cdnPath))??e.apiPath;if(typeof t!="string")throw new TypeError("Invalid initWidget argument");this.base=t.endsWith("/")?t:t+"/"}reopen(e){if(this.loaded)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}cancel(){this.revision++}async fetchCatalog(){let e=this.base+"model_list.json",t=await fetch(e);if(t.status===404&&!this.options.modelBaseUrl&&this.base!==j){let i=await S(j+"model_list.json");return this.base=j,i}if(!t.ok)throw new Error(`Failed to load ${e} (HTTP ${t.status})`);return t.json()}list(){return this.catalog??(this.catalog=this.fetchCatalog().catch(e=>{throw this.catalog=void 0,e}))}async load(e=k("modelId"),t=k("modelTexturesId"),i,n=!1,s=++this.revision,c=!1){let r;if(this.options.modelUrl)r=this.options.modelUrl;else if(this.useCDN){let{models:u}=await this.list();u[e]||(e=0);let h=u[e],f=Array.isArray(h)?h:[h];f[t]||(t=0);let y=c?f[t]:E(f);t=f.indexOf(y),r=this.base+"model/"+y+"/index.json"}else r=this.base+"get/?id="+e+"-"+t;if(s!==this.revision)return;let a=window.loadlive2d("live2d",r,{start:n,locale:this.options.locale,coreUrl:this.options.coreUrl});a&&await a,s===this.revision&&(this.options.modelUrl||(localStorage.setItem("modelId",String(e)),localStorage.setItem("modelTexturesId",String(t))),v(i,4e3,10),this.loaded=!0)}async costume(e){if(this.options.modelUrl||!this.useCDN)return;let t=++this.revision,i=k("modelId"),n=(await this.list()).models[i],c=(Array.isArray(n)?n:[n]).findIndex(r=>new URL(this.base+"model/"+r+"/index.json",document.baseURI).href===e);c>=0&&await this.load(i,c,W(),!1,t,!0)}async nextModel(e=!1){let t=++this.revision,i=k("modelId");if(this.useCDN){let{models:s,messages:c}=await this.list(),r=(i+1)%s.length;return this.load(r,0,p(c[r],"Ready for duty!"),e,t)}let{model:n}=await S(this.base+"switch/?id="+i);return this.load(n.id,0,n.message,e,t)}async nextTexture(e=!1){let t=++this.revision,i=k("modelId"),n=k("modelTexturesId");if(this.useCDN){let c=(await this.list()).models[i],r=Array.isArray(c)?c.length:1;return this.load(i,n,W(),e,t)}let{textures:s}=await S(this.base+"rand_textures/?id="+i+"-"+n);s.id===1&&n===1?v(p("我还没有其他衣服呢!","This is my only outfit so far!"),4e3,10):await this.load(i,s.id,W(),e,t)}};var $=class{constructor(){this.revision=0}begin(e){let t=document.getElementById("waifu"),i=t?.querySelector(".waifu-surface"),n=++this.revision;return t&&(this.still&&!this.still.isConnected&&(i??t).prepend(this.still),t.setAttribute("data-model-loading","")),s=>{if(this.revision!==n||!t)return;let c=document.createElement("canvas");c.className="waifu-model-still",c.setAttribute("aria-hidden","true"),c.width=s.width,c.height=s.height;try{let r=c.getContext("2d");r&&r.drawImage(s,0,0),this.still?.remove(),this.still=r?c:void 0}finally{if(i){let r=e();t.style.setProperty("--waifu-aspect",String(r)),t.toggleAttribute("data-wide-model",r>=1.35)}t.removeAttribute("data-model-loading"),t.hasAttribute("data-initial-framing")&&(t.removeAttribute("data-initial-framing"),document.activeElement?.matches("#waifu-toggle:focus-visible")&&t.querySelector("#waifu-tool button")?.focus({preventScroll:!0}))}}}};var B={scale:1,x:0,y:0},d=128;function O(o,e,t){let i=0;for(let n=0;n<o.length;n++)if(i+=o[n],i>e*t)return n;return o.length-1}function he(o,e,t,i){let n=new Float64Array(d),s=new Float64Array(d),c=d,r=0,a=0;for(let L=0;L<o.length;L++){if(!o[L])continue;let T=Math.floor(L/d);n[L%d]+=o[L],s[T]+=o[L],a+=o[L],c=Math.min(c,T),r=Math.max(r,T+1)}if(!a)return B;c=Math.max(c,O(s,a,.001)-2);let u=O(n,a,.001),h=O(n,a,.999)+1,f=h-u,y=r-c,l=i?Math.max(.7,Math.min(1.9,f/y*.93/.94)):1;i?.(l);let g=Math.min(1,l),m=Math.min(1,1/l),b=Math.min(.93*d*m/y,.94*d*g/f,5/e.scale),C=0,w=0;if(t)for(let L=c+2;L<r;L+=4)for(let T=u+2;T<h;T+=4){if(o[L*d+T]<96)continue;t((T+.5)/d,(L+.5)/d).some(de=>/^(head|face|body|bust|torso)\d*$/i.test(de))&&(C+=T+.5,w++)}let x=w>=3?C/w:O(n,a,.5)+.5,R=.475*d*g/b,le=Math.max(h-R,Math.min(u+R,x));return{scale:e.scale*b,x:(.5-le/d)*b,y:.5-.03*m+(.5-r/d)*b}}function oe(o){let e={scale:.65,x:0,y:0},t=e,i=document.createElement("canvas");i.width=i.height=d;let n=i.getContext("2d",{willReadFrequently:!0}),s=new Uint8Array(d*d),c=new Uint8Array(s.length),r=0,a=0,u=0,h;return{initial:e,measure(f,y,l){if(!n)return B;let g=performance.now();if(!(g<u)){h??(h=g);try{n.clearRect(0,0,d,d),n.drawImage(f,0,0,d,d);let{data:m}=n.getImageData(0,0,d,d),b=w=>m[w+3]>3&&Math.max(m[w],m[w+1],m[w+2])<12;if([0,4*(d-1),4*d*(d-1),m.length-4].every(b)&&g-h<2400){u=g+80;return}r++;let C=0;for(let w=0;w<s.length;w++){let x=m[4*w+3];c[w]=x>=24?x:0,c[w]&&C++}C>=16&&(s.set(c),a++,u=g+80)}catch{return B}if(!(a<3&&r<10)){if(a&&l&&t===e){for(let m=0;m<d;m++)if(!(Math.max(s[m],s[(d-1)*d+m],s[m*d],s[m*d+d-1])<96)){t={...e,scale:e.scale*.6},r=a=0,l(t);return}}return a?he(s,t,y,o):B}}}}}var ne=["fairy","doll","adjutant","npc","squad","background"],ie=["default","normal","destroy"];function N(o,e){let t=o.indexOf(e);return t<0?o.length:t}function pe(o,e){let t=new Intl.Collator("en",{numeric:!0}),i=o.map(n=>{let[s,c,r,a]=n.split("/"),u=e[[s,c,r].join("/")],h=r==="base"?-1:u??(s==="fairy"&&/^\d+$/.test(r)?Number(r):Number.MAX_SAFE_INTEGER);return{id:n,category:s,character:c,version:r,form:a,order:h}});return i.sort((n,s)=>N(ne,n.category)-N(ne,s.category)||t.compare(n.category,s.category)||t.compare(n.character,s.character)||n.order-s.order||t.compare(n.version,s.version)||N(ie,n.form)-N(ie,s.form)||t.compare(n.form,s.form)),i.map(n=>n.id)}async function se(o,e,t="zh-CN"){let i=new URL(o,document.baseURI),n=await fetch(i);if(!n.ok)throw new Error("Cannot load catalog: HTTP "+n.status);let s=await n.json();if(s.schemaVersion!==1||!s.models||!s.sources)throw new Error("Unsupported model catalog");let c=new Map,r=Object.keys(s.models).filter(l=>(!e||!l.startsWith("other/"))&&s.models[l].some(g=>g.manifest)),a=e?s.presentation:void 0,u=t==="en"?a?.en:a,h=l=>{let g=a?.aliases[l];return g&&r.includes(g)?g:l},f=e?pe(r.filter(l=>h(l)===l),a?.outfitOrder??{}):r;function y(l,g){if(e&&!r.includes(l))throw new Error("Model outside the selected collection: "+l);let m=s.models[l]?.find(x=>x.manifest&&(!g||x.source===g));if(!m?.manifest)throw new Error("No model manifest for "+l);let b=new URL(s.sources[m.source].baseUrl,n.url||i);i.hostname==="cdn.jsdmirror.com"&&b.hostname==="cdn.jsdelivr.net"&&b.pathname.startsWith("/gh/nova1751/live2d-api@cdn-")&&(b.hostname=i.hostname);let C=x=>new URL(x.split("/").map(encodeURIComponent).join("/"),b).href,w;if(m.dialogue){let x=c.get(m.source);x||(x=new Map((s.audio?.[m.source]??[]).map(R=>[R.toUpperCase(),C(R)])),c.set(m.source,x)),w={captions:t==="en"?void 0:u?.captions,url:C(m.dialogue),audio:x}}return{captions:u?.captions,modelUrl:C(m.manifest),dialogue:w,soundAliases:m.soundAliases}}return{ids:f,visibleId:h,labels:u?.labels??{},resolve:y,legacyIds:s.legacyIds}}var F=class{constructor(e,t){this.url=e;this.options=t;this.sequence=0;this.transition=new $;let i=t.collection?":"+t.collection:"",n="live2d:model:"+e+i,s=c=>c.replace(/(\/gh\/nova1751\/live2d-api)@catalog-[a-f0-9]{16}(\/catalog\/library\.json:girls-frontline)$/,"$1$2");if(this.key=s(n),this.key!==n&&!localStorage.getItem(this.key)){let c=[n,...Object.keys(localStorage)].find(r=>s(r)===this.key&&localStorage.getItem(r));c&&localStorage.setItem(this.key,localStorage.getItem(c))}}open(){return this.library??(this.library=se(this.url,this.options.collection,this.options.locale).catch(e=>{throw this.library=void 0,e}))}async select(e,t){let i=++this.sequence;try{let n=await this.open();if(i!==this.sequence)return;let s=e(n.ids,n.legacyIds,n.visibleId),{modelUrl:c,dialogue:r,soundAliases:a,captions:u}=n.resolve(s),h=1,f=this.options.collection==="girls-frontline"&&!s.startsWith("background/")?oe(l=>{h=l}):void 0,y=this.options.collection?this.transition.begin(()=>h):void 0;await window.loadlive2d("live2d",c,{start:t,locale:this.options.locale,captions:u,framing:f,onPaint:y,coreUrl:this.options.coreUrl,dialogue:r,soundAliases:a}),i===this.sequence&&(this.active=n.visibleId(s),localStorage.setItem(this.key,s),window.dispatchEvent(new CustomEvent("live2d:model",{detail:s})))}catch(n){throw i===this.sequence&&document.getElementById("waifu")?.removeAttribute("data-initial-framing"),n}}load(e,t,i,n=!1){return this.select((s,c,r)=>{let a=localStorage.getItem(this.key);if(this.options.collection)return this.options.modelId??(a&&s.includes(r(a))?a:s[0]);let u=c?.[Number(localStorage.getItem("modelId"))]?.[Number(localStorage.getItem("modelTexturesId"))];return this.options.modelId??(a&&s.includes(r(a))?a:u&&s.includes(u)?u:s[0])},n)}choose(e){return this.select(()=>e,!1)}cancel(){this.sequence++}reopen(e){if(this.active)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}character(e){return e.split("/").slice(0,2).join("/")}nextModel(e=!1){return this.select(t=>{let i=[...new Set(t.map(s=>this.character(s)))],n=i[(i.indexOf(this.character(this.active??""))+1)%i.length];return t.find(s=>this.character(s)===n)},e)}nextTexture(e=!1){return this.select(t=>{let i=t.filter(n=>this.character(n)===this.character(this.active??t[0]));{let n=i.filter(s=>s!==this.active);return n.length?n[Math.floor(Math.random()*n.length)]:i[0]}return i[(i.indexOf(this.active??"")+1)%i.length]},e)}async costume(e){let t=await this.open(),i=t.ids.find(n=>t.resolve(n).modelUrl===e);i&&await this.select(()=>i,!1)}};var we=document.currentScript,ve=we?.dataset.asteroidsUrl??"https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.8/asteroids.js",M=o=>document.getElementById(o);function A(o){console.error("[Live2D]",o);let e=document.getElementById("waifu-status");e&&(e.textContent=p("加载失败,请检查网络或切换模型后重试。","Could not load the model. Check your connection or try another character."),v(e.textContent,5e3,10))}async function ye(o){if(o==="en"){v(["One step at a time, Commander.","Even on a quiet day, there is something worth noticing."],6e3,9);return}let e=await S("https://v1.hitokoto.cn");v(I(e.hitokoto),6e3,9),setTimeout(()=>{v(`这句一言来自 <span>「${I(String(e.from))}」</span>,是 <span>${I(String(e.creator))}</span> 在 hitokoto.cn 投稿的。`,4e3,9)},6e3)}function be(){if(window.Asteroids)(window.ASTEROIDSPLAYERS??(window.ASTEROIDSPLAYERS=[])).push(new window.Asteroids);else{let o=document.createElement("script");o.src=ve,document.head.appendChild(o)}}var ae;function ce(){clearTimeout(ae),localStorage.removeItem("waifu-display"),M("waifu-toggle").setAttribute("tabindex","-1"),M("waifu-toggle").setAttribute("aria-expanded","true"),M("waifu").style.display="";let o=M("waifu");o.hasAttribute("data-initial-framing")?o.style.bottom="0":setTimeout(()=>{o.style.bottom="0"},0)}function V(o){return o.isTrusted&&!!window.loadlive2d.prepareInteraction?.()}function xe(){let o=M("waifu").contains(document.activeElement);window.loadlive2d.hide?.(),localStorage.setItem("waifu-display",String(Date.now())),v(p("愿你有一天能与重要的人重逢。","I hope you meet the people you miss again."),2e3,11),M("waifu").style.bottom="-500px",ae=setTimeout(()=>{M("waifu").style.display="none";let e=M("waifu-toggle");e.removeAttribute("tabindex"),e.setAttribute("aria-expanded","false"),e.classList.add("waifu-toggle-active"),o&&e.focus()},window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:3e3)}function re(o,e,t=!1){sessionStorage.removeItem("waifu-text");let i=o.collection==="girls-frontline",n='<canvas id="live2d" width="800" height="800"></canvas>';document.body.insertAdjacentHTML("beforeend",`<div id="waifu" lang="${o.locale==="en"?"en":"zh-CN"}"${i?' class="waifu-adaptive"':""}${i&&e instanceof F?" data-initial-framing":""}>
3
3
  <div id="waifu-status" role="status" class="waifu-sr-only"></div>
4
4
  <div id="waifu-tips"></div>
5
5
  ${i?`<div class="waifu-viewport"><div class="waifu-surface">${n}</div></div>`:n}
6
6
  <div id="waifu-tool"></div>
7
- </div>`),ce(),window.addEventListener("live2d:dialogue",r=>{let{detail:c,playback:d}=r;typeof c=="string"&&J(c,d)}),window.addEventListener("live2d:preset",r=>{let{playback:c}=r;c&&X(c)}),window.addEventListener("live2d:dialogue-end",r=>{let c=r.detail;c?.playback&&K(c.playback,c.interrupted)}),window.addEventListener("live2d:costume",r=>{let c=r.detail;typeof c=="string"&&e.costume(c).catch(S)});let s={hitokoto:g("听一句话","Hear a quote"),asteroids:g("启动小游戏","Play Asteroids"),"switch-model":g("切换人物","Next character"),"switch-texture":g("切换造型","Next outfit"),photo:g("保存照片","Save a picture"),info:g("项目信息","Project information"),quit:g("收起看板娘","Hide companion")},a={hitokoto:()=>ye(o.locale).catch(S),asteroids:be,"switch-model":r=>e.nextModel(V(r)).catch(S),"switch-texture":r=>e.nextTexture(V(r)).catch(S),photo:()=>{w(g("照好了嘛,是不是很可爱呢?","Did you get my good side?"),6e3,9),!(window.loadlive2d.capture?.()||!window.Live2D)&&(window.Live2D.captureName="photo.png",window.Live2D.captureFrame=!0)},info:()=>window.open("https://github.com/nova1751/live2d-api"),quit:()=>{e.cancel(),xe()}};for(let r of Array.isArray(o.tools)?o.tools:Object.keys(a)){if(o.modelUrl&&(r==="switch-model"||r==="switch-texture")||!Object.prototype.hasOwnProperty.call(a,r))continue;let c=r;I("waifu-tool").insertAdjacentHTML("beforeend",`<button type="button" id="waifu-tool-${c}" aria-label="${s[c]}" title="${s[c]}">${G[c]}</button>`),I("waifu-tool-"+c).addEventListener("click",a[c])}e.load(void 0,void 0,void 0,t).catch(S),T(o.waifuPath).then(Q).catch(S)}window.initWidget=(o,e)=>{let t=typeof o=="string"?{waifuPath:o,apiPath:e}:o;if(document.getElementById("waifu-toggle"))return;_(t.locale),document.body.insertAdjacentHTML("beforeend",`<button type="button" id="waifu-toggle" aria-label="${g("打开看板娘","Show companion")}" aria-controls="waifu"><span>${g("看板娘","Companion")}</span></button>`);let i=I("waifu-toggle");i.setAttribute("aria-expanded","false");let n=t.catalogUrl?new F(t.catalogUrl,t):new D(t);n instanceof F&&Object.defineProperty(window,Symbol.for("live2dapi-noa.selectModel"),{configurable:!0,value:async a=>((i.getAttribute("aria-expanded")==="false"||localStorage.getItem("waifu-display"))&&i.click(),n.choose(a))}),i.addEventListener("click",a=>{let r=V(a);i.classList.remove("waifu-toggle-active"),i.hasAttribute("first-time")?(re(t,n,r),i.removeAttribute("first-time")):(ce(),n.reopen(r)?.catch(S)),a.detail===0&&document.querySelector("#waifu-tool button")?.focus()});let s=Number(localStorage.getItem("waifu-display"));s&&Date.now()-s<=864e5?(i.setAttribute("first-time","true"),setTimeout(()=>i.classList.add("waifu-toggle-active"),0)):re(t,n)};})();
7
+ </div>`),ce(),window.addEventListener("live2d:dialogue",r=>{let{detail:a,playback:u}=r;typeof a=="string"&&J(a,u)}),window.addEventListener("live2d:preset",r=>{let{playback:a}=r;a&&X(a)}),window.addEventListener("live2d:dialogue-end",r=>{let a=r.detail;a?.playback&&K(a.playback,a.interrupted)}),window.addEventListener("live2d:costume",r=>{let a=r.detail;typeof a=="string"&&e.costume(a).catch(A)});let s={hitokoto:p("听一句话","Hear a quote"),asteroids:p("启动小游戏","Play Asteroids"),"switch-model":p("切换人物","Next character"),"switch-texture":p("切换造型","Next outfit"),photo:p("保存照片","Save a picture"),info:p("项目信息","Project information"),quit:p("收起看板娘","Hide companion")},c={hitokoto:()=>ye(o.locale).catch(A),asteroids:be,"switch-model":r=>e.nextModel(V(r)).catch(A),"switch-texture":r=>e.nextTexture(V(r)).catch(A),photo:()=>{v(p("照好了嘛,是不是很可爱呢?","Did you get my good side?"),6e3,9),!(window.loadlive2d.capture?.()||!window.Live2D)&&(window.Live2D.captureName="photo.png",window.Live2D.captureFrame=!0)},info:()=>window.open("https://github.com/nova1751/live2d-api"),quit:()=>{e.cancel(),xe()}};for(let r of Array.isArray(o.tools)?o.tools:Object.keys(c)){if(o.modelUrl&&(r==="switch-model"||r==="switch-texture")||!Object.prototype.hasOwnProperty.call(c,r))continue;let a=r;M("waifu-tool").insertAdjacentHTML("beforeend",`<button type="button" id="waifu-tool-${a}" aria-label="${s[a]}" title="${s[a]}">${G[a]}</button>`),M("waifu-tool-"+a).addEventListener("click",c[a])}e.load(void 0,void 0,void 0,t).catch(A),S(o.waifuPath).then(Q).catch(A)}window.initWidget=(o,e)=>{let t=typeof o=="string"?{waifuPath:o,apiPath:e}:o;if(document.getElementById("waifu-toggle"))return;_(t.locale),document.body.insertAdjacentHTML("beforeend",`<button type="button" id="waifu-toggle" aria-label="${p("打开看板娘","Show companion")}" aria-controls="waifu"><span>${p("看板娘","Companion")}</span></button>`);let i=M("waifu-toggle");i.setAttribute("aria-expanded","false");let n=t.catalogUrl?new F(t.catalogUrl,t):new D(t);n instanceof F&&Object.defineProperty(window,Symbol.for("live2dapi-noa.selectModel"),{configurable:!0,value:async c=>((i.getAttribute("aria-expanded")==="false"||localStorage.getItem("waifu-display"))&&i.click(),n.choose(c))}),i.addEventListener("click",c=>{let r=V(c);i.classList.remove("waifu-toggle-active"),i.hasAttribute("first-time")?(re(t,n,r),i.removeAttribute("first-time")):(ce(),n.reopen(r)?.catch(A)),c.detail===0&&document.querySelector("#waifu-tool button")?.focus()});let s=Number(localStorage.getItem("waifu-display"));s&&Date.now()-s<=864e5?(i.setAttribute("first-time","true"),setTimeout(()=>i.classList.add("waifu-toggle-active"),0)):re(t,n)};})();
@@ -8,7 +8,7 @@ const live2d_path = (() => {
8
8
  return new URL("../../", url).href;
9
9
  }
10
10
  }
11
- return "https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.7/";
11
+ return "https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.8/";
12
12
  })();
13
13
  function loadExternalResource(url, type) {
14
14
  let tag;
@@ -1,7 +1,7 @@
1
1
  /*! Live2D API | Generated from src/ | https://github.com/nova1751/live2d-api */
2
- "use strict";(()=>{var Y="zh-CN";function _(o){Y=o??"zh-CN"}function g(o,e){return Y==="en"?e:o}var G={hitokoto:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4l0 0 0 0 0 0 0 0 .3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',asteroids:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L284 427.7l-68.5 74.1c-8.9 9.7-22.9 12.9-35.2 8.1S160 493.2 160 480V396.4c0-4 1.5-7.8 4.2-10.7L331.8 202.8c5.8-6.3 5.6-16-.4-22s-15.7-6.4-22-.7L106 360.8 17.7 316.6C7.1 311.3 .3 300.7 0 288.9s5.9-22.8 16.1-28.7l448-256c10.7-6.1 23.9-5.5 34 1.4z"/></svg>',"switch-model":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M399 384.2C376.9 345.8 335.4 320 288 320H224c-47.4 0-88.9 25.8-111 64.2c35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm256 16a72 72 0 1 0 0-144 72 72 0 1 0 0 144z"/></svg>',"switch-texture":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M320 64A64 64 0 1 0 192 64a64 64 0 1 0 128 0zm-96 96c-35.3 0-64 28.7-64 64v48c0 17.7 14.3 32 32 32h1.8l11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5h38.7c16.3 0 30-12.3 31.8-28.5L318.2 304H320c17.7 0 32-14.3 32-32V224c0-35.3-28.7-64-64-64H224zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"/></svg>',photo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M220.6 121.2L271.1 96 448 96v96H333.2c-21.9-15.1-48.5-24-77.2-24s-55.2 8.9-77.2 24H64V128H192c9.9 0 19.7-2.3 28.6-6.8zM0 128V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H271.1c-9.9 0-19.7 2.3-28.6 6.8L192 64H160V48c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16l0 16C28.7 64 0 92.7 0 128zM168 304a88 88 0 1 1 176 0 88 88 0 1 1 -176 0z"/></svg>',info:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>',quit:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>'};function U(o){return Array.isArray(o)?o[Math.floor(Math.random()*o.length)]:o}function L(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var P,H,R;function z(){clearTimeout(H),sessionStorage.removeItem("waifu-text"),document.getElementById("waifu-tips")?.classList.remove("waifu-tips-active")}function q(o,e){clearTimeout(H),sessionStorage.setItem("waifu-text",String(e));let t=document.getElementById("waifu-tips");t.innerHTML=o,t.classList.add("waifu-tips-active")}function w(o,e,t){!o||R||Number(sessionStorage.getItem("waifu-text"))>t||(q(U(o),t),H=setTimeout(z,e))}function J(o,e){if(!e){w(L(o),5e3,11);return}R=e,q(L(o),11)}function X(o){let e=document.getElementById("live2d");if(!e)return;let t=P?.find(({selector:n})=>e.closest(n)),i=t?U(t.text):P?void 0:g("指挥官,我在。","Right here, Commander.");i&&(R=o,q(i.replace("{text}",()=>L(e.textContent??"")),11))}function K(o,e){R===o&&(R=void 0,e?z():H=setTimeout(z,1200))}function ue(o){if(location.pathname==="/"){let s=new Date().getHours();for(let{hour:a,text:r}of o){let[c,d=c]=a.split("-").map(Number);if(c<=s&&s<=d)return r}}let e=L(document.title.split(" - ")[0]),t=g(`欢迎阅读<span>「${e}」</span>`,`Welcome to <span>${e}</span>!`);if(!document.referrer)return t;let{hostname:i}=new URL(document.referrer);return i===location.hostname?t:g(`Hello!来自 <span>${L({baidu:"百度",so:"360搜索",google:"谷歌搜索"}[i.split(".")[1]]??i)}</span> 的朋友<br>${t}`,`Hello, visitor from <span>${L(i)}</span>!<br>${t}`)}function me(o){let[e,t]=o.split("/").map(Number);return e*100+t}function Q(o){P=o.click;let e=[...o.message.default],t=new Date,i=(t.getMonth()+1)*100+t.getDate();for(let{date:u,text:v}of o.seasons){let[l,m=l]=u.split("-").map(me);l<=i&&i<=m&&e.push(U(v).replace("{year}",String(t.getFullYear())))}let n=2e4,s=Date.now(),a;function r(){if(document.hidden)return;let u=n-(Date.now()-s);u<=0&&!localStorage.getItem("waifu-display")&&w(e,6e3,9),a=setTimeout(r,u>0?u:n)}let c=()=>{s=Date.now()};window.addEventListener("pointermove",c,{passive:!0}),window.addEventListener("pointerdown",c,{passive:!0}),window.addEventListener("keydown",c),document.hidden||(a=setTimeout(r,n)),w(ue(o.time),7e3,11);let d;for(let u of["mouseover","click"])window.addEventListener(u,v=>{let l=v.target;if(!(l instanceof Element)||v.live2dHandlesCaption)return;let m=u==="click"&&l.closest("#waifu .waifu-model-stage"),p=m?document.getElementById("live2d"):l.closest("#live2d"),y=o[u].find(({selector:C})=>l.closest(C)||m&&p?.closest(C));!y||u==="mouseover"&&y.selector===d||(u==="mouseover"&&(d=y.selector),w(U(y.text).replace("{text}",()=>L(l.textContent??"")),4e3,u==="click"&&p?11:8))});let h=()=>{};h.toString=()=>(w(o.message.console,6e3,9),""),console.log("%c",h),window.addEventListener("copy",()=>w(o.message.copy,6e3,9)),document.addEventListener("visibilitychange",()=>{clearTimeout(a),document.hidden||(c(),a=setTimeout(r,n),localStorage.getItem("waifu-display")||w(o.message.visibilitychange,6e3,9))})}async function T(o){let e=await fetch(o);if(!e.ok)throw new Error(`Failed to load ${o} (HTTP ${e.status})`);return e.json()}var Z="/gh/nova1751/live2d-api@cdn-b3ac5ae545e2/",ee="https://cdn.jsdelivr.net",j=ee+Z,fe=/\/gh\/nova1751\/live2d-api@widget-[^/]+\/?$/,ge=/\/live2dapi-noa(?:@[^/]+)?\/?$/;function te(o){let e=new URL(o,document.baseURI);return!ge.test(e.pathname)&&!fe.test(e.pathname)||/@1\.[^/]+\/?$/.test(e.pathname)?o:(e.hostname==="cdn.jsdmirror.com"?e.origin:ee)+Z}var W=()=>g("我的新衣服好看嘛?","How do you like my new outfit?"),E=o=>Number(localStorage.getItem(o))||0,D=class{constructor(e){this.options=e;this.revision=0;this.loaded=!1;this.useCDN=typeof e.cdnPath=="string";let t=e.modelBaseUrl??(e.cdnPath&&te(e.cdnPath))??e.apiPath;if(typeof t!="string")throw new TypeError("Invalid initWidget argument");this.base=t.endsWith("/")?t:t+"/"}reopen(e){if(this.loaded)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}cancel(){this.revision++}async fetchCatalog(){let e=this.base+"model_list.json",t=await fetch(e);if(t.status===404&&!this.options.modelBaseUrl&&this.base!==j){let i=await T(j+"model_list.json");return this.base=j,i}if(!t.ok)throw new Error(`Failed to load ${e} (HTTP ${t.status})`);return t.json()}list(){return this.catalog??(this.catalog=this.fetchCatalog().catch(e=>{throw this.catalog=void 0,e}))}async load(e=E("modelId"),t=E("modelTexturesId"),i,n=!1,s=++this.revision,a=!1){let r;if(this.options.modelUrl)r=this.options.modelUrl;else if(this.useCDN){let{models:d}=await this.list();d[e]||(e=0);let h=d[e],u=Array.isArray(h)?h:[h];u[t]||(t=0);let v=u[t];t=u.indexOf(v),r=this.base+"model/"+v+"/index.json"}else r=this.base+"get/?id="+e+"-"+t;if(s!==this.revision)return;let c=window.loadlive2d("live2d",r,{start:n,locale:this.options.locale,coreUrl:this.options.coreUrl});c&&await c,s===this.revision&&(this.options.modelUrl||(localStorage.setItem("modelId",String(e)),localStorage.setItem("modelTexturesId",String(t))),w(i,4e3,10),this.loaded=!0)}async costume(e){if(this.options.modelUrl||!this.useCDN)return;let t=++this.revision,i=E("modelId"),n=(await this.list()).models[i],a=(Array.isArray(n)?n:[n]).findIndex(r=>new URL(this.base+"model/"+r+"/index.json",document.baseURI).href===e);a>=0&&await this.load(i,a,W(),!1,t,!0)}async nextModel(e=!1){let t=++this.revision,i=E("modelId");if(this.useCDN){let{models:s,messages:a}=await this.list(),r=(i+1)%s.length;return this.load(r,0,g(a[r],"Ready for duty!"),e,t)}let{model:n}=await T(this.base+"switch/?id="+i);return this.load(n.id,0,n.message,e,t)}async nextTexture(e=!1){let t=++this.revision,i=E("modelId"),n=E("modelTexturesId");if(this.useCDN){let a=(await this.list()).models[i],r=Array.isArray(a)?a.length:1;return this.load(i,(n+1)%r,W(),e,t)}let{textures:s}=await T(this.base+"rand_textures/?id="+i+"-"+n);s.id===1&&n===1?w(g("我还没有其他衣服呢!","This is my only outfit so far!"),4e3,10):await this.load(i,s.id,W(),e,t)}};var $=class{constructor(){this.revision=0}begin(e){let t=document.getElementById("waifu"),i=t?.querySelector(".waifu-surface"),n=++this.revision;return t&&(this.still&&!this.still.isConnected&&(i??t).prepend(this.still),t.setAttribute("data-model-loading","")),s=>{if(this.revision!==n||!t)return;let a=document.createElement("canvas");a.className="waifu-model-still",a.setAttribute("aria-hidden","true"),a.width=s.width,a.height=s.height;try{let r=a.getContext("2d");r&&r.drawImage(s,0,0),this.still?.remove(),this.still=r?a:void 0}finally{if(i){let r=e();t.style.setProperty("--waifu-aspect",String(r)),t.toggleAttribute("data-wide-model",r>=1.35)}t.removeAttribute("data-model-loading"),t.hasAttribute("data-initial-framing")&&(t.removeAttribute("data-initial-framing"),document.activeElement?.matches("#waifu-toggle:focus-visible")&&t.querySelector("#waifu-tool button")?.focus({preventScroll:!0}))}}}};var B={scale:1,x:0,y:0},f=128;function O(o,e,t){let i=0;for(let n=0;n<o.length;n++)if(i+=o[n],i>e*t)return n;return o.length-1}function he(o,e,t,i){let n=new Float64Array(f),s=new Float64Array(f),a=f,r=0,c=0;for(let b=0;b<o.length;b++){if(!o[b])continue;let M=Math.floor(b/f);n[b%f]+=o[b],s[M]+=o[b],c+=o[b],a=Math.min(a,M),r=Math.max(r,M+1)}if(!c)return B;a=Math.max(a,O(s,c,.001)-2);let d=O(n,c,.001),h=O(n,c,.999)+1,u=h-d,v=r-a,l=i?Math.max(.7,Math.min(1.9,u/v*.93/.94)):1;i?.(l);let m=Math.min(1,l),p=Math.min(1,1/l),y=Math.min(.93*f*p/v,.94*f*m/u,5/e.scale),C=0,A=0;if(t)for(let b=a+2;b<r;b+=4)for(let M=d+2;M<h;M+=4){if(o[b*f+M]<96)continue;t((M+.5)/f,(b+.5)/f).some(de=>/^(head|face|body|bust|torso)\d*$/i.test(de))&&(C+=M+.5,A++)}let x=A>=3?C/A:O(n,c,.5)+.5,F=.475*f*m/y,le=Math.max(h-F,Math.min(d+F,x));return{scale:e.scale*y,x:(.5-le/f)*y,y:.5-.03*p+(.5-r/f)*y}}function oe(o){let e={scale:.65,x:0,y:0},t=document.createElement("canvas");t.width=t.height=f;let i=t.getContext("2d",{willReadFrequently:!0}),n=new Uint8Array(f*f),s=new Uint8Array(n.length),a=0,r=0,c=0;return{initial:e,measure(d,h){if(!i)return B;let u=performance.now();if(!(u<c)){a++;try{i.clearRect(0,0,f,f),i.drawImage(d,0,0,f,f);let{data:v}=i.getImageData(0,0,f,f),l=0;for(let m=0;m<n.length;m++){let p=v[4*m+3];s[m]=p>=24?p:0,s[m]&&l++}l>=16&&(n.set(s),r++,c=u+80)}catch{return B}if(!(r<3&&a<10))return r?he(n,e,h,o):B}}}}var ne=["fairy","doll","adjutant","npc","squad","background"],ie=["default","normal","destroy"];function N(o,e){let t=o.indexOf(e);return t<0?o.length:t}function pe(o,e){let t=new Intl.Collator("en",{numeric:!0}),i=o.map(n=>{let[s,a,r,c]=n.split("/"),d=e[[s,a,r].join("/")],h=r==="base"?-1:d??(s==="fairy"&&/^\d+$/.test(r)?Number(r):Number.MAX_SAFE_INTEGER);return{id:n,category:s,character:a,version:r,form:c,order:h}});return i.sort((n,s)=>N(ne,n.category)-N(ne,s.category)||t.compare(n.category,s.category)||t.compare(n.character,s.character)||n.order-s.order||t.compare(n.version,s.version)||N(ie,n.form)-N(ie,s.form)||t.compare(n.form,s.form)),i.map(n=>n.id)}async function se(o,e,t="zh-CN"){let i=new URL(o,document.baseURI),n=await fetch(i);if(!n.ok)throw new Error("Cannot load catalog: HTTP "+n.status);let s=await n.json();if(s.schemaVersion!==1||!s.models||!s.sources)throw new Error("Unsupported model catalog");let a=new Map,r=Object.keys(s.models).filter(l=>(!e||!l.startsWith("other/"))&&s.models[l].some(m=>m.manifest)),c=e?s.presentation:void 0,d=t==="en"?c?.en:c,h=l=>{let m=c?.aliases[l];return m&&r.includes(m)?m:l},u=e?pe(r.filter(l=>h(l)===l),c?.outfitOrder??{}):r;function v(l,m){if(e&&!r.includes(l))throw new Error("Model outside the selected collection: "+l);let p=s.models[l]?.find(x=>x.manifest&&(!m||x.source===m));if(!p?.manifest)throw new Error("No model manifest for "+l);let y=new URL(s.sources[p.source].baseUrl,n.url||i);i.hostname==="cdn.jsdmirror.com"&&y.hostname==="cdn.jsdelivr.net"&&y.pathname.startsWith("/gh/nova1751/live2d-api@cdn-")&&(y.hostname=i.hostname);let C=x=>new URL(x.split("/").map(encodeURIComponent).join("/"),y).href,A;if(p.dialogue){let x=a.get(p.source);x||(x=new Map((s.audio?.[p.source]??[]).map(F=>[F.toUpperCase(),C(F)])),a.set(p.source,x)),A={captions:t==="en"?void 0:d?.captions,url:C(p.dialogue),audio:x}}return{captions:d?.captions,modelUrl:C(p.manifest),dialogue:A,soundAliases:p.soundAliases}}return{ids:u,visibleId:h,labels:d?.labels??{},resolve:v,legacyIds:s.legacyIds}}var k=class{constructor(e,t){this.url=e;this.options=t;this.sequence=0;this.transition=new $;let i=t.collection?":"+t.collection:"",n="live2d:model:"+e+i,s=a=>a.replace(/(\/gh\/nova1751\/live2d-api)@catalog-[a-f0-9]{16}(\/catalog\/library\.json:girls-frontline)$/,"$1$2");if(this.key=s(n),this.key!==n&&!localStorage.getItem(this.key)){let a=[n,...Object.keys(localStorage)].find(r=>s(r)===this.key&&localStorage.getItem(r));a&&localStorage.setItem(this.key,localStorage.getItem(a))}}open(){return this.library??(this.library=se(this.url,this.options.collection,this.options.locale).catch(e=>{throw this.library=void 0,e}))}async select(e,t){let i=++this.sequence;try{let n=await this.open();if(i!==this.sequence)return;let s=e(n.ids,n.legacyIds,n.visibleId),{modelUrl:a,dialogue:r,soundAliases:c,captions:d}=n.resolve(s),h=1,u=this.options.collection==="girls-frontline"&&!s.startsWith("background/")?oe(l=>{h=l}):void 0,v=this.options.collection?this.transition.begin(()=>h):void 0;await window.loadlive2d("live2d",a,{start:t,locale:this.options.locale,captions:d,framing:u,onPaint:v,coreUrl:this.options.coreUrl,dialogue:r,soundAliases:c}),i===this.sequence&&(this.active=n.visibleId(s),localStorage.setItem(this.key,s),window.dispatchEvent(new CustomEvent("live2d:model",{detail:s})))}catch(n){throw i===this.sequence&&document.getElementById("waifu")?.removeAttribute("data-initial-framing"),n}}load(e,t,i,n=!1){return this.select((s,a,r)=>{let c=localStorage.getItem(this.key);if(this.options.collection)return this.options.modelId??(c&&s.includes(r(c))?c:s[0]);let d=a?.[Number(localStorage.getItem("modelId"))]?.[Number(localStorage.getItem("modelTexturesId"))];return this.options.modelId??(c&&s.includes(r(c))?c:d&&s.includes(d)?d:s[0])},n)}choose(e){return this.select(()=>e,!1)}cancel(){this.sequence++}reopen(e){if(this.active)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}character(e){return e.split("/").slice(0,2).join("/")}nextModel(e=!1){return this.select(t=>{let i=[...new Set(t.map(s=>this.character(s)))],n=i[(i.indexOf(this.character(this.active??""))+1)%i.length];return t.find(s=>this.character(s)===n)},e)}nextTexture(e=!1){return this.select(t=>{let i=t.filter(n=>this.character(n)===this.character(this.active??t[0]));return i[(i.indexOf(this.active??"")+1)%i.length]},e)}async costume(e){let t=await this.open(),i=t.ids.find(n=>t.resolve(n).modelUrl===e);i&&await this.select(()=>i,!1)}};var we=document.currentScript,ve=we?.dataset.asteroidsUrl??"https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.7/asteroids.js",I=o=>document.getElementById(o);function S(o){console.error("[Live2D]",o);let e=document.getElementById("waifu-status");e&&(e.textContent=g("加载失败,请检查网络或切换模型后重试。","Could not load the model. Check your connection or try another character."),w(e.textContent,5e3,10))}async function ye(o){if(o==="en"){w(["One step at a time, Commander.","Even on a quiet day, there is something worth noticing."],6e3,9);return}let e=await T("https://v1.hitokoto.cn");w(L(e.hitokoto),6e3,9),setTimeout(()=>{w(`这句一言来自 <span>「${L(String(e.from))}」</span>,是 <span>${L(String(e.creator))}</span> 在 hitokoto.cn 投稿的。`,4e3,9)},6e3)}function be(){if(window.Asteroids)(window.ASTEROIDSPLAYERS??(window.ASTEROIDSPLAYERS=[])).push(new window.Asteroids);else{let o=document.createElement("script");o.src=ve,document.head.appendChild(o)}}var ae;function ce(){clearTimeout(ae),localStorage.removeItem("waifu-display"),I("waifu-toggle").setAttribute("tabindex","-1"),I("waifu-toggle").setAttribute("aria-expanded","true"),I("waifu").style.display="";let o=I("waifu");o.hasAttribute("data-initial-framing")?o.style.bottom="0":setTimeout(()=>{o.style.bottom="0"},0)}function V(o){return o.isTrusted&&!!window.loadlive2d.prepareInteraction?.()}function xe(){let o=I("waifu").contains(document.activeElement);window.loadlive2d.hide?.(),localStorage.setItem("waifu-display",String(Date.now())),w(g("愿你有一天能与重要的人重逢。","I hope you meet the people you miss again."),2e3,11),I("waifu").style.bottom="-500px",ae=setTimeout(()=>{I("waifu").style.display="none";let e=I("waifu-toggle");e.removeAttribute("tabindex"),e.setAttribute("aria-expanded","false"),e.classList.add("waifu-toggle-active"),o&&e.focus()},window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:3e3)}function re(o,e,t=!1){sessionStorage.removeItem("waifu-text");let i=o.collection==="girls-frontline",n='<canvas id="live2d" width="800" height="800"></canvas>';document.body.insertAdjacentHTML("beforeend",`<div id="waifu" lang="${o.locale==="en"?"en":"zh-CN"}"${i?' class="waifu-adaptive"':""}${i&&e instanceof k?" data-initial-framing":""}>
2
+ "use strict";(()=>{var Y="zh-CN";function _(o){Y=o??"zh-CN"}function p(o,e){return Y==="en"?e:o}var G={hitokoto:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4l0 0 0 0 0 0 0 0 .3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',asteroids:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L284 427.7l-68.5 74.1c-8.9 9.7-22.9 12.9-35.2 8.1S160 493.2 160 480V396.4c0-4 1.5-7.8 4.2-10.7L331.8 202.8c5.8-6.3 5.6-16-.4-22s-15.7-6.4-22-.7L106 360.8 17.7 316.6C7.1 311.3 .3 300.7 0 288.9s5.9-22.8 16.1-28.7l448-256c10.7-6.1 23.9-5.5 34 1.4z"/></svg>',"switch-model":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M399 384.2C376.9 345.8 335.4 320 288 320H224c-47.4 0-88.9 25.8-111 64.2c35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm256 16a72 72 0 1 0 0-144 72 72 0 1 0 0 144z"/></svg>',"switch-texture":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M320 64A64 64 0 1 0 192 64a64 64 0 1 0 128 0zm-96 96c-35.3 0-64 28.7-64 64v48c0 17.7 14.3 32 32 32h1.8l11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5h38.7c16.3 0 30-12.3 31.8-28.5L318.2 304H320c17.7 0 32-14.3 32-32V224c0-35.3-28.7-64-64-64H224zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"/></svg>',photo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M220.6 121.2L271.1 96 448 96v96H333.2c-21.9-15.1-48.5-24-77.2-24s-55.2 8.9-77.2 24H64V128H192c9.9 0 19.7-2.3 28.6-6.8zM0 128V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H271.1c-9.9 0-19.7 2.3-28.6 6.8L192 64H160V48c0-8.8-7.2-16-16-16H80c-8.8 0-16 7.2-16 16l0 16C28.7 64 0 92.7 0 128zM168 304a88 88 0 1 1 176 0 88 88 0 1 1 -176 0z"/></svg>',info:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>',quit:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc. --><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>'};function U(o){return Array.isArray(o)?o[Math.floor(Math.random()*o.length)]:o}function I(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var P,H,R;function z(){clearTimeout(H),sessionStorage.removeItem("waifu-text"),document.getElementById("waifu-tips")?.classList.remove("waifu-tips-active")}function q(o,e){clearTimeout(H),sessionStorage.setItem("waifu-text",String(e));let t=document.getElementById("waifu-tips");t.innerHTML=o,t.classList.add("waifu-tips-active")}function v(o,e,t){!o||R||Number(sessionStorage.getItem("waifu-text"))>t||(q(U(o),t),H=setTimeout(z,e))}function J(o,e){if(!e){v(I(o),5e3,11);return}R=e,q(I(o),11)}function X(o){let e=document.getElementById("live2d");if(!e)return;let t=P?.find(({selector:n})=>e.closest(n)),s=t?U(t.text):P?void 0:p("指挥官,我在。","Right here, Commander.");s&&(R=o,q(s.replace("{text}",()=>I(e.textContent??"")),11))}function K(o,e){R===o&&(R=void 0,e?z():H=setTimeout(z,1200))}function ue(o){if(location.pathname==="/"){let i=new Date().getHours();for(let{hour:c,text:r}of o){let[a,u=a]=c.split("-").map(Number);if(a<=i&&i<=u)return r}}let e=I(document.title.split(" - ")[0]),t=p(`欢迎阅读<span>「${e}」</span>`,`Welcome to <span>${e}</span>!`);if(!document.referrer)return t;let{hostname:s}=new URL(document.referrer);return s===location.hostname?t:p(`Hello!来自 <span>${I({baidu:"百度",so:"360搜索",google:"谷歌搜索"}[s.split(".")[1]]??s)}</span> 的朋友<br>${t}`,`Hello, visitor from <span>${I(s)}</span>!<br>${t}`)}function me(o){let[e,t]=o.split("/").map(Number);return e*100+t}function Q(o){P=o.click;let e=[...o.message.default],t=new Date,s=(t.getMonth()+1)*100+t.getDate();for(let{date:f,text:y}of o.seasons){let[l,g=l]=f.split("-").map(me);l<=s&&s<=g&&e.push(U(y).replace("{year}",String(t.getFullYear())))}let n=2e4,i=Date.now(),c;function r(){if(document.hidden)return;let f=n-(Date.now()-i);f<=0&&!localStorage.getItem("waifu-display")&&v(e,6e3,9),c=setTimeout(r,f>0?f:n)}let a=()=>{i=Date.now()};window.addEventListener("pointermove",a,{passive:!0}),window.addEventListener("pointerdown",a,{passive:!0}),window.addEventListener("keydown",a),document.hidden||(c=setTimeout(r,n)),v(ue(o.time),7e3,11);let u;for(let f of["mouseover","click"])window.addEventListener(f,y=>{let l=y.target;if(!(l instanceof Element)||y.live2dHandlesCaption)return;let g=f==="click"&&l.closest("#waifu .waifu-model-stage"),m=g?document.getElementById("live2d"):l.closest("#live2d"),b=o[f].find(({selector:C})=>l.closest(C)||g&&m?.closest(C));!b||f==="mouseover"&&b.selector===u||(f==="mouseover"&&(u=b.selector),v(U(b.text).replace("{text}",()=>I(l.textContent??"")),4e3,f==="click"&&m?11:8))});let h=()=>{};h.toString=()=>(v(o.message.console,6e3,9),""),console.log("%c",h),window.addEventListener("copy",()=>v(o.message.copy,6e3,9)),document.addEventListener("visibilitychange",()=>{clearTimeout(c),document.hidden||(a(),c=setTimeout(r,n),localStorage.getItem("waifu-display")||v(o.message.visibilitychange,6e3,9))})}async function S(o){let e=await fetch(o);if(!e.ok)throw new Error(`Failed to load ${o} (HTTP ${e.status})`);return e.json()}var Z="/gh/nova1751/live2d-api@cdn-b3ac5ae545e2/",ee="https://cdn.jsdelivr.net",j=ee+Z,fe=/\/gh\/nova1751\/live2d-api@widget-[^/]+\/?$/,ge=/\/live2dapi-noa(?:@[^/]+)?\/?$/;function te(o){let e=new URL(o,document.baseURI);return!ge.test(e.pathname)&&!fe.test(e.pathname)||/@1\.[^/]+\/?$/.test(e.pathname)?o:(e.hostname==="cdn.jsdmirror.com"?e.origin:ee)+Z}var W=()=>p("我的新衣服好看嘛?","How do you like my new outfit?"),E=o=>Number(localStorage.getItem(o))||0,D=class{constructor(e){this.options=e;this.revision=0;this.loaded=!1;this.useCDN=typeof e.cdnPath=="string";let t=e.modelBaseUrl??(e.cdnPath&&te(e.cdnPath))??e.apiPath;if(typeof t!="string")throw new TypeError("Invalid initWidget argument");this.base=t.endsWith("/")?t:t+"/"}reopen(e){if(this.loaded)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}cancel(){this.revision++}async fetchCatalog(){let e=this.base+"model_list.json",t=await fetch(e);if(t.status===404&&!this.options.modelBaseUrl&&this.base!==j){let s=await S(j+"model_list.json");return this.base=j,s}if(!t.ok)throw new Error(`Failed to load ${e} (HTTP ${t.status})`);return t.json()}list(){return this.catalog??(this.catalog=this.fetchCatalog().catch(e=>{throw this.catalog=void 0,e}))}async load(e=E("modelId"),t=E("modelTexturesId"),s,n=!1,i=++this.revision,c=!1){let r;if(this.options.modelUrl)r=this.options.modelUrl;else if(this.useCDN){let{models:u}=await this.list();u[e]||(e=0);let h=u[e],f=Array.isArray(h)?h:[h];f[t]||(t=0);let y=f[t];t=f.indexOf(y),r=this.base+"model/"+y+"/index.json"}else r=this.base+"get/?id="+e+"-"+t;if(i!==this.revision)return;let a=window.loadlive2d("live2d",r,{start:n,locale:this.options.locale,coreUrl:this.options.coreUrl});a&&await a,i===this.revision&&(this.options.modelUrl||(localStorage.setItem("modelId",String(e)),localStorage.setItem("modelTexturesId",String(t))),v(s,4e3,10),this.loaded=!0)}async costume(e){if(this.options.modelUrl||!this.useCDN)return;let t=++this.revision,s=E("modelId"),n=(await this.list()).models[s],c=(Array.isArray(n)?n:[n]).findIndex(r=>new URL(this.base+"model/"+r+"/index.json",document.baseURI).href===e);c>=0&&await this.load(s,c,W(),!1,t,!0)}async nextModel(e=!1){let t=++this.revision,s=E("modelId");if(this.useCDN){let{models:i,messages:c}=await this.list(),r=(s+1)%i.length;return this.load(r,0,p(c[r],"Ready for duty!"),e,t)}let{model:n}=await S(this.base+"switch/?id="+s);return this.load(n.id,0,n.message,e,t)}async nextTexture(e=!1){let t=++this.revision,s=E("modelId"),n=E("modelTexturesId");if(this.useCDN){let c=(await this.list()).models[s],r=Array.isArray(c)?c.length:1;return this.load(s,(n+1)%r,W(),e,t)}let{textures:i}=await S(this.base+"rand_textures/?id="+s+"-"+n);i.id===1&&n===1?v(p("我还没有其他衣服呢!","This is my only outfit so far!"),4e3,10):await this.load(s,i.id,W(),e,t)}};var $=class{constructor(){this.revision=0}begin(e){let t=document.getElementById("waifu"),s=t?.querySelector(".waifu-surface"),n=++this.revision;return t&&(this.still&&!this.still.isConnected&&(s??t).prepend(this.still),t.setAttribute("data-model-loading","")),i=>{if(this.revision!==n||!t)return;let c=document.createElement("canvas");c.className="waifu-model-still",c.setAttribute("aria-hidden","true"),c.width=i.width,c.height=i.height;try{let r=c.getContext("2d");r&&r.drawImage(i,0,0),this.still?.remove(),this.still=r?c:void 0}finally{if(s){let r=e();t.style.setProperty("--waifu-aspect",String(r)),t.toggleAttribute("data-wide-model",r>=1.35)}t.removeAttribute("data-model-loading"),t.hasAttribute("data-initial-framing")&&(t.removeAttribute("data-initial-framing"),document.activeElement?.matches("#waifu-toggle:focus-visible")&&t.querySelector("#waifu-tool button")?.focus({preventScroll:!0}))}}}};var B={scale:1,x:0,y:0},d=128;function O(o,e,t){let s=0;for(let n=0;n<o.length;n++)if(s+=o[n],s>e*t)return n;return o.length-1}function he(o,e,t,s){let n=new Float64Array(d),i=new Float64Array(d),c=d,r=0,a=0;for(let L=0;L<o.length;L++){if(!o[L])continue;let T=Math.floor(L/d);n[L%d]+=o[L],i[T]+=o[L],a+=o[L],c=Math.min(c,T),r=Math.max(r,T+1)}if(!a)return B;c=Math.max(c,O(i,a,.001)-2);let u=O(n,a,.001),h=O(n,a,.999)+1,f=h-u,y=r-c,l=s?Math.max(.7,Math.min(1.9,f/y*.93/.94)):1;s?.(l);let g=Math.min(1,l),m=Math.min(1,1/l),b=Math.min(.93*d*m/y,.94*d*g/f,5/e.scale),C=0,w=0;if(t)for(let L=c+2;L<r;L+=4)for(let T=u+2;T<h;T+=4){if(o[L*d+T]<96)continue;t((T+.5)/d,(L+.5)/d).some(de=>/^(head|face|body|bust|torso)\d*$/i.test(de))&&(C+=T+.5,w++)}let x=w>=3?C/w:O(n,a,.5)+.5,F=.475*d*g/b,le=Math.max(h-F,Math.min(u+F,x));return{scale:e.scale*b,x:(.5-le/d)*b,y:.5-.03*m+(.5-r/d)*b}}function oe(o){let e={scale:.65,x:0,y:0},t=e,s=document.createElement("canvas");s.width=s.height=d;let n=s.getContext("2d",{willReadFrequently:!0}),i=new Uint8Array(d*d),c=new Uint8Array(i.length),r=0,a=0,u=0,h;return{initial:e,measure(f,y,l){if(!n)return B;let g=performance.now();if(!(g<u)){h??(h=g);try{n.clearRect(0,0,d,d),n.drawImage(f,0,0,d,d);let{data:m}=n.getImageData(0,0,d,d),b=w=>m[w+3]>3&&Math.max(m[w],m[w+1],m[w+2])<12;if([0,4*(d-1),4*d*(d-1),m.length-4].every(b)&&g-h<2400){u=g+80;return}r++;let C=0;for(let w=0;w<i.length;w++){let x=m[4*w+3];c[w]=x>=24?x:0,c[w]&&C++}C>=16&&(i.set(c),a++,u=g+80)}catch{return B}if(!(a<3&&r<10)){if(a&&l&&t===e){for(let m=0;m<d;m++)if(!(Math.max(i[m],i[(d-1)*d+m],i[m*d],i[m*d+d-1])<96)){t={...e,scale:e.scale*.6},r=a=0,l(t);return}}return a?he(i,t,y,o):B}}}}}var ne=["fairy","doll","adjutant","npc","squad","background"],ie=["default","normal","destroy"];function N(o,e){let t=o.indexOf(e);return t<0?o.length:t}function pe(o,e){let t=new Intl.Collator("en",{numeric:!0}),s=o.map(n=>{let[i,c,r,a]=n.split("/"),u=e[[i,c,r].join("/")],h=r==="base"?-1:u??(i==="fairy"&&/^\d+$/.test(r)?Number(r):Number.MAX_SAFE_INTEGER);return{id:n,category:i,character:c,version:r,form:a,order:h}});return s.sort((n,i)=>N(ne,n.category)-N(ne,i.category)||t.compare(n.category,i.category)||t.compare(n.character,i.character)||n.order-i.order||t.compare(n.version,i.version)||N(ie,n.form)-N(ie,i.form)||t.compare(n.form,i.form)),s.map(n=>n.id)}async function se(o,e,t="zh-CN"){let s=new URL(o,document.baseURI),n=await fetch(s);if(!n.ok)throw new Error("Cannot load catalog: HTTP "+n.status);let i=await n.json();if(i.schemaVersion!==1||!i.models||!i.sources)throw new Error("Unsupported model catalog");let c=new Map,r=Object.keys(i.models).filter(l=>(!e||!l.startsWith("other/"))&&i.models[l].some(g=>g.manifest)),a=e?i.presentation:void 0,u=t==="en"?a?.en:a,h=l=>{let g=a?.aliases[l];return g&&r.includes(g)?g:l},f=e?pe(r.filter(l=>h(l)===l),a?.outfitOrder??{}):r;function y(l,g){if(e&&!r.includes(l))throw new Error("Model outside the selected collection: "+l);let m=i.models[l]?.find(x=>x.manifest&&(!g||x.source===g));if(!m?.manifest)throw new Error("No model manifest for "+l);let b=new URL(i.sources[m.source].baseUrl,n.url||s);s.hostname==="cdn.jsdmirror.com"&&b.hostname==="cdn.jsdelivr.net"&&b.pathname.startsWith("/gh/nova1751/live2d-api@cdn-")&&(b.hostname=s.hostname);let C=x=>new URL(x.split("/").map(encodeURIComponent).join("/"),b).href,w;if(m.dialogue){let x=c.get(m.source);x||(x=new Map((i.audio?.[m.source]??[]).map(F=>[F.toUpperCase(),C(F)])),c.set(m.source,x)),w={captions:t==="en"?void 0:u?.captions,url:C(m.dialogue),audio:x}}return{captions:u?.captions,modelUrl:C(m.manifest),dialogue:w,soundAliases:m.soundAliases}}return{ids:f,visibleId:h,labels:u?.labels??{},resolve:y,legacyIds:i.legacyIds}}var k=class{constructor(e,t){this.url=e;this.options=t;this.sequence=0;this.transition=new $;let s=t.collection?":"+t.collection:"",n="live2d:model:"+e+s,i=c=>c.replace(/(\/gh\/nova1751\/live2d-api)@catalog-[a-f0-9]{16}(\/catalog\/library\.json:girls-frontline)$/,"$1$2");if(this.key=i(n),this.key!==n&&!localStorage.getItem(this.key)){let c=[n,...Object.keys(localStorage)].find(r=>i(r)===this.key&&localStorage.getItem(r));c&&localStorage.setItem(this.key,localStorage.getItem(c))}}open(){return this.library??(this.library=se(this.url,this.options.collection,this.options.locale).catch(e=>{throw this.library=void 0,e}))}async select(e,t){let s=++this.sequence;try{let n=await this.open();if(s!==this.sequence)return;let i=e(n.ids,n.legacyIds,n.visibleId),{modelUrl:c,dialogue:r,soundAliases:a,captions:u}=n.resolve(i),h=1,f=this.options.collection==="girls-frontline"&&!i.startsWith("background/")?oe(l=>{h=l}):void 0,y=this.options.collection?this.transition.begin(()=>h):void 0;await window.loadlive2d("live2d",c,{start:t,locale:this.options.locale,captions:u,framing:f,onPaint:y,coreUrl:this.options.coreUrl,dialogue:r,soundAliases:a}),s===this.sequence&&(this.active=n.visibleId(i),localStorage.setItem(this.key,i),window.dispatchEvent(new CustomEvent("live2d:model",{detail:i})))}catch(n){throw s===this.sequence&&document.getElementById("waifu")?.removeAttribute("data-initial-framing"),n}}load(e,t,s,n=!1){return this.select((i,c,r)=>{let a=localStorage.getItem(this.key);if(this.options.collection)return this.options.modelId??(a&&i.includes(r(a))?a:i[0]);let u=c?.[Number(localStorage.getItem("modelId"))]?.[Number(localStorage.getItem("modelTexturesId"))];return this.options.modelId??(a&&i.includes(r(a))?a:u&&i.includes(u)?u:i[0])},n)}choose(e){return this.select(()=>e,!1)}cancel(){this.sequence++}reopen(e){if(this.active)window.loadlive2d.show?.(e);else return this.load(void 0,void 0,void 0,e)}character(e){return e.split("/").slice(0,2).join("/")}nextModel(e=!1){return this.select(t=>{let s=[...new Set(t.map(i=>this.character(i)))],n=s[(s.indexOf(this.character(this.active??""))+1)%s.length];return t.find(i=>this.character(i)===n)},e)}nextTexture(e=!1){return this.select(t=>{let s=t.filter(n=>this.character(n)===this.character(this.active??t[0]));return s[(s.indexOf(this.active??"")+1)%s.length]},e)}async costume(e){let t=await this.open(),s=t.ids.find(n=>t.resolve(n).modelUrl===e);s&&await this.select(()=>s,!1)}};var we=document.currentScript,ve=we?.dataset.asteroidsUrl??"https://cdn.jsdelivr.net/gh/nova1751/live2d-api@widget-2.4.8/asteroids.js",M=o=>document.getElementById(o);function A(o){console.error("[Live2D]",o);let e=document.getElementById("waifu-status");e&&(e.textContent=p("加载失败,请检查网络或切换模型后重试。","Could not load the model. Check your connection or try another character."),v(e.textContent,5e3,10))}async function ye(o){if(o==="en"){v(["One step at a time, Commander.","Even on a quiet day, there is something worth noticing."],6e3,9);return}let e=await S("https://v1.hitokoto.cn");v(I(e.hitokoto),6e3,9),setTimeout(()=>{v(`这句一言来自 <span>「${I(String(e.from))}」</span>,是 <span>${I(String(e.creator))}</span> 在 hitokoto.cn 投稿的。`,4e3,9)},6e3)}function be(){if(window.Asteroids)(window.ASTEROIDSPLAYERS??(window.ASTEROIDSPLAYERS=[])).push(new window.Asteroids);else{let o=document.createElement("script");o.src=ve,document.head.appendChild(o)}}var ae;function ce(){clearTimeout(ae),localStorage.removeItem("waifu-display"),M("waifu-toggle").setAttribute("tabindex","-1"),M("waifu-toggle").setAttribute("aria-expanded","true"),M("waifu").style.display="";let o=M("waifu");o.hasAttribute("data-initial-framing")?o.style.bottom="0":setTimeout(()=>{o.style.bottom="0"},0)}function V(o){return o.isTrusted&&!!window.loadlive2d.prepareInteraction?.()}function xe(){let o=M("waifu").contains(document.activeElement);window.loadlive2d.hide?.(),localStorage.setItem("waifu-display",String(Date.now())),v(p("愿你有一天能与重要的人重逢。","I hope you meet the people you miss again."),2e3,11),M("waifu").style.bottom="-500px",ae=setTimeout(()=>{M("waifu").style.display="none";let e=M("waifu-toggle");e.removeAttribute("tabindex"),e.setAttribute("aria-expanded","false"),e.classList.add("waifu-toggle-active"),o&&e.focus()},window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:3e3)}function re(o,e,t=!1){sessionStorage.removeItem("waifu-text");let s=o.collection==="girls-frontline",n='<canvas id="live2d" width="800" height="800"></canvas>';document.body.insertAdjacentHTML("beforeend",`<div id="waifu" lang="${o.locale==="en"?"en":"zh-CN"}"${s?' class="waifu-adaptive"':""}${s&&e instanceof k?" data-initial-framing":""}>
3
3
  <div id="waifu-status" role="status" class="waifu-sr-only"></div>
4
4
  <div id="waifu-tips"></div>
5
- ${i?`<div class="waifu-viewport"><div class="waifu-surface">${n}</div></div>`:n}
5
+ ${s?`<div class="waifu-viewport"><div class="waifu-surface">${n}</div></div>`:n}
6
6
  <div id="waifu-tool"></div>
7
- </div>`),ce(),window.addEventListener("live2d:dialogue",r=>{let{detail:c,playback:d}=r;typeof c=="string"&&J(c,d)}),window.addEventListener("live2d:preset",r=>{let{playback:c}=r;c&&X(c)}),window.addEventListener("live2d:dialogue-end",r=>{let c=r.detail;c?.playback&&K(c.playback,c.interrupted)}),window.addEventListener("live2d:costume",r=>{let c=r.detail;typeof c=="string"&&e.costume(c).catch(S)});let s={hitokoto:g("听一句话","Hear a quote"),asteroids:g("启动小游戏","Play Asteroids"),"switch-model":g("切换人物","Next character"),"switch-texture":g("切换造型","Next outfit"),photo:g("保存照片","Save a picture"),info:g("项目信息","Project information"),quit:g("收起看板娘","Hide companion")},a={hitokoto:()=>ye(o.locale).catch(S),asteroids:be,"switch-model":r=>e.nextModel(V(r)).catch(S),"switch-texture":r=>e.nextTexture(V(r)).catch(S),photo:()=>{w(g("照好了嘛,是不是很可爱呢?","Did you get my good side?"),6e3,9),!(window.loadlive2d.capture?.()||!window.Live2D)&&(window.Live2D.captureName="photo.png",window.Live2D.captureFrame=!0)},info:()=>window.open("https://github.com/nova1751/live2d-api"),quit:()=>{e.cancel(),xe()}};for(let r of Array.isArray(o.tools)?o.tools:Object.keys(a)){if(o.modelUrl&&(r==="switch-model"||r==="switch-texture")||!Object.prototype.hasOwnProperty.call(a,r))continue;let c=r;I("waifu-tool").insertAdjacentHTML("beforeend",`<button type="button" id="waifu-tool-${c}" aria-label="${s[c]}" title="${s[c]}">${G[c]}</button>`),I("waifu-tool-"+c).addEventListener("click",a[c])}e.load(void 0,void 0,void 0,t).catch(S),T(o.waifuPath).then(Q).catch(S)}window.initWidget=(o,e)=>{let t=typeof o=="string"?{waifuPath:o,apiPath:e}:o;if(document.getElementById("waifu-toggle"))return;_(t.locale),document.body.insertAdjacentHTML("beforeend",`<button type="button" id="waifu-toggle" aria-label="${g("打开看板娘","Show companion")}" aria-controls="waifu"><span>${g("看板娘","Companion")}</span></button>`);let i=I("waifu-toggle");i.setAttribute("aria-expanded","false");let n=t.catalogUrl?new k(t.catalogUrl,t):new D(t);n instanceof k&&Object.defineProperty(window,Symbol.for("live2dapi-noa.selectModel"),{configurable:!0,value:async a=>((i.getAttribute("aria-expanded")==="false"||localStorage.getItem("waifu-display"))&&i.click(),n.choose(a))}),i.addEventListener("click",a=>{let r=V(a);i.classList.remove("waifu-toggle-active"),i.hasAttribute("first-time")?(re(t,n,r),i.removeAttribute("first-time")):(ce(),n.reopen(r)?.catch(S)),a.detail===0&&document.querySelector("#waifu-tool button")?.focus()});let s=Number(localStorage.getItem("waifu-display"));s&&Date.now()-s<=864e5?(i.setAttribute("first-time","true"),setTimeout(()=>i.classList.add("waifu-toggle-active"),0)):re(t,n)};})();
7
+ </div>`),ce(),window.addEventListener("live2d:dialogue",r=>{let{detail:a,playback:u}=r;typeof a=="string"&&J(a,u)}),window.addEventListener("live2d:preset",r=>{let{playback:a}=r;a&&X(a)}),window.addEventListener("live2d:dialogue-end",r=>{let a=r.detail;a?.playback&&K(a.playback,a.interrupted)}),window.addEventListener("live2d:costume",r=>{let a=r.detail;typeof a=="string"&&e.costume(a).catch(A)});let i={hitokoto:p("听一句话","Hear a quote"),asteroids:p("启动小游戏","Play Asteroids"),"switch-model":p("切换人物","Next character"),"switch-texture":p("切换造型","Next outfit"),photo:p("保存照片","Save a picture"),info:p("项目信息","Project information"),quit:p("收起看板娘","Hide companion")},c={hitokoto:()=>ye(o.locale).catch(A),asteroids:be,"switch-model":r=>e.nextModel(V(r)).catch(A),"switch-texture":r=>e.nextTexture(V(r)).catch(A),photo:()=>{v(p("照好了嘛,是不是很可爱呢?","Did you get my good side?"),6e3,9),!(window.loadlive2d.capture?.()||!window.Live2D)&&(window.Live2D.captureName="photo.png",window.Live2D.captureFrame=!0)},info:()=>window.open("https://github.com/nova1751/live2d-api"),quit:()=>{e.cancel(),xe()}};for(let r of Array.isArray(o.tools)?o.tools:Object.keys(c)){if(o.modelUrl&&(r==="switch-model"||r==="switch-texture")||!Object.prototype.hasOwnProperty.call(c,r))continue;let a=r;M("waifu-tool").insertAdjacentHTML("beforeend",`<button type="button" id="waifu-tool-${a}" aria-label="${i[a]}" title="${i[a]}">${G[a]}</button>`),M("waifu-tool-"+a).addEventListener("click",c[a])}e.load(void 0,void 0,void 0,t).catch(A),S(o.waifuPath).then(Q).catch(A)}window.initWidget=(o,e)=>{let t=typeof o=="string"?{waifuPath:o,apiPath:e}:o;if(document.getElementById("waifu-toggle"))return;_(t.locale),document.body.insertAdjacentHTML("beforeend",`<button type="button" id="waifu-toggle" aria-label="${p("打开看板娘","Show companion")}" aria-controls="waifu"><span>${p("看板娘","Companion")}</span></button>`);let s=M("waifu-toggle");s.setAttribute("aria-expanded","false");let n=t.catalogUrl?new k(t.catalogUrl,t):new D(t);n instanceof k&&Object.defineProperty(window,Symbol.for("live2dapi-noa.selectModel"),{configurable:!0,value:async c=>((s.getAttribute("aria-expanded")==="false"||localStorage.getItem("waifu-display"))&&s.click(),n.choose(c))}),s.addEventListener("click",c=>{let r=V(c);s.classList.remove("waifu-toggle-active"),s.hasAttribute("first-time")?(re(t,n,r),s.removeAttribute("first-time")):(ce(),n.reopen(r)?.catch(A)),c.detail===0&&document.querySelector("#waifu-tool button")?.focus()});let i=Number(localStorage.getItem("waifu-display"));i&&Date.now()-i<=864e5?(s.setAttribute("first-time","true"),setTimeout(()=>s.classList.add("waifu-toggle-active"),0)):re(t,n)};})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "live2dapi-noa",
3
- "version": "2.4.7",
3
+ "version": "2.4.8",
4
4
  "packageManager": "pnpm@10.33.0",
5
5
  "description": "少女前线 Live2D 网页看板娘,支持中英文台词与 Cubism 2–5 模型。",
6
6
  "main": "./widget.mjs",
package/widget.mjs CHANGED
@@ -134,7 +134,7 @@ async function loadModelCatalog(input, collection, locale = "zh-CN") {
134
134
  }
135
135
 
136
136
  // package.json
137
- var version = "2.4.7";
137
+ var version = "2.4.8";
138
138
 
139
139
  // src/distribution.ts
140
140
  var snapshot = "/gh/nova1751/live2d-api@cdn-b3ac5ae545e2/";