1"use strict";(self.webpackChunkwikipoint_platform=self.webpackChunkwikipoint_platform||[]).push([[4758],{84758:(Y,D,v)=>{v.r(D),v.d(D,{_BasisTextureLoader:()=>M});var L=v(10467),g=v(44001),W=v(36467),V=v(70385);function x(){let o=null;function r(t,n,a,d,i){const f=t.getImageTranscodedSizeInBytes(n,a,d);let T=new Uint8Array(f);return t.transcodeImage(T,n,a,d,1,0)?(i&&(T=function l(t,n,a,d){const i=new Uint16Array(4),f=new Uint16Array(a*d),T=a/4,p=d/4;for(let u=0;u<p;u++)for(let m=0;m<T;m++){const b=n+8*(u*T+m);i[0]=t[b]|t[b+1]<<8,i[1]=t[b+2]|t[b+3]<<8,i[2]=(2*(31&i[0])+1*(31&i[1]))/3|(2*(2016&i[0])+1*(2016&i[1]))/3&2016|(2*(63488&i[0])+1*(63488&i[1]))/3&63488,i[3]=(2*(31&i[1])+1*(31&i[0]))/3|(2*(2016&i[1])+1*(2016&i[0]))/3&2016|(2*(63488&i[1])+1*(63488&i[0]))/3&63488;for(let B=0;B<4;B++){const C=t[b+4+B];let G=(4*u+B)*a+4*m;f[G++]=i[3&C],f[G++]=i[C>>2&3],f[G++]=i[C>>4&3],f[G++]=i[C>>6&3]}}return f}(T,0,t.getImageWidth(n,a)+3&-4,t.getImageHeight(n,a)+3&-4)),T):null}onmessage=t=>{if("init"===t.data.action){if(t.data.url)try{importScripts(t.data.url)}catch(n){postMessage({action:"error",error:n})}o||(o=BASIS({wasmBinary:t.data.wasmBinary})),null!==o&&o.then(n=>{BASIS=n,n.initializeBasis(),postMessage({action:"init"})})}else if("transcode"===t.data.action){const n=t.data.config,d=new BASIS.BasisFile(t.data.imageData),i=function c(t){const n=t.getHasAlpha(),a=t.getNumImages(),d=[];for(let f=0;f<a;f++){const T={levels:[]},p=t.getNumLevels(f);for(let u=0;u<p;u++){const m={width:t.getImageWidth(f,u),height:t.getImageHeight(f,u)};T.levels.push(m)}d.push(T)}return{hasAlpha:n,images:d}}(d);let f=t.data.ignoreSupportedFormats?null:function s(t,n){let a=null;return t.supportedCompressionFormats&&(a=t.supportedCompressionFormats.astc?10:t.supportedCompressionFormats.bc7?6:t.supportedCompressionFormats.s3tc?n.hasAlpha?3:2:t.supportedCompressionFormats.pvrtc?n.hasAlpha?9:8:t.supportedCompressionFormats.etc2?1:t.supportedCompressionFormats.etc1?0:14),a}(t.data.config,i),T=!1;null===f&&(T=!0,f=i.hasAlpha?3:2);let p=!0;d.startTranscoding()||(p=!1);const u=[];for(let m=0;m<i.images.length&&p;m++){const b=i.images[m];if(void 0===n.loadSingleImage||n.loadSingleImage===m){let B=b.levels.length;!1===n.loadMipmapLevels&&(B=1);for(let C=0;C<B;C++){const G=b.levels[C],k=r(d,m,C,f,T);if(!k){p=!1;break}G.transcodedPixels=k,u.push(G.transcodedPixels.buffer)}}}d.close(),d.delete(),T&&(f=-1),p?postMessage({action:"transcode",success:p,id:t.data.id,fileInfo:i,format:f},u):postMessage({action:"transcode",success:p,id:t.data.id})}}}function R(){return(R=(0,L.A)(function*(e,o,s){return yield new Promise((c,r)=>{const l=t=>{"init"===t.data.action?(e.removeEventListener("message",l),c(e)):"error"===t.data.action&&r(t.data.error||"error initializing worker")};e.addEventListener("message",l),e.postMessage({action:"init",url:s?g.S0.GetBabylonScriptURL(s):void 0,wasmBinary:o},[o])})})).apply(this,arguments)}var h=function(e){return e[e.cTFETC1=0]="cTFETC1",e[e.cTFETC2=1]="cTFETC2",e[e.cTFBC1=2]="cTFBC1",e[e.cTFBC3=3]="cTFBC3",e[e.cTFBC4=4]="cTFBC4",e[e.cTFBC5=5]="cTFBC5",e[e.cTFBC7=6]="cTFBC7",e[e.cTFPVRTC1_4_RGB=8]="cTFPVRTC1_4_RGB",e[e.cTFPVRTC1_4_RGBA=9]="cTFPVRTC1_4_RGBA",e[e.cTFASTC_4x4=10]="cTFASTC_4x4",e[e.cTFATC_RGB=11]="cTFATC_RGB",e[e.cTFATC_RGBA_INTERPOLATED_ALPHA=12]="cTFATC_RGBA_INTERPOLATED_ALPHA",e[e.cTFRGBA32=13]="cTFRGBA32",e[e.cTFRGB565=14]="cTFRGB565",e[e.cTFBGR565=15]="cTFBGR565",e[e.cTFRGBA4444=16]="cTFRGBA4444",e[e.cTFFXT1_RGB=17]="cTFFXT1_RGB",e[e.cTFPVRTC2_4_RGB=18]="cTFPVRTC2_4_RGB",e[e.cTFPVRTC2_4_RGBA=19]="cTFPVRTC2_4_RGBA",e[e.cTFETC2_EAC_R11=20]="cTFETC2_EAC_R11",e[e.cTFETC2_EAC_RG11=21]="cTFETC2_EAC_RG11",e}(h||{});const F={JSModuleURL:"".concat(g.S0._DefaultCdnUrl,"/basisTranscoder/1/basis_transcoder.js"),WasmModuleURL:"".concat(g.S0._DefaultCdnUrl,"/basisTranscoder/1/basis_transcoder.wasm")};let w=null,y=null,N=0;const X=function(){var e=(0,L.A)(function*(){return w||(w=new Promise((o,s)=>{y?o(y):g.S0.LoadFileAsync(g.S0.GetBabylonScriptURL(F.WasmModuleURL)).then(c=>{if("function"!=typeof URL)return s("Basis transcoder requires an environment with a URL constructor");const r=URL.createObjectURL(new Blob(["(".concat(x,")()")],{type:"application/javascript"}));y=new Worker(r),function H(e,o,s){return R.apply(this,arguments)}(y,c,F.JSModuleURL).then(o,s)}).catch(s)})),yield w});return function(){return e.apply(this,arguments)}}(),P=function(){var e=(0,L.A)(function*(o,s){const c=o instanceof ArrayBuffer?new Uint8Array(o):o;return yield new Promise((r,l)=>{X().then(()=>{const t=N++,n=d=>{"transcode"===d.data.action&&d.data.id===t&&(y.removeEventListener("message",n),d.data.success?r(d.data):l("Transcode is not supported on this device"))};y.addEventListener("message",n);const a=new Uint8Array(c.byteLength);a.set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)),y.postMessage({action:"transcode",id:t,imageData:a,config:s,ignoreSupportedFormats:!1},[a.buffer])},t=>{l(t)})})});return function(s,c){return e.apply(this,arguments)}}(),E=(e,o)=>{var s;let c=null===(s=o._gl)||void 0===s?void 0:s.TEXTURE_2D;var r;e.isCube&&(c=null===(r=o._gl)||void 0===r?void 0:r.TEXTURE_CUBE_MAP),o._bindTextureDirectly(c,e,!0)},_=(e,o)=>{const s=e.getEngine();for(let c=0;c<o.fileInfo.images.length;c++){const r=o.fileInfo.images[c].levels[0];if(e._invertVScale=e.invertY,-1===o.format||o.format===h.cTFRGB565)if(e.type=10,e.format=4,!s._features.basisNeedsPOT||Math.log2(r.
1width)%1==0&&Math.log2(r.height)%1==0)e._invertVScale=!e.invertY,e.width=r.width+3&-4,e.height=r.height+3&-4,e.samplingMode=2,E(e,s),s._uploadDataToTextureDirectly(e,new Uint16Array(r.transcodedPixels.buffer),c,0,4,!0);else{const l=new V.h(s,2);e._invertVScale=e.invertY,l.type=10,l.format=4,l.width=r.width+3&-4,l.height=r.height+3&-4,E(l,s),s._uploadDataToTextureDirectly(l,new Uint16Array(r.transcodedPixels.buffer),c,0,4,!0),s._rescaleTexture(l,e,s.scenes[0],s._getInternalFormat(4),()=>{s._releaseTexture(l),E(e,s)})}else{e.width=r.width,e.height=r.height,e.generateMipMaps=o.fileInfo.images[c].levels.length>1;const l=U.GetInternalFormatFromBasisFormat(o.format,s);e.format=l,E(e,s);const t=o.fileInfo.images[c].levels;for(let n=0;n<t.length;n++){const a=t[n];s._uploadCompressedDataToTextureDirectly(e,l,a.width,a.height,a.transcodedPixels,c,n)}s._features.basisNeedsPOT&&(Math.log2(e.width)%1!=0||Math.log2(e.height)%1!=0)&&(g.S0.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."),e._cachedWrapU=W.Texture.CLAMP_ADDRESSMODE,e._cachedWrapV=W.Texture.CLAMP_ADDRESSMODE)}}},U={JSModuleURL:F.JSModuleURL,WasmModuleURL:F.WasmModuleURL,GetInternalFormatFromBasisFormat:(e,o)=>{let s;switch(e){case h.cTFETC1:s=36196;break;case h.cTFBC1:s=33776;break;case h.cTFBC4:s=33779;break;case h.cTFASTC_4x4:s=37808;break;case h.cTFETC2:s=37496;break;case h.cTFBC7:s=36492}if(void 0===s)throw"The chosen Basis transcoder format is not currently supported";return s},TranscodeAsync:P,LoadTextureFromTranscodeResult:_};Object.defineProperty(U,"JSModuleURL",{get:function(){return F.JSModuleURL},set:function(e){F.JSModuleURL=e}}),Object.defineProperty(U,"WasmModuleURL",{get:function(){return F.WasmModuleURL},set:function(e){F.WasmModuleURL=e}});class M{constructor(){this.supportCascades=!1}loadCubeData(o,s,c,r,l){if(Array.isArray(o))return;const t=s.getEngine().getCaps();P(o,{supportedCompressionFormats:{etc1:!!t.etc1,s3tc:!!t.s3tc,pvrtc:!!t.pvrtc,etc2:!!t.etc2,astc:!!t.astc,bc7:!!t.bptc}}).then(a=>{const d=a.fileInfo.images[0].levels.length>1&&s.generateMipMaps;_(s,a),s.getEngine()._setCubeMapTextureParams(s,d),s.isReady=!0,s.onLoadedObservable.notifyObservers(s),s.onLoadedObservable.clear(),r&&r()}).catch(a=>{g.S0.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),s.isReady=!0,l&&l(a)})}loadData(o,s,c){const r=s.getEngine().getCaps();P(o,{supportedCompressionFormats:{etc1:!!r.etc1,s3tc:!!r.s3tc,pvrtc:!!r.pvrtc,etc2:!!r.etc2,astc:!!r.astc,bc7:!!r.bptc}}).then(t=>{const n=t.fileInfo.images[0].levels[0];c(n.width,n.height,t.fileInfo.images[0].levels.length>1&&s.generateMipMaps,-1!==t.format,()=>{_(s,t)})}).catch(t=>{g.S0.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),g.S0.Warn("Failed to transcode Basis file: ".concat(t)),c(0,0,!1,!1,()=>{},!0)})}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.