You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
10 KiB
JavaScript

!function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){!function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],n=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function r(t,i,n,r,s){if("string"==typeof t&&(t=document.getElementById(t)),!(t&&"object"===e(t)&&"getContext"in t))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var o=t.getContext("2d");try{return o.getImageData(i,n,r,s)}catch(t){throw new Error("unable to access image data: "+t)}}function s(t,e,i,n,s,a){if(!(isNaN(a)||a<1)){a|=0;var h=r(t,e,i,n,s);h=o(h,0,0,n,s,a),t.getContext("2d").putImageData(h,e,i)}}function o(t,e,r,s,o,a){var h,l,u,d,f,c,m,p,b,y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c+2])*j,w+=(H.a=E=_[c+3])*j,O+=C,R+=I,z+=P,k+=E,H=H.next,u<G&&(f+=s);for(c=h,T=D,V=A,l=0;l<o;l++)_[3+(d=c<<2)]=E=w*U>>$,E>0?(E=255/E,_[d]=(p*U>>$)*E,_[d+1]=(b*U>>$)*E,_[d+2]=(y*U>>$)*E):_[d]=_[d+1]=_[d+2]=0,p-=x,b-=S,y-=v,w-=B,x-=T.r,S-=T.g,v-=T.b,B-=T.a,d=h+((d=l+L)<G?d:G)*s<<2,p+=O+=T.r=_[d],b+=R+=T.g=_[d+1],y+=z+=T.b=_[d+2],w+=k+=T.a=_[d+3],T=T.next,x+=C=V.r,S+=I=V.g,v+=P=V.b,B+=E=V.a,O-=C,R-=I,z-=P,k-=E,V=V.next,c+=s}return t}function a(t,e,i,n,s,o){if(!(isNaN(o)||o<1)){o|=0;var a=r(t,e,i,n,s);a=h(a,0,0,n,s,o),t.getContext("2d").putImageData(a,e,i)}}function h(t,e,r,s,o,a){var h,l,u,d,f,c,m,p,b,y,w,x,S,v,B,O,R,z,k,C,I,P=t.data,E=2*a+1,j=s-1,A=o-1,_=a+1,M=_*(_+1)/2,W=new g,G=W;for(u=1;u<E;u++)G=G.next=new g,u===_&&(I=G);G.next=W;var L=null,N=null;m=c=0;var D=i[a],H=n[a];for(l=0;l<o;l++){for(v=B=O=p=b=y=0,w=_*(R=P[c]),x=_*(z=P[c+1]),S=_*(k=P[c+2]),p+=M*R,b+=M*z,y+=M*k,G=W,u=0;u<_;u++)G.r=R,G.g=z,G.b=k,G=G.next;for(u=1;u<_;u++)d=c+((j<u?j:u)<<2),p+=(G.r=R=P[d])*(C=_-u),b+=(G.g=z=P[d+1])*C,y+=(G.b=k=P[d+2])*C,v+=R,B+=z,O+=k,G=G.next;for(L=W,N=I,h=0;h<s;h++)P[c]=p*D>>H,P[c+1]=b*D>>H,P[c+2]=y*D>>H,p-=w,b-=x,y-=S,w-=L.r,x-=L.g,S-=L.b,d=m+((d=h+a+1)<j?d:j)<<2,p+=v+=L.r=P[d],b+=B+=L.g=P[d+1],y+=O+=L.b=P[d+2],L=L.next,w+=R=N.r,x+=z=N.g,S+=k=N.b,v-=R,B-=z,O-=k,N=N.next,c+=4;m+=s}for(h=0;h<s;h++){for(B=O=v=b=y=p=0,w=_*(R=P[c=h<<2]),x=_*(z=P[c+1]),S=_*(k=P[c+2]),p+=M*R,b+=M*z,y+=M*k,G=W,u=0;u<_;u++)G.r=R,G.g=z,G.b=k,G=G.next;for(f=s,u=1;u<=a;u++)c=f+h<<2,p+=(G.r=R=P[c])*(C=_-u),b+=(G.g=z=P[c+1])*C,y+=(G.b=k=P[c+2])*C,v+=R,B+=z,O+=k,G=G.next,u<A&&(f+=s);for(c=h,L=W,N=I,l=0;l<o;l++)P[d=c<<2]=p*D>>H,P[d+1]=b*D>>H,P[d+2]=y*D>>H,p-=w,b-=x,y-=S,w-=L.r,x-=L.g,S-=L.b,d=h+((d=l+_)<A?d:A)*s<<2,p+=v+=L.r=P[d],b+=B+=L.g=P[d+1],y+=O+=L.b=P[d+2],L=L.next,w+=R=N.r,x+=z=N.g,S+=k=N.b,v-=R,B-=z,O-=k,N=N.next,c+=s}return t}var g=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};t.BlurStack=g,t.canvasRGB=a,t.canvasRGBA=s,t.image=function(t,e,i,n){if("string"==typeof t&&(t=document.getElementById(t)),t&&"naturalWidth"in t){var r=t.naturalWidth,o=t.naturalHeight;if("string"==typeof e&&(e=document.getElementById(e)),e&&"getContext"in e){e.style.width=r+"px",e.style.height=o+"px",e.width=r,e.height=o;var h=e.getContext("2d");h.clearRect(0,0,r,o),h.drawImage(t,0,0),isNaN(i)||i<1||(n?s(e,0,0,r,o,i):a(e,0,0,r,o,i))}}},t.imageDataRGB=h,t.imageDataRGBA=o,Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,i){t.exports=i(3)},function(t,e,i){"use strict";i.r(e),function(t){var e=i(1);t.isekai||(t.isekai={}),t.isekai.BgImage=class{constructor(){this.loaded=!1,this.isCrosBlocked=!1,this.domStyles=$("head").append('<style data-type="bgimg-styles"></style>').find('style[data-type="bgimg-styles"]'),this.posStyles=$("head").append('<style data-type="bgimg-styles-pos"></style>').find('style[data-type="bgimg-styles-pos"]'),this.domStyleSheet=this.domStyles[0].sheet,this.posStyleSheet=this.posStyles[0].sheet,this.hasBlurArea=!1,this.blurRadius=20,this.blurSource=null,this.img=new Image,this.img.crossOrigin="anonymous",this.img.addEventListener("load",this.onImageLoaded.bind(this)),this.imgRatio=0,this.imgOffset={top:0,left:0},this.imgSize={width:0,height:0},this.viewports=[],window.addEventListener("resize",this.onWindowResize.bind(this))}async loadImage(t,e,i){try{await fetch(t)}catch(t){this.isCrosBlocked=!0,this.img.crossOrigin=null}this.source=t,this.xCenter=e||50,this.yCenter=i||50,this.img.src=t}generateBlurImage(){return new Promise((t,i)=>{let n=document.createElement("canvas");n.width=this.img.width,n.height=this.img.height,n.getContext("2d").drawImage(this.img,0,0),e.canvasRGBA(n,0,0,n.width,n.height,this.blurRadius),n.toBlob(e=>{this.blurSource=URL.createObjectURL(e),t()})})}async onImageLoaded(){if(this.imgRatio=this.img.width/this.img.height,this.hasBlurArea&&(this.isCrosBlocked?this.blurSource=this.source:await this.generateBlurImage()),this.fixPosition(),!this.loaded){this.viewports.forEach(t=>{t.css({backgroundImage:"url('"+this.source+"')",backgroundAttachement:"fixed",opacity:1})});var t=".has-bgimg .bgimg-background-blur::after { ";t+="opacity: 1; background-image: url('"+this.blurSource+"'); ",this.isCrosBlocked&&(t+="filter: blur("+this.blurRadius+"px); "),t+=";",this.domStyleSheet.insertRule(t,this.domStyleSheet.rules.length),this.loaded=!0}}onWindowResize(){this.loaded&&this.fixPosition()}getOverflowSize(t,e,i){let n=e-t,r=e*i/100-t/2;return Math.max(0,Math.min(n,r))}fixPosition(){let t=window.innerWidth/window.innerHeight;this.imgRatio>t?(this.imgSize.height=window.innerHeight,this.imgSize.width=this.imgSize.height*this.imgRatio,this.imgOffset.top=0,this.imgOffset.left=-this.getOverflowSize(window.innerWidth,this.imgSize.width,this.xCenter)):(this.imgSize.width=window.innerWidth,this.imgSize.height=this.imgSize.width/this.imgRatio,this.imgOffset.left=0,this.imgOffset.top=-this.getOverflowSize(window.innerHeight,this.imgSize.height,this.yCenter)),this.fixViewportPosition()}fixViewportPosition(){if(this.viewports.forEach(t=>{t.css({backgroundSize:this.imgSize.width+"px "+this.imgSize.height+"px",backgroundPosition:this.imgOffset.left+"px "+this.imgOffset.top+"px"})}),this.hasBlurArea){let t=".has-bgimg .bgimg-background-blur::after { ";t+="background-size: "+this.imgSize.width+"px "+this.imgSize.height+"px; ",t+="background-position: "+this.imgOffset.left+"px "+this.imgOffset.top+"px; ",t+="}",this.posStyleSheet.insertRule(t,this.posStyleSheet.rules.length),this.posStyleSheet.rules.length>1&&this.posStyleSheet.deleteRule(this.posStyleSheet.rules.length-2)}}addViewport(t){t.css("opacity",0),this.viewports.push(t)}addBlurBackground(t){t.addClass("bgimg-background-blur"),this.hasBlurArea=!0}}}.call(this,i(0))}]);