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(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},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 r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(r,o,function(e){return t[e]}.bind(null,o));return r},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],r=[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 o(t,i,r,o,n){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 s=t.getContext("2d");try{return s.getImageData(i,r,o,n)}catch(t){throw new Error("unable to access image data: "+t)}}function n(t,e,i,r,n,a){if(!(isNaN(a)||a<1)){a|=0;var h=o(t,e,i,r,n);h=s(h,0,0,r,n,a),t.getContext("2d").putImageData(h,e,i)}}function s(t,e,o,n,s,a){var h,u,c,f,l,d,m,b,p,w,x,y,v,S,k,B,C,O,z,R,I,P,E,F,j,A=t.data,W=2*a+1,_=n-1,L=s-1,M=a+1,G=M*(M+1)/2,N=new g,$=N;for(c=1;c<W;c++)$=$.next=new g,c===M&&(j=$);$.next=N;var D=null,H=null;m=d=0;var T=i[a],V=r[a];for(u=0;u<s;u++){for(B=C=O=z=b=p=w=x=0,y=M*(R=A[d]),v=M*(I=A[d+1]),S=M*(P=A[d+2]),k=M*(E=A[d+3]),b+=G*R,p+=G*I,w+=G*P,x+=G*E,$=N,c=0;c<M;c++)$.r=R,$.g=I,$.b=P,$.a=E,$=$.next;for(c=1;c<M;c++)f=d+((_<c?_:c)<<2),b+=($.r=R=A[f])*(F=M-c),p+=($.g=I=A[f+1])*F,w+=($.b=P=A[f+2])*F,x+=($.a=E=A[f+3])*F,B+=R,C+=I,O+=P,z+=E,$=$.next;for(D=N,H=j,h=0;h<n;h++)A[d+3]=E=x*T>>V,0!==E?(E=255/E,A[d]=(b*T>>V)*E,A[d+1]=(p*T>>V)*E,A[d+2]=(w*T>>V)*E):A[d]=A[d+1]=A[d+2]=0,b-=y,p-=v,w-=S,x-=k,y-=D.r,v-=D.g,S-=D.b,k-=D.a,f=m+((f=h+a+1)<_?f:_)<<2,b+=B+=D.r=A[f],p+=C+=D.g=A[f+1],w+=O+=D.b=A[f+2],x+=z+=D.a=A[f+3],D=D.next,y+=R=H.r,v+=I=H.g,S+=P=H.b,k+=E=H.a,B-=R,C-=I,O-=P,z-=E,H=H.next,d+=4;m+=n}for(h=0;h<n;h++){for(C=O=z=B=p=w=x=b=0,y=M*(R=A[d=h<<2]),v=M*(I=A[d+1]),S=M*(P=A[d+2]),k=M*(E=A[d+3]),b+=G*R,p+=G*I,w+=G*P,x+=G*E,$=N,c=0;c<M;c++)$.r=R,$.g=I,$.b=P,$.a=E,$=$.next;for(l=n,c=1;c<=a;c++)d=l+h<<2,b+=($.r=R=A[d])*(F=M-c),p+=($.g=I=A[d+1])*F,w+=($.b=P=A[d+2])*F,x+=($.a=E=A[d+3])*F,B+=R,C+=I,O+=P,z+=E,$=$.next,c<L&&(l+=n);for(d=h,D=N,H=j,u=0;u<s;u++)A[3+(f=d<<2)]=E=x*T>>V,E>0?(E=255/E,A[f]=(b*T>>V)*E,A[f+1]=(p*T>>V)*E,A[f+2]=(w*T>>V)*E):A[f]=A[f+1]=A[f+2]=0,b-=y,p-=v,w-=S,x-=k,y-=D.r,v-=D.g,S-=D.b,k-=D.a,f=h+((f=u+M)<L?f:L)*n<<2,b+=B+=D.r=A[f],p+=C+=D.g=A[f+1],w+=O+=D.b=A[f+2],x+=z+=D.a=A[f+3],D=D.next,y+=R=H.r,v+=I=H.g,S+=P=H.b,k+=E=H.a,B-=R,C-=I,O-=P,z-=E,H=H.next,d+=n}return t}function a(t,e,i,r,n,s){if(!(isNaN(s)||s<1)){s|=0;var a=o(t,e,i,r,n);a=h(a,0,0,r,n,s),t.getContext("2d").putImageData(a,e,i)}}function h(t,e,o,n,s,a){var h,u,c,f,l,d,m,b,p,w,x,y,v,S,k,B,C,O,z,R,I,P=t.data,E=2*a+1,F=n-1,j=s-1,A=a+1,W=A*(A+1)/2,_=new g,L=_;for(c=1;c<E;c++)L=L.next=new g,c===A&&(I=L);L.next=_;var M=null,G=null;m=d=0;var N=i[a],$=r[a];for(u=0;u<s;u++){for(S=k=B=b=p=w=0,x=A*(C=P[d]),y=A*(O=P[d+1]),v=A*(z=P[d+2]),b+=W*C,p+=W*O,w+=W*z,L=_,c=0;c<A;c++)L.r=C,L.g=O,L.b=z,L=L.next;for(c=1;c<A;c++)f=d+((F<c?F:c)<<2),b+=(L.r=C=P[f])*(R=A-c),p+=(L.g=O=P[f+1])*R,w+=(L.b=z=P[f+2])*R,S+=C,k+=O,B+=z,L=L.next;for(M=_,G=I,h=0;h<n;h++)P[d]=b*N>>$,P[d+1]=p*N>>$,P[d+2]=w*N>>$,b-=x,p-=y,w-=v,x-=M.r,y-=M.g,v-=M.b,f=m+((f=h+a+1)<F?f:F)<<2,b+=S+=M.r=P[f],p+=k+=M.g=P[f+1],w+=B+=M.b=P[f+2],M=M.next,x+=C=G.r,y+=O=G.g,v+=z=G.b,S-=C,k-=O,B-=z,G=G.next,d+=4;m+=n}for(h=0;h<n;h++){for(k=B=S=p=w=b=0,x=A*(C=P[d=h<<2]),y=A*(O=P[d+1]),v=A*(z=P[d+2]),b+=W*C,p+=W*O,w+=W*z,L=_,c=0;c<A;c++)L.r=C,L.g=O,L.b=z,L=L.next;for(l=n,c=1;c<=a;c++)d=l+h<<2,b+=(L.r=C=P[d])*(R=A-c),p+=(L.g=O=P[d+1])*R,w+=(L.b=z=P[d+2])*R,S+=C,k+=O,B+=z,L=L.next,c<j&&(l+=n);for(d=h,M=_,G=I,u=0;u<s;u++)P[f=d<<2]=b*N>>$,P[f+1]=p*N>>$,P[f+2]=w*N>>$,b-=x,p-=y,w-=v,x-=M.r,y-=M.g,v-=M.b,f=h+((f=u+A)<j?f:j)*n<<2,b+=S+=M.r=P[f],p+=k+=M.g=P[f+1],w+=B+=M.b=P[f+2],M=M.next,x+=C=G.r,y+=O=G.g,v+=z=G.b,S-=C,k-=O,B-=z,G=G.next,d+=n}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=n,t.image=function(t,e,i,r){if("string"==typeof t&&(t=document.getElementById(t)),t&&"naturalWidth"in t){var o=t.naturalWidth,s=t.naturalHeight;if("string"==typeof e&&(e=document.getElementById(e)),e&&"getContext"in e){e.style.width=o+"px",e.style.height=s+"px",e.width=o,e.height=s;var h=e.getContext("2d");h.clearRect(0,0,o,s),h.drawImage(t,0,0),isNaN(i)||i<1||(r?n(e,0,0,o,s,i):a(e,0,0,o,s,i))}}},t.imageDataRGB=h,t.imageDataRGBA=s,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.cssFeature=this.getCssFeatures({filter:{chrome:53,firefox:35,safari:9.3},backdropFilter:{chrome:76,safari:9}}),this.domStyle=document.documentElement.style,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=[],this.blurWidgets=[],window.addEventListener("resize",this.onWindowResize.bind(this))}getCssFeatures(t){var e=(navigator.userAgent||"").match(/(?<browser>(chrome|firefox|safari))\/(?<version>[0-9]+(\.[0-9]+)?)/i);if(e){var i=(e.groups.browser||"").toLowerCase(),r=parseFloat(e.groups.version),o={};for(var n in t){var s=t[n];for(var a in o[n]=!1,s)if(i==a){r>=s[a]&&(o[n]=!0);break}}return o}}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 r=document.createElement("canvas");r.width=this.img.width,r.height=this.img.height,r.getContext("2d").drawImage(this.img,0,0),e.canvasRGBA(r,0,0,r.width,r.height,this.blurRadius),r.toBlob(e=>{this.blurSource=URL.createObjectURL(e),t()})})}async onImageLoaded(){this.imgRatio=this.img.width/this.img.height,this.hasBlurArea&&!this.cssFeature.backdropFilter&&(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})}),this.blurWidgets.forEach(t=>{t.removeClass("bgimg-background-loading")}),this.cssFeature.backdropFilter||($("body").addClass("bgimg-fallback"),this.domStyle.setProperty("--bgimg-blur-image",`url('${this.blurSource}')`)),this.loaded=!0)}onWindowResize(){this.loaded&&this.fixPosition()}getOverflowSize(t,e,i){let r=e-t,o=e*i/100-t/2;return Math.max(0,Math.min(r,o))}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(){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&&!this.cssFeature.backdropFilter&&(this.domStyle.setProperty("--bgimg-bg-size",`${this.imgSize.width}px ${this.imgSize.height}px`),this.domStyle.setProperty("--bgimg-bg-pos",`${this.imgOffset.left}px ${this.imgOffset.top}px`))}addViewport(t){t.css("opacity",0),this.viewports.push(t)}addBlurBackground(t){let e=["bgimg-background-blur","bgimg-background-loading"];this.cssFeature.backdropFilter&&e.push("bgimg-backdrop-blur"),t.addClass(e),this.hasBlurArea=!0,this.blurWidgets.push(t)}}}.call(this,i(0))}]);