yxuse 3.0.18 → 3.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs6.js +1 -1
- package/lib/index.cjs6.js.gz +0 -0
- package/lib/index.es6.js +1 -1
- package/lib/index.es6.js.gz +0 -0
- package/package.json +1 -1
package/lib/index.cjs6.js
CHANGED
|
@@ -34,7 +34,7 @@ __p += '`),ye&&(P+=`' +
|
|
|
34
34
|
function print() { __p += __j.call(arguments, '') }
|
|
35
35
|
`:`;
|
|
36
36
|
`)+P+`return __p
|
|
37
|
-
}`;var pe=af(function(){return Se(c,ee+"return "+P).apply(r,v)});if(pe.source=P,mu(pe))throw pe;return pe}function hm(e){return Te(e).toLowerCase()}function dm(e){return Te(e).toUpperCase()}function pm(e,t,n){if(e=Te(e),e&&(n||t===r))return ps(e);if(!e||!(t=St(t)))return e;var o=Vt(e),s=Vt(t),c=gs(o,s),v=vs(o,s)+1;return Nn(o,c,v).join("")}function gm(e,t,n){if(e=Te(e),e&&(n||t===r))return e.slice(0,_s(e)+1);if(!e||!(t=St(t)))return e;var o=Vt(e),s=vs(o,Vt(t))+1;return Nn(o,0,s).join("")}function vm(e,t,n){if(e=Te(e),e&&(n||t===r))return e.replace(Vr,"");if(!e||!(t=St(t)))return e;var o=Vt(e),s=gs(o,Vt(t));return Nn(o,s).join("")}function mm(e,t){var n=Le,o=Pe;if(Fe(t)){var s="separator"in t?t.separator:s;n="length"in t?he(t.length):n,o="omission"in t?St(t.omission):o}e=Te(e);var c=e.length;if(vr(e)){var v=Vt(e);c=v.length}if(n>=c)return e;var _=n-mr(o);if(_<1)return o;var x=v?Nn(v,0,_).join(""):e.slice(0,_);if(s===r)return x+o;if(v&&(_+=x.length-_),_u(s)){if(e.slice(_).search(s)){var B,L=x;for(s.global||(s=La(s.source,Te(Di.exec(s))+"g")),s.lastIndex=0;B=s.exec(L);)var P=B.index;x=x.slice(0,P===r?_:P)}}else if(e.indexOf(St(s),_)!=_){var Y=x.lastIndexOf(s);Y>-1&&(x=x.slice(0,Y))}return x+o}function _m(e){return e=Te(e),e&&Ci.test(e)?e.replace(xi,Xc):e}var ym=xr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),bu=al("toUpperCase");function of(e,t,n){return e=Te(e),t=n?r:t,t===r?$c(e)?Zc(e):Bc(e):e.match(t)||[]}var af=ge(function(e,t){try{return bt(e,r,t)}catch(n){return mu(n)?n:new le(n)}}),wm=un(function(e,t){return Bt(t,function(n){n=Zt(n),on(e,n,gu(e[n],e))}),e});function bm(e){var t=e==null?0:e.length,n=te();return e=t?Oe(e,function(o){if(typeof o[1]!="function")throw new Lt(y);return[n(o[0]),o[1]]}):[],ge(function(o){for(var s=-1;++s<t;){var c=e[s];if(bt(c[0],this,o))return bt(c[1],this,o)}})}function Em(e){return Xh(Mt(e,I))}function Eu(e){return function(){return e}}function Sm(e,t){return e==null||e!==e?t:e}var xm=sl(),Tm=sl(!0);function mt(e){return e}function Su(e){return ks(typeof e=="function"?e:Mt(e,I))}function Cm(e){return Us(Mt(e,I))}function Im(e,t){return Vs(e,Mt(t,I))}var Am=ge(function(e,t){return function(n){return Qr(n,e,t)}}),Dm=ge(function(e,t){return function(n){return Qr(e,n,t)}});function xu(e,t,n){var o=Ze(t),s=to(t,o);n==null&&!(Fe(t)&&(s.length||!o.length))&&(n=t,t=e,e=this,s=to(t,Ze(t)));var c=!(Fe(n)&&"chain"in n)||!!n.chain,v=ln(e);return Bt(s,function(_){var x=t[_];e[_]=x,v&&(e.prototype[_]=function(){var B=this.__chain__;if(c||B){var L=e(this.__wrapped__),P=L.__actions__=pt(this.__actions__);return P.push({func:x,args:arguments,thisArg:e}),L.__chain__=B,L}return x.apply(e,xn([this.value()],arguments))})}),e}function Nm(){return Qe._===this&&(Qe._=nh),this}function Tu(){}function Rm(e){return e=he(e),ge(function(t){return $s(t,e)})}var Om=nu(Oe),Bm=nu(ls),Lm=nu(Ia);function uf(e){return lu(e)?Aa(Zt(e)):fd(e)}function Pm(e){return function(t){return e==null?r:qn(e,t)}}var Mm=fl(),Fm=fl(!0);function Cu(){return[]}function Iu(){return!1}function km(){return{}}function Wm(){return""}function Um(){return!0}function Vm(e,t){if(e=he(e),e<1||e>Je)return[];var n=Me,o=nt(e,Me);t=te(t),e-=Me;for(var s=Ra(o,t);++n<e;)t(n);return s}function $m(e){return fe(e)?Oe(e,Zt):xt(e)?[e]:pt(Cl(Te(e)))}function Hm(e){var t=++eh;return Te(e)+t}var zm=uo(function(e,t){return e+t},0),Ym=ru("ceil"),Gm=uo(function(e,t){return e/t},1),Xm=ru("floor");function Km(e){return e&&e.length?eo(e,mt,$a):r}function qm(e,t){return e&&e.length?eo(e,te(t,2),$a):r}function Zm(e){return hs(e,mt)}function Jm(e,t){return hs(e,te(t,2))}function Qm(e){return e&&e.length?eo(e,mt,Ga):r}function jm(e,t){return e&&e.length?eo(e,te(t,2),Ga):r}var e_=uo(function(e,t){return e*t},1),t_=ru("round"),n_=uo(function(e,t){return e-t},0);function r_(e){return e&&e.length?Na(e,mt):0}function i_(e,t){return e&&e.length?Na(e,te(t,2)):0}return l.after=Cg,l.ary=Fl,l.assign=dv,l.assignIn=Jl,l.assignInWith=bo,l.assignWith=pv,l.at=gv,l.before=kl,l.bind=gu,l.bindAll=wm,l.bindKey=Wl,l.castArray=kg,l.chain=Ll,l.chunk=Xd,l.compact=Kd,l.concat=qd,l.cond=bm,l.conforms=Em,l.constant=Eu,l.countBy=rg,l.create=vv,l.curry=Ul,l.curryRight=Vl,l.debounce=$l,l.defaults=mv,l.defaultsDeep=_v,l.defer=Ig,l.delay=Ag,l.difference=Zd,l.differenceBy=Jd,l.differenceWith=Qd,l.drop=jd,l.dropRight=ep,l.dropRightWhile=tp,l.dropWhile=np,l.fill=rp,l.filter=og,l.flatMap=sg,l.flatMapDeep=lg,l.flatMapDepth=fg,l.flatten=Nl,l.flattenDeep=ip,l.flattenDepth=op,l.flip=Dg,l.flow=xm,l.flowRight=Tm,l.fromPairs=ap,l.functions=Tv,l.functionsIn=Cv,l.groupBy=cg,l.initial=sp,l.intersection=lp,l.intersectionBy=fp,l.intersectionWith=cp,l.invert=Av,l.invertBy=Dv,l.invokeMap=dg,l.iteratee=Su,l.keyBy=pg,l.keys=Ze,l.keysIn=vt,l.map=go,l.mapKeys=Rv,l.mapValues=Ov,l.matches=Cm,l.matchesProperty=Im,l.memoize=mo,l.merge=Bv,l.mergeWith=Ql,l.method=Am,l.methodOf=Dm,l.mixin=xu,l.negate=_o,l.nthArg=Rm,l.omit=Lv,l.omitBy=Pv,l.once=Ng,l.orderBy=gg,l.over=Om,l.overArgs=Rg,l.overEvery=Bm,l.overSome=Lm,l.partial=vu,l.partialRight=Hl,l.partition=vg,l.pick=Mv,l.pickBy=jl,l.property=uf,l.propertyOf=Pm,l.pull=gp,l.pullAll=Ol,l.pullAllBy=vp,l.pullAllWith=mp,l.pullAt=_p,l.range=Mm,l.rangeRight=Fm,l.rearg=Og,l.reject=yg,l.remove=yp,l.rest=Bg,l.reverse=du,l.sampleSize=bg,l.set=kv,l.setWith=Wv,l.shuffle=Eg,l.slice=wp,l.sortBy=Tg,l.sortedUniq=Ip,l.sortedUniqBy=Ap,l.split=sm,l.spread=Lg,l.tail=Dp,l.take=Np,l.takeRight=Rp,l.takeRightWhile=Op,l.takeWhile=Bp,l.tap=Kp,l.throttle=Pg,l.thru=po,l.toArray=Kl,l.toPairs=ef,l.toPairsIn=tf,l.toPath=$m,l.toPlainObject=Zl,l.transform=Uv,l.unary=Mg,l.union=Lp,l.unionBy=Pp,l.unionWith=Mp,l.uniq=Fp,l.uniqBy=kp,l.uniqWith=Wp,l.unset=Vv,l.unzip=pu,l.unzipWith=Bl,l.update=$v,l.updateWith=Hv,l.values=Ir,l.valuesIn=zv,l.without=Up,l.words=of,l.wrap=Fg,l.xor=Vp,l.xorBy=$p,l.xorWith=Hp,l.zip=zp,l.zipObject=Yp,l.zipObjectDeep=Gp,l.zipWith=Xp,l.entries=ef,l.entriesIn=tf,l.extend=Jl,l.extendWith=bo,xu(l,l),l.add=zm,l.attempt=af,l.camelCase=Kv,l.capitalize=nf,l.ceil=Ym,l.clamp=Yv,l.clone=Wg,l.cloneDeep=Vg,l.cloneDeepWith=$g,l.cloneWith=Ug,l.conformsTo=Hg,l.deburr=rf,l.defaultTo=Sm,l.divide=Gm,l.endsWith=qv,l.eq=Ht,l.escape=Zv,l.escapeRegExp=Jv,l.every=ig,l.find=ag,l.findIndex=Al,l.findKey=yv,l.findLast=ug,l.findLastIndex=Dl,l.findLastKey=wv,l.floor=Xm,l.forEach=Pl,l.forEachRight=Ml,l.forIn=bv,l.forInRight=Ev,l.forOwn=Sv,l.forOwnRight=xv,l.get=yu,l.gt=zg,l.gte=Yg,l.has=Iv,l.hasIn=wu,l.head=Rl,l.identity=mt,l.includes=hg,l.indexOf=up,l.inRange=Gv,l.invoke=Nv,l.isArguments=Qn,l.isArray=fe,l.isArrayBuffer=Gg,l.isArrayLike=gt,l.isArrayLikeObject=$e,l.isBoolean=Xg,l.isBuffer=Rn,l.isDate=Kg,l.isElement=qg,l.isEmpty=Zg,l.isEqual=Jg,l.isEqualWith=Qg,l.isError=mu,l.isFinite=jg,l.isFunction=ln,l.isInteger=zl,l.isLength=yo,l.isMap=Yl,l.isMatch=ev,l.isMatchWith=tv,l.isNaN=nv,l.isNative=rv,l.isNil=ov,l.isNull=iv,l.isNumber=Gl,l.isObject=Fe,l.isObjectLike=We,l.isPlainObject=ii,l.isRegExp=_u,l.isSafeInteger=av,l.isSet=Xl,l.isString=wo,l.isSymbol=xt,l.isTypedArray=Cr,l.isUndefined=uv,l.isWeakMap=sv,l.isWeakSet=lv,l.join=hp,l.kebabCase=Qv,l.last=kt,l.lastIndexOf=dp,l.lowerCase=jv,l.lowerFirst=em,l.lt=fv,l.lte=cv,l.max=Km,l.maxBy=qm,l.mean=Zm,l.meanBy=Jm,l.min=Qm,l.minBy=jm,l.stubArray=Cu,l.stubFalse=Iu,l.stubObject=km,l.stubString=Wm,l.stubTrue=Um,l.multiply=e_,l.nth=pp,l.noConflict=Nm,l.noop=Tu,l.now=vo,l.pad=tm,l.padEnd=nm,l.padStart=rm,l.parseInt=im,l.random=Xv,l.reduce=mg,l.reduceRight=_g,l.repeat=om,l.replace=am,l.result=Fv,l.round=t_,l.runInContext=S,l.sample=wg,l.size=Sg,l.snakeCase=um,l.some=xg,l.sortedIndex=bp,l.sortedIndexBy=Ep,l.sortedIndexOf=Sp,l.sortedLastIndex=xp,l.sortedLastIndexBy=Tp,l.sortedLastIndexOf=Cp,l.startCase=lm,l.startsWith=fm,l.subtract=n_,l.sum=r_,l.sumBy=i_,l.template=cm,l.times=Vm,l.toFinite=fn,l.toInteger=he,l.toLength=ql,l.toLower=hm,l.toNumber=Wt,l.toSafeInteger=hv,l.toString=Te,l.toUpper=dm,l.trim=pm,l.trimEnd=gm,l.trimStart=vm,l.truncate=mm,l.unescape=_m,l.uniqueId=Hm,l.upperCase=ym,l.upperFirst=bu,l.each=Pl,l.eachRight=Ml,l.first=Rl,xu(l,function(){var e={};return Kt(l,function(t,n){Ce.call(l.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),l.VERSION=u,Bt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),Bt(["drop","take"],function(e,t){_e.prototype[e]=function(n){n=n===r?1:Ke(he(n),0);var o=this.__filtered__&&!t?new _e(this):this.clone();return o.__filtered__?o.__takeCount__=nt(n,o.__takeCount__):o.__views__.push({size:nt(n,Me),type:e+(o.__dir__<0?"Right":"")}),o},_e.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Bt(["filter","map","takeWhile"],function(e,t){var n=t+1,o=n==tt||n==ht;_e.prototype[e]=function(s){var c=this.clone();return c.__iteratees__.push({iteratee:te(s,3),type:n}),c.__filtered__=c.__filtered__||o,c}}),Bt(["head","last"],function(e,t){var n="take"+(t?"Right":"");_e.prototype[e]=function(){return this[n](1).value()[0]}}),Bt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");_e.prototype[e]=function(){return this.__filtered__?new _e(this):this[n](1)}}),_e.prototype.compact=function(){return this.filter(mt)},_e.prototype.find=function(e){return this.filter(e).head()},_e.prototype.findLast=function(e){return this.reverse().find(e)},_e.prototype.invokeMap=ge(function(e,t){return typeof e=="function"?new _e(this):this.map(function(n){return Qr(n,e,t)})}),_e.prototype.reject=function(e){return this.filter(_o(te(e)))},_e.prototype.slice=function(e,t){e=he(e);var n=this;return n.__filtered__&&(e>0||t<0)?new _e(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=he(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},_e.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},_e.prototype.toArray=function(){return this.take(Me)},Kt(_e.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),s=l[o?"take"+(t=="last"?"Right":""):t],c=o||/^find/.test(t);s&&(l.prototype[t]=function(){var v=this.__wrapped__,_=o?[1]:arguments,x=v instanceof _e,B=_[0],L=x||fe(v),P=function(ve){var ye=s.apply(l,xn([ve],_));return o&&Y?ye[0]:ye};L&&n&&typeof B=="function"&&B.length!=1&&(x=L=!1);var Y=this.__chain__,ee=!!this.__actions__.length,ne=c&&!Y,pe=x&&!ee;if(!c&&L){v=pe?v:new _e(this);var re=e.apply(v,_);return re.__actions__.push({func:po,args:[P],thisArg:r}),new Pt(re,Y)}return ne&&pe?e.apply(this,_):(re=this.thru(P),ne?o?re.value()[0]:re.value():re)})}),Bt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Wi[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",o=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var s=arguments;if(o&&!this.__chain__){var c=this.value();return t.apply(fe(c)?c:[],s)}return this[n](function(v){return t.apply(fe(v)?v:[],s)})}}),Kt(_e.prototype,function(e,t){var n=l[t];if(n){var o=n.name+"";Ce.call(br,o)||(br[o]=[]),br[o].push({name:t,func:n})}}),br[ao(r,J).name]=[{name:"wrapper",func:r}],_e.prototype.clone=_h,_e.prototype.reverse=yh,_e.prototype.value=wh,l.prototype.at=qp,l.prototype.chain=Zp,l.prototype.commit=Jp,l.prototype.next=Qp,l.prototype.plant=eg,l.prototype.reverse=tg,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=ng,l.prototype.first=l.prototype.head,Yr&&(l.prototype[Yr]=jp),l},_r=Jc();zn?((zn.exports=_r)._=_r,Sa._=_r):Qe._=_r}).call(dn)})(Uo,Uo.exports);var V0=Uo.exports;const Sf=Jf(V0),On=/^[\u4e00-\u9fa5]+$/;let Uu;const $0=["svg","g","path","polyline","circle"];class H0{constructor(){hn(this,"from");hn(this,"to");hn(this,"yxI18nThesaurus");hn(this,"systemKey");hn(this,"dbKey");hn(this,"unknownWords");hn(this,"unknownWordsNode");hn(this,"rootDocument");this.from="zh",this.to="en",this.yxI18nThesaurus={},this.systemKey="station-control",this.dbKey="",this.initTranslate=this.initTranslate.bind(this),this.unknownWords=[],this.unknownWordsNode=new Map,this.rootDocument=null}initTranslate(u){return it(this,arguments,function*({to:i,systemKey:r}){if(i!=="zh"){if(i==="cht")return this.handleTraditionalChinese();console.log("开始初始化"),yield this.initConfig({to:i,systemKey:r}),console.log("初始化配置已完成"),this.observerRouteChange()}})}handleTraditionalChinese(){document.body.style.fontFamily="PingFang SC",document.body.style["font-variant-east-asian"]="traditional",document.documentElement.lang="zh-tw"}observerRouteChange(){let i=new MutationObserver(h=>{h.length>0&&h.forEach(g=>{switch(g.type){case"characterData":if(On.test(g.target.data)){const y=g.target.nodeValue.replace(/\s/g,"");this.unknownWords.includes(y)||(this.replaceTextByNode(g.target),this.startMicroTaskQueue())}break;case"childList":this.handleChildListMutation(g);break;case"attributes":g.attributeName==="placeholder"&&On.test(g.target.placeholder)?(console.log("placeholder",g.target.placeholder),this.replaceTextByNode(g.target)):g.attributeName==="readonly"?this.replaceTextByNode(g.target):g.attributeName==="title"&&console.log(g);break}})}),r={childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["readonly"]};i.observe(this.rootDocument,r);const u=i.takeRecords();u.length>0&&(console.log("DOM变化检测到,未处理的Dom",u),u.forEach(h=>{}))}handleChildListMutation(i){var r;if(!(i.removedNodes.length>0&&i.removedNodes[0].id!=="nprogress"))if(i.addedNodes.length>0){const u=i.target.tagName.toLowerCase();if($0.includes(u))return;const h=(r=i.addedNodes[0])==null?void 0:r.className;if(!h)return;h.includes("v-modal")?(this.throttleTraversingNode(i.previousSibling),this.startMicroTaskQueue()):h.includes("tooltip")?(console.log("监听到了tooltip发生了更新!!!"),i.addedNodes[0].innerText=this.replaceValue(i.addedNodes[0].innerText,i.addedNodes[0])):h.includes("message")?(console.log("message组件更新!!"),i.addedNodes[0].innerText=this.replaceValue(i.addedNodes[0].innerText,i.addedNodes[0])):h.includes("loading")?(console.log("loading",i),this.throttleTraversingNode(i.previousSibling),this.startMicroTaskQueue()):h.includes("suffix")?(console.log("其他新增情况"),this.throttleTraversingNode(i.target),this.startMicroTaskQueue()):(console.log("dom新增更新!!"),this.throttleTraversingNode(i.target),this.startMicroTaskQueue())}else console.log("其他情况",i),this.throttleTraversingNode(i.target),this.replaceDocumentTitle(),this.startMicroTaskQueue()}startMicroTaskQueue(){Uu&&clearTimeout(Uu),Uu=setTimeout(()=>{console.log("更新结束"),this.unknownWords.length>0&&(console.log("DOM更新结束,未替换的词汇有:",this.unknownWords),console.log("DOM更新结束,收集到的dom:",this.unknownWordsNode),Sf.throttle(()=>this.translateUnknownWords(this.unknownWords),1e3,{leading:!0})())},0)}throttleTraversingNode(i){Sf.throttle(()=>this.traversingNode(i),500,{leading:!0})()}traversingNode(i){if(!i)return;const r=g=>this.replaceTextByNode(g),u=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode(g){return g.tagName&&g.tagName.toLowerCase()==="svg"?NodeFilter.FILTER_REJECT:(r(g),NodeFilter.FILTER_SKIP)}});let h;for(;h=u.nextNode();)r(h)}replaceTextByNode(i){i.title&&On.test(i.title)&&(i.title=this.replaceValue(i.title,i)),i.nodeType===Node.ELEMENT_NODE?["textarea","input"].includes(i.tagName.toLowerCase())&&(On.test(i.value)&&(i.value=this.replaceValue(i.value,i)),On.test(i.placeholder)&&(i.placeholder=this.replaceValue(i.placeholder,i)),i.readOnly&&On.test(i.value)&&(i.value=this.replaceValue(i.value,i))):i.nodeType===Node.TEXT_NODE&&On.test(i.nodeValue)&&(i.nodeValue=this.replaceValue(i.nodeValue,i))}replaceDocumentTitle(){const i=document.title;On.test(i)&&this.yxI18nThesaurus[i]&&(document.title=this.yxI18nThesaurus[i])}replaceValue(i,r){if(i==="")return;const u=i.replace(/\s/g,"");if(this.yxI18nThesaurus[u])return this.yxI18nThesaurus[u];if(this.unknownWords.includes(u)||(this.unknownWords.push(u),console.log("未找到匹配项:",u)),r!=null&&r.getBoundingClientRect){const{x:h,y:g}=r.getBoundingClientRect(),y=`${h}_${g}`;this.unknownWordsNode.has(y)||this.unknownWordsNode.set(y,r)}else if(r.parentNode){const{x:h,y:g}=r.parentNode.getBoundingClientRect(),y=`${h}_${g}`;this.unknownWordsNode.has(y)||this.unknownWordsNode.set(y,r)}else this.unknownWordsNode.set(i,r);return i}translateUnknownWords(i){return it(this,null,function*(){const r=i.filter(g=>g.trim()!=="");if(r.length===0)return;const u=Array.from(new Set(r)),h=yield Ef({words:u,toSource:this.to,systemFlag:this.systemKey});this.unknownWords=[],this.yxI18nThesaurus=_t(_t({},this.yxI18nThesaurus),h),yield si(this.dbKey,this.yxI18nThesaurus),console.log("远程翻译结束",this.yxI18nThesaurus),this.unknownWords=[];for(const g of this.unknownWordsNode.values())this.replaceTextByNode(g);console.log("更新翻译完成!!!"),this.unknownWordsNode.clear()})}initConfig(u){return it(this,arguments,function*({to:i,systemKey:r}){this.to=i||this.to,this.systemKey=r||this.systemKey,this.dbKey=`${this.systemKey}_${this.to}`,document.querySelector("html").classList.add(i),this.rootDocument=document.querySelector("body"),(yield Wo("lang"))!==i&&(yield si("lang",i)),console.log("开始同步词库!!!");const g=yield Wo(this.dbKey);if(!g)yield si(this.dbKey,{});else try{const y=yield Ef({words:[],toSource:this.to,systemFlag:this.systemKey});this.yxI18nThesaurus=y,yield si(this.dbKey,this.yxI18nThesaurus),console.log("同步词库已完成!!!")}catch(y){this.yxI18nThesaurus=g}})}}const jf=new H0().initTranslate,ec=a=>it(exports,null,function*(){console.log("切换语言",a),(yield Wo("lang"))!==a&&(yield si("lang",a),yi.postMessage(JSON.stringify({type:"lang"})),location.reload())}),tc=()=>it(exports,null,function*(){return(yield Wo("lang"))||""}),nc=Object.freeze(Object.defineProperty({__proto__:null,changeLang:ec,getLang:tc,initTranslate:jf},Symbol.toStringTag,{value:"Module"})),z0={props:{value:{typeof:Number}}},Y0={class:"badge-container"};function G0(a,i,r,u,h,g){return d.withDirectives((d.openBlock(),d.createElementBlock("div",Y0,[d.createElementVNode("sup",null,d.toDisplayString(r.value),1)],512)),[[d.vShow,r.value>0]])}const rc=nr(z0,[["render",G0],["__scopeId","data-v-181eafdb"]]),X0={components:{theme:A0,issue:B0,Badge:rc,lang:k0},props:{showTool:{typeof:Boolean,default:!1},badgeValue:{typeof:Number}},data(){return{columns:"repeat(2, 1fr)",rows:window.isRenderLang?"repeat(2, 1fr)":"lfr",config:[{name:"theme",label:"主题切换",icon:"theme",icon_active:"https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/toolbar-theme-back.svg",position:[50,0],desc:"跳转到问题反馈页面",action:"hiddenTool",component:"Theme",data:window.theme,"grid-area":window.isRenderLang?"1 / 1 / 2 / 3":"1 / 1 / 2 / 2",show:window.theme.length>0},{name:"lang",label:"语言切换",icon:"lang",position:[100,0],desc:"语言切换",component:"Lang",isShowBadge:!0,"grid-area":"2 / 1 / 3 / 2",show:window.isRenderLang?window.isRenderLang:!1},{name:"issue",label:"问题反馈",icon:"issue",position:[100,0],desc:"跳转到问题反馈页面",component:"Issue",isShowBadge:!0,"grid-area":window.isRenderLang?"2 / 2 / 3 / 3":"1 / 2 / 2 / 3",show:window.isRenderIssue?window.isRenderIssue:!1}],curComponent:{},curTheme:gi(),langList:[{name:"中文-Chinese",lang:"zh"},{name:"中文(香港)-Chinese(Hong Kong)",lang:"cht"},{name:"英语-English",lang:"en"}]}},computed:{configList(){return this.config.filter(a=>a.show)}},watch:{showTool(a){a?this.curTheme=this.getCurTheme():this.curComponent={}}},mounted(){this.curTheme=this.getCurTheme(),console.log(this.curTheme)},methods:{changeLang:ec,getCurTheme(){return gi()},configHandle(a){if(a.name==="issue"){const i=window.location.pathname.split("/")[1];window.open(`/${i}/integrated/#/workOrderManagement`),this.$emit("zero")}else this.curComponent=a},chooseTheme(a){Qu(a),this.curTheme=a.id},getPosition(a){return{0:{"grid-row":2,"grid-column":1},1:{"grid-row":1,"grid-column":2},2:{"grid-row":2,"grid-column":3},3:{"grid-row":3,"grid-column":2}}[a]}}},K0=["onClick"],q0=["title"],Z0={class:"tool-icon relative flex justify-center items-center"},J0={class:"yx-icon",style:{color:"var(--color-main-100)"},color:`var(--color-main-100) \r
|
|
37
|
+
}`;var pe=af(function(){return Se(c,ee+"return "+P).apply(r,v)});if(pe.source=P,mu(pe))throw pe;return pe}function hm(e){return Te(e).toLowerCase()}function dm(e){return Te(e).toUpperCase()}function pm(e,t,n){if(e=Te(e),e&&(n||t===r))return ps(e);if(!e||!(t=St(t)))return e;var o=Vt(e),s=Vt(t),c=gs(o,s),v=vs(o,s)+1;return Nn(o,c,v).join("")}function gm(e,t,n){if(e=Te(e),e&&(n||t===r))return e.slice(0,_s(e)+1);if(!e||!(t=St(t)))return e;var o=Vt(e),s=vs(o,Vt(t))+1;return Nn(o,0,s).join("")}function vm(e,t,n){if(e=Te(e),e&&(n||t===r))return e.replace(Vr,"");if(!e||!(t=St(t)))return e;var o=Vt(e),s=gs(o,Vt(t));return Nn(o,s).join("")}function mm(e,t){var n=Le,o=Pe;if(Fe(t)){var s="separator"in t?t.separator:s;n="length"in t?he(t.length):n,o="omission"in t?St(t.omission):o}e=Te(e);var c=e.length;if(vr(e)){var v=Vt(e);c=v.length}if(n>=c)return e;var _=n-mr(o);if(_<1)return o;var x=v?Nn(v,0,_).join(""):e.slice(0,_);if(s===r)return x+o;if(v&&(_+=x.length-_),_u(s)){if(e.slice(_).search(s)){var B,L=x;for(s.global||(s=La(s.source,Te(Di.exec(s))+"g")),s.lastIndex=0;B=s.exec(L);)var P=B.index;x=x.slice(0,P===r?_:P)}}else if(e.indexOf(St(s),_)!=_){var Y=x.lastIndexOf(s);Y>-1&&(x=x.slice(0,Y))}return x+o}function _m(e){return e=Te(e),e&&Ci.test(e)?e.replace(xi,Xc):e}var ym=xr(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),bu=al("toUpperCase");function of(e,t,n){return e=Te(e),t=n?r:t,t===r?$c(e)?Zc(e):Bc(e):e.match(t)||[]}var af=ge(function(e,t){try{return bt(e,r,t)}catch(n){return mu(n)?n:new le(n)}}),wm=un(function(e,t){return Bt(t,function(n){n=Zt(n),on(e,n,gu(e[n],e))}),e});function bm(e){var t=e==null?0:e.length,n=te();return e=t?Oe(e,function(o){if(typeof o[1]!="function")throw new Lt(y);return[n(o[0]),o[1]]}):[],ge(function(o){for(var s=-1;++s<t;){var c=e[s];if(bt(c[0],this,o))return bt(c[1],this,o)}})}function Em(e){return Xh(Mt(e,I))}function Eu(e){return function(){return e}}function Sm(e,t){return e==null||e!==e?t:e}var xm=sl(),Tm=sl(!0);function mt(e){return e}function Su(e){return ks(typeof e=="function"?e:Mt(e,I))}function Cm(e){return Us(Mt(e,I))}function Im(e,t){return Vs(e,Mt(t,I))}var Am=ge(function(e,t){return function(n){return Qr(n,e,t)}}),Dm=ge(function(e,t){return function(n){return Qr(e,n,t)}});function xu(e,t,n){var o=Ze(t),s=to(t,o);n==null&&!(Fe(t)&&(s.length||!o.length))&&(n=t,t=e,e=this,s=to(t,Ze(t)));var c=!(Fe(n)&&"chain"in n)||!!n.chain,v=ln(e);return Bt(s,function(_){var x=t[_];e[_]=x,v&&(e.prototype[_]=function(){var B=this.__chain__;if(c||B){var L=e(this.__wrapped__),P=L.__actions__=pt(this.__actions__);return P.push({func:x,args:arguments,thisArg:e}),L.__chain__=B,L}return x.apply(e,xn([this.value()],arguments))})}),e}function Nm(){return Qe._===this&&(Qe._=nh),this}function Tu(){}function Rm(e){return e=he(e),ge(function(t){return $s(t,e)})}var Om=nu(Oe),Bm=nu(ls),Lm=nu(Ia);function uf(e){return lu(e)?Aa(Zt(e)):fd(e)}function Pm(e){return function(t){return e==null?r:qn(e,t)}}var Mm=fl(),Fm=fl(!0);function Cu(){return[]}function Iu(){return!1}function km(){return{}}function Wm(){return""}function Um(){return!0}function Vm(e,t){if(e=he(e),e<1||e>Je)return[];var n=Me,o=nt(e,Me);t=te(t),e-=Me;for(var s=Ra(o,t);++n<e;)t(n);return s}function $m(e){return fe(e)?Oe(e,Zt):xt(e)?[e]:pt(Cl(Te(e)))}function Hm(e){var t=++eh;return Te(e)+t}var zm=uo(function(e,t){return e+t},0),Ym=ru("ceil"),Gm=uo(function(e,t){return e/t},1),Xm=ru("floor");function Km(e){return e&&e.length?eo(e,mt,$a):r}function qm(e,t){return e&&e.length?eo(e,te(t,2),$a):r}function Zm(e){return hs(e,mt)}function Jm(e,t){return hs(e,te(t,2))}function Qm(e){return e&&e.length?eo(e,mt,Ga):r}function jm(e,t){return e&&e.length?eo(e,te(t,2),Ga):r}var e_=uo(function(e,t){return e*t},1),t_=ru("round"),n_=uo(function(e,t){return e-t},0);function r_(e){return e&&e.length?Na(e,mt):0}function i_(e,t){return e&&e.length?Na(e,te(t,2)):0}return l.after=Cg,l.ary=Fl,l.assign=dv,l.assignIn=Jl,l.assignInWith=bo,l.assignWith=pv,l.at=gv,l.before=kl,l.bind=gu,l.bindAll=wm,l.bindKey=Wl,l.castArray=kg,l.chain=Ll,l.chunk=Xd,l.compact=Kd,l.concat=qd,l.cond=bm,l.conforms=Em,l.constant=Eu,l.countBy=rg,l.create=vv,l.curry=Ul,l.curryRight=Vl,l.debounce=$l,l.defaults=mv,l.defaultsDeep=_v,l.defer=Ig,l.delay=Ag,l.difference=Zd,l.differenceBy=Jd,l.differenceWith=Qd,l.drop=jd,l.dropRight=ep,l.dropRightWhile=tp,l.dropWhile=np,l.fill=rp,l.filter=og,l.flatMap=sg,l.flatMapDeep=lg,l.flatMapDepth=fg,l.flatten=Nl,l.flattenDeep=ip,l.flattenDepth=op,l.flip=Dg,l.flow=xm,l.flowRight=Tm,l.fromPairs=ap,l.functions=Tv,l.functionsIn=Cv,l.groupBy=cg,l.initial=sp,l.intersection=lp,l.intersectionBy=fp,l.intersectionWith=cp,l.invert=Av,l.invertBy=Dv,l.invokeMap=dg,l.iteratee=Su,l.keyBy=pg,l.keys=Ze,l.keysIn=vt,l.map=go,l.mapKeys=Rv,l.mapValues=Ov,l.matches=Cm,l.matchesProperty=Im,l.memoize=mo,l.merge=Bv,l.mergeWith=Ql,l.method=Am,l.methodOf=Dm,l.mixin=xu,l.negate=_o,l.nthArg=Rm,l.omit=Lv,l.omitBy=Pv,l.once=Ng,l.orderBy=gg,l.over=Om,l.overArgs=Rg,l.overEvery=Bm,l.overSome=Lm,l.partial=vu,l.partialRight=Hl,l.partition=vg,l.pick=Mv,l.pickBy=jl,l.property=uf,l.propertyOf=Pm,l.pull=gp,l.pullAll=Ol,l.pullAllBy=vp,l.pullAllWith=mp,l.pullAt=_p,l.range=Mm,l.rangeRight=Fm,l.rearg=Og,l.reject=yg,l.remove=yp,l.rest=Bg,l.reverse=du,l.sampleSize=bg,l.set=kv,l.setWith=Wv,l.shuffle=Eg,l.slice=wp,l.sortBy=Tg,l.sortedUniq=Ip,l.sortedUniqBy=Ap,l.split=sm,l.spread=Lg,l.tail=Dp,l.take=Np,l.takeRight=Rp,l.takeRightWhile=Op,l.takeWhile=Bp,l.tap=Kp,l.throttle=Pg,l.thru=po,l.toArray=Kl,l.toPairs=ef,l.toPairsIn=tf,l.toPath=$m,l.toPlainObject=Zl,l.transform=Uv,l.unary=Mg,l.union=Lp,l.unionBy=Pp,l.unionWith=Mp,l.uniq=Fp,l.uniqBy=kp,l.uniqWith=Wp,l.unset=Vv,l.unzip=pu,l.unzipWith=Bl,l.update=$v,l.updateWith=Hv,l.values=Ir,l.valuesIn=zv,l.without=Up,l.words=of,l.wrap=Fg,l.xor=Vp,l.xorBy=$p,l.xorWith=Hp,l.zip=zp,l.zipObject=Yp,l.zipObjectDeep=Gp,l.zipWith=Xp,l.entries=ef,l.entriesIn=tf,l.extend=Jl,l.extendWith=bo,xu(l,l),l.add=zm,l.attempt=af,l.camelCase=Kv,l.capitalize=nf,l.ceil=Ym,l.clamp=Yv,l.clone=Wg,l.cloneDeep=Vg,l.cloneDeepWith=$g,l.cloneWith=Ug,l.conformsTo=Hg,l.deburr=rf,l.defaultTo=Sm,l.divide=Gm,l.endsWith=qv,l.eq=Ht,l.escape=Zv,l.escapeRegExp=Jv,l.every=ig,l.find=ag,l.findIndex=Al,l.findKey=yv,l.findLast=ug,l.findLastIndex=Dl,l.findLastKey=wv,l.floor=Xm,l.forEach=Pl,l.forEachRight=Ml,l.forIn=bv,l.forInRight=Ev,l.forOwn=Sv,l.forOwnRight=xv,l.get=yu,l.gt=zg,l.gte=Yg,l.has=Iv,l.hasIn=wu,l.head=Rl,l.identity=mt,l.includes=hg,l.indexOf=up,l.inRange=Gv,l.invoke=Nv,l.isArguments=Qn,l.isArray=fe,l.isArrayBuffer=Gg,l.isArrayLike=gt,l.isArrayLikeObject=$e,l.isBoolean=Xg,l.isBuffer=Rn,l.isDate=Kg,l.isElement=qg,l.isEmpty=Zg,l.isEqual=Jg,l.isEqualWith=Qg,l.isError=mu,l.isFinite=jg,l.isFunction=ln,l.isInteger=zl,l.isLength=yo,l.isMap=Yl,l.isMatch=ev,l.isMatchWith=tv,l.isNaN=nv,l.isNative=rv,l.isNil=ov,l.isNull=iv,l.isNumber=Gl,l.isObject=Fe,l.isObjectLike=We,l.isPlainObject=ii,l.isRegExp=_u,l.isSafeInteger=av,l.isSet=Xl,l.isString=wo,l.isSymbol=xt,l.isTypedArray=Cr,l.isUndefined=uv,l.isWeakMap=sv,l.isWeakSet=lv,l.join=hp,l.kebabCase=Qv,l.last=kt,l.lastIndexOf=dp,l.lowerCase=jv,l.lowerFirst=em,l.lt=fv,l.lte=cv,l.max=Km,l.maxBy=qm,l.mean=Zm,l.meanBy=Jm,l.min=Qm,l.minBy=jm,l.stubArray=Cu,l.stubFalse=Iu,l.stubObject=km,l.stubString=Wm,l.stubTrue=Um,l.multiply=e_,l.nth=pp,l.noConflict=Nm,l.noop=Tu,l.now=vo,l.pad=tm,l.padEnd=nm,l.padStart=rm,l.parseInt=im,l.random=Xv,l.reduce=mg,l.reduceRight=_g,l.repeat=om,l.replace=am,l.result=Fv,l.round=t_,l.runInContext=S,l.sample=wg,l.size=Sg,l.snakeCase=um,l.some=xg,l.sortedIndex=bp,l.sortedIndexBy=Ep,l.sortedIndexOf=Sp,l.sortedLastIndex=xp,l.sortedLastIndexBy=Tp,l.sortedLastIndexOf=Cp,l.startCase=lm,l.startsWith=fm,l.subtract=n_,l.sum=r_,l.sumBy=i_,l.template=cm,l.times=Vm,l.toFinite=fn,l.toInteger=he,l.toLength=ql,l.toLower=hm,l.toNumber=Wt,l.toSafeInteger=hv,l.toString=Te,l.toUpper=dm,l.trim=pm,l.trimEnd=gm,l.trimStart=vm,l.truncate=mm,l.unescape=_m,l.uniqueId=Hm,l.upperCase=ym,l.upperFirst=bu,l.each=Pl,l.eachRight=Ml,l.first=Rl,xu(l,function(){var e={};return Kt(l,function(t,n){Ce.call(l.prototype,n)||(e[n]=t)}),e}(),{chain:!1}),l.VERSION=u,Bt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),Bt(["drop","take"],function(e,t){_e.prototype[e]=function(n){n=n===r?1:Ke(he(n),0);var o=this.__filtered__&&!t?new _e(this):this.clone();return o.__filtered__?o.__takeCount__=nt(n,o.__takeCount__):o.__views__.push({size:nt(n,Me),type:e+(o.__dir__<0?"Right":"")}),o},_e.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Bt(["filter","map","takeWhile"],function(e,t){var n=t+1,o=n==tt||n==ht;_e.prototype[e]=function(s){var c=this.clone();return c.__iteratees__.push({iteratee:te(s,3),type:n}),c.__filtered__=c.__filtered__||o,c}}),Bt(["head","last"],function(e,t){var n="take"+(t?"Right":"");_e.prototype[e]=function(){return this[n](1).value()[0]}}),Bt(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");_e.prototype[e]=function(){return this.__filtered__?new _e(this):this[n](1)}}),_e.prototype.compact=function(){return this.filter(mt)},_e.prototype.find=function(e){return this.filter(e).head()},_e.prototype.findLast=function(e){return this.reverse().find(e)},_e.prototype.invokeMap=ge(function(e,t){return typeof e=="function"?new _e(this):this.map(function(n){return Qr(n,e,t)})}),_e.prototype.reject=function(e){return this.filter(_o(te(e)))},_e.prototype.slice=function(e,t){e=he(e);var n=this;return n.__filtered__&&(e>0||t<0)?new _e(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(t=he(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},_e.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},_e.prototype.toArray=function(){return this.take(Me)},Kt(_e.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),s=l[o?"take"+(t=="last"?"Right":""):t],c=o||/^find/.test(t);s&&(l.prototype[t]=function(){var v=this.__wrapped__,_=o?[1]:arguments,x=v instanceof _e,B=_[0],L=x||fe(v),P=function(ve){var ye=s.apply(l,xn([ve],_));return o&&Y?ye[0]:ye};L&&n&&typeof B=="function"&&B.length!=1&&(x=L=!1);var Y=this.__chain__,ee=!!this.__actions__.length,ne=c&&!Y,pe=x&&!ee;if(!c&&L){v=pe?v:new _e(this);var re=e.apply(v,_);return re.__actions__.push({func:po,args:[P],thisArg:r}),new Pt(re,Y)}return ne&&pe?e.apply(this,_):(re=this.thru(P),ne?o?re.value()[0]:re.value():re)})}),Bt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Wi[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",o=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var s=arguments;if(o&&!this.__chain__){var c=this.value();return t.apply(fe(c)?c:[],s)}return this[n](function(v){return t.apply(fe(v)?v:[],s)})}}),Kt(_e.prototype,function(e,t){var n=l[t];if(n){var o=n.name+"";Ce.call(br,o)||(br[o]=[]),br[o].push({name:t,func:n})}}),br[ao(r,J).name]=[{name:"wrapper",func:r}],_e.prototype.clone=_h,_e.prototype.reverse=yh,_e.prototype.value=wh,l.prototype.at=qp,l.prototype.chain=Zp,l.prototype.commit=Jp,l.prototype.next=Qp,l.prototype.plant=eg,l.prototype.reverse=tg,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=ng,l.prototype.first=l.prototype.head,Yr&&(l.prototype[Yr]=jp),l},_r=Jc();zn?((zn.exports=_r)._=_r,Sa._=_r):Qe._=_r}).call(dn)})(Uo,Uo.exports);var V0=Uo.exports;const Sf=Jf(V0),On=/[\u4e00-\u9fa5]+/;let Uu;const $0=["svg","g","path","polyline","circle"];class H0{constructor(){hn(this,"from");hn(this,"to");hn(this,"yxI18nThesaurus");hn(this,"systemKey");hn(this,"dbKey");hn(this,"unknownWords");hn(this,"unknownWordsNode");hn(this,"rootDocument");this.from="zh",this.to="en",this.yxI18nThesaurus={},this.systemKey="station-control",this.dbKey="",this.initTranslate=this.initTranslate.bind(this),this.unknownWords=[],this.unknownWordsNode=new Map,this.rootDocument=null}initTranslate(u){return it(this,arguments,function*({to:i,systemKey:r}){if(i!=="zh"){if(i==="cht")return this.handleTraditionalChinese();console.log("开始初始化"),yield this.initConfig({to:i,systemKey:r}),console.log("初始化配置已完成"),this.observerRouteChange()}})}handleTraditionalChinese(){document.body.style.fontFamily="PingFang SC",document.body.style["font-variant-east-asian"]="traditional",document.documentElement.lang="zh-tw"}observerRouteChange(){let i=new MutationObserver(h=>{h.length>0&&h.forEach(g=>{switch(g.type){case"characterData":if(On.test(g.target.data)){const y=g.target.nodeValue.replace(/\s/g,"");this.unknownWords.includes(y)||(this.replaceTextByNode(g.target),this.startMicroTaskQueue())}break;case"childList":this.handleChildListMutation(g);break;case"attributes":g.attributeName==="placeholder"&&On.test(g.target.placeholder)?(console.log("placeholder",g.target.placeholder),this.replaceTextByNode(g.target)):g.attributeName==="readonly"?this.replaceTextByNode(g.target):g.attributeName==="title"&&console.log(g);break}})}),r={childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["readonly"]};i.observe(this.rootDocument,r);const u=i.takeRecords();u.length>0&&(console.log("DOM变化检测到,未处理的Dom",u),u.forEach(h=>{}))}handleChildListMutation(i){var r;if(!(i.removedNodes.length>0&&i.removedNodes[0].id!=="nprogress"))if(i.addedNodes.length>0){const u=i.target.tagName.toLowerCase();if($0.includes(u))return;const h=(r=i.addedNodes[0])==null?void 0:r.className;if(!h)return;h.includes("v-modal")?(this.throttleTraversingNode(i.previousSibling),this.startMicroTaskQueue()):h.includes("tooltip")?(console.log("监听到了tooltip发生了更新!!!"),i.addedNodes[0].innerText=this.replaceValue(i.addedNodes[0].innerText,i.addedNodes[0])):h.includes("message")?(console.log("message组件更新!!"),i.addedNodes[0].innerText=this.replaceValue(i.addedNodes[0].innerText,i.addedNodes[0])):h.includes("loading")?(console.log("loading",i),this.throttleTraversingNode(i.previousSibling),this.startMicroTaskQueue()):h.includes("suffix")?(console.log("其他新增情况"),this.throttleTraversingNode(i.target),this.startMicroTaskQueue()):(console.log("dom新增更新!!"),this.throttleTraversingNode(i.target),this.startMicroTaskQueue())}else console.log("其他情况",i),this.throttleTraversingNode(i.target),this.replaceDocumentTitle(),this.startMicroTaskQueue()}startMicroTaskQueue(){Uu&&clearTimeout(Uu),Uu=setTimeout(()=>{console.log("更新结束"),this.unknownWords.length>0&&(console.log("DOM更新结束,未替换的词汇有:",this.unknownWords),console.log("DOM更新结束,收集到的dom:",this.unknownWordsNode),Sf.throttle(()=>this.translateUnknownWords(this.unknownWords),1e3,{leading:!0})())},0)}throttleTraversingNode(i){Sf.throttle(()=>this.traversingNode(i),500,{leading:!0})()}traversingNode(i){if(!i)return;const r=g=>this.replaceTextByNode(g),u=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode(g){return g.tagName&&g.tagName.toLowerCase()==="svg"?NodeFilter.FILTER_REJECT:(r(g),NodeFilter.FILTER_SKIP)}});let h;for(;h=u.nextNode();)r(h)}replaceTextByNode(i){i.title&&On.test(i.title)&&(i.title=this.replaceValue(i.title,i)),i.nodeType===Node.ELEMENT_NODE?["textarea","input"].includes(i.tagName.toLowerCase())&&(On.test(i.value)&&(i.value=this.replaceValue(i.value,i)),On.test(i.placeholder)&&(i.placeholder=this.replaceValue(i.placeholder,i)),i.readOnly&&On.test(i.value)&&(i.value=this.replaceValue(i.value,i))):i.nodeType===Node.TEXT_NODE&&On.test(i.nodeValue)&&(i.nodeValue=this.replaceValue(i.nodeValue,i))}replaceDocumentTitle(){const i=document.title;On.test(i)&&this.yxI18nThesaurus[i]&&(document.title=this.yxI18nThesaurus[i])}replaceValue(i,r){if(i==="")return;const u=i.replace(/\s/g,"");if(this.yxI18nThesaurus[u])return this.yxI18nThesaurus[u];if(this.unknownWords.includes(u)||(this.unknownWords.push(u),console.log("未找到匹配项:",u)),r!=null&&r.getBoundingClientRect){const{x:h,y:g}=r.getBoundingClientRect(),y=`${h}_${g}`;this.unknownWordsNode.has(y)||this.unknownWordsNode.set(y,r)}else if(r.parentNode){const{x:h,y:g}=r.parentNode.getBoundingClientRect(),y=`${h}_${g}`;this.unknownWordsNode.has(y)||this.unknownWordsNode.set(y,r)}else this.unknownWordsNode.set(i,r);return i}translateUnknownWords(i){return it(this,null,function*(){const r=i.filter(g=>g.trim()!=="");if(r.length===0)return;const u=Array.from(new Set(r)),h=yield Ef({words:u,toSource:this.to,systemFlag:this.systemKey});this.unknownWords=[],this.yxI18nThesaurus=_t(_t({},this.yxI18nThesaurus),h),yield si(this.dbKey,this.yxI18nThesaurus),console.log("远程翻译结束",this.yxI18nThesaurus),this.unknownWords=[];for(const g of this.unknownWordsNode.values())this.replaceTextByNode(g);console.log("更新翻译完成!!!"),this.unknownWordsNode.clear()})}initConfig(u){return it(this,arguments,function*({to:i,systemKey:r}){this.to=i||this.to,this.systemKey=r||this.systemKey,this.dbKey=`${this.systemKey}_${this.to}`,document.querySelector("html").classList.add(i),this.rootDocument=document.querySelector("body"),(yield Wo("lang"))!==i&&(yield si("lang",i)),console.log("开始同步词库!!!");const g=yield Wo(this.dbKey);if(!g)yield si(this.dbKey,{});else try{const y=yield Ef({words:[],toSource:this.to,systemFlag:this.systemKey});this.yxI18nThesaurus=y,yield si(this.dbKey,this.yxI18nThesaurus),console.log("同步词库已完成!!!")}catch(y){this.yxI18nThesaurus=g}})}}const jf=new H0().initTranslate,ec=a=>it(exports,null,function*(){console.log("切换语言",a),(yield Wo("lang"))!==a&&(yield si("lang",a),yi.postMessage(JSON.stringify({type:"lang"})),location.reload())}),tc=()=>it(exports,null,function*(){return(yield Wo("lang"))||""}),nc=Object.freeze(Object.defineProperty({__proto__:null,changeLang:ec,getLang:tc,initTranslate:jf},Symbol.toStringTag,{value:"Module"})),z0={props:{value:{typeof:Number}}},Y0={class:"badge-container"};function G0(a,i,r,u,h,g){return d.withDirectives((d.openBlock(),d.createElementBlock("div",Y0,[d.createElementVNode("sup",null,d.toDisplayString(r.value),1)],512)),[[d.vShow,r.value>0]])}const rc=nr(z0,[["render",G0],["__scopeId","data-v-181eafdb"]]),X0={components:{theme:A0,issue:B0,Badge:rc,lang:k0},props:{showTool:{typeof:Boolean,default:!1},badgeValue:{typeof:Number}},data(){return{columns:"repeat(2, 1fr)",rows:window.isRenderLang?"repeat(2, 1fr)":"lfr",config:[{name:"theme",label:"主题切换",icon:"theme",icon_active:"https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/toolbar-theme-back.svg",position:[50,0],desc:"跳转到问题反馈页面",action:"hiddenTool",component:"Theme",data:window.theme,"grid-area":window.isRenderLang?"1 / 1 / 2 / 3":"1 / 1 / 2 / 2",show:window.theme.length>0},{name:"lang",label:"语言切换",icon:"lang",position:[100,0],desc:"语言切换",component:"Lang",isShowBadge:!0,"grid-area":"2 / 1 / 3 / 2",show:window.isRenderLang?window.isRenderLang:!1},{name:"issue",label:"问题反馈",icon:"issue",position:[100,0],desc:"跳转到问题反馈页面",component:"Issue",isShowBadge:!0,"grid-area":window.isRenderLang?"2 / 2 / 3 / 3":"1 / 2 / 2 / 3",show:window.isRenderIssue?window.isRenderIssue:!1}],curComponent:{},curTheme:gi(),langList:[{name:"中文-Chinese",lang:"zh"},{name:"中文(香港)-Chinese(Hong Kong)",lang:"cht"},{name:"英语-English",lang:"en"}]}},computed:{configList(){return this.config.filter(a=>a.show)}},watch:{showTool(a){a?this.curTheme=this.getCurTheme():this.curComponent={}}},mounted(){this.curTheme=this.getCurTheme(),console.log(this.curTheme)},methods:{changeLang:ec,getCurTheme(){return gi()},configHandle(a){if(a.name==="issue"){const i=window.location.pathname.split("/")[1];window.open(`/${i}/integrated/#/workOrderManagement`),this.$emit("zero")}else this.curComponent=a},chooseTheme(a){Qu(a),this.curTheme=a.id},getPosition(a){return{0:{"grid-row":2,"grid-column":1},1:{"grid-row":1,"grid-column":2},2:{"grid-row":2,"grid-column":3},3:{"grid-row":3,"grid-column":2}}[a]}}},K0=["onClick"],q0=["title"],Z0={class:"tool-icon relative flex justify-center items-center"},J0={class:"yx-icon",style:{color:"var(--color-main-100)"},color:`var(--color-main-100) \r
|
|
38
38
|
`,size:"24"},Q0={class:"mt-10 text-center"},j0={key:1,class:"w-full h-full"},e1={key:0,class:"toolbar-wrap-component"},t1={class:"yx-icon",style:{color:"var(--color-main-100)"},color:"var(--color-main-100)",size:"30"},n1=["title","onClick"],r1={key:1,class:"box-border w-full h-full py-10 overflow-y-auto"},i1=["onClick","title"];function o1(a,i,r,u,h,g){const y=d.resolveComponent("Badge");return d.openBlock(),d.createBlock(d.Transition,{name:"zoom",mode:"out-in"},{default:d.withCtx(()=>[d.withDirectives(d.createElementVNode("div",{class:d.normalizeClass(["toolbar-container",r.showTool?"zoom-in":"zoom-out "])},[h.curComponent.name?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:0,style:d.normalizeStyle({"grid-template-columns":h.columns,"grid-template-rows":h.rows}),class:"toolbar-wrap"},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(g.configList,E=>(d.openBlock(),d.createElementBlock("div",{class:"flex justify-center items-center",onClick:A=>g.configHandle(E),style:d.normalizeStyle({"grid-area":E["grid-area"]})},[d.createElementVNode("div",{title:E.label,class:"flex flex-col justify-center items-center"},[d.createElementVNode("div",Z0,[d.createElementVNode("i",J0,[(d.openBlock(),d.createBlock(d.resolveDynamicComponent(E.icon)))]),E.isShowBadge?(d.openBlock(),d.createBlock(y,{key:0,value:r.badgeValue},null,8,["value"])):d.createCommentVNode("",!0)]),d.createElementVNode("span",Q0,d.toDisplayString(E.label),1)],8,q0)],12,K0))),256))],4)),h.curComponent.name?(d.openBlock(),d.createElementBlock("div",j0,[h.curComponent.name==="theme"?(d.openBlock(),d.createElementBlock("div",e1,[d.createElementVNode("div",{class:"flex flex-col toolbar-center items-center",onClick:i[0]||(i[0]=E=>h.curComponent={}),title:"返回"},[d.createElementVNode("i",t1,[(d.openBlock(),d.createBlock(d.resolveDynamicComponent(h.curComponent.icon)))])]),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(h.curComponent.data,(E,A)=>(d.openBlock(),d.createElementBlock("div",{style:d.normalizeStyle([{background:E.themeColor,boxShadow:`0px 4px 7px 0px ${E.themeColor}`},g.getPosition(A)]),title:E.name,class:d.normalizeClass(["theme",h.curTheme===E.id?"select":""]),onClick:N=>g.chooseTheme(E)},null,14,n1))),256))])):h.curComponent.name==="lang"?(d.openBlock(),d.createElementBlock("div",r1,[d.createElementVNode("div",{onClick:i[1]||(i[1]=E=>h.curComponent={}),class:"px-10 cursor-pointer"},"返回"),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(h.langList,E=>(d.openBlock(),d.createElementBlock("div",{onClick:A=>g.changeLang(E.lang),title:E.name,class:"px-10 cursor-pointer mt-10 whitespace-nowrap truncate"},d.toDisplayString(E.name),9,i1))),256))])):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0)],2),[[d.vShow,r.showTool]])]),_:1})}const a1=nr(X0,[["render",o1],["__scopeId","data-v-22890fe2"]]),u1={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",fill:"none",viewBox:"0 0 25 25"},s1=d.createElementVNode("g",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},[d.createElementVNode("path",{d:"M9 3H4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1ZM9 14H4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1ZM20 3h-5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1ZM20 14h-5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1Z"})],-1),l1=[s1];function f1(a,i){return d.openBlock(),d.createElementBlock("svg",u1,l1)}const c1={render:f1},Ju={name:"YxToolbar",components:{ToolbarContainer:a1,menu:c1,Badge:rc},mixins:[S0],data(){return{showTool:!1,position:{top:0,left:0},badgeValue:0,showBadge:window.isRenderIssue}},computed:{showClass(){return this.status?"expanded":"folded"}},mounted(){this.showBadge&&this.getCount(),this.initToolPosition()},methods:{initToolPosition(){const a=document.querySelector(".toolbar-wrap"),i=window.innerWidth-60-100+"px",r=window.innerHeight-60-100+"px";a.style.setProperty("--tool-left",i),a.style.setProperty("--tool-top",r)},getCount(){return it(this,null,function*(){const{data:a}=yield Gu.getCommentUntreatedCount();this.badgeValue=a.count})},handlerClickTool(a){this.mousePoint.x===a.screenX&&this.mousePoint.y===a.screenY&&(this.switchStatus(),this.getAllPosition(),this.setPanel(),this.showTool=!0)},switchStatus(){this.status=!this.status},getAllPosition(){this.toolPos=this.getDomPosition(this.toolDom),this.panelPos=this.getDomPosition(this.panelDom)},getDomPosition(a){return a.getBoundingClientRect()},setPanel(){const r=window.innerWidth-this.panelWidth,u=window.innerHeight-this.panelHeight;let h=this.toolPos.left+this.toolPos.width/2-this.panelWidth/2,g=this.toolPos.top+this.toolPos.height/2-this.panelHeight/2;h<0&&(h=0),g<0&&(g=0),h>r&&(h=r-40),g>u&&(g=u-40),this.setPanelPosition(h,g)},setPanelPosition(a,i){this.panelDom.style.left=a+"px",this.panelDom.style.top=i+"px"},mousedownTool(a){this.mousePoint.x=a.screenX,this.mousePoint.y=a.screenY},close(){this.status=!1,this.showTool=!1}}},xf=()=>{d.useCssVars(a=>({"14e08ee2":a.panelWidthPX,b58f614a:a.panelHeightPX}))},Tf=Ju.setup;Ju.setup=Tf?(a,i)=>(xf(),Tf(a,i)):xf;const h1={id:"toolbar-wrap",class:"toolbar-wrap"},d1={class:"yx-icon"};function p1(a,i,r,u,h,g){const y=d.resolveComponent("Badge"),E=d.resolveComponent("ToolbarContainer");return d.openBlock(),d.createElementBlock("div",h1,[d.createElementVNode("div",{class:d.normalizeClass(["tool",`${g.showClass}`]),onClick:i[0]||(i[0]=(...A)=>g.handlerClickTool&&g.handlerClickTool(...A)),onMousedown:i[1]||(i[1]=(...A)=>g.mousedownTool&&g.mousedownTool(...A)),onMouseup:i[2]||(i[2]=(...A)=>a.mouseupTool&&a.mouseupTool(...A))},[d.createElementVNode("i",d1,[(d.openBlock(),d.createBlock(d.resolveDynamicComponent("menu")))]),h.showBadge?(d.openBlock(),d.createBlock(y,{key:0,value:h.badgeValue},null,8,["value"])):d.createCommentVNode("",!0)],34),d.createElementVNode("div",{class:d.normalizeClass(["mask",`${g.showClass}`]),onClick:i[3]||(i[3]=(...A)=>g.close&&g.close(...A))},null,2),d.createVNode(E,{onZero:i[4]||(i[4]=A=>h.badgeValue=0),badgeValue:h.badgeValue,class:"panel",showTool:h.showTool},null,8,["badgeValue","showTool"])])}const Cf=nr(Ju,[["render",p1],["__scopeId","data-v-8e3349c3"]]);var Lr;const Or=class Or{constructor(i){hf(this,Lr,"yxToolbarV2");const{theme:r,isRenderIssue:u,isRenderLang:h}=i;return Or.instance||(window.theme=r,window.isRenderIssue=u,window.isRenderLang=h,this.init(),Or.instance=this),Or.instance}get vueVersion(){return d.version[0]}init(){this.mount()}mount(){const i=document.createElement("div");if(i.id=So(this,Lr),document.body.appendChild(i),this.vueVersion==="3")return d.createApp(Cf).mount(`#${So(this,Lr)}`);{const r=require("vue");return new r({render:u=>u(Cf)}).$mount(`#${So(this,Lr)}`)}}};Lr=new WeakMap,Or.instance=null;let pi=Or;const ic=Object.freeze(Object.defineProperty({__proto__:null,Toolbar:pi,Update:qf,YxDialog:Df,YxForm:Gf,YxIcon:Zf,YxSearchForm:Yf,YxTable:zf},Symbol.toStringTag,{value:"Module"})),oc=a=>it(exports,null,function*(){var r;a=_t(_t({},d_),a);let i=gi();try{yield g1(a);const{data:u}=yield $o.http.get(a.themeApiUrl);if(console.log(a),a.isRenderLang&&a.systemKey){const y=yield tc();yield jf({to:y||a.lang,systemKey:"integrated"})}a.isRenderToolbar&&new pi({theme:u,isRenderIssue:a.isRenderIssue,isRenderLang:a.isRenderLang});let h=i?(r=u.find(y=>y.id===i))==null?void 0:r.themeUrl:"";if(!i||!h){const E=u.find(A=>A.defaultTheme===1)||u[0];h=E.themeUrl,i=E.id}const g=yield Yu(h);ac({themeCssVar:g,themeId:i}),If(),yi.onmessage=y=>{const E=JSON.parse(y.data);E.type==="theme"&&(Yu(E.data.themeUrl),Vo.yxSubscribe.publish({type:"theme",data:null})),E.type==="lang"&&(console.log("监听到其他系统切换语言"),location.reload())},console.log("主题初始化完毕!!!")}catch(u){If(),ju()}}),g1=a=>it(exports,null,function*(){$o.setSystemConfig(_t({},a))}),If=()=>{const a=document.createElement("style");a.innerHTML=h_,document.head.appendChild(a)},ac=({themeCssVar:a,themeId:i})=>{const r=localStorage.getItem("ttcGlobalState")||"{}",u=JSON.parse(r);u.theme={themeCssVar:a,id:i},localStorage.setItem("ttcGlobalState",JSON.stringify(u))},Qu=a=>it(exports,null,function*(){const i=yield Yu(a.themeUrl);ac({themeCssVar:i,themeId:a==null?void 0:a.id}),yi.postMessage(JSON.stringify({type:"theme",data:a})),Vo.yxSubscribe.publish({type:"theme",data:a})}),ju=()=>{const a=_i(),i=document.documentElement;Object.keys(a).forEach(r=>{r!=="exclude"&&Object.keys(a[r]).forEach(u=>{const h=`--${r}-${u}`;i.style.setProperty(h,a[r][u])})})},Yu=a=>it(exports,null,function*(){const r=yield(yield fetch(a)).json(),u=document.createElement("style");let h=`:root {
|
|
39
39
|
`;return Object.keys(r).forEach(g=>{g!=="exclude"&&Object.keys(r[g]).forEach(y=>{const E=`--${g}-${y}`,A=r[g][y];h+=` ${E}: ${A};
|
|
40
40
|
`})}),h+="}",u.appendChild(document.createTextNode(h)),document.head.appendChild(u),r}),uc=()=>it(exports,null,function*(){const{data:a}=yield Gu.getUserThemeList(),i=a.find(u=>u.defaultTheme===1);return i?i.themeUrl:a[0].themeUrl}),gi=()=>{var r;const a=localStorage.getItem("ttcGlobalState"),i=a&&((r=JSON.parse(a))==null?void 0:r.theme);return(i==null?void 0:i.id)||null},_i=()=>{var r;const a=localStorage.getItem("ttcGlobalState"),i=a&&((r=JSON.parse(a))==null?void 0:r.theme);return(i==null?void 0:i.themeCssVar)||{}},sc=a=>{const i=_i();return(i==null?void 0:i[a])||{}},lc=(a,i)=>{const r=_i();if(!r.exclude)return null;for(let u in r.exclude){const h=r.exclude[u];for(let g of Object.keys(h))for(let y of Object.keys(h[g]))if(`--${g}-${y}`===a&&Vo.isColorEqual(h[g][y],i))return i}return null},fc=Object.freeze(Object.defineProperty({__proto__:null,changeTheme:Qu,findColorByTheme:lc,getCurTheme:gi,getCurThemeCssVar:_i,getDefaultThemeUrl:uc,getGroupColor:sc,install:oc,updateTheme:ju},Symbol.toStringTag,{value:"Module"})),yi=new BroadcastChannel("YXUSE_BC"),v1={utils:Vo.utils2,icons:Af,api:Gu.api2,theme:fc,components:ic,directives:u_.directives,BC:yi,translate:nc};exports.BC=yi;exports.Toolbar=pi;exports.Update=qf;exports._sfc_main=Df;exports._sfc_main$1=zf;exports.changeTheme=Qu;exports.components2=ic;exports.findColorByTheme=lc;exports.form=Gf;exports.getCurTheme=gi;exports.getCurThemeCssVar=_i;exports.getDefaultThemeUrl=uc;exports.getGroupColor=sc;exports.icons2=Af;exports.index=Yf;exports.index$1=Zf;exports.index$2=v1;exports.install=oc;exports.theme2=fc;exports.translate2=nc;exports.updateTheme=ju;
|
package/lib/index.cjs6.js.gz
CHANGED
|
Binary file
|
package/lib/index.es6.js
CHANGED
|
@@ -7221,7 +7221,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
7221
7221
|
}).call(Tn);
|
|
7222
7222
|
})(jo, jo.exports);
|
|
7223
7223
|
var D1 = jo.exports;
|
|
7224
|
-
const Mf = /* @__PURE__ */ sc(D1), zn =
|
|
7224
|
+
const Mf = /* @__PURE__ */ sc(D1), zn = /[\u4e00-\u9fa5]+/;
|
|
7225
7225
|
let es;
|
|
7226
7226
|
const R1 = ["svg", "g", "path", "polyline", "circle"];
|
|
7227
7227
|
class O1 {
|
package/lib/index.es6.js.gz
CHANGED
|
Binary file
|