This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/443190/1038775/%E5%81%B6%E5%83%8F%E5%A4%A7%E5%B8%88ShinyColors%E6%B1%89%E5%8C%96.js
// ==UserScript==
// @name 偶像大师ShinyColors汉化
// @namespace https://github.com/biuuu/ShinyColors
// @version 1.8.9
// @description 录剧情视频到公开的网站请先取得译者同意,提交翻译或问题请到 https://github.com/biuuu/ShinyColors
// @icon https://shinycolors.enza.fun/icon_192x192.png
// @author biuuu
// @match https://shinycolors.enza.fun/*
// @run-at document-start
// @grant GM_xmlhttpRequest
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @connect api.interpreter.caiyunai.com
// @connect translate.google.cn
// @connect fanyi.baidu.com
// @updateURL https://www.shiny.fun/ShinyColors.user.js
// @supportURL https://github.com/biuuu/ShinyColors/issues
// ==/UserScript==
!function(){"use strict";const e=(e,t=!1)=>t&&e.startsWith("")?e:""+e,t=e=>e.startsWith("")?e.slice(1,e.length):e;var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var o="object"==typeof r&&r&&r.Object===Object&&r,s="object"==typeof self&&self&&self.Object===Object&&self,a=o||s||Function("return this")(),i=a.Symbol,c=Object.prototype,u=c.hasOwnProperty,l=c.toString,d=i?i.toStringTag:void 0;var p=function(e){var t=u.call(e,d),r=e[d];try{e[d]=void 0;var n=!0}catch(e){}var o=l.call(e);return n&&(t?e[d]=r:delete e[d]),o},h=Object.prototype.toString;var f=function(e){return h.call(e)},m=i?i.toStringTag:void 0;var v=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":m&&m in Object(e)?p(e):f(e)},g=Array.isArray;var y=function(e){return null!=e&&"object"==typeof e};var w=function(e){return"string"==typeof e||!g(e)&&y(e)&&"[object String]"==v(e)};var b=function(e){return!0===e||!1===e||y(e)&&"[object Boolean]"==v(e)};var E=function(e,t){return function(r){return e(t(r))}},_=E(Object.getPrototypeOf,Object),S=Function.prototype,k=Object.prototype,I=S.toString,x=k.hasOwnProperty,A=I.call(Object);var j=function(e){if(!y(e)||"[object Object]"!=v(e))return!1;var t=_(e);if(null===t)return!0;var r=x.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&I.call(r)==A};let C=window.unsafeWindow||window;const R=Math.floor(640/C.devicePixelRatio),M=Math.floor(1136/C.devicePixelRatio),P=e=>{e--,(()=>{let e=C.outerHeight,t=C.outerWidth;const r=document.body.clientHeight,n=document.body.clientWidth,o=R-r,s=M-n;(o||s)&&(e+=o,t+=s,C.resizeTo(t,e))})(),e>0&&setTimeout(()=>P(e),1e3)},T={origin:"https://www.shiny.fun",hash:"",localHash:"",version:"1.8.9",story:"normal",timeout:30,font1:"yuanti",font2:"heiti",auto:"off",bgm:"off",dev:!1},O=Object.assign({},T),D=["yuanti","heiti","yuanti2"],z={HEITI_JA:"UDKakugo_SmallPr6-B",HEITI_TRANS:"sczh-heiti,UDKakugo_SmallPr6-B",YUAN_JA:"HummingStd-E",YUAN_TRANS:"sczh-yuanti,HummingStd-E"},F=["origin","font1","font2","timeout","story","auto","bgm","dev"],N=F,L=()=>{z.HEITI_TRANS=`${D.includes(T.font2)?"sczh-":""}${T.font2},${z.HEITI_JA}`,z.YUAN_TRANS=`${D.includes(T.font1)?"sczh-":""}${T.font1},${z.YUAN_JA}`},$=()=>{const e={};N.forEach(t=>{T[t]!==O[t]&&(e[t]=T[t])}),L(),localStorage.setItem("sczh:setting",JSON.stringify(e))},B=()=>{let e=location.hash;e=e.slice(1).replace(/\?tdsourcetag=s_pc(tim|qq)_aiomsg/,""),e.split(";").forEach(e=>{let t=e.split("="),r=decodeURIComponent(t[0].trim()),n=t[1]?decodeURIComponent(t[1].trim()):"";r&&N.includes(r)&&(T[r]=n||O[r],$())})},U={auto:{on:"关闭机翻",off:"开启机翻",id:0,callback:()=>{T.auto="off"!==T.auto?"off":"on"}},story:{normal:"开启剧情提取",edit:"关闭剧情提取",id:0,callback:()=>{if("normal"===T.story)T.story="edit";else{const e=document.getElementById("btn-close-sczh");e?e.click():T.story="normal"}}},bgm:{on:"关闭BGM后台播放",off:"开启BGM后台播放",id:0,callback:()=>{T.bgm="off"!==T.bgm?"off":"on"}},origin:{id:0,title:"修改数据源",callback:()=>{const e=prompt("请输入数据源URL,清空则使用默认数据源",T.origin);null!==e&&(T.origin=e.trim())}},dev:{id:0,titles:["打开开发模式","关闭开发模式"],callback:()=>{T.dev=!T.dev}},update:{id:0,title:"检查更新",callback:()=>{window.open(T.origin+"/ShinyColors.user.js")}},resize:{id:0,title:"调整窗口尺寸",callback:()=>P(10)}},H=e=>{const t=T[e],r=U[e];let n="";if(b(t)){let e=t?1:0;n=r.titles[e]}else n=r.title||r[t];const o=r.id;o&&window.GM_unregisterMenuCommand(o),r.id=window.GM_registerMenuCommand(n,()=>{(0,r.callback)(),$(),W()})},W=()=>{if(!window.GM_registerMenuCommand||!window.GM_unregisterMenuCommand)return;["update","bgm","story","origin","auto","dev","resize"].forEach(e=>{H(e)})};(()=>{const e=localStorage.getItem("sczh:setting");let t=JSON.parse(e);j(t)||(t={});const{origin:r}=t;/^https?:\/\//.test(r)&&(T.origin=r.trim()),N.forEach(e=>{let r=t[e];w(r)&&(r=r.trim()),(b(r)||r)&&(T[e]=r)}),L()})(),B(),W(),window.addEventListener("hashchange",B);const J=e=>{if(!e)return"";return e.replace(/[\u0020]+$/g,"").replace(/^[\u0020]+/g,"")},q=(e,t=!1)=>{let r=J(e).replace(/(\\r)?\\n/g,"\n").replace(/\\r/g,"\n");return t?r:r.replace(/\n{2,}/g,"\n")},G=e=>e.replace(/\u200b/g," "),K=e=>J(e).replace(/\r/g,"\n").replace(/\n{2,}/g,"\n"),Y=(...e)=>{T.dev&&console.info(...e)},Q=(...e)=>{console.info(...e)},V=e=>w(e)?e.replace(/\r?\n/g,"\\n").replace(/\r/g,"\\n"):e,X=(e="0.0.0",t="0.0.0")=>{let r=!1;const n=e.split(".").map(e=>parseInt(e,10)),o=t.split(".").map(e=>parseInt(e,10));for(let e=0;e<n.length;e++){(n[e]||0)>(o[e]||0)&&(r=!0)}return r},Z=(e,t)=>{if(!e||!e.length)return e;let r=e,n=!1,o=((e=2)=>{let t="";for(let r=0;r<e;r++)t+=String.fromCharCode(Math.floor(16*Math.random()+65520));return t})(3);Array.isArray(e)&&(r=e.join(o),n=!0);for(let[e,n]of t){if(!e||e.length<2)continue;const t=e.replace(/\./g,"\\.").replace(/\*/g,"\\*");r=r.replace(new RegExp(t,"g"),n)}return n?r.split(o):r},ee=()=>{const e=new Map;return t=>{if(t&&!/^0+$/.test(t)&&"select"!==t){if(e.has(t)){const r=e.get(t);return e.set(t,r+1),`${t}-${r}`}e.set(t,0)}return t}},te=(e,t)=>{try{if(t)return sessionStorage.setItem(e,JSON.stringify(t)),!0;{let t=sessionStorage.getItem(e);return JSON.parse(t)}}catch(e){}},re=new Map,ne=(t,r,n)=>{if(!t||!w(t[r]))return;const{expMap:o,wordMaps:s,textMap:a}=n,i=K(t[r]);let c=i;i&&((null==a?void 0:a.has(i))?t[r]=e(a.get(i)):(c=((e,t,r=[])=>{if(re.has(e))return re.get(e);let n=e;for(let[e,o]of t)n=n.replace(e,(...e)=>{let t=o;for(let n=1;n<e.length-2;n++){let o=e[n],s=!1;r.forEach(e=>{e.has(o)&&(t=t.replace("$"+n,e.get(o)),s=!0)}),s||(/億$/.test(e[n])&&(e[n]=e[n].replace(/億$/,"亿")),t=t.replace("$"+n,e[n]))}return t}),e.lastIndex=0;return e!==n&&re.set(e,n),n})(i,o,s),i!==c&&(t[r]=e(c))))};var oe=function(){this.__data__=[],this.size=0};var se=function(e,t){return e===t||e!=e&&t!=t};var ae=function(e,t){for(var r=e.length;r--;)if(se(e[r][0],t))return r;return-1},ie=Array.prototype.splice;var ce=function(e){var t=this.__data__,r=ae(t,e);return!(r<0)&&(r==t.length-1?t.pop():ie.call(t,r,1),--this.size,!0)};var ue=function(e){var t=this.__data__,r=ae(t,e);return r<0?void 0:t[r][1]};var le=function(e){return ae(this.__data__,e)>-1};var de=function(e,t){var r=this.__data__,n=ae(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function pe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}pe.prototype.clear=oe,pe.prototype.delete=ce,pe.prototype.get=ue,pe.prototype.has=le,pe.prototype.set=de;var he=pe;var fe=function(){this.__data__=new he,this.size=0};var me=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var ve=function(e){return this.__data__.get(e)};var ge=function(e){return this.__data__.has(e)};var ye=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var we=function(e){if(!ye(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},be=a["__core-js_shared__"],Ee=function(){var e=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var _e=function(e){return!!Ee&&Ee in e},Se=Function.prototype.toString;var ke=function(e){if(null!=e){try{return Se.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Ie=/^\[object .+?Constructor\]$/,xe=Function.prototype,Ae=Object.prototype,je=xe.toString,Ce=Ae.hasOwnProperty,Re=RegExp("^"+je.call(Ce).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Me=function(e){return!(!ye(e)||_e(e))&&(we(e)?Re:Ie).test(ke(e))};var Pe=function(e,t){return null==e?void 0:e[t]};var Te=function(e,t){var r=Pe(e,t);return Me(r)?r:void 0},Oe=Te(a,"Map"),De=Te(Object,"create");var ze=function(){this.__data__=De?De(null):{},this.size=0};var Fe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ne=Object.prototype.hasOwnProperty;var Le=function(e){var t=this.__data__;if(De){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ne.call(t,e)?t[e]:void 0},$e=Object.prototype.hasOwnProperty;var Be=function(e){var t=this.__data__;return De?void 0!==t[e]:$e.call(t,e)};var Ue=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=De&&void 0===t?"__lodash_hash_undefined__":t,this};function He(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}He.prototype.clear=ze,He.prototype.delete=Fe,He.prototype.get=Le,He.prototype.has=Be,He.prototype.set=Ue;var We=He;var Je=function(){this.size=0,this.__data__={hash:new We,map:new(Oe||he),string:new We}};var qe=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ge=function(e,t){var r=e.__data__;return qe(t)?r["string"==typeof t?"string":"hash"]:r.map};var Ke=function(e){var t=Ge(this,e).delete(e);return this.size-=t?1:0,t};var Ye=function(e){return Ge(this,e).get(e)};var Qe=function(e){return Ge(this,e).has(e)};var Ve=function(e,t){var r=Ge(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Xe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Xe.prototype.clear=Je,Xe.prototype.delete=Ke,Xe.prototype.get=Ye,Xe.prototype.has=Qe,Xe.prototype.set=Ve;var Ze=Xe;var et=function(e,t){var r=this.__data__;if(r instanceof he){var n=r.__data__;if(!Oe||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ze(n)}return r.set(e,t),this.size=r.size,this};function tt(e){var t=this.__data__=new he(e);this.size=t.size}tt.prototype.clear=fe,tt.prototype.delete=me,tt.prototype.get=ve,tt.prototype.has=ge,tt.prototype.set=et;var rt=tt;var nt=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e},ot=function(){try{var e=Te(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var st=function(e,t,r){"__proto__"==t&&ot?ot(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},at=Object.prototype.hasOwnProperty;var it=function(e,t,r){var n=e[t];at.call(e,t)&&se(n,r)&&(void 0!==r||t in e)||st(e,t,r)};var ct=function(e,t,r,n){var o=!r;r||(r={});for(var s=-1,a=t.length;++s<a;){var i=t[s],c=n?n(r[i],e[i],i,r,e):void 0;void 0===c&&(c=e[i]),o?st(r,i,c):it(r,i,c)}return r};var ut=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var lt=function(e){return y(e)&&"[object Arguments]"==v(e)},dt=Object.prototype,pt=dt.hasOwnProperty,ht=dt.propertyIsEnumerable,ft=lt(function(){return arguments}())?lt:function(e){return y(e)&&pt.call(e,"callee")&&!ht.call(e,"callee")};var mt=function(){return!1},vt=n((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?a.Buffer:void 0,s=(o?o.isBuffer:void 0)||mt;e.exports=s})),gt=/^(?:0|[1-9]\d*)$/;var yt=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&>.test(e))&&e>-1&&e%1==0&&e<t};var wt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},bt={};bt["[object Float32Array]"]=bt["[object Float64Array]"]=bt["[object Int8Array]"]=bt["[object Int16Array]"]=bt["[object Int32Array]"]=bt["[object Uint8Array]"]=bt["[object Uint8ClampedArray]"]=bt["[object Uint16Array]"]=bt["[object Uint32Array]"]=!0,bt["[object Arguments]"]=bt["[object Array]"]=bt["[object ArrayBuffer]"]=bt["[object Boolean]"]=bt["[object DataView]"]=bt["[object Date]"]=bt["[object Error]"]=bt["[object Function]"]=bt["[object Map]"]=bt["[object Number]"]=bt["[object Object]"]=bt["[object RegExp]"]=bt["[object Set]"]=bt["[object String]"]=bt["[object WeakMap]"]=!1;var Et=function(e){return y(e)&&wt(e.length)&&!!bt[v(e)]};var _t=function(e){return function(t){return e(t)}},St=n((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,s=n&&n.exports===r&&o.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=a})),kt=St&&St.isTypedArray,It=kt?_t(kt):Et,xt=Object.prototype.hasOwnProperty;var At=function(e,t){var r=g(e),n=!r&&ft(e),o=!r&&!n&&vt(e),s=!r&&!n&&!o&&It(e),a=r||n||o||s,i=a?ut(e.length,String):[],c=i.length;for(var u in e)!t&&!xt.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||yt(u,c))||i.push(u);return i},jt=Object.prototype;var Ct=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||jt)},Rt=E(Object.keys,Object),Mt=Object.prototype.hasOwnProperty;var Pt=function(e){if(!Ct(e))return Rt(e);var t=[];for(var r in Object(e))Mt.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Tt=function(e){return null!=e&&wt(e.length)&&!we(e)};var Ot=function(e){return Tt(e)?At(e):Pt(e)};var Dt=function(e,t){return e&&ct(t,Ot(t),e)};var zt=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},Ft=Object.prototype.hasOwnProperty;var Nt=function(e){if(!ye(e))return zt(e);var t=Ct(e),r=[];for(var n in e)("constructor"!=n||!t&&Ft.call(e,n))&&r.push(n);return r};var Lt=function(e){return Tt(e)?At(e,!0):Nt(e)};var $t=function(e,t){return e&&ct(t,Lt(t),e)},Bt=n((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?a.Buffer:void 0,s=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=s?s(r):new e.constructor(r);return e.copy(n),n}}));var Ut=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t};var Ht=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,s=[];++r<n;){var a=e[r];t(a,r,e)&&(s[o++]=a)}return s};var Wt=function(){return[]},Jt=Object.prototype.propertyIsEnumerable,qt=Object.getOwnPropertySymbols,Gt=qt?function(e){return null==e?[]:(e=Object(e),Ht(qt(e),(function(t){return Jt.call(e,t)})))}:Wt;var Kt=function(e,t){return ct(e,Gt(e),t)};var Yt=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},Qt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Yt(t,Gt(e)),e=_(e);return t}:Wt;var Vt=function(e,t){return ct(e,Qt(e),t)};var Xt=function(e,t,r){var n=t(e);return g(e)?n:Yt(n,r(e))};var Zt=function(e){return Xt(e,Ot,Gt)};var er=function(e){return Xt(e,Lt,Qt)},tr=Te(a,"DataView"),rr=Te(a,"Promise"),nr=Te(a,"Set"),or=Te(a,"WeakMap"),sr=ke(tr),ar=ke(Oe),ir=ke(rr),cr=ke(nr),ur=ke(or),lr=v;(tr&&"[object DataView]"!=lr(new tr(new ArrayBuffer(1)))||Oe&&"[object Map]"!=lr(new Oe)||rr&&"[object Promise]"!=lr(rr.resolve())||nr&&"[object Set]"!=lr(new nr)||or&&"[object WeakMap]"!=lr(new or))&&(lr=function(e){var t=v(e),r="[object Object]"==t?e.constructor:void 0,n=r?ke(r):"";if(n)switch(n){case sr:return"[object DataView]";case ar:return"[object Map]";case ir:return"[object Promise]";case cr:return"[object Set]";case ur:return"[object WeakMap]"}return t});var dr=lr,pr=Object.prototype.hasOwnProperty;var hr=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&pr.call(e,"index")&&(r.index=e.index,r.input=e.input),r},fr=a.Uint8Array;var mr=function(e){var t=new e.constructor(e.byteLength);return new fr(t).set(new fr(e)),t};var vr=function(e,t){var r=t?mr(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},gr=/\w*$/;var yr=function(e){var t=new e.constructor(e.source,gr.exec(e));return t.lastIndex=e.lastIndex,t},wr=i?i.prototype:void 0,br=wr?wr.valueOf:void 0;var Er=function(e){return br?Object(br.call(e)):{}};var _r=function(e,t){var r=t?mr(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var Sr=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return mr(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return vr(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return _r(e,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return yr(e);case"[object Set]":return new n;case"[object Symbol]":return Er(e)}},kr=Object.create,Ir=function(){function e(){}return function(t){if(!ye(t))return{};if(kr)return kr(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();var xr=function(e){return"function"!=typeof e.constructor||Ct(e)?{}:Ir(_(e))};var Ar=function(e){return y(e)&&"[object Map]"==dr(e)},jr=St&&St.isMap,Cr=jr?_t(jr):Ar;var Rr=function(e){return y(e)&&"[object Set]"==dr(e)},Mr=St&&St.isSet,Pr=Mr?_t(Mr):Rr,Tr={};Tr["[object Arguments]"]=Tr["[object Array]"]=Tr["[object ArrayBuffer]"]=Tr["[object DataView]"]=Tr["[object Boolean]"]=Tr["[object Date]"]=Tr["[object Float32Array]"]=Tr["[object Float64Array]"]=Tr["[object Int8Array]"]=Tr["[object Int16Array]"]=Tr["[object Int32Array]"]=Tr["[object Map]"]=Tr["[object Number]"]=Tr["[object Object]"]=Tr["[object RegExp]"]=Tr["[object Set]"]=Tr["[object String]"]=Tr["[object Symbol]"]=Tr["[object Uint8Array]"]=Tr["[object Uint8ClampedArray]"]=Tr["[object Uint16Array]"]=Tr["[object Uint32Array]"]=!0,Tr["[object Error]"]=Tr["[object Function]"]=Tr["[object WeakMap]"]=!1;var Or=function e(t,r,n,o,s,a){var i,c=1&r,u=2&r,l=4&r;if(n&&(i=s?n(t,o,s,a):n(t)),void 0!==i)return i;if(!ye(t))return t;var d=g(t);if(d){if(i=hr(t),!c)return Ut(t,i)}else{var p=dr(t),h="[object Function]"==p||"[object GeneratorFunction]"==p;if(vt(t))return Bt(t,c);if("[object Object]"==p||"[object Arguments]"==p||h&&!s){if(i=u||h?{}:xr(t),!c)return u?Vt(t,$t(i,t)):Kt(t,Dt(i,t))}else{if(!Tr[p])return s?t:{};i=Sr(t,p,c)}}a||(a=new rt);var f=a.get(t);if(f)return f;a.set(t,i),Pr(t)?t.forEach((function(o){i.add(e(o,r,n,o,t,a))})):Cr(t)&&t.forEach((function(o,s){i.set(s,e(o,r,n,s,t,a))}));var m=d?void 0:(l?u?er:Zt:u?Lt:Ot)(t);return nt(m||t,(function(o,s){m&&(o=t[s=o]),it(i,s,e(o,r,n,s,t,a))})),i};var Dr=function(e){return Or(e,5)};const{origin:zr,version:Fr}=T,Nr=async()=>{const e=Math.floor(Date.now()/1e3/60/60/6),t=await fetch(`${zr}/manifest.json?t=${e}`);if(t.ok){const e=await t.json();return e.time=Date.now(),localStorage.setItem("sczh:manifest",JSON.stringify(e)),e}throw new Error(`${t.status} ${t.url}`)};let Lr={data:null};const $r=new Promise((e,t)=>{(async()=>{let e;try{let t=localStorage.getItem("sczh:manifest");t&&(e=JSON.parse(t)),Date.now()-e.time>60*T.cacheTime*1e3&&(e=!1)}catch(e){}return e?X(Fr,e.version)?e=await Nr():setTimeout(Nr,5e3):e=await Nr(),e})().then(t=>{Lr.data=t,T.newVersion=t.version,T.hashes=t.hashes,e(t)}).catch(t)}),Br=async(e,t)=>{if(!t){const{hashes:r}=await $r;t=r[e.replace(/^\/(data\/)?/,"")]}return await(async e=>new Promise((t,r)=>{let n=setTimeout(()=>{r(`加载${e}超时`)},1e3*T.timeout);fetch(`${zr}${e}`).then(e=>{if(clearTimeout(n),!e.ok)return r(`${e.status} ${e.url}`),"";const t=e.headers.get("content-type");return(null==t?void 0:t.includes("json"))?e.json():e.text()}).then(t).catch(r)}))(`${e}${t?"?v="+t:""}`)};let Ur=null;const Hr=new Map([["AOBA",e=>e&&e.loaders&&e.Text&&e.BLEND_MODES],["SCENARIO",e=>e&&e.default&&e.default.load&&e.default._errorEvent&&e.default._handleError],["REQUEST",e=>e&&e.get&&e.post&&e.put&&e.patch],["PHRASE",e=>e&&e.default&&e.default._polyglot&&e.default._polyglot.phrases],["SPEAKER",e=>e&&e.default&&e.default.getCharacterBackLogIconId],["WEBP",e=>e&&e.default&&e.default.isSupportedWebP]]),Wr=new Map([["AOBA",e=>e],["SCENARIO",e=>e.default],["REQUEST",e=>e],["PHRASE",e=>e.default._polyglot.phrases],["SPEAKER",e=>e.default],["WEBP",e=>e.default]]),Jr=Object.freeze;Object.freeze=new Proxy(Jr,{apply:(e,t,[r])=>r});const qr=/^function\s(\w)\((\w)\){if\((\w)\[\2\]\)return\s\3\[\2\]\.exports;var\s(\w)=\3\[\2\]={\w:\2,(\w):!1,exports:{}};return\s\w\[\2\]\.call\(\4.exports,\4,\4\.exports,\1\),\4\.\5=!0,\4\.exports}$/,Gr=Function.prototype.call;let Kr={Reflect:window.Reflect};Function.prototype.call=new Proxy(Gr,{apply(e,t,r){var n,o,s,a;(null==r||null===(n=r[3])||void 0===n?void 0:n.toString)&&(qr.test(r[3].toString())&&(null===(o=r[3].caller)||void 0===o||null===(s=o.arguments)||void 0===s||null===(a=s[0])||void 0===a?void 0:a.length)>1e3&&(Ur=r[3],Function.prototype.call=Gr));return Kr.Reflect.apply(e,t,r)}});const Yr=async e=>{const{moduleId:t}=await $r;let[r,n]=((e,t)=>{let r,n,o=((e,t)=>{let r=e+t,n=[];for(let o=e-t;o<=r;o++)o>=0&&o!==e&&n.push(o);return n.unshift(e),n})(e,20);for(let e=0;e<o.length;e++){let s=Ur(o[e]);if(t(s)){r=s,n=o[e];break}}return[r,n]})(t[e],Hr.get(e));return r?Wr.get(e)(r):null},Qr=(e,t,r,n)=>{if(T.dev){let o=n;n&&(o=Dr(n)),Y(`%c${e}%c %c${r[0]}`,...(e=>[`background-color:${e};color:#fff;padding:0 0.3em`,"",`color:${e};text-decoration:underline`])(t),r[1]||"","\n=>",o)}},Vr=async(e,t,r)=>{try{for(let[n,o]of r){let r=!1;if(("string"===o.type&&o.key===t||"regexp"===o.type&&o.key.test(t))&&(r=!0),r){const t=o.handles;for(let r of t)await r(e)}}}catch(e){Y(e)}},Xr=e=>{const t=e.replace(/{num}/g,"\\d+").replace(/{uuid}/g,"[a-f\\d]{8}-([a-f\\d]{4}-){3}[a-f\\d]{12}");return new RegExp(`^${t}$`)},Zr={get:new Map,post:new Map,patch:new Map,put:new Map},en=(e,t,r)=>{if(!r.has(e)){const t=e.includes("{")||e.includes("("),n={handles:[],key:t?Xr(e):e,type:t?"regexp":"string"};r.set(e,n)}const n=r.get(e);Array.isArray(t)?n.handles=n.handles.concat(t):n.handles.push(t)},tn=(e,t,r)=>{if(Array.isArray(e))for(let n of e)en(n,t,r);else en(e,t,r)},rn=e=>(t,r)=>{const n=Zr[e];if(r)tn(t,r,n);else{const e=t;for(let[t,r]of e)tn(t,r,n)}},nn={get:rn("get"),post:rn("post"),patch:rn("patch"),put:rn("put")};async function on(){const e=await Yr("REQUEST"),t=e.get;e.get=async function(...e){const r=e[0],n=await t.apply(this,e);if(!r)return n;let o=n.body;return Qr("GET","#009688",e,o),await Vr(o,r,Zr.get),n};const r=e.patch;e.patch=async function(...e){const t=e[0],n=await r.apply(this,e);if(!t)return n;let o=n.body;return Qr("PATCH","#8BC34A",e,o),await Vr(o,t,Zr.patch),n};const n=e.post;e.post=async function(...e){const t=e[0],r=await n.apply(this,e);if(!t)return r;let o=r.body;return Qr("POST","#3F51B5",e,o),await Vr(o,t,Zr.post),r};const o=e.put;e.put=async function(...e){const t=e[0],r=await o.apply(this,e);if(!t)return r;let n=r.body;return Qr("PUT","#9C27B0",e,n),await Vr(n,t,Zr.put),r}}var sn=n((function(e,t){e.exports=function e(){var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},r=!t.document&&!!t.postMessage,n=r&&/blob:/i.test((t.location||{}).protocol),o={},s=0,a={parse:function(r,n){var i=(n=n||{}).dynamicTyping||!1;if(E(i)&&(n.dynamicTypingFunction=i,i={}),n.dynamicTyping=i,n.transform=!!E(n.transform)&&n.transform,n.worker&&a.WORKERS_SUPPORTED){var c=function(){if(!a.WORKERS_SUPPORTED)return!1;var r,n,i=(r=t.URL||t.webkitURL||null,n=e.toString(),a.BLOB_URL||(a.BLOB_URL=r.createObjectURL(new Blob(["(",n,")();"],{type:"text/javascript"})))),c=new t.Worker(i);return c.onmessage=v,c.id=s++,o[c.id]=c}();return c.userStep=n.step,c.userChunk=n.chunk,c.userComplete=n.complete,c.userError=n.error,n.step=E(n.step),n.chunk=E(n.chunk),n.complete=E(n.complete),n.error=E(n.error),delete n.worker,void c.postMessage({input:r,config:n,workerId:c.id})}var h=null;return"string"==typeof r?h=n.download?new u(n):new d(n):!0===r.readable&&E(r.read)&&E(r.on)?h=new p(n):(t.File&&r instanceof File||r instanceof Object)&&(h=new l(n)),h.stream(r)},unparse:function(e,t){var r=!1,n=!0,o=",",s="\r\n",i='"',c=i+i,u=!1,l=null;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(o=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(i=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");l=t.columns}void 0!==t.escapeChar&&(c=t.escapeChar+i)}}();var d=new RegExp(f(i),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,u);if("object"==typeof e[0])return h(l||p(e[0]),e,u)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:p(e.data[0])),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function p(e){if("object"!=typeof e)return[];var t=[];for(var r in e)t.push(r);return t}function h(e,t,r){var a="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var i=Array.isArray(e)&&0<e.length,c=!Array.isArray(t[0]);if(i&&n){for(var u=0;u<e.length;u++)0<u&&(a+=o),a+=m(e[u],u);0<t.length&&(a+=s)}for(var l=0;l<t.length;l++){var d=i?e.length:t[l].length,p=!1,h=i?0===Object.keys(t[l]).length:0===t[l].length;if(r&&!i&&(p="greedy"===r?""===t[l].join("").trim():1===t[l].length&&0===t[l][0].length),"greedy"===r&&i){for(var f=[],v=0;v<d;v++){var g=c?e[v]:v;f.push(t[l][g])}p=""===f.join("").trim()}if(!p){for(var y=0;y<d;y++){0<y&&!h&&(a+=o);var w=i&&c?e[y]:y;a+=m(t[l][w],y)}l<t.length-1&&(!r||0<d&&!h)&&(a+=s)}}return a}function m(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);var n=e.toString().replace(d,c);return"boolean"==typeof r&&r||"function"==typeof r&&r(e,t)||Array.isArray(r)&&r[t]||function(e,t){for(var r=0;r<t.length;r++)if(-1<e.indexOf(t[r]))return!0;return!1}(n,a.BAD_DELIMITERS)||-1<n.indexOf(o)||" "===n.charAt(0)||" "===n.charAt(n.length-1)?i+n+i:n}}};if(a.RECORD_SEP=String.fromCharCode(30),a.UNIT_SEP=String.fromCharCode(31),a.BYTE_ORDER_MARK="\ufeff",a.BAD_DELIMITERS=["\r","\n",'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!r&&!!t.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=10485760,a.RemoteChunkSize=5242880,a.DefaultDelimiter=",",a.Parser=m,a.ParserHandle=h,a.NetworkStreamer=u,a.FileStreamer=l,a.StringStreamer=d,a.ReadableStreamStreamer=p,t.jQuery){var i=t.jQuery;i.fn.parse=function(e){var r=e.config||{},n=[];return this.each((function(e){if("INPUT"!==i(this).prop("tagName").toUpperCase()||"file"!==i(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var o=0;o<this.files.length;o++)n.push({file:this.files[o],inputElem:this,instanceConfig:i.extend({},r)})})),o(),this;function o(){if(0!==n.length){var t,r,o,c=n[0];if(E(e.before)){var u=e.before(c.file,c.inputElem);if("object"==typeof u){if("abort"===u.action)return t=c.file,r=c.inputElem,o=u.reason,void(E(e.error)&&e.error({name:"AbortError"},t,r,o));if("skip"===u.action)return void s();"object"==typeof u.config&&(c.instanceConfig=i.extend(c.instanceConfig,u.config))}else if("skip"===u)return void s()}var l=c.instanceConfig.complete;c.instanceConfig.complete=function(e){E(l)&&l(e,c.file,c.inputElem),s()},a.parse(c.file,c.instanceConfig)}else E(e.complete)&&e.complete()}function s(){n.splice(0,1),o()}}}function c(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=w(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,r){if(this.isFirstChunk&&E(this._config.beforeFirstChunk)){var o=this._config.beforeFirstChunk(e);void 0!==o&&(e=o)}this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e;this._partialLine="";var i=this._handle.parse(s,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var c=i.meta.cursor;this._finished||(this._partialLine=s.substring(c-this._baseIndex),this._baseIndex=c),i&&i.data&&(this._rowCount+=i.data.length);var u=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(n)t.postMessage({results:i,workerId:a.WORKER_ID,finished:u});else if(E(this._config.chunk)&&!r){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);i=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),this._completed||!u||!E(this._config.complete)||i&&i.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),u||i&&i.meta.paused||this._nextChunk(),i}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):n&&this._config.error&&t.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),c.call(this,e),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),r||(t.onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var n in e)t.setRequestHeader(n,e[n])}if(this._config.chunkSize){var o=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+o)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}r&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var r=t.statusText||e;this._sendError(new Error(r))}}function l(e){var t,r;(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),c.call(this,e);var n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var o=Math.min(this._start+this._config.chunkSize,this._input.size);e=r.call(e,this._start,o)}var s=t.readAsText(e,this._config.encoding);n||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function d(e){var t;c.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,r=this._config.chunkSize;return r?(e=t.substring(0,r),t=t.substring(r)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function p(e){c.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){c.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){c.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=b((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=b((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=b((function(){this._streamCleanUp(),n=!0,this._streamData("")}),this),this._streamCleanUp=b((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function h(e){var t,r,n,o=Math.pow(2,53),s=-o,i=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)(e[-+]?\d+)?\s*$/,c=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,u=this,l=0,d=0,p=!1,h=!1,v=[],g={data:[],errors:[],meta:{}};if(E(e.step)){var y=e.step;e.step=function(t){if(g=t,S())_();else{if(_(),0===g.data.length)return;l+=t.data.length,e.preview&&l>e.preview?r.abort():(g.data=g.data[0],y(g,u))}}}function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function _(){if(g&&n&&(I("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines)for(var t=0;t<g.data.length;t++)b(g.data[t])&&g.data.splice(t--,1);return S()&&function(){if(g)if(Array.isArray(g.data[0])){for(var t=0;S()&&t<g.data.length;t++)g.data[t].forEach(r);g.data.splice(0,1)}else g.data.forEach(r);function r(t){E(e.transformHeader)&&(t=e.transformHeader(t)),v.push(t)}}(),function(){if(!g||!e.header&&!e.dynamicTyping&&!e.transform)return g;function t(t,r){var n,o=e.header?{}:[];for(n=0;n<t.length;n++){var s=n,a=t[n];e.header&&(s=n>=v.length?"__parsed_extra":v[n]),e.transform&&(a=e.transform(a,s)),a=k(s,a),"__parsed_extra"===s?(o[s]=o[s]||[],o[s].push(a)):o[s]=a}return e.header&&(n>v.length?I("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+n,d+r):n<v.length&&I("FieldMismatch","TooFewFields","Too few fields: expected "+v.length+" fields but parsed "+n,d+r)),o}var r=1;return!g.data.length||Array.isArray(g.data[0])?(g.data=g.data.map(t),r=g.data.length):g.data=t(g.data,0),e.header&&g.meta&&(g.meta.fields=v),d+=r,g}()}function S(){return e.header&&0===v.length}function k(t,r){return n=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[n]&&(e.dynamicTyping[n]=e.dynamicTypingFunction(n)),!0===(e.dynamicTyping[n]||e.dynamicTyping)?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&(function(e){if(i.test(e)){var t=parseFloat(e);if(s<t&&t<o)return!0}return!1}(r)?parseFloat(r):c.test(r)?new Date(r):""===r?null:r):r;var n}function I(e,t,r,n){var o={type:e,code:t,message:r};void 0!==n&&(o.row=n),g.errors.push(o)}this.parse=function(o,s,i){var c=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var r=new RegExp(f(t)+"([^]*?)"+f(t),"gm"),n=(e=e.replace(r,"")).split("\r"),o=e.split("\n"),s=1<o.length&&o[0].length<n[0].length;if(1===n.length||s)return"\n";for(var a=0,i=0;i<n.length;i++)"\n"===n[i][0]&&a++;return a>=n.length/2?"\r\n":"\r"}(o,c)),n=!1,e.delimiter)E(e.delimiter)&&(e.delimiter=e.delimiter(o),g.meta.delimiter=e.delimiter);else{var u=function(t,r,n,o,s){var i,c,u,l;s=s||[",","\t","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var d=0;d<s.length;d++){var p=s[d],h=0,f=0,v=0;u=void 0;for(var g=new m({comments:o,delimiter:p,newline:r,preview:10}).parse(t),y=0;y<g.data.length;y++)if(n&&b(g.data[y]))v++;else{var w=g.data[y].length;f+=w,void 0!==u?0<w&&(h+=Math.abs(w-u),u=w):u=w}0<g.data.length&&(f/=g.data.length-v),(void 0===c||h<=c)&&(void 0===l||l<f)&&1.99<f&&(c=h,i=p,l=f)}return{successful:!!(e.delimiter=i),bestDelimiter:i}}(o,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);u.successful?e.delimiter=u.bestDelimiter:(n=!0,e.delimiter=a.DefaultDelimiter),g.meta.delimiter=e.delimiter}var l=w(e);return e.preview&&e.header&&l.preview++,t=o,r=new m(l),g=r.parse(t,s,i),_(),p?{meta:{paused:!0}}:g||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,r.abort(),t=E(e.chunk)?"":t.substring(r.getCharIndex())},this.resume=function(){u.streamer._halted?(p=!1,u.streamer.parseChunk(t,!0)):setTimeout(u.resume,3)},this.aborted=function(){return h},this.abort=function(){h=!0,r.abort(),g.meta.aborted=!0,E(e.complete)&&e.complete(g),t=""}}function f(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t,r=(e=e||{}).delimiter,n=e.newline,o=e.comments,s=e.step,i=e.preview,c=e.fastMode,u=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(u=e.escapeChar),("string"!=typeof r||-1<a.BAD_DELIMITERS.indexOf(r))&&(r=","),o===r)throw new Error("Comment character same as delimiter");!0===o?o="#":("string"!=typeof o||-1<a.BAD_DELIMITERS.indexOf(o))&&(o=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var l=0,d=!1;this.parse=function(e,a,p){if("string"!=typeof e)throw new Error("Input must be a string");var h=e.length,m=r.length,v=n.length,g=o.length,y=E(s),w=[],b=[],_=[],S=l=0;if(!e)return F();if(c||!1!==c&&-1===e.indexOf(t)){for(var k=e.split(n),I=0;I<k.length;I++){if(_=k[I],l+=_.length,I!==k.length-1)l+=n.length;else if(p)return F();if(!o||_.substring(0,g)!==o){if(y){if(w=[],T(_.split(r)),N(),d)return F()}else T(_.split(r));if(i&&i<=I)return w=w.slice(0,i),F(!0)}}return F()}for(var x=e.indexOf(r,l),A=e.indexOf(n,l),j=new RegExp(f(u)+f(t),"g"),C=e.indexOf(t,l);;)if(e[l]!==t)if(o&&0===_.length&&e.substring(l,l+g)===o){if(-1===A)return F();l=A+v,A=e.indexOf(n,l),x=e.indexOf(r,l)}else{if(-1!==x&&(x<A||-1===A)){if(!(x<C)){_.push(e.substring(l,x)),l=x+m,x=e.indexOf(r,l);continue}var R=L(x,C,A);if(R&&void 0!==R.nextDelim){x=R.nextDelim,C=R.quoteSearch,_.push(e.substring(l,x)),l=x+m,x=e.indexOf(r,l);continue}}if(-1===A)break;if(_.push(e.substring(l,A)),z(A+v),y&&(N(),d))return F();if(i&&w.length>=i)return F(!0)}else for(C=l,l++;;){if(-1===(C=e.indexOf(t,C+1)))return p||b.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:l}),D();if(C===h-1)return D(e.substring(l,C).replace(j,t));if(t!==u||e[C+1]!==u){if(t===u||0===C||e[C-1]!==u){-1!==x&&x<C+1&&(x=e.indexOf(r,C+1)),-1!==A&&A<C+1&&(A=e.indexOf(n,C+1));var M=O(-1===A?x:Math.min(x,A));if(e[C+1+M]===r){_.push(e.substring(l,C).replace(j,t)),e[l=C+1+M+m]!==t&&(C=e.indexOf(t,l)),x=e.indexOf(r,l),A=e.indexOf(n,l);break}var P=O(A);if(e.substring(C+1+P,C+1+P+v)===n){if(_.push(e.substring(l,C).replace(j,t)),z(C+1+P+v),x=e.indexOf(r,l),C=e.indexOf(t,l),y&&(N(),d))return F();if(i&&w.length>=i)return F(!0);break}b.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:l}),C++}}else C++}return D();function T(e){w.push(e),S=l}function O(t){var r=0;if(-1!==t){var n=e.substring(C+1,t);n&&""===n.trim()&&(r=n.length)}return r}function D(t){return p||(void 0===t&&(t=e.substring(l)),_.push(t),l=h,T(_),y&&N()),F()}function z(t){l=t,T(_),_=[],A=e.indexOf(n,l)}function F(e){return{data:w,errors:b,meta:{delimiter:r,linebreak:n,aborted:d,truncated:!!e,cursor:S+(a||0)}}}function N(){s(F()),w=[],b=[]}function L(n,o,s){var a={nextDelim:void 0,quoteSearch:void 0},i=e.indexOf(t,o+1);if(o<n&&n<i&&(i<s||-1===s)){var c=e.indexOf(r,i);if(-1===c)return a;i<c&&(i=e.indexOf(t,i+1)),a=L(c,i,s)}else a={nextDelim:n,quoteSearch:o};return a}},this.abort=function(){d=!0},this.getCharIndex=function(){return l}}function v(e){var t=e.data,r=o[t.workerId],n=!1;if(t.error)r.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){n=!0,g(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(E(r.userStep)){for(var a=0;a<t.results.data.length&&(r.userStep({data:t.results.data[a],errors:t.results.errors,meta:t.results.meta},s),!n);a++);delete t.results}else E(r.userChunk)&&(r.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!n&&g(t.workerId,t.results)}function g(e,t){var r=o[e];E(r.userComplete)&&r.userComplete(t),r.terminate(),delete o[e]}function y(){throw new Error("Not implemented.")}function w(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=w(e[r]);return t}function b(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return n&&(t.onmessage=function(e){var r=e.data;if(void 0===a.WORKER_ID&&r&&(a.WORKER_ID=r.workerId),"string"==typeof r.input)t.postMessage({workerId:a.WORKER_ID,results:a.parse(r.input,r.config),finished:!0});else if(t.File&&r.input instanceof File||r.input instanceof Object){var n=a.parse(r.input,r.config);n&&t.postMessage({workerId:a.WORKER_ID,results:n,finished:!0})}}),(u.prototype=Object.create(c.prototype)).constructor=u,(l.prototype=Object.create(c.prototype)).constructor=l,(d.prototype=Object.create(d.prototype)).constructor=d,(p.prototype=Object.create(c.prototype)).constructor=p,a}()}));const an=e=>{try{return sn.parse(e.replace(/^\ufeff/,""),{header:!0}).data}catch(e){return console.log(e),{}}},cn=(e,t="EMPTY")=>e.sort((e,r)=>{let n=e,o=r;return"EMPTY"!==t&&(n=e[t],o=r[t]),o||(o=""),n||(n=""),o.length>n.length?1:n.length>o.length?-1:0});let un=null;const ln=async e=>{if(!un)try{const e=localStorage.getItem("sczh:data");if(!e)return!1;un=JSON.parse(e)}catch(e){return console.error(e),!1}if(X(T.version,un.version))return un=null,localStorage.removeItem("sczh:data"),!1;let t=e;/(\.csv|\.json)/.test(e)||(t=e+".csv");const{hashes:r}=await $r,n=r[t],o=un.hashes[t];return o&&o===n?un[e]:(un.hashes[t]=n,!1)},dn=(e,t)=>{un&&un.hashes||(un={hashes:T.hashes,version:T.version});let r=e;/(\.csv|\.json)/.test(e)||(r=e+".csv");const n=T.hashes[r];n&&(un.hashes[r]=n),un[e]=t;const o=JSON.stringify(un);try{localStorage.setItem("sczh:data",o)}catch(e){console.error(e)}},pn=new Map,hn=async(e,t)=>{const r=t||e;if(pn.has(e))return pn.get(e);let n=await ln(e);n||(n=await Br(`/data/${r}.csv`),dn(e,n));const o=an(n);return pn.set(e,o),o},fn=e=>{const t=new Map;let r=!1;const{name:n,path:o,ignoreTrans:s}=e,a=e.keys||{},i=a.text||"text",c=a.trans||"trans";return async()=>{if(!r){const a=await hn(n,o);e.sort&&cn(a,e.sort),a.forEach(e=>{const r=q(e[i]),n=G(q(e[c],!0));r&&(n||s)&&t.set(r,n)}),r=!0}return t}},mn=(e,t=[])=>{let r=e.replace(/\./g,"\\.").replace(/\$num/g,"([+-+-]?[0-90-9]{1,10}\\.?[0-90-9]{0,4}[万億]?)").replace(/\$percent/g,"([+-+-]?[0-90-9]{1,10}\\.?[0-90-9]{0,4}?[%%])").replace(/\$unknown/g,"([\\s\\S]+)").replace(/\$uk/g,"([\\s\\S]+)").replace(/\$sep/g,"[\\s\\S]?");return t.forEach(e=>{r=r.replace(e.re,e.exp),e.re.lastIndex=0}),new RegExp(r,"gi")},vn=fn({name:"name",keys:{text:"name"}}),gn=fn({name:"etc/idol-name",keys:{text:"name"}});let yn=null;const wn=async(e=!0)=>{if(yn)return yn;const t=await gn();yn=new Map;for(let[r,n]of t){const t=r.split(" "),o=n.split(" ");e&&yn.set(t[1],o[1]),yn.set(t.join(""),o.join("")),yn.set(r,n)}return yn};let bn=null;const En=async()=>{if(bn)return bn;const e=await vn(),t=await wn();return bn=new Map([...e,...t]),bn},_n=(t,r)=>{let n=null;const o=((e,...t)=>{let r=null,n=null;return async()=>(n||(n=e(...t)),r||(r=await n),r)})((e=>{let t=!1,r=new Map,n=[],o=new Map;return async()=>{if(!t){const s=await hn(e),a=await wn(),i=new Map,c=new Map,u=new Map,l=new Map([["name",[...a.keys()]]]),d=[];cn(s,"text").forEach(e=>{if(null==e?void 0:e.text){const t=q(e.text),r=G(q(e.trans,!0)),n=J(e.type);t&&r&&("text"===n?c.set(t,r):n&&"exp"!==n?(l.has(n)||l.set(n,[]),l.get(n).push((e=>e.replace(/\?/g,"\\?").replace(/\./g,"\\.").replace(/\*/g,"\\*").replace(/\+/g,"\\+").replace(/\(/g,"\\(").replace(/\)/g,"\\)"))(t)),i.set(t,r)):u.set(t.replace(/\[/g,"\\[").replace(/\]/g,"\\]"),r))}});for(let[e,t]of l)d.push({re:new RegExp("\\$"+e,"g"),exp:`(${t.join("|")})`});for(let[e,t]of u){const r=mn(e,d);o.set(r,t)}r=new Map([...c,...i,...a]),n=[i,a],t=!0}return{expMap:o,wordMaps:n,textMap:r}}})(t)),s=e=>async t=>(n||(n=await o(),r&&await r()),e&&e(t),n),a=e=>e.map(e=>{const t=e[1];return Array.isArray(t)?e[1]=t.map(e=>s(e)):e[1]=s(t),e}),i=(e,t)=>{if(!t){let t=[];return e.forEach((r,n)=>{let o=r.match(/([++]+)$/);(null==o?void 0:o[1])?(t.push(o[1]),e[n]=r.replace(/[++]+$/,"")):t.push("")}),t}e.forEach((r,n)=>{e[n]=r+t[n]})};return{api:{get(e){nn.get(a(e))},post(e){nn.post(a(e))},put(e){nn.put(a(e))},patch(e){nn.patch(a(e))}},transItem:(t,r,o=n)=>{if(null==t?void 0:t[r]){let n=t[r].split("/");n.forEach((e,t)=>{let r=i(n);ne(n,t,o),i(n,r)});let s=n.join("/");s!==t[r]&&(t[r]=e(s,!0))}},getTransItem:e=>(t,r)=>{e(t,r,n)},ensureData:s()}},{api:Sn,transItem:kn}=_n("skill"),In=e=>{var t,r;e&&(null===(t=e.skillEffects)||void 0===t||t.forEach(e=>{kn(e,"effectName"),kn(e,"effectDescription")}),null===(r=e.rivalMemoryAppealEffects)||void 0===r||r.forEach(e=>{kn(e,"effectName"),kn(e,"effectDescription")}))},xn=(e,t=!1)=>{e&&(kn(e,"comment"),kn(e,"name"),t&&In(e),e.linkSkill&&(kn(e.linkSkill,"comment"),kn(e.linkSkill,"name"),t&&In(e.linkSkill)))},An=e=>{e&&e.forEach(e=>{kn(e,"releaseConditions"),kn(e.passiveSkills,"comment"),kn(e.passiveSkills,"name"),xn(e.skill),xn(e.concertActiveSkill),e.activeSkills&&e.activeSkills.forEach(e=>{xn(e)})})},jn=e=>{e.forEach(e=>{xn(e)})},Cn=(e,t=!1)=>{var r,n,o;let s=e.userProduceIdol;s&&(null===(r=s.activeSkills)||void 0===r||r.forEach(e=>{xn(e)}),null===(n=s.passiveSkills)||void 0===n||n.forEach(e=>{xn(e)}),null===(o=s.limitBreaks)||void 0===o||o.forEach(e=>{xn(e)}),t&&An(s.skillPanels))},Rn=e=>{e.forEach(e=>{xn(e.skill,!0)})},Mn=e=>{e&&e.forEach(e=>{var t,r,n;null===(t=e.userFesDeck)||void 0===t||t.userFesDeckMembers.forEach(e=>{e.userFesIdol.activeSkills.forEach(e=>{In(e)})}),null===(r=e.userRaidDeck)||void 0===r||r.userRaidDeckMembers.forEach(e=>{e.userFesIdol.activeSkills.forEach(e=>{xn(e,!0)})}),null===(n=e.rival)||void 0===n||n.rivalSkills.forEach(e=>{In(e)})})},Pn=e=>{An(e.idol.skillPanels),jn(e.idol.memoryAppeals)},Tn=e=>{var t,r,n;An(e.supportIdol.skillPanels),null===(t=e.supportIdol)||void 0===t||null===(r=t.supportIdolActiveSkill)||void 0===r||null===(n=r.activeSkills)||void 0===n||n.forEach(e=>{kn(e,"comment"),kn(e,"name")})},On=e=>{const t=e.userFesIdol;t.activeSkills.forEach(e=>{xn(e)}),xn(t.memoryAppeal),t.passiveSkills.forEach(e=>{kn(e,"comment"),kn(e,"name")})},Dn=On,zn=e=>{var t,r,n,o;e.userProduceSupportIdols.forEach(e=>{An(e.skillPanels)}),Cn(e,!0),null===(t=e.userProduceLimitedSkills)||void 0===t||t.forEach(e=>{xn(e.passiveSkills),xn(e.skill)}),An(null===(r=e.userProduceIdol)||void 0===r||null===(n=r.userIdol)||void 0===n||null===(o=n.idol)||void 0===o?void 0:o.skillPanels)},Fn=e=>{var t;e.userFesIdol&&(e.userFesIdol.activeSkills.forEach(e=>{xn(e,!0)}),xn(e.userFesIdol.memoryAppeal,!0),null===(t=e.userFesIdol.passiveSkills)||void 0===t||t.forEach(e=>{kn(e,"comment"),kn(e,"name"),In(e)}))},Nn=e=>{var t,r;null===(t=e.userFesDeck)||void 0===t||t.userFesDeckMembers.forEach(Fn),null===(r=e.userRaidDeck)||void 0===r||r.userRaidDeckMembers.forEach(Fn),Rn(e.judges),Mn(e.userFesRivals),Mn(e.userFesRaidRivals),In(e.feverActiveSkill)},Ln=e=>{var t;null===(t=e.fanActiveSkills)||void 0===t||t.forEach(e=>{xn(e,!0)}),e.userProduceSupportIdols.forEach(e=>{xn(e.activeSkill,!0)});let r=e.userProduceIdol;r.activeSkills.forEach(e=>{xn(e,!0)}),xn(r.memoryAppeal,!0),r.passiveSkills.forEach(e=>{xn(e,!0)});let n=e.produceAudition||e.produceConcert;Rn(n.judges),(e=>{e.forEach(e=>{In(e.rivalMemoryAppeal),e.rivalSkills.forEach(e=>{In(e)})})})(n.rivals),In(e.feverActiveSkill)},$n=e=>{if(e.gameData)try{let t=JSON.parse(e.gameData);t.produceAudition||t.produceConcert?Ln(t):(t.userFesDeck||t.userRaidDeck)&&Nn(t),e.gameData=JSON.stringify(t)}catch(e){log(e)}},Bn=e=>{e.userProduceIdol.activeSkills.forEach(e=>{xn(e)})},Un=e=>{var t,r,n;null===(t=e.userProduceReporterEvent)||void 0===t||null===(r=t.produceReporterEventResult)||void 0===r||null===(n=r.produceReporterEventSkills)||void 0===n||n.forEach(e=>{kn(e,"name")})};Sn.get([[["userSupportIdols/{num}","userSupportIdols/statusMax","produceTeachingSupportIdols/{num}"],[Tn]],["userProduce(Teaching)?SupportIdols/{num}",[e=>{var t,r,n,o;An(e.skillPanels),null===(t=e.userSupportIdol)||void 0===t||null===(r=t.supportIdol)||void 0===r||null===(n=r.supportIdolActiveSkill)||void 0===n||null===(o=n.activeSkills)||void 0===o||o.forEach(e=>{kn(e,"comment"),kn(e,"name")})}]],["userReserveSupportIdols/userSupportIdol/{num}",[e=>{var t,r,n;An(e.supportIdol.skillPanels),null===(t=e.supportIdol)||void 0===t||null===(r=t.supportIdolActiveSkill)||void 0===r||null===(n=r.activeSkills)||void 0===n||n.forEach(e=>{kn(e,"comment"),kn(e,"name")})}]],[["userIdols/{num}","userIdols/statusMax","produceTeachingIdols/{num}"],[Pn]],[["userProduce(Teaching)?Idols/{num}","userProduceTeachingIdol"],e=>{e.activeSkills.forEach(e=>{xn(e)}),jn(e.userIdol.idol.memoryAppeals)}],["userReserveIdols/userIdol/{num}",e=>{An(e.idol.skillPanels),jn(e.idol.memoryAppeals)}],["userFesIdols/{num}",On],[["userProduces/skillPanels","userProduceTeachings/skillPanels"],zn],["fes(Match)?Concert/actions/resume",[$n]],["earthUsers/{uuid}/userFesIdols/{num}",Dn],["userRaidDecks",e=>{e.userRaidDecks.forEach(e=>{e.userRaidDeckMembers.forEach(e=>{var t;null===(t=e.userFesIdol)||void 0===t||t.activeSkills.forEach(e=>{xn(e)})})})}],["userProduceAbilities",Bn],["userProduces",[Un]]]),Sn.post([["userIdols/{num}/produceExSkills/{num}/actions/set",Pn],[["userProduce(Teaching)?s/skillPanels/{num}","userProduces/limitedSkills/{num}"],zn],["userSupportIdols/{num}/produceExSkills/{num}/actions/set",[Tn]],[["produces/actions/resume","produces/actions/finish","produceTeachings/resume"],[e=>{e.gameData||Cn(e)},$n]],[["produces/actions/resume","produces/actions/next"],[Un]],["fes(Match|Raid)?Concert/actions/start",[Nn]],["fes(Match)?Concert/actions/resume",[$n]],["fesRaidConcert/actions/resume",[e=>{if(e.gameState&&e.gameState.game_data)try{let t=JSON.parse(e.gameState.game_data);t.userRaidDeck&&Nn(t),e.gameState.game_data=JSON.stringify(t)}catch(e){log(e)}}]],[["produce(Teaching)?s/({num}/audition|concert)/actions/start","produceTeachings/(auditions|concerts)/start"],[Ln]],["userProduceAbilities",Bn]]),Sn.patch([["userFesDecks",e=>{e.userFesDecks.forEach(e=>{e.userFesDeckMembers.forEach(Fn)})}],["userSupportIdols/{num}",e=>{Tn(e.userSupportIdol)}]]);const{api:Hn,transItem:Wn}=_n("etc/ex-skill"),Jn=e=>{Wn(e,"name"),Wn(e,"description")},qn=e=>{e.userIdolProduceExSkills.forEach(e=>{Jn(e.produceExSkill)})},Gn=e=>{var t;null===(t=e.userSupportIdolProduceExSkills)||void 0===t||t.forEach(e=>{Jn(e.produceExSkill)})},Kn=e=>{const t=e.userFesIdol;t.userFesIdolProduceExSkills.forEach(e=>{Jn(e.produceExSkill)}),t.userFesSupportIdols.forEach(e=>{e.userFesSupportIdolProduceExSkills.forEach(e=>{Jn(e.produceExSkill)})})},Yn=Kn;Hn.get([[["userIdols/produceExSkillTop","userSupportIdols/produceExSkillTop","userIdols/{num}/produceExSkillTop","userSupportIdols/{num}/produceExSkillTop"],e=>{var t,r,n,o,s,a;null===(t=e.userIdols)||void 0===t||t.forEach(e=>{var t;null===(t=e.userIdolProduceExSkills)||void 0===t||t.forEach(e=>{Jn(e.produceExSkill)})}),null===(r=e.userSupportIdols)||void 0===r||r.forEach(e=>{var t;null===(t=e.userSupportIdolProduceExSkills)||void 0===t||t.forEach(e=>{Jn(e.produceExSkill)})}),null===(n=e.userIdol)||void 0===n||null===(o=n.userIdolProduceExSkills)||void 0===o||o.forEach(e=>{Jn(e.produceExSkill)}),null===(s=e.userSupportIdol)||void 0===s||null===(a=s.userSupportIdolProduceExSkills)||void 0===a||a.forEach(e=>{Jn(e.produceExSkill)}),e.userProduceExSkills.forEach(e=>{var t;Jn(e.produceExSkill),Jn(null===(t=e.produceExSkillUpgrade)||void 0===t?void 0:t.produceExSkill)})}],[["userSupportIdols/{num}","userSupportIdols/statusMax","produceTeachingSupportIdols/{num}"],[Gn]],["userProduce(Teaching)?SupportIdols/{num}",[e=>{var t;null===(t=e.userProduceSupportIdolProduceExSkills)||void 0===t||t.forEach(e=>{Jn(e.produceExSkill)})}]],[["userIdols/{num}","userIdols/statusMax","produceTeachingIdols/{num}"],[qn]],[["userProduce(Teaching)?Idols/{num}","userProduceTeachingIdol"],e=>{e.userProduceIdolProduceExSkills.forEach(e=>{Jn(e.produceExSkill)})}],["userFesIdols/{num}",Kn],["earthUsers/{uuid}/userFesIdols/{num}",Yn],["userProducerSkills/summaries",e=>{e.forEach(e=>{Jn(e)})}]]),Hn.post([["userIdols/{num}/produceExSkills/{num}/actions/set",qn],["userSupportIdols/{num}/produceExSkills/{num}/actions/set",[Gn]],["produces/actions/result",[e=>{e.produceExSkillRewards.forEach(e=>{Jn(e.produceExSkill)})}]],["business/actions/finish",e=>{e.slots.forEach(e=>{e.businessProduceExSkillRewards.forEach(e=>{Jn(e.produceExSkill)})})}],["userProduceExSkills/actions/upgrade",e=>{Jn(e.produceExSkill)}]]);const{api:Qn,transItem:Vn}=_n("support-skill"),Xn=e=>{null==e||e.forEach(e=>{Vn(e,"description"),Vn(e,"name")})},Zn=e=>{var t,r;const n=null!==(t=e.userSupportIdol)&&void 0!==t?t:e;Xn(n.acquiredSupportSkills),Xn(n.supportSkills),Xn(null===(r=n.supportIdol)||void 0===r?void 0:r.supportSkills)};Qn.get([[["userSupportIdols/{num}","userSupportIdols/statusMax","produceTeachingSupportIdols/{num}"],[Zn]],["userProduce(Teaching)?SupportIdols/{num}",[Zn]],["userReserveSupportIdols/userSupportIdol/{num}",[Zn]],["produces/{num}/decks",e=>{var t;null===(t=e.userSupportIdols)||void 0===t||t.forEach(e=>{var t;Xn(null===(t=e.supportIdol)||void 0===t?void 0:t.supportSkills)})}]]),Qn.post([["produces/{num}/actions/ready",[e=>{e.userDecks.forEach(e=>{e.userSupportIdols.forEach(e=>{var t;Xn(null===(t=e.supportIdol)||void 0===t?void 0:t.supportSkills)})})}]],["userSupportIdols/{num}/produceExSkills/{num}/actions/set",[Zn]],["produces/actions/(resume|next)",[Zn]],[["produceTeachings/resume","produceTeachings/next"],Zn]]),Qn.patch([["userSupportIdols/{num}",Zn],["produces/{num}/produceItem/consume",e=>{Xn(e.supportSkills)}]]);const{api:eo,transItem:to}=_n("etc/idea-note"),ro=e=>{var t;e&&(to(e,"title"),(e=>{to(e,"title"),to(e,"comment")})(e.produceIdeaNoteCompleteBonus),null===(t=e.produceIdeaNoteExtraBonuses)||void 0===t||t.forEach(e=>{to(e,"comment"),to(e,"condition")}))},no=e=>{var t,r;null===(t=e.ideaNoteResult)||void 0===t||null===(r=t.seasonClearBonusIdeaNotes)||void 0===r||r.forEach(e=>{ro(e)})};eo.get([["userProduceIdeaNotes",e=>{e.forEach(e=>{ro(e.produceIdeaNote)})}]]),eo.post([["produces/actions/(resume|next)",[e=>{var t;null===(t=e.userProduceIdeaNotes)||void 0===t||t.forEach(e=>{ro(e.produceIdeaNote)})},no]],["produces/actions/act",[e=>{var t,r,n;null===(t=e.produceEvents)||void 0===t||t.forEach(e=>{var t;null===(t=e.produceIdeaNotes)||void 0===t||t.forEach(e=>{ro(e)})});let o=null===(r=e.lessonResult)||void 0===r||null===(n=r.userProduceIdeaNote)||void 0===n?void 0:n.produceIdeaNote;ro(o)}]],["produces/actions/endWeek",no]]),eo.patch([["userProduceIdeaNotes/228681479/actions/select",e=>{ro(e.userProduceIdeaNote.produceIdeaNote)}]]);const{api:oo,transItem:so}=_n("etc/grad-skill"),ao=e=>{var t;e&&(so(e,"comment"),so(e,"name"),so(e,"acquireComment"),so(e,"releaseComment"),null===(t=e.produceAbilityAcquireConditionComments)||void 0===t||t.forEach(e=>{so(e,"name")}))},io=e=>{e.userFesIdol.abilities.forEach(e=>{ao(e)})},co=io,uo=e=>{var t,r;const n=e=>{e.userFesIdol.abilities.forEach(e=>{ao(e)}),e.userFesIdol.concertAbilities.forEach(e=>{ao(e)})};null===(t=e.userFesDeck)||void 0===t||t.userFesDeckMembers.forEach(n),null===(r=e.userRaidDeck)||void 0===r||r.userRaidDeckMembers.forEach(n)},lo=e=>{var t,r;const n=e.userProduceIdol;n&&(null===(t=n.abilities)||void 0===t||t.forEach(e=>{ao(e)}),null===(r=n.concertAbilities)||void 0===r||r.forEach(e=>{ao(e)}))},po=e=>{if(e.gameData)try{let t=JSON.parse(e.gameData);t.produceAudition||t.produceConcert?lo(t):(t.userFesDeck||t.userRaidDeck)&&uo(t),e.gameData=JSON.stringify(t)}catch(e){log(e)}},ho=e=>{e.userProduceIdol.abilities.forEach(e=>{ao(e)}),e.userProduceAbilities.forEach(e=>{ao(e.ability)})};oo.get([["userFesIdols/{num}",io],["fes(Match)?Concert/actions/resume",[po]],["earthUsers/{uuid}/userFesIdols/{num}",co],["userProduceAbilities",ho],[["userProduceAreas"],e=>{var t;null===(t=e.abilities)||void 0===t||t.forEach(e=>{ao(e)})}]]),oo.post([[["produces/actions/resume","produces/actions/finish","produceTeachings/resume"],[e=>{e.gameData||((e,t=!1)=>{var r;let n=e.userProduceIdol;n&&(null===(r=n.abilities)||void 0===r||r.forEach(e=>{ao(e)}))})(e)},po]],["fes(Match|Raid)?Concert/actions/start",[uo]],["fes(Match)?Concert/actions/resume",[po]],["fesRaidConcert/actions/resume",[e=>{if(e.gameState&&e.gameState.game_data)try{let t=JSON.parse(e.gameState.game_data);t.userRaidDeck&&uo(t),e.gameState.game_data=JSON.stringify(t)}catch(e){log(e)}}]],[["produce(Teaching)?s/({num}/audition|concert)/actions/start","produceTeachings/(auditions|concerts)/start"],[lo]],["produces/({num}/audition|concert)/actions/(start|finish)",e=>{var t,r;null===(t=e.concertEvent)||void 0===t||null===(r=t.abilities)||void 0===r||r.forEach(e=>{so(e,"name")})}],["userProduceAbilities",ho]]);const{api:fo,transItem:mo}=_n("etc/landing-point"),vo=e=>{e&&(mo(e,"comment"),mo(e,"name"),mo(e,"acquireComment"),mo(e,"releaseComment"))},go=e=>{mo(e,"title"),e.produceMusicAssignmentClearBonuses.forEach(e=>{mo(e,"title")})},yo=e=>{var t,r;mo(e.feverActiveSkill,"comment"),e.produceMusicProficiencyBonuses.forEach(e=>{var t;mo(e,"description"),e.ability&&(vo(e.ability),null===(t=e.ability.produceAbilityAcquireConditionComments)||void 0===t||t.forEach(e=>{mo(e,"name")}))}),null===(t=e.produceMusicAssignments)||void 0===t||t.forEach(go),null===(r=e.produceMusicProficiencyJudgeStarBonuses)||void 0===r||r.forEach(e=>{mo(e,"description")})},wo=e=>{var t,r,n;yo(e.produceMusic),null===(t=e.userProduceMusicAssignments)||void 0===t||t.forEach(e=>{go(e.produceMusicAssignment)}),null===(r=e.allUserProduceMusicAssignments)||void 0===r||r.forEach(e=>{go(e.produceMusicAssignment)}),null===(n=e.judgeStarBonuses)||void 0===n||n.forEach(e=>{mo(e,"description")})},bo=e=>{var t,r;null===(t=e.userProduceMusicProficiencies)||void 0===t||t.forEach(wo),null===(r=e.activatedProduceMusicAssignmentBonuses)||void 0===r||r.forEach(e=>{var t;null===(t=e.produceMusicAssignmentClearBonuses)||void 0===t||t.forEach(e=>{mo(e,"title")})})},Eo=e=>{var t;vo(e),null===(t=e.skillEffects)||void 0===t||t.forEach(e=>{mo(e,"effectDescription"),mo(e,"effectName")})},_o=e=>{var t,r,n,o;null===(t=e.produceMusic)||void 0===t||null===(r=t.judgeStarBonuses)||void 0===r||r.forEach(e=>{mo(e,"description")}),null===(n=e.userProduceIdol)||void 0===n||null===(o=n.abilities)||void 0===o||o.forEach(Eo),mo(e.feverActiveSkill,"comment")};fo.get([[["userProduceAreas","produceMusics"],e=>{var t;null===(t=e.produceMusics)||void 0===t||t.forEach(yo)}],["userProduces",[bo]],["userFesIdols/{num}",e=>{var t,r;null===(t=e.userFesIdol)||void 0===t||null===(r=t.abilities)||void 0===r||r.forEach(Eo)}]]),fo.post([[["produces/actions/resume","produces/actions/next"],[bo]],["produces/actions/resume",e=>{if(e.gameData)try{let t=JSON.parse(e.gameData);t.produceAudition||t.produceConcert?_o(t):t.userFesDeck||t.userRaidDeck,e.gameData=JSON.stringify(t)}catch(e){log(e)}}],["userProduceMusicProficiencies",e=>{wo(e.userProduceMusicProficiency)}],["produces/concert/actions/start",_o]]),fo.patch([["userProduceMusicAssignments/{num}",e=>{go(e.produceMusicAssignment)}]]);const{api:So,getTransItem:ko,ensureData:Io}=_n("item"),xo=ko((t,r,n)=>{if(null==t?void 0:t[r]){let o=t[r].split("\n");o.forEach((e,t)=>{ne(o,t,n)});let s=o.join("\n");s!==t[r]&&(t[r]=e(s,!0))}}),Ao=ko(ne),jo=ko((e,t,r)=>{if(null==e?void 0:e[t]){let n=e[t];if(ne(e,t,r),e[t]===n){e[t]=e[t].replace("\n","");let o=e[t];ne(e,t,r),o===e[t]&&(e[t]=n)}}}),Co=["produceItem","recoveryItem","exchangeItem","lotteryTicket","evolutionItem","gashaTicket","scoutTicket","enhancementItem"],Ro=e=>{var t;null==e||null===(t=e.shopMerchandises)||void 0===t||t.forEach(e=>{var t;Ao(e,"title"),jo(e,"shopTitle"),xo(e,"comment"),null===(t=e.shopContents)||void 0===t||t.forEach(e=>{Ao(e.content,"name"),xo(e.content,"comment")})})},Mo=e=>{let t=e;e.userProduceItems&&(t=e.userProduceItems),Array.isArray(t)&&t.forEach(e=>{const t=e[Co[0]]||e[Co[1]]||e[Co[2]]||e[Co[3]]||e[Co[4]]||e[Co[5]]||e[Co[6]]||e[Co[7]];Ao(t,"name"),xo(t,"comment")})},Po=e=>{e.accumulatedPresent.userGameEventAccumulatedPresents.forEach(e=>{e.gameEventAccumulatedPresent.rewards.forEach(e=>{Ao(e.content,"name")})})},To=e=>{var t;null==e||null===(t=e.activeProduceItems)||void 0===t||t.forEach(e=>{Ao(e.produceItem,"name"),xo(e.produceItem,"comment")})};So.get([[["userShops","userIdolPieceShops"],e=>{e&&(Array.isArray(e.userShops)&&e.userShops.forEach(e=>{Ro(e)}),Array.isArray(e.userEventShops)&&e.userEventShops.forEach(e=>{Ro(e.userShop)}))}],[["userRecoveryItems","userProduceItems","userExchangeItems","userLotteryTickets","userEvolutionItems","userGashaTickets","userScoutTickets","userEnhancementItems"],Mo],[["userPresents\\?limit={num}","userPresentHistories\\?limit={num}"],e=>{Array.isArray(e)&&e.forEach(e=>{Ao(e.content,"name"),Ao(e,"note")})}],["userProduces",To],["missionEvents/{num}/top",Po],["gashaGroups",e=>{var t;null===(t=e.gashaGroups)||void 0===t||t.forEach(e=>{var t;const r=null===(t=e.userGashaTicket)||void 0===t?void 0:t.gashaTicket;Ao(r,"name"),xo(r,"comment")})}],["businessTop",e=>{var t;null===(t=e.userRecoveryItems)||void 0===t||t.forEach(e=>{Ao(e.recoveryItem,"name")})}]]),So.post([["myPage",e=>{To(e.userProduce)}],["(produceMarathons|fesMarathons|trainingEvents)/{num}/top",Po],["userShops/actions/purchase",e=>{Ao(null==e?void 0:e.shopMerchandise,"title"),xo(null==e?void 0:e.shopMerchandise,"comment")}],["produces/{num}/actions/ready",Mo],["userPresents/{num}/actions/receive",e=>{Ao(e.receivedPresent,"Name")}],["userMissions/{num}/actions/receive",e=>{Ao(e.userMission.mission.missionReward.content,"name")}],["userLoginBonuses",e=>{e.userLoginBonuses.forEach(e=>{e.loginBonus.sheets.forEach(e=>{e.rewards.forEach(e=>{Ao(e.content,"name")})})}),e.userTotalBonuses.forEach(e=>{e.rewards.forEach(e=>{Ao(e.content,"name")})})}],["fesTop",e=>{e.lastRankingResult&&Array.isArray(e.lastRankingResult.fesMatchGradeRewards)&&e.lastRankingResult.fesMatchGradeRewards.forEach(e=>{Ao(e.content,"name")})}],["userSelectLoginBonuses/{num}",e=>{e.rewards.forEach(e=>{Ao(e.content,"name")})}],["gashas/{num}/actions/draw",e=>{var t;null===(t=e.acquiredStampRewards)||void 0===t||t.forEach(e=>{Ao(e.content,"name")})}]]),So.patch([["produces/{num}/produceItem/consume",e=>{var t;const r=null===(t=e.consumeProduceItem)||void 0===t?void 0:t.produceItem;r&&(Ao(r,"name"),xo(r,"comment"))}]]);const{api:Oo,transItem:Do}=_n("mission",Io),zo=(e,t)=>{Do(e,t)||("name"===t?Ao(e,t):xo(e,t))},Fo=e=>{null==e||e.forEach(e=>{Do(e.mission,"title"),Do(e.mission,"comment"),e.mission.missionReward.content&&(zo(e.mission.missionReward.content,"name"),zo(e.mission.missionReward.content,"comment"))})},No=e=>{e.forEach(e=>{let t=e.fesRaidAccumulatedReward;Do(t,"title"),Do(t,"comment");let r=t.fesRaidAccumulatedRewardContent;(null==r?void 0:r.content)&&(zo(r.content,"name"),zo(r.content,"comment"))})},Lo=(e,t=!0)=>{null==e||e.forEach(e=>{let r=e.mission||e;if(Do(r,"title"),Do(r,"comment"),Do(r,"afterAchievedComment"),Do(r,"beforeAchievedComment"),t){let e=r.lectureMissionReward;(null==e?void 0:e.content)&&(zo(e.content,"name"),zo(e.content,"comment"))}})},$o=e=>{var t,r;Do(null===(t=e.userRecommendedMission)||void 0===t?void 0:t.mission,"comment"),Do(null===(r=e.userRecommendedMission)||void 0===r?void 0:r.mission,"title"),e.accumulatedPresent.userGameEventAccumulatedPresents.forEach(e=>{Do(e.gameEventAccumulatedPresent,"comment"),Do(e.gameEventAccumulatedPresent,"title")})},Bo=e=>{var t;null===(t=e.teachingHints)||void 0===t||t.forEach(e=>{var t,r;null===(t=e.userProduceHints)||void 0===t||t.forEach(e=>{Do(e.produceTeachingHint,"title")}),null===(r=e.userProduceTeachingHints)||void 0===r||r.forEach(e=>{Do(e.produceTeachingHint,"title")})})},Uo=e=>{Lo(e.lectureMissions)},Ho=e=>{var t;null===(t=e.userIdolRoad)||void 0===t||t.idolRoad.idolRoadRewards.forEach(e=>{zo(e.content,"name"),zo(e.content,"comment")})};Oo.get([["userMissions",e=>{var t;Fo(e.dailyUserMissions),Fo(e.weeklyUserMissions),null===(t=e.eventUserMissions)||void 0===t||t.forEach(e=>{Fo(null==e?void 0:e.userMissions)}),Fo(e.normalUserMissions),Fo(e.specialUserMissions),Fo(e.fesMatchRankingUserMissions)}],["fesRaidEvents/{num}/rewards",e=>{No(e.fesRaidBestScoreRewards),No(e.fesRaidLapRewards),No(e.fesRaidPointRewards)}],["userProduces",[Bo]],["userBeginnerMissions/top",Uo],["idolRoads/top",e=>{var t;Lo(e.userMissions,!1),null===(t=e.userIdols)||void 0===t||t.forEach(Ho)}],["missionEvents/{num}/top",[$o]],["producerDesk/rewards",e=>{e.producerLevelRewards.forEach(e=>{Do(e,"title"),zo(e.content,"name")})}]]),Oo.post([["myPage",[e=>{Fo(e.reportUserMissions)},e=>{let t=e.beginnerMission;t&&(t.clearedLectureMission&&Lo([t.clearedLectureMission]),t.progressLectureMission&&Lo([t.progressLectureMission]))},e=>{var t;(e=>{if(!e)return;const t=[];for(let r=0;r<e.length;r++){let n=e[r];Do(e,r),n===e[r]&&t.push(n)}T.dev&&t.length&&Y(t.join("\n"))})(null===(t=e.producerDesk)||void 0===t?void 0:t.messages)}]],["(produceMarathons|fesMarathons|trainingEvents)/{num}/top",[$o]],[["produceTeachings/resume","produceTeachings/next"],Bo],["userLectureMissions/{num}/actions/receive",Uo],["producerDesk/top",e=>{e.progresses.forEach(e=>{Do(e,"comment"),Do(e,"title")})}]]),Oo.put([["userIdolRoads",e=>{Ho(e.userIdol)}]]);const Wo=new Map,Jo=new Map,qo=new Map;let Go=!1;let Ko,Yo,Qo,Vo;const Xo=async()=>{Qo||(Qo=(async()=>{if(!Go){(await hn("title")).forEach(e=>{if(null==e?void 0:e.text){const t=q(e.text),r=q(e.trans,!0),n=J(e.type)||"text";t&&r&&t!==r&&("exp"===n?Jo.set(t,r):"text"===n&&Wo.set(t,r))}});for(let[e,t]of Jo){const r=mn(e);qo.set(r,t)}Go=!0}return{textMap:Wo,expMap:qo}})(),Vo=En()),Ko&&Yo||(Ko=await Qo,Yo=await Vo,Ko.wordMaps=[Yo])};let Zo=[];(window.unsafeWindow||window).printUnknowTitles=()=>Y(Zo.join("\n"));const es=new Map,ts=(e,t)=>{e&&w(t)&&(es.has(e)||es.set(e,t))},rs=(e={},t)=>{let r=e[t];ne(e,t,Ko),r===e[t]&&T.dev&&(e=>{if(!e)return;let t=V(e);Zo.includes(t)||Zo.push(t)})(r)},ns=e=>{e.forEach(e=>{rs(e,"name"),e.communications.forEach(e=>{rs(e,"name"),rs(e,"title"),ts(e.id,`${e.name}-${e.title}`)})})};nn.get([[["userSupportIdols/{num}","userSupportIdols/statusMax","produceTeachingSupportIdols/{num}"],async e=>{await Xo(),e.supportIdol.produceSupportIdolEvents.forEach(e=>{rs(e,"title"),ts(e.id,e.title)})}],[["userIdols/{num}","userIdols/statusMax","produceTeachingIdols/{num}"],async e=>{await Xo(),e.idol.produceAfterEvents.forEach(e=>{rs(e,"title"),ts(e.id,e.title)}),e.idol.produceIdolEvents.forEach(e=>{rs(e,"title"),ts(e.id,e.title)})}],[["characterAlbums","album/top"],async e=>{await Xo(),ns(e.gameEvents),ns(e.specialEvents)}]]),nn.post([["characterAlbums/characters/{num}",async e=>{await Xo(),e.albumCommunicationTitles.forEach(e=>{rs(e,"title")}),e.communications.forEach(e=>{rs(e,"title"),ts(e.communicationId,e.title)}),e.voices.forEach(e=>{rs(e,"title"),rs(e,"releasedConditionComment")})}],["produceMarathons/{num}/top",async e=>{await Xo(),e.releasedCommunications.forEach(e=>{rs(e,"name"),rs(e,"title"),ts(e.id,`${e.name}-${e.title}`)}),rs(e.gameEvent,"name")}]]);const os=async t=>{const r=await En();if(t.userProduceIdol){const n=t.userProduceIdol.userIdol.idol.character;r.has(n.name)&&(n.name=e(r.get(n.name))),r.has(n.firstName)&&(n.firstName=e(r.get(n.firstName)))}},ss=async e=>{var t;await Xo(),null===(t=e.produceEvents)||void 0===t||t.forEach(e=>{rs(e,"title"),ts(e.id,e.title)})};nn.get([["userProduceAreas",async e=>{var t;await Xo(),null===(t=e.produceHintSettings)||void 0===t||t.forEach(e=>{rs(e,"title")})}]]),nn.post([["myPage",async e=>{var t;await Xo(),rs(null==e||null===(t=e.userProduce)||void 0===t?void 0:t.produce,"title")}],["produces/actions/(resume|next)",[ss,os]],[["produces/actions/resume","produces/actions/finish","produceTeachings/resume"],ss],["produces/actions/act",ss],["produces/({num}/audition|concert)/actions/(start|finish)",os]]);const as=fn({name:"etc/noun-fix",keys:{trans:"fixed"},sort:"text",ignoreTrans:!0}),is=fn({name:"etc/caiyun-prefix",keys:{trans:"fixed"},sort:"text",ignoreTrans:!0}),cs=new Map,us=new Map;let ls=!1,ds=null;const ps=t=>{const r=an(t),n=new Map,o=ee();return r.forEach(t=>{const r=o(J(t.id)),s=q(t.text),a=q(t.trans,!0),i=J(t.name);s&&a&&(r&&!/^0+$/.test(r)&&"select"!==r?n.set(r,e(a)):"select"===r?n.set(s+"-select",e(a)):n.set(s,e(a))),r&&i&&"info"===r&&n.set("name",i)}),n},hs=async()=>{if(!ls){(await hn("comm-story")).forEach(e=>{if(null==e?void 0:e.text){const t=q(e.text),r=q(e.trans,!0);t&&r&&t!==r&&us.set(t,r)}}),ls=!0}return us};let fs=null,ms=!1;const vs=fn({name:"type-text"}),gs=async()=>{if(!ms){fs=await vs();const e=await hs(),t=await En();fs=new Map([...e,...fs,...t]),ms=!0}return fs},ys=!!window.GM_xmlhttpRequest,ws=(e,t={})=>{const{method:r="GET",headers:n,responseType:o="json",data:s,cors:a=!1,credentials:i}=t;return a?fetch(e,{body:s,headers:n,method:r,mode:"cors",credentials:i}).then(e=>e.json()):new Promise((t,a)=>{if(!ys)return a("GM_XHR MISSING");window.GM_xmlhttpRequest({method:r,url:e,headers:n,responseType:o,data:s,onload({status:e,responseText:r,statusText:n}){if(e>=200&&e<300)if("json"===o){const e=JSON.parse(r);t(e)}else t(r);else a(n)},onerror(e){a(e)}})})};var bs=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]},Es=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]},_s=function(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},Ss=function(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},ks=function(e,t){return[e[0]^t[0],e[1]^t[1]]},Is=function(e){return e=ks(e,[0,e[0]>>>1]),e=Es(e,[4283543511,3981806797]),e=ks(e,[0,e[0]>>>1]),e=Es(e,[3301882366,444984403]),e=ks(e,[0,e[0]>>>1])};let xs="",As="",js=!1;const Cs=()=>{let e="0123456789abcdefghijklmnopqrstuvwxyz",t="";for(let r=0;r<33;r++)t+=e[Math.floor(Math.random()*e.length)];xs=function(e,t){t=t||0;for(var r=(e=e||"").length%16,n=e.length-r,o=[0,t],s=[0,t],a=[0,0],i=[0,0],c=[2277735313,289559509],u=[1291169091,658871167],l=0;l<n;l+=16)a=[255&e.charCodeAt(l+4)|(255&e.charCodeAt(l+5))<<8|(255&e.charCodeAt(l+6))<<16|(255&e.charCodeAt(l+7))<<24,255&e.charCodeAt(l)|(255&e.charCodeAt(l+1))<<8|(255&e.charCodeAt(l+2))<<16|(255&e.charCodeAt(l+3))<<24],i=[255&e.charCodeAt(l+12)|(255&e.charCodeAt(l+13))<<8|(255&e.charCodeAt(l+14))<<16|(255&e.charCodeAt(l+15))<<24,255&e.charCodeAt(l+8)|(255&e.charCodeAt(l+9))<<8|(255&e.charCodeAt(l+10))<<16|(255&e.charCodeAt(l+11))<<24],a=Es(a,c),a=_s(a,31),a=Es(a,u),o=ks(o,a),o=_s(o,27),o=bs(o,s),o=bs(Es(o,[0,5]),[0,1390208809]),i=Es(i,u),i=_s(i,33),i=Es(i,c),s=ks(s,i),s=_s(s,31),s=bs(s,o),s=bs(Es(s,[0,5]),[0,944331445]);switch(a=[0,0],i=[0,0],r){case 15:i=ks(i,Ss([0,e.charCodeAt(l+14)],48));case 14:i=ks(i,Ss([0,e.charCodeAt(l+13)],40));case 13:i=ks(i,Ss([0,e.charCodeAt(l+12)],32));case 12:i=ks(i,Ss([0,e.charCodeAt(l+11)],24));case 11:i=ks(i,Ss([0,e.charCodeAt(l+10)],16));case 10:i=ks(i,Ss([0,e.charCodeAt(l+9)],8));case 9:i=ks(i,[0,e.charCodeAt(l+8)]),i=Es(i,u),i=_s(i,33),i=Es(i,c),s=ks(s,i);case 8:a=ks(a,Ss([0,e.charCodeAt(l+7)],56));case 7:a=ks(a,Ss([0,e.charCodeAt(l+6)],48));case 6:a=ks(a,Ss([0,e.charCodeAt(l+5)],40));case 5:a=ks(a,Ss([0,e.charCodeAt(l+4)],32));case 4:a=ks(a,Ss([0,e.charCodeAt(l+3)],24));case 3:a=ks(a,Ss([0,e.charCodeAt(l+2)],16));case 2:a=ks(a,Ss([0,e.charCodeAt(l+1)],8));case 1:a=ks(a,[0,e.charCodeAt(l)]),a=Es(a,c),a=_s(a,31),a=Es(a,u),o=ks(o,a)}return o=ks(o,[0,e.length]),s=ks(s,[0,e.length]),o=bs(o,s),s=bs(s,o),o=Is(o),s=Is(s),o=bs(o,s),s=bs(s,o),("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)+("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)}(t,31),localStorage.setItem("sczh:bid",xs)};try{xs=localStorage.getItem("sczh:bid")}catch(e){}xs||Cs();const Rs=async(e,t="ja")=>{if(await(async()=>{const e=await ws("https://api.interpreter.caiyunai.com/v1/page/auth",{cors:!0,method:"POST",headers:{"X-Authorization":"token "+Lr.data.cyweb_token,"Content-Type":"application/json"},data:JSON.stringify({browser_id:xs,device_id:"",os_type:"web",title:document.title,url:document.URL,user_id:""})});-1!==e.auth_type&&e.page_id?(js=!1,As=e.page_id):(js=!0,Cs())})(),js)return[];const r=await ws("https://api.interpreter.caiyunai.com/v1/page/translator",{cors:!0,method:"POST",headers:{"X-Authorization":"token "+Lr.data.cyweb_token,"Content-Type":"application/json"},data:JSON.stringify({cached:!0,os_type:"web",page_id:As,replaced:!0,request_id:xs||"",source:e,trans_type:t+"2zh",url:document.URL})});return r&&r.target?r.target.map(e=>e.target):[]},Ms=async e=>{try{let t=te("caiyuLimit");if(t&&Date.now()-t<36e5)return[];let[r,n]=(e=>{let t=[],r=e.map(e=>K(e));return r.forEach(e=>{let r=[...e].filter(e=>"\n"===e).length;t.push(r)}),[r.join("\n"),t]})(e),o=((e,t=4e3)=>{let r="",n=[],o=0;return e.split("\n").forEach(e=>{r+=e,o+=new Blob([e]).size,o>t?(n.push(r),o=0,r=""):r+="\n"}),r&&n.push(r.replace(/\n$/,"")),n})(r),s=(await Promise.all(o.map(e=>Rs(e.split("\n"))))).reduce((e,t)=>e.concat(t)),a=[];return((e,t,r)=>{t.forEach(t=>{let n=t,o="";for(;n>=0;){n--;let t=e.shift();w(t)&&(t||(t="……"),o+=t+"\n")}o&&r.push(o.slice(0,o.length-1))})})(s,n,a),a}catch(e){return"Caiyun api out of limit."===e.message&&te("caiyuLimit",Date.now()),Y(e),[]}},Ps=["text","select","comment","title","actionComment","actionComment2","reactionComment","resultLoseComment","resultStartComment","resultWinComment","characterComment","producerComment","comment1","comment2"],Ts=new Map,Os=async(r,n,o,s=!1)=>{if(!r.length)return;const a=await hs(),i=await gs(),{textInfo:c,textList:u}=((t,r,n)=>{const o=[],s=[];return t.forEach((t,a)=>{Ps.forEach(i=>{let c=K(t[i]);t[i]&&(r.has(c)?t[i]=e(r.get(c)):n.has(c)?t[i]=e(n.get(c)):(o.push({key:i,index:a}),s.push(c)))})}),{textInfo:o,textList:s}})(r,a,i);if(!c.length)return;const l=n||r;let d=!1,p=[];if(Ts.has(l))d=!0,p=Ts.get(l);else{let e=Lr.data.trans_api,t=[];if("on"===T.auto&&!s){if("caiyun"===e){let e=await(async e=>{const t=await is();return Z(e,t)})(u);t=await Ms(e)}p=await(async e=>{const t=await as();return Z(e,t)})(t)}Ts.set(l,p)}if(!d&&(T.dev||!n||o)){let e=[];u.forEach((t,r)=>{e.push([V(t),V(p[r])])});let r=Y;n&&!o||(r=Q);r(e.map(e=>e[1]?(e[1]=t(e[1]),e.join("\n")+"\n"):e[0]).join("\n"))}p.forEach((t,n)=>{let s=t;const{key:a,index:i}=c[n];"select"===a&&(s=((e,t)=>{if(e.length>t&&!e.includes("\n")){const t=Math.floor(e.length/2)+1;return e.slice(0,t)+"\n"+e.slice(t,e.length)}return e})(s,8)),s=s.replace(/"([^"]*)"/g,"“$1”").replace(/'([^']*)'/g,"“$1”").replace(/‘([^']+)'/g,"“$1”"),0!==n||o||(s+=" ☁️"),r[i][a]=e(s)}),(e=>{e.forEach(e=>{e.text&&!e.text.startsWith("")&&(e.text=""+e.text)})})(r)},Ds=async(e,t="comment")=>{if(!e)return;const r=e.map(e=>e[t]).join("").trim();await Os(e,r,!0)},zs=async(e,t="comment")=>{if(!e)return;const r=e.map(e=>e[t]).join("").trim();await Os(e,r,!0,!0)},Fs=["actionComment","actionComment2","reactionComment","resultLoseComment","resultStartComment","resultWinComment"],Ns=async e=>{try{if(e.produceAudition){let t=e.produceAudition.judges.map(e=>Fs.map(t=>e[t]||"").join("")).join("").trim();await Os(e.produceAudition.judges,t,!0)}if(e.produceConcert){let t=e.produceConcert.judges.map(e=>Fs.map(t=>e[t]||"").join("")).join("").trim();await Os(e.produceConcert.judges,t,!0)}e.produceConcertFanSkillComments&&await Ds(e.produceConcertFanSkillComments,"comment1")}catch(e){Y(e)}},Ls=async e=>{if(e.judges){let t=e.judges.map(e=>Fs.map(t=>e[t]||"").join("")).join("").trim();await Os(e.judges,t,!0)}},$s=async e=>{if(e.topCharacterReaction)try{const t=[...e.topCharacterReaction.moveReactions,...e.topCharacterReaction.skillReleasedReactions,...e.topCharacterReaction.touchExReactions,...e.topCharacterReaction.touchReactions,...e.topCharacterReaction.waitReactions];await Ds(t)}catch(e){Y(e)}},Bs=async e=>{let t=[...e.produceStaffComments||[],...e.produceStaffConcertComments||[],...e.produceStaffFailComments||[],...e.produceStaffSeasonComments||[]];await Ds(t)},Us=async e=>{if(e.gameData)try{let t=JSON.parse(e.gameData);t.judges?await Ls(t):await Ns(t),e.gameData=JSON.stringify(t)}catch(e){Y(e)}},Hs=async e=>{if(!e.characterComment)return;let t=[];t=t.concat(e.characterComment),await Ds(t)};nn.get([["userProduces",$s],["fes(Match)?Concert/actions/resume",Us]]),nn.post([["myPage",async e=>{try{let t=[];e.userHomeDeck.userHomeDeckAnimationMember&&(t=[...e.userHomeDeck.userHomeDeckAnimationMember.mypageComments]);let r=e.userHomeDeck.userHomeAnimationDeck.userHomeAnimationDeckMembers;r&&r.forEach(e=>{e.mypageComments.forEach(e=>{t.push(e)}),e.mypageConversations.forEach(e=>{e.mypageConversationComments.forEach(e=>{t.push(e)})})}),e.userHomeDeck.userHomeDeckMembers.length&&e.userHomeDeck.userHomeDeckMembers.forEach(e=>{e.mypageComments.forEach(e=>{t.push(e)})}),await zs(t)}catch(e){Y(e)}}],["fesTop",async e=>{if(e.userFesDeck)try{let t=[],r=e.userFesDeck.userFesDeckMembers;for(let e of r)e.fesTopCharacterReactions.forEach(e=>{t.push(e)});await Ds(t)}catch(e){Y(e)}}],["produces/actions/(resume|next)",[$s,Bs,Us,Hs,Ns,async e=>{try{var t;await Ds(null===(t=e.produceReporterEvent)||void 0===t?void 0:t.produceReporterEventAnswers,"comment2")}catch(e){Y(e)}}]],["produces/actions/endWeek",Bs],["produces/actions/act",async e=>{if(!e.lessonResult)return;let t=e.lessonResult;try{let e=[];t.produceActCutinComment&&(e=e.concat(t.produceActCutinComment)),t.produceRestBoostIdolComment&&(e=e.concat(t.produceRestBoostIdolComment)),t.produceRestBoostSupportIdolComment&&(e=e.concat(t.produceRestBoostSupportIdolComment)),t.produceRestComments&&(e=e.concat(t.produceRestComments)),await Ds(e)}catch(e){Y(e)}}],["fes(Match|Raid)?Concert/actions/start",Ls],["fes(Match)?Concert/actions/resume",Us],["fesRaidConcert/actions/resume",async e=>{if(e.gameState&&e.gameState.game_data)try{let t=JSON.parse(e.gameState.game_data);t.judges&&await Ls(t),e.gameState.game_data=JSON.stringify(t)}catch(e){Y(e)}}],["produces/actions/result",async e=>{try{let t=e.characterTrustLevelUpComments;await Ds(t)}catch(e){Y(e)}}],["produces/({num}/audition|concert)/actions/(start|finish)",[Ns,Hs]],["userProduceHelperSupportIdols",async e=>{try{let t=e.characterComment+e.producerComment;await Os([e],t,!0)}catch(e){Y(e)}}]]);nn.get("gashas/{num}/redraws",async e=>{const t=[];e.forEach(e=>{e.comment&&t.push(e.comment)}),await zs(t)}),nn.post([["characterAlbums/characters/{num}",async e=>{const t=[];e.produceIdols.forEach(e=>{e.comment&&t.push(e.comment)}),await zs(t)}],["gashas/{num}/actions/draw",async e=>{var t;const r=[];null===(t=e.gashaDraws)||void 0===t||t.forEach(e=>{e.comment&&r.push(e.comment)}),await zs(r)}]]);nn.post("characterAlbums/characters/{num}",async e=>{if(e.voices){const t=[];e.voices.forEach(e=>{e.characterTrustLevelComment&&t.push(e.characterTrustLevelComment)}),await zs(t)}});const Ws=new Map;let Js=!1;const qs=["nameKana","unit","age","bloodType","birthday","starSign","height","weight","figure","arm","place","hobby","specialty","cv"],Gs=async()=>{if(!Js){(await hn("profile")).forEach(t=>{if(null==t?void 0:t.id){const r=q(t.id);if(r)if("label"===r){const n=q(t.nameKana).split("|");Ws.set(r,new Map(qs.map((t,r)=>[t,e(J(n[r]))])))}else{for(let r in t)t[r]=e(q(t[r]));Ws.set(r,t)}}}),Js=!0}return Ws},Ks=async t=>{const r=await Gs();await(async t=>{const r=await wn();r.has(t.name)&&(t.name=e(r.get(t.name))),r.has(t.firstName)&&(t.firstName=r.get(t.firstName))})(t);const n=r.get(t.id);for(let e in n)"id"!==e&&t[e]&&("unit"===e?t.unit.name=n[e]:t[e]=n[e])};nn.post("characterAlbums/characters/{num}",async e=>{await Ks(e),profileKey1()}),nn.get("userIdols/{num}",async e=>{const t=e.idol.character;await Ks(t)}),nn.get("userSupportIdols/{num}",async e=>{const t=e.supportIdol.character;await Ks(t)}),nn.get("userFesIdols/{num}",async e=>{const t=e.userFesIdol.idol.character;await Ks(t)});const Ys=new Map;let Qs=!1;let Vs=null;const Xs=["concert.skill.betweenString","concert.skill.appealString"];async function Zs(){const t=await Yr("PHRASE");if(t){Vs=await(async(e=!1)=>{if(!Qs){(await hn("phrase")).forEach(t=>{if(null==t?void 0:t.id){const r=q(t.id),n=q(t.trans,!0);r&&(e?Ys.set(r,t.trans):n&&Ys.set(r,n))}}),Qs=!0}return Ys})();for(let[r,n]of Vs)t[r]=Xs.includes(r)?n:e(n)}}let ea=!1,ta=null;const ra=fn({name:"common"});let na=new Map,oa=new Map;const sa=[],aa=e=>{e&&e.fontFamily&&(e.fontFamily===z.HEITI_JA?Reflect.set(e,"fontFamily",z.HEITI_TRANS):e.fontFamily===z.YUAN_JA&&Reflect.set(e,"fontFamily",z.YUAN_TRANS))},ia=(e,t,r)=>{let n=e,o=K(e);return t.has(o)?(n=""+t.get(o),aa(r)):e.startsWith("")||(e=>{e&&e.fontFamily&&(e.fontFamily===z.HEITI_TRANS?Reflect.set(e,"fontFamily",z.HEITI_JA):e.fontFamily===z.YUAN_TRANS&&Reflect.set(e,"fontFamily",z.YUAN_JA))})(r),n},ca=(e,t,r=!1)=>{if(!w(e))return e;let n=e;return e.startsWith("")?aa(t):e.trim()&&(r?(n=ia(e,oa,t),n===e&&(e=>{sa.push(e),T.dev,setTimeout(()=>sa.shift(),1e4)})(e)):(e=>{let t=!1;return sa.forEach(r=>{r.startsWith(e)&&(t=!0)}),t})(e)||e.startsWith("")||(n=ia(e,na,t))),n};async function ua(){const e=await Yr("AOBA");try{na=await(async()=>{if(!ea){ta=await ra();const e=await wn();ta=new Map([...e,...ta]),ea=!0}return ta})(),oa=await gs()}catch(e){}const t=e.Text.prototype.typeText;e.Text.prototype.typeText=function(...e){const r=e[0];return e[0]=ca(r,this.style,!0),t.apply(this,e)};const r=e.Text.prototype.updateText;e.Text.prototype.updateText=function(e){if(this.localStyleID!==this._style.styleID&&(this.dirty=!0,this._style.styleID),this.dirty||!e){T.dev,0;const t=ca(this._text,this._style);return Reflect.set(this,"_text",t),r.call(this,e)}}}const la=new Map;let da=!1;let pa=null;let ha=null;const fa=()=>ha||(ha=(async()=>{if(pa)return pa;try{const e=await fetch("https://comic.shiny.fun/4ko.json?t="+Math.floor(Date.now()/36e5)),t=await e.json();pa=new Map(t)}catch(e){pa=new Map}return pa})(),ha);nn.get([[["comics"],async t=>{await fa(),t.comics.forEach(t=>{const r=parseInt(t.id);if(pa.has(r)){const n=pa.get(r).title;n&&(t.title=e(n))}})}]]);let ma=null;const va=async()=>(ma||(ma=(async()=>{if(!da){(await hn("image")).forEach(e=>{if(null==e?void 0:e.name){const t=J(e.name),r=J(e.url),n=J(e.version)||"1";t&&r&&la.set(t,{url:r,version:n})}}),da=!0}return la})()),await ma);let ga="";(()=>{try{ga=sessionStorage.getItem("sczh:res-name")}catch(e){}})();(window.unsafeWindow||window).queryImageName=e=>{try{sessionStorage.setItem("sczh:res-name",e)}catch(e){}};let ya=!1;async function wa(){const e=await Yr("AOBA"),{isSupportedWebP:t,toWebPUrl:r}=await Yr("WEBP");if(ya)return;e.loaders.Resource.prototype=Object.assign({},e.loaders.Resource.prototype);const n=e.loaders.Resource.prototype._loadElement;e.loaders.Resource.prototype._loadElement=async function(e){T.dev&&"image"===e&&ga&&this.url.includes(ga)&&(Q("%c查询到的图片:","color:#66ccff"),Q(this.url,this.name));try{const n=await va();if("image"===e){if(n.has(this.name)){const e=n.get(this.name);if(this.url.endsWith("v="+e.version)){const n="image/"+e.url;let o=n;t()&&!o.startsWith("tips/")&&(o=r(o)),this.url=`${T.origin}/data/${o}?v=${T.hashes[n]}`,this.crossOrigin=!0}else Y(this.name,this.url)}await async function(e){if(/^images\/content\/comics\/(web|limited|special)\/page\/[^_]+_\d+\.jpg/.test(e.name)){const t=parseInt(e.name.match(/page\/[^_]+_(\d+)\.jpg/)[1]);await fa(),pa.has(t)&&(e.url="https://comic.shiny.fun/4ko/"+pa.get(t).name,e.crossOrigin=!0)}}(this)}}catch(e){Y(e)}return n.call(this,e)},ya=!0}var ba=function(){return a.Date.now()},Ea=/\s/;var _a=function(e){for(var t=e.length;t--&&Ea.test(e.charAt(t)););return t},Sa=/^\s+/;var ka=function(e){return e?e.slice(0,_a(e)+1).replace(Sa,""):e};var Ia=function(e){return"symbol"==typeof e||y(e)&&"[object Symbol]"==v(e)},xa=/^[-+]0x[0-9a-f]+$/i,Aa=/^0b[01]+$/i,ja=/^0o[0-7]+$/i,Ca=parseInt;var Ra=function(e){if("number"==typeof e)return e;if(Ia(e))return NaN;if(ye(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ye(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=ka(e);var r=Aa.test(e);return r||ja.test(e)?Ca(e.slice(2),r?2:8):xa.test(e)?NaN:+e},Ma=Math.max,Pa=Math.min;var Ta=function(e,t,r){var n,o,s,a,i,c,u=0,l=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var r=n,s=o;return n=o=void 0,u=t,a=e.apply(s,r)}function f(e){return u=e,i=setTimeout(v,t),l?h(e):a}function m(e){var r=e-c;return void 0===c||r>=t||r<0||d&&e-u>=s}function v(){var e=ba();if(m(e))return g(e);i=setTimeout(v,function(e){var r=t-(e-c);return d?Pa(r,s-(e-u)):r}(e))}function g(e){return i=void 0,p&&n?h(e):(n=o=void 0,a)}function y(){var e=ba(),r=m(e);if(n=arguments,o=this,c=e,r){if(void 0===i)return f(c);if(d)return clearTimeout(i),i=setTimeout(v,t),h(c)}return void 0===i&&(i=setTimeout(v,t)),a}return t=Ra(t)||0,ye(r)&&(l=!!r.leading,s=(d="maxWait"in r)?Ma(Ra(r.maxWait)||0,t):s,p="trailing"in r?!!r.trailing:p),y.cancel=function(){void 0!==i&&clearTimeout(i),u=0,n=c=o=i=void 0},y.flush=function(){return void 0===i?a:g(ba())},y};const Oa=`\n <style>\n #sczh-story-tool {\n position: absolute;\n display: none;\n background: #ffffff;\n border-radius: 24px;\n box-sizing: border-box;\n font-family: sczh-yuanti;\n align-items: center;\n justify-content: center;\n color: #ff6499;\n text-shadow: 0 0 6px #fff;\n cursor: pointer;\n user-select: none;\n width: 100px;\n height: 100px;\n font-size: 32px;\n border: 7px solid transparent;\n border-image: url(${T.origin}/data/image/border.png);\n border-image-slice: 7;\n transform-origin: top right;\n transition: opacity 0.3s;\n }\n .story-tool-btns {\n width: 100%;\n height: 100%;\n display: none;\n }\n .story-tool-btns .btn-download-sczh,\n .story-tool-btns label {\n flex: 1;\n height: 100%;\n background: #fff;\n display: flex;\n box-sizing: content-box;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n color: #c0aade;\n text-shadow: 0 0 6px #fff;\n }\n .story-tool-btns .btn-download-sczh:hover {\n color: #9f66ec;\n }\n .story-tool-btns label {\n color: rgb(242, 156, 199);\n border-right: 1px solid #c9c9c9;\n }\n #sczh-story-tool .btn-close-sczh {\n height: 25px;\n width: 50px;\n background: rgba(0, 0, 0, 0.58);\n color: #fff;\n letter-spacing: 2px;\n position: absolute;\n right: -25px;\n top: -20px;\n border-radius: 4px;\n display: none;\n align-items: center;\n justify-content: center;\n z-index: 1;\n font-family: sczh-heiti;\n font-size: 15px;\n }\n #sczh-story-tool:hover {\n width: 200px;\n }\n #sczh-story-tool:hover .story-tool-btns {\n display: flex;\n }\n #sczh-story-tool:hover .btn-close-sczh {\n display: flex;\n }\n #sczh-story-tool:hover > .text-sczh {\n display: none;\n }\n #sczh-story-tool .btn-close-sczh:hover {\n background: rgba(0, 0, 0, 0.9);\n }\n #sczh-story-tool.blur {\n opacity: 0.2;\n }\n .story-tool-btns label:hover {\n color: #f270b1;\n }\n .story-tool-btns .btn-download-sczh:hover,\n .story-tool-btns label:hover {\n background-color: #f7f7f7;\n }\n </style>\n <div id="sczh-story-tool"><span class="text-sczh">剧情</span>\n <span id="btn-close-sczh" class="btn-close-sczh">关闭</span>\n <input type="file" style="display:none" id="ipt-preview-sczh" multiple accept=".csv">\n <div class="story-tool-btns">\n <label for="ipt-preview-sczh">预览</label>\n <div id="btn-download-sczh" class="btn-download-sczh">下载</div>\n </div>\n </div>\n `;let Da=!1;const za=e=>{if(Da)return;Da=!0,document.body.insertAdjacentHTML("beforeend",Oa);const t=document.getElementById("sczh-story-tool"),r=Ta(()=>{const r=[.017,.22],n=window.innerHeight,o=window.innerWidth;let s=n,a=o,i=0,c=0;n/o>9/16?(s=9*o/16,i=(n-s)/2):(a=16*n/9,c=(o-a)/2),t.style.right=Math.floor(c+r[0]*a)+"px",t.style.top=Math.floor(i+r[1]*s)+"px",t.style.transform=`scale(${(s/900).toFixed(3)})`,e.name?t.style.display="flex":t.style.display="none"},300);r(),window.addEventListener("resize",r);document.getElementById("btn-download-sczh").addEventListener("click",(function(){if(e.name){((e,t)=>{const r=document.createElement("a");r.download=t,r.style.display="none";const n=new Blob([e],{type:"text/csv"});r.href=URL.createObjectURL(n),document.body.appendChild(r),r.click(),document.body.removeChild(r)})(sn.unparse(e.list),e.filename)}}));document.getElementById("btn-close-sczh").addEventListener("click",(function(){t.style.display="none",T.story="normal",$()}));let n;document.getElementById("ipt-preview-sczh").addEventListener("change",(function(){const t=this.files;t.length&&t.forEach(t=>{const r=new FileReader;r.onload=t=>{const r=t.target.result,n=ps(r);if(n.has("name")){const t=n.get("name");e.preview.set(t,n),(e=>{const t=[...e].slice(-5).map(e=>(e[1]=[...e[1]],e));sessionStorage.setItem("sczh:preview",JSON.stringify(t))})(e.preview),alert(`导入${t}成功`)}},r.readAsText(t)})})),t.addEventListener("mouseenter",()=>{clearTimeout(n),t.classList.remove("blur")});const o=()=>{clearTimeout(n),n=setTimeout(()=>{t.classList.add("blur")},5e3)};t.addEventListener("mouseleave",o),o()},Fa=new Map,Na=new Map;let La=!1;const $a=async()=>{if(!La){(await hn("speaker-icon")).forEach(e=>{let{name:t,id:r,type:n}=e;t=J(t),r=J(r),n=J(n),t&&r&&("sub"===n?Na.set(t,r):Fa.set(t,r))}),La=!0}return{iconMap:Fa,subIconMap:Na}};let Ba=null;let Ua=!1;const Ha=async()=>{if(Ua)return;Ua=!0;const e=await Yr("SPEAKER");if(!e)return Q("Speaker-icon module not found.");const{iconMap:r,subIconMap:n}=await $a(),o=e.getSubCharacterBackLogIconId,s=e.getCharacterBackLogIconId;e.getSubCharacterBackLogIconId=function(e){const r=t(e);return n.has(r)?n.get(r):o.call(this,e)},e.getCharacterBackLogIconId=function(e){const n=t(e);return r.has(n)?r.get(n):s.call(this,e)}},Wa=(e,t)=>{let r=e,n="";return/[0-90-9]$/.test(e)&&(n=e.match(/([0-90-9])$/)[1],r=e.slice(0,e.length-1)),t.has(r)?t.get(r)+n:e},Ja=async t=>{if(t.speaker){await Ha();const r=await(async()=>(Ba||(Ba=En()),await Ba))();let n=J(t.speaker);if(r.has(n))return t.speaker=e(r.get(n));["&","&"].forEach(e=>{n=((e,t,r)=>{const n=e.split(t);for(let e=0;e<n.length;e++)n[e]=Wa(n[e],r);return n.join(t)})(n,e,r)}),n!==t.speaker&&(t.speaker=e(n))}},qa={name:"",filename:"",list:"",preview:new Map};let Ga=!1;const Ka=async()=>{const t=await Yr("SCENARIO"),r=t.load;t.load=async function(...t){const n=await r.apply(this,t),o=t[0];if(!o)return n;if(T.dev&&o.includes("/assets/json/")&&Qr("STORY","#ad37c2",t,n),o.includes("/produce_events/")||o.includes("/produce_communications/")||o.includes("/produce_communications_promises/")||o.includes("/produce_communication_promise_results/")||o.includes("/game_event_communications/")||o.includes("/special_communications/")||o.includes("/mypage_communications/")||o.includes("/produce_communication_cheers/")||o.includes("/produce_communication_auditions/")||o.includes("/produce_communication_televisions/"))try{if(!Array.isArray(n))return n;const t=o.replace(/^\/assets\/json\//,"");let r;if("edit"===T.story&&(((e,t)=>{const r=t.replace(".json",""),n=(e=>{var t;const r=e.match(/\/(\d+)$/);return null!==(t=null==r?void 0:r[1])&&void 0!==t?t:""})(r);let o=es.get(n)||r.replace(/\//g,"_");o=o.replace("","");const s=[];e.forEach(e=>{let t=J(V(e.text));(null==t?void 0:t.trim())?s.push({id:e.id||"0000000000000",name:e.speaker||"",text:t,trans:""}):e.select&&s.push({id:"select",name:"",text:J(V(e.select)),trans:""})}),s.push({id:"info",name:t,text:"",trans:""}),s.push({id:"译者",name:"",text:"",trans:""}),qa.name=t,qa.filename=o+".csv",qa.list=s})(n,t),za(qa)),(()=>{if(Ga)return;Ga=!0;const e=sessionStorage.getItem("sczh:preview");if(e)try{const t=JSON.parse(e),r=new Map(t);for(let[e,t]of r)r.set(e,new Map(t));qa.preview=r}catch(e){Y(e)}})(),r=qa.preview.has(t)?qa.preview.get(t):await(async e=>{if(!ds){let e=await ln("story.json");if(e)ds=new Map(JSON.parse(e));else{const e=await Br("/story.json");ds=new Map(e),dn("story.json",JSON.stringify(ds))}}if(ds.has(e)){if(cs.has(e))return cs.get(e);{const t=ds.get(e),r=await Br(`/data/story/${t}.csv`),n=ps(r);return cs.set(e,n),n}}return!1})(t),r){((t,r,n)=>{const o=ee();t.forEach(t=>{if(t.text){const s=o(t.id),a=K(t.text);r.has(a)?t.text=r.get(a):s&&r.has(""+s)?t.text=r.get(""+s):n.has(a)&&(t.text=e(n.get(a)))}if(t.select){const o=K(t.select),s=o+"-select";r.has(s)?t.select=r.get(s):n.has(o)&&(t.select=e(n.get(t.select)))}})})(n,r,await hs())}else"on"===T.auto?await Os(n,t):await Os(n,t,!1,!0);for(let e of n)await Ja(e)}catch(e){Y(e)}return n}},Ya=e=>{const t=document.createElement("link");t.setAttribute("rel","preload"),t.setAttribute("href",e),t.setAttribute("as","font"),t.setAttribute("type","font/woff2"),t.setAttribute("crossorigin","anonymous"),document.head.appendChild(t)},Qa=(e,t)=>`/data/font/${e}.woff2?v=${t[`font/${e}.woff2`]}`,Va=async()=>{const e=document.createElement("style"),{hashes:t}=await $r;e.innerHTML=`\n @font-face {\n font-family: "sczh-heiti";\n src: url("${T.origin}${Qa("heiti",t)}");\n }\n @font-face {\n font-family: "sczh-yuanti";\n src: url("${T.origin}${Qa("yuanti",t)}");\n }\n ::-webkit-scrollbar {\n display: none;\n }\n `,"yuanti"===T.font1&&Ya(`${T.origin}${Qa("yuanti",t)}`),"heiti"===T.font2&&Ya(`${T.origin}${Qa("heiti",t)}`),document.head.appendChild(e)};window.addEventListener("blur",(function(e){"on"===T.bgm&&e.stopImmediatePropagation()}),!1),document.addEventListener("visibilitychange",(function(e){"on"===T.bgm&&e.stopImmediatePropagation()}));let Xa=0;const Za=async()=>{var e;Ur||Xa>=300?(async()=>{try{await Promise.all([wa(),Va(),Zs(),ua(),on(),Ka()])}catch(e){Y(e)}})():(await(e=100,new Promise(t=>{setTimeout(t,e)})),Xa++,Xa%10==0&&Y(`Waiting: ${Xa/10}s`),await Za())};let ei=window.unsafeWindow||window;"loading"!=ei.document.readyState?Za():ei.addEventListener("DOMContentLoaded",Za)}();